code stringlengths 4 991k | repo_name stringlengths 6 116 | path stringlengths 4 249 | language stringclasses 30 values | license stringclasses 15 values | size int64 4 991k | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
<?php defined('SYSPATH') or die('No direct script access.');
class Jelly_Meta extends Jelly_Core_Meta {}
| loonies/kohana-jelly | classes/jelly/meta.php | PHP | mit | 106 | [
30522,
1026,
1029,
25718,
4225,
1006,
1005,
25353,
13102,
8988,
1005,
1007,
2030,
3280,
1006,
1005,
2053,
3622,
5896,
3229,
1012,
1005,
1007,
1025,
2465,
20919,
1035,
18804,
8908,
20919,
1035,
4563,
1035,
18804,
1063,
1065,
102,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
pub mod text_box;
pub mod button;
| Fishman2009/rust_os | Usermode/libwtk/input/mod.rs | Rust | bsd-2-clause | 36 | [
30522,
9047,
16913,
3793,
1035,
3482,
1025,
9047,
16913,
6462,
1025,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
const { nativeImage } = require('electron')
const { resolve } = require('path')
exports.size16 = nativeImage.createFromPath(resolve(__dirname, '../icon16.png'))
exports.size16.setTemplateImage(true)
| Gerhut/Meibo | lib/icon.js | JavaScript | gpl-3.0 | 201 | [
30522,
9530,
3367,
1063,
3128,
9581,
3351,
1065,
1027,
5478,
1006,
1005,
10496,
1005,
1007,
9530,
3367,
1063,
10663,
1065,
1027,
5478,
1006,
1005,
4130,
1005,
1007,
14338,
1012,
2946,
16048,
1027,
3128,
9581,
3351,
1012,
3443,
19699,
25377,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*===
buffer: ptr-is-NULL=0, sz=1024
buffer
buffer: ptr-is-NULL=-1, sz=0
buffer
buffer: ptr-is-NULL=0, sz=1024
buffer
buffer: ptr-is-NULL=-1, sz=0
buffer
rc=0, result=undefined
rc=1, result=TypeError: not buffer
rc=1, result=TypeError: not buffer
rc=1, result=TypeError: not buffer
===*/
int test_1(duk_context *ctx) {
void *ptr;
size_t sz;
int i;
duk_set_top(ctx, 0);
duk_push_fixed_buffer(ctx, 1024);
duk_push_fixed_buffer(ctx, 0);
duk_push_dynamic_buffer(ctx, 1024);
duk_push_dynamic_buffer(ctx, 0);
for (i = 0; i < 4; i++) {
sz = (size_t) 0xdeadbeef;
ptr = duk_require_buffer(ctx, i, &sz);
printf("buffer: ptr-is-NULL=%d, sz=%d\n", (sz == 0 ? -1 : (ptr == NULL ? 1 : 0)), (int) sz);
sz = (size_t) 0xdeadbeef;
ptr = duk_require_buffer(ctx, i, NULL);
printf("buffer\n");
}
return 0;
}
int test_2(duk_context *ctx) {
void *ptr;
size_t sz;
duk_set_top(ctx, 0);
duk_push_null(ctx);
sz = (size_t) 0xdeadbeef;
ptr = duk_require_buffer(ctx, 0, &sz);
printf("buffer ok: %p\n", ptr); /* ok to print, should not be reached */
return 0;
}
int test_3(duk_context *ctx) {
void *ptr;
size_t sz;
duk_set_top(ctx, 0);
sz = (size_t) 0xdeadbeef;
ptr = duk_require_buffer(ctx, 0, &sz);
printf("buffer ok: %p\n", ptr); /* ok to print, should not be reached */
return 0;
}
int test_4(duk_context *ctx) {
void *ptr;
size_t sz;
duk_set_top(ctx, 0);
sz = (size_t) 0xdeadbeef;
ptr = duk_require_buffer(ctx, DUK_INVALID_INDEX, &sz);
printf("buffer ok: %p\n", ptr); /* ok to print, should not be reached */
return 0;
}
void test(duk_context *ctx) {
int rc;
rc = duk_safe_call(ctx, test_1, 0, 1, DUK_INVALID_INDEX);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_2, 0, 1, DUK_INVALID_INDEX);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_3, 0, 1, DUK_INVALID_INDEX);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
rc = duk_safe_call(ctx, test_4, 0, 1, DUK_INVALID_INDEX);
printf("rc=%d, result=%s\n", rc, duk_to_string(ctx, -1));
duk_pop(ctx);
}
| JoshEngebretson/duktape | api-testcases/test-require-buffer.c | C | mit | 2,133 | [
30522,
1013,
1008,
1027,
1027,
1027,
17698,
1024,
13866,
2099,
1011,
2003,
1011,
19701,
1027,
1014,
1010,
1055,
2480,
1027,
9402,
2549,
17698,
17698,
1024,
13866,
2099,
1011,
2003,
1011,
19701,
1027,
1011,
1015,
1010,
1055,
2480,
1027,
1014... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
(function () {
'use strict';
angular
.module('Debug', ['pullrefresh']);
})();
| stomt/angular-pullrefresh | debug/debug-app.js | JavaScript | mit | 87 | [
30522,
1006,
3853,
1006,
1007,
1063,
1005,
2224,
9384,
1005,
1025,
16108,
1012,
11336,
1006,
1005,
2139,
8569,
2290,
1005,
1010,
1031,
1005,
4139,
2890,
19699,
9953,
1005,
1033,
1007,
1025,
1065,
1007,
1006,
1007,
1025,
102,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var angular = require('angular');
// import the hello UI component
require('./hello/main');
// compose the app and the routes
module.exports = angular
.module('myApp', [
'ngRoute',
'hello'
])
.config([
'$routeProvider', function ($routeProvider) {
$routeProvider.when(
'/',
{ templateUrl: 'app/hello/base.html', controller: 'HelloCtrl' }
);
$routeProvider.otherwise({ redirectTo: '/' });
}
]);
// start the application
angular.bootstrap(document, ['myApp']);
| RaveJS/rave-start-angular | app/main.js | JavaScript | mit | 491 | [
30522,
13075,
16108,
1027,
5478,
1006,
1005,
16108,
1005,
1007,
1025,
1013,
1013,
12324,
1996,
7592,
21318,
6922,
5478,
1006,
1005,
1012,
1013,
7592,
1013,
2364,
1005,
1007,
1025,
1013,
1013,
17202,
1996,
10439,
1998,
1996,
5847,
11336,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package gitbot
import "fmt"
// PullRequest object from github API
type PullRequest struct {
Head *Head `json:"head"`
Base *Head `json:"base"`
Links *Links `json:"_links"`
User *User `json:"user"`
MergedBy *User `json:"merged_by"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
DiffURL string `json:"diff_url"`
PatchURL string `json:"patch_url"`
IssueURL string `json:"issue_url"`
CommitsURL string `json:"commits_url"`
ReviewCommentsURL string `json:"review_comments_url"`
ReviewCommentURL string `json:"review_comment_url"`
CommentsURL string `json:"comments_url"`
StatusesURL string `json:"statuses_url"`
Number int `json:"number"`
State string `json:"state"`
Title string `json:"title"`
Body string `json:"body"`
//CreatedAt NullTime `json:"created_at"`
//UpdatedAt NullTime `json:"updated_at"`
//ClosedAt NullTime `json:"closed_at"`
//MergedAt NullTime `json:"merged_at"`
MergeCommitSha string `json:"merge_commit_sha"`
Merged bool `json:"merged"`
Mergeable bool `json:"mergeable"`
Comments int `json:"comments"`
Commits int `json:"commits"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
ChangedFiles int `json:"changed_files"`
}
func (s PullRequest) String() string {
return fmt.Sprintf("#%v %s (%s)", s.Number, s.Title, s.HTMLURL)
}
| knivey/gitbot | pull_request.go | GO | mit | 1,582 | [
30522,
7427,
21025,
2102,
18384,
12324,
1000,
4718,
2102,
1000,
1013,
1013,
4139,
2890,
15500,
4874,
2013,
21025,
2705,
12083,
17928,
2828,
4139,
2890,
15500,
2358,
6820,
6593,
1063,
2132,
1008,
2132,
1036,
1046,
3385,
1024,
1000,
2132,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
/**
* @license @product.name@ JS v@product.version@ (@product.date@)
*
* (c) 2009-2014 Torstein Honsi
*
* License: www.highcharts.com/license
*/
(function (root, factory) {
if (typeof module === 'object' && module.exports) {
module.exports = root.document ?
factory(root) :
function (w) {
return factory(w);
};
} else {
root.Highcharts = factory();
}
}(typeof window !== 'undefined' ? window : this, function (w) {
| frank12268/codis | cmd/fe/assets/node_modules/highcharts/js/parts/Intro.js | JavaScript | mit | 554 | [
30522,
1013,
1013,
1027,
1027,
8503,
9006,
22090,
2099,
1027,
1027,
1013,
1013,
1030,
6268,
1035,
2504,
3722,
1035,
20600,
2015,
1013,
1008,
1008,
1008,
1030,
6105,
1030,
4031,
1012,
2171,
1030,
1046,
2015,
1058,
1030,
4031,
1012,
2544,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using Hik.Communication.Scs.Communication.EndPoints.Tcp;
namespace Hik.Communication.Scs.Client.Tcp
{
/// <summary>
/// This class is used to simplify TCP socket operations.
/// </summary>
internal static class TcpHelper
{
public static Socket ConnectToServer(ScsTcpEndPoint endPoint, int timeoutMs)
{
var pc = ProxyConfig.ProxyConfig.GetConfig();
if (pc.ProxyEnable && !string.IsNullOrEmpty(pc.ProxyType) && pc.ProxyType.Equals("HTTP"))
{
return ConnectViaHttpProxy(endPoint.IpAddress, endPoint.TcpPort, pc.ProxyAddress, pc.ProxyPort,
pc.ProxyUserName, pc.ProxyPassword);
}
return ConnectToServerNoProxy(new IPEndPoint(IPAddress.Parse(endPoint.IpAddress), endPoint.TcpPort),
timeoutMs);
}
/// <summary>
/// This code is used to connect to a TCP socket with timeout option.
/// </summary>
/// <param name="endPoint">IP endpoint of remote server</param>
/// <param name="timeoutMs">Timeout to wait until connect</param>
/// <returns>Socket object connected to server</returns>
/// <exception cref="SocketException">Throws SocketException if can not connect.</exception>
/// <exception cref="TimeoutException">Throws TimeoutException if can not connect within specified timeoutMs</exception>
public static Socket ConnectToServerNoProxy(EndPoint endPoint, int timeoutMs)
{
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
try
{
socket.Blocking = false;
socket.Connect(endPoint);
socket.Blocking = true;
return socket;
}
catch (SocketException socketException)
{
if (socketException.ErrorCode != 10035)
{
socket.Close();
throw;
}
if (!socket.Poll(timeoutMs*1000, SelectMode.SelectWrite))
{
socket.Close();
throw new TimeoutException("The host failed to connect. Timeout occured.");
}
socket.Blocking = true;
return socket;
}
}
public static Socket ConnectViaHttpProxy(string targetHost, int targetPort, string httpProxyHost,
int httpProxyPort, string proxyUserName, string proxyPassword)
{
const BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance;
var uriBuilder = new UriBuilder
{
Scheme = Uri.UriSchemeHttp,
Host = httpProxyHost,
Port = httpProxyPort
};
var request = WebRequest.Create("http://" + targetHost + ":" + targetPort);
var webProxy = new WebProxy(uriBuilder.Uri);
request.Proxy = webProxy;
request.Method = "CONNECT";
webProxy.Credentials = new NetworkCredential(proxyUserName, proxyPassword);
var response = request.GetResponse();
var responseStream = response.GetResponseStream();
if (responseStream == null)
throw new ArgumentNullException(nameof(responseStream));
var rsType = responseStream.GetType();
var connectionProperty = rsType.GetProperty("Connection", flags);
var connection = connectionProperty.GetValue(responseStream, null);
var connectionType = connection.GetType();
var networkStreamProperty = connectionType.GetProperty("NetworkStream", flags);
var networkStream = networkStreamProperty.GetValue(connection, null);
var nsType = networkStream.GetType();
var socketProperty = nsType.GetProperty("Socket", flags);
return (Socket) socketProperty.GetValue(networkStream, null);
}
}
} | huhen/scs | src/Scs/Communication/Scs/Client/Tcp/TcpHelper.cs | C# | mit | 4,229 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
5658,
1025,
2478,
2291,
1012,
5658,
1012,
27540,
1025,
2478,
2291,
1012,
9185,
1025,
2478,
7632,
2243,
1012,
4807,
1012,
8040,
2015,
1012,
4807,
1012,
2203,
26521,
1012,
22975,
2361,
1025,
3415,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2013 Triforce - in association with the University of Pretoria and Epi-Use <Advance/>
*
* 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 afk.ge.tokyo.ems.systems;
import afk.bot.london.Sonar;
import afk.ge.BBox;
import afk.ge.ems.Engine;
import afk.ge.ems.ISystem;
import afk.ge.ems.Utils;
import afk.ge.tokyo.ems.components.Camera;
import afk.ge.tokyo.ems.components.Display;
import afk.ge.tokyo.ems.components.Mouse;
import afk.ge.tokyo.ems.components.Selection;
import afk.ge.tokyo.ems.nodes.CollisionNode;
import afk.ge.tokyo.ems.nodes.SonarNode;
import afk.gfx.GfxEntity;
import static afk.gfx.GfxEntity.*;
import static afk.gfx.GfxUtils.X_AXIS;
import static afk.gfx.GfxUtils.Y_AXIS;
import static afk.gfx.GfxUtils.Z_AXIS;
import afk.gfx.GraphicsEngine;
import com.hackoeur.jglm.Mat4;
import com.hackoeur.jglm.Matrices;
import com.hackoeur.jglm.Vec3;
import com.hackoeur.jglm.Vec4;
import java.util.List;
/**
*
* @author daniel
*/
public class DebugRenderSystem implements ISystem
{
Engine engine;
GraphicsEngine gfxEngine;
public DebugRenderSystem(GraphicsEngine gfxEngine)
{
this.gfxEngine = gfxEngine;
}
@Override
public boolean init(Engine engine)
{
this.engine = engine;
return true;
}
@Override
public void update(float t, float dt)
{
Camera camera = engine.getGlobal(Camera.class);
Mouse mouse = engine.getGlobal(Mouse.class);
Display display = engine.getGlobal(Display.class);
Selection selection = engine.getGlobal(Selection.class);
List<CollisionNode> nodes = engine.getNodeList(CollisionNode.class);
for (CollisionNode node : nodes)
{
BBox bbox = new BBox(node.state, node.bbox);
GfxEntity gfx = gfxEngine.getDebugEntity(bbox);
gfx.position = bbox.getCenterPoint();
gfx.rotation = node.state.rot;
gfx.scale = new Vec3(1);
gfx.colour = selection.getEntity() == node.entity ? GREEN : MAGENTA;
}
List<SonarNode> snodes = engine.getNodeList(SonarNode.class);
for (SonarNode node : snodes)
{
final Vec3[] POS_AXIS =
{
X_AXIS, Y_AXIS, Z_AXIS
};
final Vec3[] NEG_AXIS =
{
X_AXIS.getNegated(),
Y_AXIS.getNegated(),
Z_AXIS.getNegated()
};
Sonar sonar = node.controller.events.sonar;
Mat4 m = Utils.getMatrix(node.state);
Vec3 pos = node.state.pos.add(m.multiply(node.bbox.offset.toDirection()).getXYZ());
float[] sonarmins =
{
sonar.distance[3], sonar.distance[4], sonar.distance[5]
};
float[] sonarmaxes =
{
sonar.distance[0], sonar.distance[1], sonar.distance[2]
};
for (int i = 0; i < 3; i++)
{
if (!Float.isNaN(node.sonar.min.get(i)))
{
drawSonar(node, NEG_AXIS[i], sonarmins[i],
node.sonar.min.get(i), pos.subtract(m.multiply(NEG_AXIS[i].scale(node.bbox.extent.get(i)).toDirection()).getXYZ()));
}
if (!Float.isNaN(node.sonar.max.get(i)))
{
drawSonar(node, POS_AXIS[i], sonarmaxes[i],
node.sonar.max.get(i), pos.add(m.multiply(POS_AXIS[i].scale(node.bbox.extent.get(i)).toDirection()).getXYZ()));
}
}
gfxEngine.getDebugEntity(new Vec3[]
{
new Vec3(-1000, 0, 0), new Vec3(1000, 0, 0)
}).colour = new Vec3(0.7f, 0, 0);
gfxEngine.getDebugEntity(new Vec3[]
{
new Vec3(0, -1000, 0), new Vec3(0, 1000, 0)
}).colour = new Vec3(0, 0.7f, 0);
gfxEngine.getDebugEntity(new Vec3[]
{
new Vec3(0, 0, -1000), new Vec3(0, 0, 1000)
}).colour = new Vec3(0, 0, 0.7f);
final float fov = 60.0f, near = 0.1f, far = 200.0f;
Mat4 proj = Matrices.perspective(fov, display.screenWidth/display.screenHeight, near, far);
Mat4 view = Matrices.lookAt(camera.eye, camera.at, camera.up);
Mat4 cam = proj.multiply(view);
Mat4 camInv = cam.getInverse();
Vec4 mouseNear4 = camInv.multiply(new Vec4(mouse.nx,mouse.ny,-1,1));
Vec4 mouseFar4 = camInv.multiply(new Vec4(mouse.nx,mouse.ny,1,1));
Vec3 mouseNear = mouseNear4.getXYZ().scale(1.0f/mouseNear4.getW());
Vec3 mouseFar = mouseFar4.getXYZ().scale(1.0f/mouseFar4.getW());
gfxEngine.getDebugEntity(new Vec3[]
{
mouseNear, mouseFar
}).colour = new Vec3(1,0,0);
}
}
private void drawSonar(SonarNode node, Vec3 axis, float sonar, float value, Vec3 pos)
{
GfxEntity gfx = gfxEngine.getDebugEntity(new Vec3[]
{
Vec3.VEC3_ZERO,
axis.scale((Float.isInfinite(sonar) ? value : sonar))
});
gfx.position = pos;
gfx.rotation = node.state.rot;
gfx.scale = new Vec3(1);
gfx.colour = MAGENTA;
}
@Override
public void destroy()
{
}
}
| jwfwessels/AFK | src/afk/ge/tokyo/ems/systems/DebugRenderSystem.java | Java | mit | 6,629 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2286,
13012,
14821,
1011,
1999,
2523,
30524,
1008,
1008,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
1037,
6100,
1008,
1997,
2023,
4007,
1998,
3378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
export { AbilityScoresViewModel } from './ability_scores';
export { ActionsToolbarViewModel } from './actions_toolbar';
export { ArmorViewModel } from './armor';
export { CharacterNameViewModel } from './character_name';
export { CharacterPortraitModel } from './character_portrait';
export { CharacterStatusLineViewModel } from './character_status_line';
export { BackgroundViewModel } from './background';
export { FeatsViewModel } from './feats';
export { FeaturesViewModel } from './features';
export { ItemsViewModel } from './items';
export { MagicItemsViewModel } from './magic_items';
export { ProficienciesViewModel } from './proficiencies';
export { ProfileViewModel } from './profile';
export { CharacterRootViewModel } from './root';
export { SkillsViewModel } from './skills';
export { SpellSlotsViewModel } from './spell_slots';
export { SpellStatsViewModel } from './spell_stats';
export { SpellbookViewModel } from './spells';
export { StatsViewModel } from './stats';
export { TrackerViewModel } from './tracker';
export { TraitsViewModel } from './traits';
export { WealthViewModel } from './wealth';
export { WeaponsViewModel } from './weapons';
export { OtherStatsViewModel } from './other_stats';
| adventurerscodex/adventurerscodex | src/charactersheet/viewmodels/character/index.js | JavaScript | gpl-3.0 | 1,218 | [
30522,
9167,
1063,
3754,
9363,
6072,
8584,
5302,
9247,
1065,
2013,
1005,
1012,
1013,
3754,
1035,
7644,
1005,
1025,
9167,
1063,
4506,
3406,
4747,
8237,
8584,
5302,
9247,
1065,
2013,
1005,
1012,
1013,
4506,
1035,
6994,
8237,
1005,
1025,
916... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_45) on Sun Jun 09 12:17:04 GMT+05:30 2013 -->
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>
ExtractingMetadataConstants (Solr 4.3.1 API)
</TITLE>
<META NAME="date" CONTENT="2013-06-09">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ExtractingMetadataConstants (Solr 4.3.1 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../org/apache/solr/handler/extraction/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ExtractingMetadataConstants.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../org/apache/solr/handler/extraction/ExtractingDocumentLoader.html" title="class in org.apache.solr.handler.extraction"><B>PREV CLASS</B></A>
<A HREF="../../../../../org/apache/solr/handler/extraction/ExtractingParams.html" title="interface in org.apache.solr.handler.extraction"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/solr/handler/extraction/ExtractingMetadataConstants.html" target="_top"><B>FRAMES</B></A>
<A HREF="ExtractingMetadataConstants.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | METHOD</FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | METHOD</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.solr.handler.extraction</FONT>
<BR>
Interface ExtractingMetadataConstants</H2>
<HR>
<DL>
<DT><PRE>public interface <B>ExtractingMetadataConstants</B></DL>
</PRE>
<P>
Constants used internally by the <A HREF="../../../../../org/apache/solr/handler/extraction/ExtractingRequestHandler.html" title="class in org.apache.solr.handler.extraction"><CODE>ExtractingRequestHandler</CODE></A>.
<P>
<P>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/solr/handler/extraction/ExtractingMetadataConstants.html#STREAM_CONTENT_TYPE">STREAM_CONTENT_TYPE</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/solr/handler/extraction/ExtractingMetadataConstants.html#STREAM_NAME">STREAM_NAME</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/solr/handler/extraction/ExtractingMetadataConstants.html#STREAM_SIZE">STREAM_SIZE</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/solr/handler/extraction/ExtractingMetadataConstants.html#STREAM_SOURCE_INFO">STREAM_SOURCE_INFO</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="STREAM_NAME"><!-- --></A><H3>
STREAM_NAME</H3>
<PRE>
static final <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>STREAM_NAME</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.solr.handler.extraction.ExtractingMetadataConstants.STREAM_NAME">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="STREAM_SOURCE_INFO"><!-- --></A><H3>
STREAM_SOURCE_INFO</H3>
<PRE>
static final <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>STREAM_SOURCE_INFO</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.solr.handler.extraction.ExtractingMetadataConstants.STREAM_SOURCE_INFO">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="STREAM_SIZE"><!-- --></A><H3>
STREAM_SIZE</H3>
<PRE>
static final <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>STREAM_SIZE</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.solr.handler.extraction.ExtractingMetadataConstants.STREAM_SIZE">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="STREAM_CONTENT_TYPE"><!-- --></A><H3>
STREAM_CONTENT_TYPE</H3>
<PRE>
static final <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>STREAM_CONTENT_TYPE</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.solr.handler.extraction.ExtractingMetadataConstants.STREAM_CONTENT_TYPE">Constant Field Values</A></DL>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../org/apache/solr/handler/extraction/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ExtractingMetadataConstants.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../org/apache/solr/handler/extraction/ExtractingDocumentLoader.html" title="class in org.apache.solr.handler.extraction"><B>PREV CLASS</B></A>
<A HREF="../../../../../org/apache/solr/handler/extraction/ExtractingParams.html" title="interface in org.apache.solr.handler.extraction"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/solr/handler/extraction/ExtractingMetadataConstants.html" target="_top"><B>FRAMES</B></A>
<A HREF="ExtractingMetadataConstants.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | METHOD</FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | METHOD</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<i>Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.</i>
<script src='../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</BODY>
</HTML>
| rcr-81/SolrCamper | docs/solr-cell/org/apache/solr/handler/extraction/ExtractingMetadataConstants.html | HTML | apache-2.0 | 12,778 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright 2020 The TensorFlow Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "rasterizer.h"
Rasterizer::Rasterizer(
std::unique_ptr<gl_utils::Program>&& program,
std::unique_ptr<gl_utils::RenderTargets>&& render_targets, float clear_red,
float clear_green, float clear_blue, float clear_alpha, float clear_depth,
bool enable_cull_face)
: program_(std::move(program)),
render_targets_(std::move(render_targets)),
clear_red_(clear_red),
clear_green_(clear_green),
clear_blue_(clear_blue),
clear_alpha_(clear_alpha),
clear_depth_(clear_depth),
enable_cull_face_(enable_cull_face) {}
Rasterizer::~Rasterizer() {}
void Rasterizer::Reset() {
program_.reset();
render_targets_.reset();
for (auto&& buffer : shader_storage_buffers_) buffer.second.reset();
}
tensorflow::Status Rasterizer::Render(int num_points,
absl::Span<float> result) {
return RenderImpl(num_points, result);
}
tensorflow::Status Rasterizer::Render(int num_points,
absl::Span<unsigned char> result) {
return RenderImpl(num_points, result);
}
tensorflow::Status Rasterizer::SetUniformMatrix(
const std::string& name, int num_columns, int num_rows, bool transpose,
absl::Span<const float> matrix) {
if (size_t(num_rows * num_columns) != matrix.size())
return TFG_INTERNAL_ERROR("num_rows * num_columns != matrix.size()");
typedef void (*setter_fn)(GLint location, GLsizei count, GLboolean transpose,
const GLfloat* value);
static const auto type_mapping =
std::unordered_map<int, std::tuple<int, int, setter_fn>>({
{GL_FLOAT_MAT2, std::make_tuple(2, 2, glUniformMatrix2fv)},
{GL_FLOAT_MAT3, std::make_tuple(3, 3, glUniformMatrix3fv)},
{GL_FLOAT_MAT4, std::make_tuple(4, 4, glUniformMatrix4fv)},
{GL_FLOAT_MAT2x3, std::make_tuple(2, 3, glUniformMatrix2x3fv)},
{GL_FLOAT_MAT2x4, std::make_tuple(2, 4, glUniformMatrix2x4fv)},
{GL_FLOAT_MAT3x2, std::make_tuple(3, 2, glUniformMatrix3x2fv)},
{GL_FLOAT_MAT3x4, std::make_tuple(3, 4, glUniformMatrix3x4fv)},
{GL_FLOAT_MAT4x2, std::make_tuple(4, 2, glUniformMatrix4x2fv)},
{GL_FLOAT_MAT4x3, std::make_tuple(4, 3, glUniformMatrix4x3fv)},
});
GLint uniform_type;
GLenum property = GL_TYPE;
TF_RETURN_IF_ERROR(program_->GetResourceProperty(
name, GL_UNIFORM, 1, &property, 1, &uniform_type));
// Is a resource active under that name?
if (uniform_type == GLint(GL_INVALID_INDEX))
return TFG_INTERNAL_ERROR("GL_INVALID_INDEX");
auto type_info = type_mapping.find(uniform_type);
if (type_info == type_mapping.end())
return TFG_INTERNAL_ERROR("Unsupported type");
if (std::get<0>(type_info->second) != num_columns ||
std::get<1>(type_info->second) != num_rows)
return TFG_INTERNAL_ERROR("Invalid dimensions");
GLint uniform_location;
property = GL_LOCATION;
TF_RETURN_IF_ERROR(program_->GetResourceProperty(
name, GL_UNIFORM, 1, &property, 1, &uniform_location));
TF_RETURN_IF_ERROR(program_->Use());
auto program_cleanup = MakeCleanup([this]() { return program_->Detach(); });
// Specify the value of the uniform in the current program.
TFG_RETURN_IF_GL_ERROR(std::get<2>(type_info->second)(
uniform_location, 1, transpose ? GL_TRUE : GL_FALSE, matrix.data()));
// Cleanup the program; no program is active at this point.
return tensorflow::Status::OK();
}
| tensorflow/graphics | tensorflow_graphics/rendering/opengl/rasterizer.cc | C++ | apache-2.0 | 4,114 | [
30522,
1013,
1008,
9385,
12609,
1996,
23435,
12314,
6048,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.gw4e.eclipse.builder.exception;
/*-
* #%L
* gw4e
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2017 gw4e-project
* %%
* 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.
* #L%
*/
import org.gw4e.eclipse.builder.GW4EParser;
import org.gw4e.eclipse.builder.Location;
public class SeverityConfigurationException extends BuildPolicyConfigurationException {
/**
*
*/
private static final long serialVersionUID = 1L;
public SeverityConfigurationException(Location location, String message,ParserContextProperties p) {
super(location, message,p);
}
public int getProblemId () {
return GW4EParser.INVALID_SEVERITY;
}
}
| gw4e/gw4e.project | bundles/gw4e-eclipse-plugin/src/org/gw4e/eclipse/builder/exception/SeverityConfigurationException.java | Java | mit | 1,676 | [
30522,
7427,
8917,
1012,
1043,
2860,
2549,
2063,
1012,
13232,
1012,
12508,
1012,
6453,
1025,
1013,
1008,
1011,
1008,
1001,
1003,
1048,
1008,
1043,
2860,
2549,
2063,
1008,
1002,
8909,
1024,
1002,
1008,
1002,
2132,
3126,
2140,
1024,
1002,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_TILES_TILE_H_
#define CC_TILES_TILE_H_
#include <stddef.h>
#include <stdint.h>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "cc/raster/tile_task.h"
#include "cc/tiles/tile_draw_info.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
namespace cc {
class PrioritizedTile;
class TileManager;
struct TilePriority;
class CC_EXPORT Tile {
public:
class CC_EXPORT Deleter {
public:
void operator()(Tile* tile) const;
};
class CC_EXPORT CreateInfo {
public:
int tiling_i_index;
int tiling_j_index;
gfx::Rect enclosing_layer_rect;
gfx::Rect content_rect;
float contents_scale;
CreateInfo(int tiling_i_index,
int tiling_j_index,
const gfx::Rect& enclosing_layer_rect,
const gfx::Rect& content_rect,
float contents_scale)
: tiling_i_index(tiling_i_index),
tiling_j_index(tiling_j_index),
enclosing_layer_rect(enclosing_layer_rect),
content_rect(content_rect),
contents_scale(contents_scale) {}
};
enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0, IS_OPAQUE = 1 << 1 };
typedef uint64_t Id;
Id id() const {
return id_;
}
// TODO(vmpstr): Move this to the iterators.
bool required_for_activation() const { return required_for_activation_; }
void set_required_for_activation(bool is_required) {
required_for_activation_ = is_required;
}
bool required_for_draw() const { return required_for_draw_; }
void set_required_for_draw(bool is_required) {
required_for_draw_ = is_required;
}
bool use_picture_analysis() const {
return !!(flags_ & USE_PICTURE_ANALYSIS);
}
bool is_opaque() const { return !!(flags_ & IS_OPAQUE); }
void AsValueInto(base::trace_event::TracedValue* value) const;
const TileDrawInfo& draw_info() const { return draw_info_; }
TileDrawInfo& draw_info() { return draw_info_; }
float contents_scale() const { return contents_scale_; }
const gfx::Rect& content_rect() const { return content_rect_; }
const gfx::Rect& enclosing_layer_rect() const {
return enclosing_layer_rect_;
}
int layer_id() const { return layer_id_; }
int source_frame_number() const { return source_frame_number_; }
size_t GPUMemoryUsageInBytes() const;
const gfx::Size& desired_texture_size() const { return content_rect_.size(); }
int tiling_i_index() const { return tiling_i_index_; }
int tiling_j_index() const { return tiling_j_index_; }
void SetInvalidated(const gfx::Rect& invalid_content_rect,
Id previous_tile_id) {
invalidated_content_rect_ = invalid_content_rect;
invalidated_id_ = previous_tile_id;
}
Id invalidated_id() const { return invalidated_id_; }
const gfx::Rect& invalidated_content_rect() const {
return invalidated_content_rect_;
}
bool HasRasterTask() const { return !!raster_task_.get(); }
void set_solid_color_analysis_performed(bool performed) {
is_solid_color_analysis_performed_ = performed;
}
bool is_solid_color_analysis_performed() const {
return is_solid_color_analysis_performed_;
}
private:
friend class TileManager;
friend class FakeTileManager;
friend class FakePictureLayerImpl;
// Methods called by by tile manager.
Tile(TileManager* tile_manager,
const CreateInfo& info,
int layer_id,
int source_frame_number,
int flags);
~Tile();
TileManager* const tile_manager_;
const gfx::Rect content_rect_;
const gfx::Rect enclosing_layer_rect_;
const float contents_scale_;
TileDrawInfo draw_info_;
const int layer_id_;
const int source_frame_number_;
const int flags_;
const int tiling_i_index_;
const int tiling_j_index_;
bool required_for_activation_ : 1;
bool required_for_draw_ : 1;
bool is_solid_color_analysis_performed_ : 1;
Id id_;
// The rect bounding the changes in this Tile vs the previous tile it
// replaced.
gfx::Rect invalidated_content_rect_;
// The |id_| of the Tile that was invalidated and replaced by this tile.
Id invalidated_id_;
unsigned scheduled_priority_;
scoped_refptr<TileTask> raster_task_;
DISALLOW_COPY_AND_ASSIGN(Tile);
};
using ScopedTilePtr = std::unique_ptr<Tile, Tile::Deleter>;
} // namespace cc
#endif // CC_TILES_TILE_H_
| ssaroha/node-webrtc | third_party/webrtc/include/chromium/src/cc/tiles/tile.h | C | bsd-2-clause | 4,503 | [
30522,
1013,
1013,
9385,
2262,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
2179,
1999,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module.exports = [
require('./ngdoc'),
require('./name'),
require('./area'),
require('./module'),
require('./id'),
require('./restrict'),
require('./eventType'),
require('./example'),
require('./element'),
require('./fullName'),
require('./priority'),
require('./title'),
require('./parent'),
require('./packageName'),
require('./scope')
]; | uistyleguide/uistyleguide.github.io | node_modules/dgeni-packages/ngdoc/tag-defs/index.js | JavaScript | mit | 370 | [
30522,
11336,
1012,
14338,
1027,
1031,
5478,
1006,
1005,
1012,
1013,
12835,
3527,
2278,
1005,
1007,
1010,
5478,
1006,
1005,
1012,
1013,
2171,
1005,
1007,
1010,
5478,
1006,
1005,
1012,
1013,
2181,
1005,
1007,
1010,
5478,
1006,
1005,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//----------------------------------------------------------------------------
//
// License: See top level LICENSE.txt file.
//
// Author: David Burken
//
// Description: Test application to for projection classes.
//
//----------------------------------------------------------------------------
// $Id: ossim-projection-test.cpp 2777 2011-06-27 19:14:17Z david.burken $
#include <ossim/base/ossimKeywordlist.h>
#include <ossim/init/ossimInit.h>
#include <ossim/projection/ossimMapProjection.h>
#include <ossim/projection/ossimEquDistCylProjection.h>
#include <ossim/projection/ossimGoogleProjection.h>
#include <ossim/projection/ossimProjection.h>
#include <ossim/projection/ossimProjectionFactoryRegistry.h>
#include <vector>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
ossimInit::instance()->initialize(argc, argv);
ossimRefPtr<ossimMapProjection> proj1 = new ossimEquDistCylProjection();
cout << "\n\nproj1 orgin=(0,0):\n";
proj1->print(cout);
ossim_float64 dpp = 1.0/3600.0; // Degrees per pixel.
ossimDpt scale(dpp, dpp);
proj1->setDecimalDegreesPerPixel(scale);
cout << "\n\nproj1 after setDecimalDegreesPerPixel(0.000277778, 0.000277778):\n";
proj1->print(cout);
ossimGpt origin(38.0, -123.0, 0.0);
proj1->setOrigin(origin);
cout << "\n\nproj1 after setOrgin=(38, -123):\n";
proj1->print(cout);
proj1->setDecimalDegreesPerPixel(scale);
cout << "\n\nproj1 after setDecimalDegreesPerPixel(0.000277778, 0.000277778) with origin lat of 38N:\n";
proj1->print(cout);
ossimRefPtr<ossimMapProjection> proj2 = static_cast<ossimMapProjection*>(proj1->dup());
cout << "\n\nproj2 a dup of proj1:\n";
proj2->print(cout);
ossimKeywordlist kwl;
proj2->saveState(kwl);
cout << "\n\nproj2 save state:\n"
<< kwl << endl;
ossimRefPtr<ossimProjection> proj3 = ossimProjectionFactoryRegistry::instance()->
createProjection(kwl);
cout << "\n\nproj3 created from proj2's saveState via ossimProjectionFactoryRegistry::createProjection\n";
if ( proj3.valid() )
{
proj3->print(cout);
}
ossimRefPtr<ossimMapProjection> proj4 = new ossimEquDistCylProjection();
proj4->loadState(kwl);
cout << "\n\nproj4 from proj2 save state via ossimEquDistCylProjection::loadState:\n";
proj4->print(cout);
ossimRefPtr<ossimMapProjection> proj5 = new ossimGoogleProjection();
ossimDpt dpt(-20037508.3428, 20037508.3428);
ossimGpt gpt = proj5->inverse( dpt );
cout << "\n\nossimGoogleProjection test:"
<< "\ndpt: " << dpt
<< "\ninverse gpt: " << gpt
<< endl;
dpt.x = 20037508.3428;
dpt.y = -20037508.3428;
gpt = proj5->inverse( dpt );
cout << "\ndpt: " << dpt
<< "\ninverse gpt: " << gpt
<< "\n" << endl;
return 0;
}
| ossimlabs/ossim | test/src/projection/ossim-projection-test.cpp | C++ | mit | 2,863 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>PHPExcel classes</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="css/template.css" rel="stylesheet" media="all">
<script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
<script src="js/jquery.mousewheel.min.js" type="text/javascript"></script>
<script src="js/bootstrap.js" type="text/javascript"></script>
<script src="js/template.js" type="text/javascript"></script>
<script src="js/prettify/prettify.min.js" type="text/javascript"></script>
<link rel="shortcut icon" href="img/favicon.ico">
<link rel="apple-touch-icon" href="img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/apple-touch-icon-114x114.png">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span
class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a><a
class="brand" href="index.html">PHPExcel classes</a>
<div class="nav-collapse">
<ul class="nav">
<li class="dropdown">
<a href="#api" class="dropdown-toggle" data-toggle="dropdown">
API Documentation <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a>Packages</a></li>
<li><a href="packages/Default.html"><i class="icon-folder-open"></i> Default</a></li>
<li><a href="packages/JAMA.html"><i class="icon-folder-open"></i> JAMA</a></li>
<li>
<a href="packages/JAMA%0D%0ACholesky%20decomposition%20class%0D%0AFor%20a%20symmetric,%20positive%20definite%20matrix%20A,%20the%20Cholesky%20decomposition%0D%0Ais%20an%20lower%20triangular%20matrix%20L%20so%20that%20A%20=%20L*L'.html"><i
class="icon-folder-open"></i> JAMA
Cholesky decomposition class
For a symmetric, positive definite matrix A, the Cholesky decomposition
is an lower triangular matrix L so that A = L*L'</a></li>
<li>
<a href="packages/JAMA%0D%0AClass%20to%20obtain%20eigenvalues%20and%20eigenvectors%20of%20a%20real%20matrix.html"><i
class="icon-folder-open"></i> JAMA
Class to obtain eigenvalues and eigenvectors of a real matrix</a></li>
<li><a href="packages/JAMA%0D%0AError%20handling.html"><i class="icon-folder-open"></i> JAMA
Error handling</a></li>
<li>
<a href="packages/JAMA%0D%0AFor%20an%20m-by-n%20matrix%20A%20with%20m%20>=%20n,%20the%20LU%20decomposition%20is%20an%20m-by-n%0D%0Aunit%20lower%20triangular%20matrix%20L,%20an%20n-by-n%20upper%20triangular%20matrix%20U,%0D%0Aand%20a%20permutation%20vector%20piv%20of%20length%20m%20so%20that%20A(piv,:)%20=%20L*U.html"><i
class="icon-folder-open"></i> JAMA
For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n
unit lower triangular matrix L, an n-by-n upper triangular matrix U,
and a permutation vector piv of length m so that A(piv,:) = L*U</a></li>
<li>
<a href="packages/JAMA%0D%0AFor%20an%20m-by-n%20matrix%20A%20with%20m%20>=%20n,%20the%20QR%20decomposition%20is%20an%20m-by-n%0D%0Aorthogonal%20matrix%20Q%20and%20an%20n-by-n%20upper%20triangular%20matrix%20R%20so%20that%0D%0AA%20=%20Q*R.html"><i
class="icon-folder-open"></i> JAMA
For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n
orthogonal matrix Q and an n-by-n upper triangular matrix R so that
A = Q*R</a></li>
<li>
<a href="packages/JAMA%0D%0AFor%20an%20m-by-n%20matrix%20A%20with%20m%20>=%20n,%20the%20singular%20value%20decomposition%20is%0D%0Aan%20m-by-n%20orthogonal%20matrix%20U,%20an%20n-by-n%20diagonal%20matrix%20S,%20and%0D%0Aan%20n-by-n%20orthogonal%20matrix%20V%20so%20that%20A%20=%20U*S*V'.html"><i
class="icon-folder-open"></i> JAMA
For an m-by-n matrix A with m >= n, the singular value decomposition is
an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and
an n-by-n orthogonal matrix V so that A = U*S*V'</a></li>
<li>
<a href="packages/JAMA%0D%0APythagorean%20Theorem:%0D%0Aa%20=%203%0D%0Ab%20=%204%0D%0Ar%20=%20sqrt(square(a)%20+%20square(b))%0D%0Ar%20=%205%0D%0Ar%20=%20sqrt(a%5E2%20+%20b%5E2)%20without%20under.overflow.html"><i
class="icon-folder-open"></i> JAMA
Pythagorean Theorem:
a = 3
b = 4
r = sqrt(square(a) + square(b))
r = 5
r = sqrt(a^2 + b^2) without under/overflow</a></li>
<li><a href="packages/PHPExcel.html"><i class="icon-folder-open"></i> PHPExcel</a></li>
</ul>
</li>
<li class="dropdown" id="charts-menu">
<a href="#charts" class="dropdown-toggle" data-toggle="dropdown">
Charts <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="graph_class.html"><i class="icon-list-alt"></i> Class hierarchy diagram</a>
</li>
</ul>
</li>
<li class="dropdown" id="reports-menu">
<a href="#reports" class="dropdown-toggle" data-toggle="dropdown">
Reports <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="errors.html"><i class="icon-remove-sign"></i> Errors
<span class="label label-info">519</span></a></li>
<li><a href="markers.html"><i class="icon-map-marker"></i> Markers
<ul>
<li>todo
<span class="label label-info">19</span>
</li>
<li>fixme
<span class="label label-info">10</span>
</li>
</ul>
</a></li>
<li><a href="deprecated.html"><i class="icon-stop"></i> Deprecated elements
<span class="label label-info">12</span></a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="go_to_top"><a href="#___" style="color: inherit">Back to top <i class="icon-upload icon-white"></i></a>
</div>
</div>
<div id="___" class="container">
<noscript>
<div class="alert alert-warning">
Javascript is disabled; several features are only available
if Javascript is enabled.
</div>
</noscript>
<div class="row">
<div class="span4">
<ul class="side-nav nav nav-list">
<li class="nav-header">Navigation</li>
<li><a href="#PHPExcel%5CCalculation%5CLookupRef.php"><i class="icon-file"></i>PHPExcel\Calculation\LookupRef.php</a>
</li>
<li><a href="#PHPExcel%5CCalculation%5CStatistical.php"><i class="icon-file"></i>PHPExcel\Calculation\Statistical.php</a>
</li>
<li><a href="#PHPExcel%5CCell%5CDataType.php"><i class="icon-file"></i>PHPExcel\Cell\DataType.php</a></li>
<li><a href="#PHPExcel%5CReader%5CExcel2007.php"><i class="icon-file"></i>PHPExcel\Reader\Excel2007.php</a></li>
<li><a href="#PHPExcel%5CReader%5CExcel5.php"><i class="icon-file"></i>PHPExcel\Reader\Excel5.php</a></li>
<li><a href="#PHPExcel%5CReader%5CHTML.php"><i class="icon-file"></i>PHPExcel\Reader\HTML.php</a></li>
<li><a href="#PHPExcel%5CWriter%5CExcel5%5CParser.php"><i class="icon-file"></i>PHPExcel\Writer\Excel5\Parser.php</a>
</li>
<li><a href="#PHPExcel%5CWriter%5CExcel5%5CWorkbook.php"><i class="icon-file"></i>PHPExcel\Writer\Excel5\Workbook.php</a>
</li>
<li><a href="#PHPExcel%5CWriter%5CExcel5%5CWorksheet.php"><i class="icon-file"></i>PHPExcel\Writer\Excel5\Worksheet.php</a>
</li>
<li><a href="#PHPExcel%5CWriter%5CHTML.php"><i class="icon-file"></i>PHPExcel\Writer\HTML.php</a></li>
</ul>
</div>
<div class="span8">
<ul class="breadcrumb">
<li>
<a href=""><i class="icon-map-marker"></i></a><span class="divider">\</span>
</li>
<li>Markers</li>
</ul>
<div class="alert alert-info">
The following markers were found:
<ul>
<li>todo
<span class="label label-info">19</span>
</li>
<li>fixme
<span class="label label-info">10</span>
</li>
</ul>
</div>
<div id="marker-accordion">
<div class="package-contents">
<a name="PHPExcel%5CCalculation%5CLookupRef.php" id="PHPExcel\Calculation\LookupRef.php"></a>
<h3>
<i class="icon-file"></i>PHPExcel\Calculation\LookupRef.php
<small style="float: right;padding-right: 10px;">1</small>
</h3>
<div>
<table class="table markers table-bordered">
<tr>
<th>Type</th>
<th>Line</th>
<th>Description</th>
</tr>
<tr>
<td>todo</td>
<td>280</td>
<td>Support for the optional a1 parameter introduced in Excel 2010</td>
</tr>
</table>
</div>
</div>
<div class="package-contents">
<a name="PHPExcel%5CCalculation%5CStatistical.php" id="PHPExcel\Calculation\Statistical.php"></a>
<h3>
<i class="icon-file"></i>PHPExcel\Calculation\Statistical.php
<small style="float: right;padding-right: 10px;">3</small>
</h3>
<div>
<table class="table markers table-bordered">
<tr>
<th>Type</th>
<th>Line</th>
<th>Description</th>
</tr>
<tr>
<td>todo</td>
<td>962</td>
<td>Cumulative distribution function</td>
</tr>
<tr>
<td>todo</td>
<td>1311</td>
<td>Warning. This implementation differs from the algorithm detailed on the MS
web site in that $CumPGuessMinus1 = $CumPGuess - 1 rather than $CumPGuess - $PGuess
This eliminates a potential endless loop error, but may have an adverse affect on the
accuracy of the function (although all my tests have so far returned correct results).
</td>
</tr>
<tr>
<td>todo</td>
<td>2060</td>
<td>Try implementing P J Acklam's refinement algorithm for greater
accuracy if I can get my head round the mathematics
(as described at) http://home.online.no/~pjacklam/notes/invnorm/
</td>
</tr>
</table>
</div>
</div>
<div class="package-contents">
<a name="PHPExcel%5CCell%5CDataType.php" id="PHPExcel\Cell\DataType.php"></a>
<h3>
<i class="icon-file"></i>PHPExcel\Cell\DataType.php
<small style="float: right;padding-right: 10px;">1</small>
</h3>
<div>
<table class="table markers table-bordered">
<tr>
<th>Type</th>
<th>Line</th>
<th>Description</th>
</tr>
<tr>
<td>todo</td>
<td>92</td>
<td>Sanitize Rich-Text string (max. character count is 32,767)</td>
</tr>
</table>
</div>
</div>
<div class="package-contents">
<a name="PHPExcel%5CReader%5CExcel2007.php" id="PHPExcel\Reader\Excel2007.php"></a>
<h3>
<i class="icon-file"></i>PHPExcel\Reader\Excel2007.php
<small style="float: right;padding-right: 10px;">3</small>
</h3>
<div>
<table class="table markers table-bordered">
<tr>
<th>Type</th>
<th>Line</th>
<th>Description</th>
</tr>
<tr>
<td>todo</td>
<td>1380</td>
<td>Autoshapes from twoCellAnchors!</td>
</tr>
<tr>
<td>fixme</td>
<td>1559</td>
<td>what if sheetname contains comma?</td>
</tr>
<tr>
<td>fixme</td>
<td>1562</td>
<td>what if sheetname contains exclamation mark?</td>
</tr>
</table>
</div>
</div>
<div class="package-contents">
<a name="PHPExcel%5CReader%5CExcel5.php" id="PHPExcel\Reader\Excel5.php"></a>
<h3>
<i class="icon-file"></i>PHPExcel\Reader\Excel5.php
<small style="float: right;padding-right: 10px;">8</small>
</h3>
<div>
<table class="table markers table-bordered">
<tr>
<th>Type</th>
<th>Line</th>
<th>Description</th>
</tr>
<tr>
<td>fixme</td>
<td>959</td>
<td>what if sheetname contains comma?</td>
</tr>
<tr>
<td>fixme</td>
<td>967</td>
<td>what if sheetname contains exclamation mark?</td>
</tr>
<tr>
<td>fixme</td>
<td>994</td>
<td>what if sheetname contains comma?</td>
</tr>
<tr>
<td>todo</td>
<td>1047</td>
<td>Provide support for named values</td>
</tr>
<tr>
<td>fixme</td>
<td>4039</td>
<td>set $firstVisibleRow and $firstVisibleColumn</td>
</tr>
<tr>
<td>todo</td>
<td>4623</td>
<td>Investigate structure for .xls SHEETLAYOUT record as saved by MS Office Excel 2007</td>
</tr>
<tr>
<td>todo</td>
<td>5981</td>
<td>if cell range is just a single cell, should this funciton</td>
</tr>
<tr>
<td>todo</td>
<td>6155</td>
<td>external sheet support</td>
</tr>
</table>
</div>
</div>
<div class="package-contents">
<a name="PHPExcel%5CReader%5CHTML.php" id="PHPExcel\Reader\HTML.php"></a>
<h3>
<i class="icon-file"></i>PHPExcel\Reader\HTML.php
<small style="float: right;padding-right: 10px;">3</small>
</h3>
<div>
<table class="table markers table-bordered">
<tr>
<th>Type</th>
<th>Line</th>
<th>Description</th>
</tr>
<tr>
<td>todo</td>
<td>202</td>
<td></td>
</tr>
<tr>
<td>todo</td>
<td>217</td>
<td></td>
</tr>
<tr>
<td>todo</td>
<td>233</td>
<td></td>
</tr>
</table>
</div>
</div>
<div class="package-contents">
<a name="PHPExcel%5CWriter%5CExcel5%5CParser.php" id="PHPExcel\Writer\Excel5\Parser.php"></a>
<h3>
<i class="icon-file"></i>PHPExcel\Writer\Excel5\Parser.php
<small style="float: right;padding-right: 10px;">7</small>
</h3>
<div>
<table class="table markers table-bordered">
<tr>
<th>Type</th>
<th>Line</th>
<th>Description</th>
</tr>
<tr>
<td>todo</td>
<td>566</td>
<td>use real error codes</td>
</tr>
<tr>
<td>todo</td>
<td>641</td>
<td>possible class value 0,1,2 check Formula.pm</td>
</tr>
<tr>
<td>todo</td>
<td>646</td>
<td>use real error codes</td>
</tr>
<tr>
<td>todo</td>
<td>662</td>
<td>use real error codes</td>
</tr>
<tr>
<td>todo</td>
<td>734</td>
<td>use real error codes</td>
</tr>
<tr>
<td>fixme</td>
<td>982</td>
<td>maximum possible value for Excel 5 (change this!!!)</td>
</tr>
<tr>
<td>fixme</td>
<td>984</td>
<td>this changes for BIFF8</td>
</tr>
</table>
</div>
</div>
<div class="package-contents">
<a name="PHPExcel%5CWriter%5CExcel5%5CWorkbook.php" id="PHPExcel\Writer\Excel5\Workbook.php"></a>
<h3>
<i class="icon-file"></i>PHPExcel\Writer\Excel5\Workbook.php
<small style="float: right;padding-right: 10px;">1</small>
</h3>
<div>
<table class="table markers table-bordered">
<tr>
<th>Type</th>
<th>Line</th>
<th>Description</th>
</tr>
<tr>
<td>fixme</td>
<td>975</td>
<td>only using internal SUPBOOK record</td>
</tr>
</table>
</div>
</div>
<div class="package-contents">
<a name="PHPExcel%5CWriter%5CExcel5%5CWorksheet.php" id="PHPExcel\Writer\Excel5\Worksheet.php"></a>
<h3>
<i class="icon-file"></i>PHPExcel\Writer\Excel5\Worksheet.php
<small style="float: right;padding-right: 10px;">1</small>
</h3>
<div>
<table class="table markers table-bordered">
<tr>
<th>Type</th>
<th>Line</th>
<th>Description</th>
</tr>
<tr>
<td>fixme</td>
<td>1330</td>
<td>!!!</td>
</tr>
</table>
</div>
</div>
<div class="package-contents">
<a name="PHPExcel%5CWriter%5CHTML.php" id="PHPExcel\Writer\HTML.php"></a>
<h3>
<i class="icon-file"></i>PHPExcel\Writer\HTML.php
<small style="float: right;padding-right: 10px;">1</small>
</h3>
<div>
<table class="table markers table-bordered">
<tr>
<th>Type</th>
<th>Line</th>
<th>Description</th>
</tr>
<tr>
<td>todo</td>
<td>1497</td>
<td>Same for columns</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<footer class="span12">
Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons
provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a12</a> and<br>
generated on 2013-06-02T15:42:54+01:00.<br></footer>
</div>
</div>
</body>
</html>
| kristhianfigueroa/retos | protected/messages/PHPExcel/Documentation/API/markers.html | HTML | apache-2.0 | 20,935 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.tech11.spg;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Locale;
public class Main {
public static void main(String... args) throws IOException {
if (args.length != 3) {
System.err.println("Please use SPG with java -jar spg.jar <TEMPLATE_FOLDER> <TARGET_FOLDER> <MASTERLANGUAGE> <SINGLETARGETLANGUAGE>");
System.exit(1);
}
String templateFolder = convertIntoAbsolutePath(args[0]);
String targetFolder = convertIntoAbsolutePath(args[1]);
Locale locale = new Locale(args[2]);
SystemConfiguration.instance().setTemplateFolder(templateFolder);
SystemConfiguration.instance().setTargetFolder(targetFolder);
SystemConfiguration.instance().setLocale(locale);
// String folderPath =
// "D:\\hero\\workspace-neon\\spg\\src\\test\\resources";
// String outputPath =
// "D:\\hero\\workspace-neon\\spg\\src\\test\\resources\\de";
StaticPageGenerator spg = new StaticPageGenerator()
.setTemplateFolder(templateFolder)
.setTargetFolder(targetFolder)
.setMasterLanguage(locale);
spg.run();
if (System.getProperty("spg.watch") == null)
return;
Path dir = Paths.get(templateFolder);
new WatchDir(dir, true).processEvents(spg);
}
static String convertIntoAbsolutePath(String path) {
if (path.contains(":") || path.startsWith("/"))
return path;
return new File(path).getAbsolutePath();
}
}
| mr678/spg | core/src/main/java/com/tech11/spg/Main.java | Java | unlicense | 1,442 | [
30522,
7427,
4012,
1012,
6627,
14526,
1012,
11867,
2290,
1025,
12324,
9262,
1012,
22834,
1012,
5371,
1025,
12324,
9262,
1012,
22834,
1012,
22834,
10288,
24422,
1025,
12324,
9262,
1012,
9152,
2080,
1012,
5371,
1012,
4130,
1025,
12324,
9262,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<h3>
<a name="opt">Možnosti štartu</a>
</h3>
<p>
There are two types of boot options available. First, there are
options that affect the installer. Second, there are kernel
options. Some of the more common options are:
</p>
<p>
a) installer options
<ul>
<li><a href="#o_install">inštalovať</a> -- select an installation source</li>
<li><a href="#network">voľby siete</a> -- the network options</li>
<li><a href="#o_vnc">Voľby vnc</a> -- options for installation via VNC</li>
</ul>
</p>
<p>
b) kernel options
<ul>
<li><a href="#o_splash">úvodná obrazovka</a> -- influence the behavior of the splash screen</li>
<li><a href="#o_apm">apm</a> -- toggle power management</li>
<li><a href="#o_acpi">acpi</a> -- advanced configuration and power interface</li>
<li><a href="#o_ide">ide</a> -- control the IDE subsystem</li>
</ul>
</p>
| sTeeLM/MINIME | toolkit/srpm/SOURCES/gfxboot-themes-1.0.0/themes/openSUSE/help-install/sk/main::opt.html | HTML | gpl-2.0 | 852 | [
30522,
1026,
1044,
2509,
1028,
1026,
1037,
2171,
1027,
1000,
23569,
1000,
1028,
9587,
2480,
15460,
3775,
2707,
2226,
1026,
1013,
1037,
1028,
1026,
1013,
1044,
2509,
1028,
1026,
1052,
1028,
2045,
2024,
2048,
4127,
1997,
9573,
7047,
2800,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Coq bench</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="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-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../../..">Unstable</a></li>
<li><a href=".">8.4.5 / contrib:rsa 8.4.dev</a></li>
<li class="active"><a href="">2014-11-29 23:17:27</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="../../../../../about.html">About</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href=".">« Up</a>
<h1>
contrib:rsa
<small>
8.4.dev
<span class="label label-success">6 s</span>
</small>
</h1>
<p><em><script>document.write(moment("2014-11-29 23:17:27 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2014-11-29 23:17:27 UTC)</em><p>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>ruby lint.rb unstable ../unstable/packages/coq:contrib:rsa/coq:contrib:rsa.8.4.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
<dt>Output</dt>
<dd><pre>The package is valid.
</pre></dd>
</dl>
<h2>Dry install</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --dry-run coq:contrib:rsa.8.4.dev coq.8.4.5</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>1 s</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.4.5).
The following actions will be performed:
- install coq:contrib:rsa.8.4.dev
=== 1 to install ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Building coq:contrib:rsa.8.4.dev:
coq_makefile -f Make -o Makefile
make -j4
make install
Installing coq:contrib:rsa.8.4.dev.
</pre></dd>
</dl>
<p>Dry install without Coq, to test if the problem was incompatibility with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --deps-only coq:contrib:rsa.8.4.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>1 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --verbose coq:contrib:rsa.8.4.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>6 s</dd>
<dt>Output</dt>
<dd><pre>The following actions will be performed:
- install coq:contrib:rsa.8.4.dev
=== 1 to install ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[coq:contrib:rsa] Fetching https://gforge.inria.fr/git/coq-contribs/rsa.git#v8.4
Initialized empty Git repository in /home/bench/.opam/packages.dev/coq:contrib:rsa.8.4.dev/.git/
[master (root-commit) 21ab524] opam-git-init
From https://gforge.inria.fr/git/coq-contribs/rsa
* [new branch] v8.4 -> opam-ref
* [new branch] v8.4 -> origin/v8.4
Binomials.v
Divides.v
Fermat.v
LICENSE
Make
Makefile
MiscRsa.v
README
Rsa.v
bench.log
description
HEAD is now at 571e999 Sauvegarde des bench.log
=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Building coq:contrib:rsa.8.4.dev:
coq_makefile -f Make -o Makefile
make -j4
make install
"coqdep" -c -slash -R . RSA "Binomials.v" > "Binomials.v.d" || ( RV=$?; rm -f "Binomials.v.d"; exit ${RV} )
"coqdep" -c -slash -R . RSA "Divides.v" > "Divides.v.d" || ( RV=$?; rm -f "Divides.v.d"; exit ${RV} )
"coqdep" -c -slash -R . RSA "Fermat.v" > "Fermat.v.d" || ( RV=$?; rm -f "Fermat.v.d"; exit ${RV} )
"coqdep" -c -slash -R . RSA "MiscRsa.v" > "MiscRsa.v.d" || ( RV=$?; rm -f "MiscRsa.v.d"; exit ${RV} )
"coqdep" -c -slash -R . RSA "Rsa.v" > "Rsa.v.d" || ( RV=$?; rm -f "Rsa.v.d"; exit ${RV} )
"coqc" -q -R . RSA MiscRsa
"coqc" -q -R . RSA Divides
"coqc" -q -R . RSA Binomials
"coqc" -q -R . RSA Fermat
"coqc" -q -R . RSA Rsa
for i in Rsa.vo MiscRsa.vo Fermat.vo Divides.vo Binomials.vo; do \
install -d `dirname "/home/bench/.opam/system/lib/coq/user-contrib"/RSA/$i`; \
install -m 0644 $i "/home/bench/.opam/system/lib/coq/user-contrib"/RSA/$i; \
done
Installing coq:contrib:rsa.8.4.dev.
</pre></dd>
</dl>
<h2>Installation size</h2>
<p>Data not available in this bench.</p>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq:contrib:rsa.8.4.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>1 s</dd>
<dt>Output</dt>
<dd><pre>The following actions will be performed:
- remove coq:contrib:rsa.8.4.dev
=== 1 to remove ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[coq:contrib:rsa] Fetching https://gforge.inria.fr/git/coq-contribs/rsa.git#v8.4
=-=- Removing Packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Removing coq:contrib:rsa.8.4.dev.
rm -R /home/bench/.opam/system/lib/coq/user-contrib/RSA
</pre></dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html> | coq-bench/coq-bench.github.io-old | clean/Linux-x86_64-4.02.1-1.2.0/unstable/8.4.5/contrib:rsa/8.4.dev/2014-11-29_23-17-27.html | HTML | mit | 8,579 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'serverspec'
set :backend, :exec
set :path, 'build:$PATH'
ENV['AWS_CONFIG_FILE']='.aws/config' | mmmorris1975/go-aws-runas | spec/spec_helper.rb | Ruby | mit | 104 | [
30522,
5478,
1005,
14903,
5051,
2278,
1005,
2275,
1024,
2067,
10497,
1010,
1024,
4654,
8586,
2275,
1024,
4130,
1010,
1005,
3857,
1024,
1002,
4130,
1005,
4372,
2615,
1031,
1005,
22091,
2015,
1035,
9530,
8873,
2290,
1035,
5371,
1005,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @license
* Copyright 2016 Google Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This creates a form submit button that is not displayed, in order that the form may be submitted
* using the enter key.
*/
export function makeHiddenSubmitButton() {
let element = document.createElement('button');
element.type = 'submit';
element.className = 'hidden-submit-button';
// We apply these styles directly to the element rather than by styling the class in order to
// avoid them being overridden accidentally.
element.style.margin = '0';
element.style.border = '0';
element.style.padding = '0';
element.style.width = '0';
element.style.height = '0';
element.style.overflow = 'hidden';
element.tabIndex = -1;
return element;
}
| funkey/neuroglancer | src/neuroglancer/widget/hidden_submit_button.ts | TypeScript | apache-2.0 | 1,280 | [
30522,
1013,
1008,
1008,
1008,
1030,
6105,
1008,
9385,
2355,
8224,
4297,
1012,
1008,
7000,
30524,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
1008,
2017,
2089,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Decompiled with JetBrains decompiler
// Type: System.Runtime.CompilerServices.DiscardableAttribute
// Assembly: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 255ABCDF-D9D6-4E3D-BAD4-F74D4CE3D7A8
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll
using System;
using System.Runtime;
using System.Runtime.InteropServices;
namespace System.Runtime.CompilerServices
{
/// <summary>
/// Marks a type definition as discardable.
/// </summary>
[ComVisible(true)]
public class DiscardableAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Runtime.CompilerServices.DiscardableAttribute"/> class with default values.
/// </summary>
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public DiscardableAttribute()
{
}
}
}
| mater06/LEGOChimaOnlineReloaded | LoCO Client Files/Decompressed Client/Extracted DLL/mscorlib/System/Runtime/CompilerServices/DiscardableAttribute.cs | C# | gpl-3.0 | 932 | [
30522,
1013,
1013,
21933,
8737,
18450,
2007,
6892,
10024,
7076,
21933,
8737,
9463,
2099,
1013,
1013,
2828,
1024,
2291,
1012,
2448,
7292,
1012,
21624,
8043,
7903,
2229,
1012,
5860,
4232,
3085,
19321,
3089,
8569,
2618,
1013,
1013,
3320,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"04963110","logradouro":"Rua Alan Napier","bairro":"Ch\u00e1cara da Enseada","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/04963110.jsonp.js | JavaScript | cc0-1.0 | 155 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
5840,
2683,
2575,
21486,
10790,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
5070,
21320,
1000,
1010,
1000,
21790,
18933,
1000,
1024,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# nginx-tfs安装及配置
https://github.com/alibaba/nginx-tfs
### 1. 安装依赖库
```bash
sudo apt-get install cmake libpcre3 libpcre3-dev build-essential libssl-dev
```
### 2. 安装yajl
```bash
git clone git://github.com/lloyd/yajl
cd yajl
./configure
make
sudo make install
sudo ldconfig
```
### 3. 克隆nginx-tfs
```bash
ubuntu@s1:~/apps$ git clone https://github.com/alibaba/nginx-tfs.git
```
### 4. 编译安装nginx
```bash
./configure --prefix=/home/ubuntu/apps/nginx --add-module=/home/ubuntu/apps/nginx-tfs --with-http_ssl_module
make
make install
```
### 5. 修改nginx.conf
```
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
tfs_upstream tfs_rc {
server 192.168.64.136:8100;
type ns;
rcs_zone name=tfs1 size=128M;
rcs_interface eth0;
rcs_heartbeat lock_file=/logs/lk.file interval=10s;
}
server {
listen 7500;
server_name 192.168.64.136;
tfs_keepalive max_cached=100 bucket_count=10;
#tfs_log "pipe:/usr/sbin/cronolog -p 30min /path/to/nginx/logs/cronolog/%Y/%m/%Y-%m-%d-%H-%M-tfs_access.log";
location / {
tfs_pass tfs://tfs_rc;
}
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
```
### 6. 启动nginx
```bash
ubuntu@s1:~/apps/nginx$ sudo sbin/nginx
ubuntu@s1:~/apps/nginx$ ps -ef | grep nginx
```
### 7. 访问资源
http://192.168.64.136:7500/v1/tfs/T1naJTByhT1R4cSCrK
这里值得注意的是端口后面的url一定是/v1/,tfs三个字符可以用任意字符代替。例如一个空格字符,或者aaaa,bbb等,但至少需要存在一个字符。
### 8. 参考文档
http://ylw6006.blog.51cto.com/470441/1558631
https://github.com/alibaba/nginx-tfs | sxyx2008/taobao-tfs-example | nginx-tfs.md | Markdown | mit | 4,320 | [
30522,
1001,
12835,
2378,
2595,
1011,
1056,
10343,
1820,
100,
100,
100,
100,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
4862,
3676,
3676,
1013,
12835,
2378,
2595,
1011,
1056,
10343,
1001,
1001,
1001,
1015,
1012,
1820,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.jettdurham.jinteg;
/**
* Thrown when a method designed to be run as a test is not static.
*
* @author jettdurham
*
*/
public class MethodNotStaticException extends Exception {
private static final long serialVersionUID = -6889136974544927532L;
public MethodNotStaticException(String message) {
super(message);
}
}
| thejettdurham/jinteg | src/main/java/com/jettdurham/jinteg/MethodNotStaticException.java | Java | apache-2.0 | 351 | [
30522,
7427,
4012,
1012,
22962,
24979,
3511,
1012,
9743,
2618,
2290,
1025,
1013,
1008,
1008,
1008,
6908,
2043,
1037,
4118,
2881,
2000,
2022,
2448,
2004,
1037,
3231,
2003,
2025,
10763,
1012,
1008,
1008,
1030,
3166,
22962,
24979,
3511,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*! tableSorter (FORK) 2.16+ widgets - updated 12/22/2014 (v2.18.4)
*
* Column Styles
* Column Filters
* Column Resizing
* Sticky Header
* UI Theme (generalized)
* Save Sort
* [ "columns", "filter", "resizable", "stickyHeaders", "uitheme", "saveSort" ]
*/
/*jshint browser:true, jquery:true, unused:false, loopfunc:true */
/*global jQuery: false, localStorage: false */
;(function ($, window) {
"use strict";
var ts = $.tablesorter = $.tablesorter || {};
ts.themes = {
"bootstrap" : {
table : 'table table-bordered table-striped',
caption : 'caption',
header : 'bootstrap-header', // give the header a gradient background
footerRow : '',
footerCells: '',
icons : '', // add "icon-white" to make them white; this icon class is added to the <i> in the header
sortNone : 'bootstrap-icon-unsorted',
sortAsc : 'icon-chevron-up glyphicon glyphicon-chevron-up',
sortDesc : 'icon-chevron-down glyphicon glyphicon-chevron-down',
active : '', // applied when column is sorted
hover : '', // use custom css here - bootstrap class may not override it
filterRow : '', // filter row class
even : '', // even row zebra striping
odd : '' // odd row zebra striping
},
"jui" : {
table : 'ui-widget ui-widget-content ui-corner-all', // table classes
caption : 'ui-widget-content',
header : 'ui-widget-header ui-corner-all ui-state-default', // header classes
footerRow : '',
footerCells: '',
icons : 'ui-icon', // icon class added to the <i> in the header
sortNone : 'ui-icon-carat-2-n-s',
sortAsc : 'ui-icon-carat-1-n',
sortDesc : 'ui-icon-carat-1-s',
active : 'ui-state-active', // applied when column is sorted
hover : 'ui-state-hover', // hover class
filterRow : '',
even : 'ui-widget-content', // even row zebra striping
odd : 'ui-state-default' // odd row zebra striping
}
};
$.extend(ts.css, {
filterRow : 'tablesorter-filter-row', // filter
filter : 'tablesorter-filter',
wrapper : 'tablesorter-wrapper', // ui theme & resizable
resizer : 'tablesorter-resizer', // resizable
sticky : 'tablesorter-stickyHeader', // stickyHeader
stickyVis : 'tablesorter-sticky-visible',
stickyWrap: 'tablesorter-sticky-wrapper'
});
// *** Store data in local storage, with a cookie fallback ***
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
if you need it, then include https://github.com/douglascrockford/JSON-js
$.parseJSON is not available is jQuery versions older than 1.4.1, using older
versions will only allow storing information for one page at a time
// *** Save data (JSON format only) ***
// val must be valid JSON... use http://jsonlint.com/ to ensure it is valid
var val = { "mywidget" : "data1" }; // valid JSON uses double quotes
// $.tablesorter.storage(table, key, val);
$.tablesorter.storage(table, 'tablesorter-mywidget', val);
// *** Get data: $.tablesorter.storage(table, key); ***
v = $.tablesorter.storage(table, 'tablesorter-mywidget');
// val may be empty, so also check for your data
val = (v && v.hasOwnProperty('mywidget')) ? v.mywidget : '';
alert(val); // "data1" if saved, or "" if not
*/
ts.storage = function(table, key, value, options) {
table = $(table)[0];
var cookieIndex, cookies, date,
hasLocalStorage = false,
values = {},
c = table.config,
$table = $(table),
id = options && options.id || $table.attr(options && options.group ||
'data-table-group') || table.id || $('.tablesorter').index( $table ),
url = options && options.url || $table.attr(options && options.page ||
'data-table-page') || c && c.fixedUrl || window.location.pathname;
// https://gist.github.com/paulirish/5558557
if ("localStorage" in window) {
try {
window.localStorage.setItem('_tmptest', 'temp');
hasLocalStorage = true;
window.localStorage.removeItem('_tmptest');
} catch(error) {}
}
// *** get value ***
if ($.parseJSON) {
if (hasLocalStorage) {
values = $.parseJSON(localStorage[key] || '{}');
} else {
// old browser, using cookies
cookies = document.cookie.split(/[;\s|=]/);
// add one to get from the key to the value
cookieIndex = $.inArray(key, cookies) + 1;
values = (cookieIndex !== 0) ? $.parseJSON(cookies[cookieIndex] || '{}') : {};
}
}
// allow value to be an empty string too
if ((value || value === '') && window.JSON && JSON.hasOwnProperty('stringify')) {
// add unique identifiers = url pathname > table ID/index on page > data
if (!values[url]) {
values[url] = {};
}
values[url][id] = value;
// *** set value ***
if (hasLocalStorage) {
localStorage[key] = JSON.stringify(values);
} else {
date = new Date();
date.setTime(date.getTime() + (31536e+6)); // 365 days
document.cookie = key + '=' + (JSON.stringify(values)).replace(/\"/g,'\"') + '; expires=' + date.toGMTString() + '; path=/';
}
} else {
return values && values[url] ? values[url][id] : '';
}
};
// Add a resize event to table headers
// **************************
ts.addHeaderResizeEvent = function(table, disable, settings) {
table = $(table)[0]; // make sure we're usig a dom element
var headers,
defaults = {
timer : 250
},
options = $.extend({}, defaults, settings),
c = table.config,
wo = c.widgetOptions,
checkSizes = function(triggerEvent) {
wo.resize_flag = true;
headers = [];
c.$headers.each(function() {
var $header = $(this),
sizes = $header.data('savedSizes') || [0,0], // fixes #394
width = this.offsetWidth,
height = this.offsetHeight;
if (width !== sizes[0] || height !== sizes[1]) {
$header.data('savedSizes', [ width, height ]);
headers.push(this);
}
});
if (headers.length && triggerEvent !== false) {
c.$table.trigger('resize', [ headers ]);
}
wo.resize_flag = false;
};
checkSizes(false);
clearInterval(wo.resize_timer);
if (disable) {
wo.resize_flag = false;
return false;
}
wo.resize_timer = setInterval(function() {
if (wo.resize_flag) { return; }
checkSizes();
}, options.timer);
};
// Widget: General UI theme
// "uitheme" option in "widgetOptions"
// **************************
ts.addWidget({
id: "uitheme",
priority: 10,
format: function(table, c, wo) {
var i, time, classes, $header, $icon, $tfoot, $h, oldtheme, oldremove,
themesAll = ts.themes,
$table = c.$table,
$headers = c.$headers,
theme = c.theme || 'jui',
themes = themesAll[theme] || themesAll.jui,
remove = [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' );
if (c.debug) { time = new Date(); }
// initialization code - run once
if (!$table.hasClass('tablesorter-' + theme) || c.theme !== c.appliedTheme || !table.hasInitialized) {
oldtheme = themes[c.appliedTheme] || {};
oldremove = oldtheme ? [ oldtheme.sortNone, oldtheme.sortDesc, oldtheme.sortAsc, oldtheme.active ].join( ' ' ) : '';
if (oldtheme) {
wo.zebra[0] = wo.zebra[0].replace(' ' + oldtheme.even, '');
wo.zebra[1] = wo.zebra[1].replace(' ' + oldtheme.odd, '');
}
// update zebra stripes
if (themes.even !== '') { wo.zebra[0] += ' ' + themes.even; }
if (themes.odd !== '') { wo.zebra[1] += ' ' + themes.odd; }
// add caption style
$table.children('caption').removeClass(oldtheme.caption).addClass(themes.caption);
// add table/footer class names
$tfoot = $table
// remove other selected themes
.removeClass( c.appliedTheme ? 'tablesorter-' + ( c.appliedTheme || '' ) : '' )
.addClass('tablesorter-' + theme + ' ' + themes.table) // add theme widget class name
.children('tfoot');
if ($tfoot.length) {
$tfoot
// if oldtheme.footerRow or oldtheme.footerCells are undefined, all class names are removed
.children('tr').removeClass(oldtheme.footerRow || '').addClass(themes.footerRow)
.children('th, td').removeClass(oldtheme.footerCells || '').addClass(themes.footerCells);
}
// update header classes
$headers
.add(c.$extraHeaders)
.removeClass(oldtheme.header + ' ' + oldtheme.hover + ' ' + oldremove)
.addClass(themes.header)
.not('.sorter-false')
.bind('mouseenter.tsuitheme mouseleave.tsuitheme', function(event) {
// toggleClass with switch added in jQuery 1.3
$(this)[ event.type === 'mouseenter' ? 'addClass' : 'removeClass' ](themes.hover);
});
if (!$headers.find('.' + ts.css.wrapper).length) {
// Firefox needs this inner div to position the resizer correctly
$headers.wrapInner('<div class="' + ts.css.wrapper + '" style="position:relative;height:100%;width:100%"></div>');
}
if (c.cssIcon) {
// if c.cssIcon is '', then no <i> is added to the header
$headers.find('.' + ts.css.icon).removeClass(oldtheme.icons + ' ' + oldremove).addClass(themes.icons);
}
if ($table.hasClass('hasFilters')) {
$table.children('thead').children('.' + ts.css.filterRow).removeClass(oldtheme.filterRow).addClass(themes.filterRow);
}
c.appliedTheme = c.theme;
}
for (i = 0; i < c.columns; i++) {
$header = c.$headers.add(c.$extraHeaders).not('.sorter-false').filter('[data-column="' + i + '"]');
$icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $header;
$h = $headers.not('.sorter-false').filter('[data-column="' + i + '"]:last');
if ($h.length) {
if ($h[0].sortDisabled) {
// no sort arrows for disabled columns!
$header.removeClass(remove);
$icon.removeClass(remove + ' ' + themes.icons);
} else {
classes = ($header.hasClass(ts.css.sortAsc)) ?
themes.sortAsc :
($header.hasClass(ts.css.sortDesc)) ? themes.sortDesc :
$header.hasClass(ts.css.header) ? themes.sortNone : '';
$header[classes === themes.sortNone ? 'removeClass' : 'addClass'](themes.active);
$icon.removeClass(remove).addClass(classes);
}
}
}
if (c.debug) {
ts.benchmark("Applying " + theme + " theme", time);
}
},
remove: function(table, c) {
var $table = c.$table,
theme = c.theme || 'jui',
themes = ts.themes[ theme ] || ts.themes.jui,
$headers = $table.children('thead').children(),
remove = themes.sortNone + ' ' + themes.sortDesc + ' ' + themes.sortAsc;
$table
.removeClass('tablesorter-' + theme + ' ' + themes.table)
.find(ts.css.header).removeClass(themes.header);
$headers
.unbind('mouseenter.tsuitheme mouseleave.tsuitheme') // remove hover
.removeClass(themes.hover + ' ' + remove + ' ' + themes.active)
.find('.' + ts.css.filterRow)
.removeClass(themes.filterRow);
$headers.find('.' + ts.css.icon).removeClass(themes.icons);
}
});
// Widget: Column styles
// "columns", "columns_thead" (true) and
// "columns_tfoot" (true) options in "widgetOptions"
// **************************
ts.addWidget({
id: "columns",
priority: 30,
options : {
columns : [ "primary", "secondary", "tertiary" ]
},
format: function(table, c, wo) {
var $tbody, tbodyIndex, $rows, rows, $row, $cells, remove, indx,
$table = c.$table,
$tbodies = c.$tbodies,
sortList = c.sortList,
len = sortList.length,
// removed c.widgetColumns support
css = wo && wo.columns || [ "primary", "secondary", "tertiary" ],
last = css.length - 1;
remove = css.join(' ');
// check if there is a sort (on initialization there may not be one)
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
$tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true); // detach tbody
$rows = $tbody.children('tr');
// loop through the visible rows
$rows.each(function() {
$row = $(this);
if (this.style.display !== 'none') {
// remove all columns class names
$cells = $row.children().removeClass(remove);
// add appropriate column class names
if (sortList && sortList[0]) {
// primary sort column class
$cells.eq(sortList[0][0]).addClass(css[0]);
if (len > 1) {
for (indx = 1; indx < len; indx++) {
// secondary, tertiary, etc sort column classes
$cells.eq(sortList[indx][0]).addClass( css[indx] || css[last] );
}
}
}
}
});
ts.processTbody(table, $tbody, false);
}
// add classes to thead and tfoot
rows = wo.columns_thead !== false ? ['thead tr'] : [];
if (wo.columns_tfoot !== false) {
rows.push('tfoot tr');
}
if (rows.length) {
$rows = $table.find( rows.join(',') ).children().removeClass(remove);
if (len) {
for (indx = 0; indx < len; indx++) {
// add primary. secondary, tertiary, etc sort column classes
$rows.filter('[data-column="' + sortList[indx][0] + '"]').addClass(css[indx] || css[last]);
}
}
}
},
remove: function(table, c, wo) {
var tbodyIndex, $tbody,
$tbodies = c.$tbodies,
remove = (wo.columns || [ "primary", "secondary", "tertiary" ]).join(' ');
c.$headers.removeClass(remove);
c.$table.children('tfoot').children('tr').children('th, td').removeClass(remove);
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
$tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true); // remove tbody
$tbody.children('tr').each(function() {
$(this).children().removeClass(remove);
});
ts.processTbody(table, $tbody, false); // restore tbody
}
}
});
// Widget: filter
// **************************
ts.addWidget({
id: "filter",
priority: 50,
options : {
filter_childRows : false, // if true, filter includes child row content in the search
filter_columnFilters : true, // if true, a filter will be added to the top of each table column
filter_cellFilter : '', // css class name added to the filter cell (string or array)
filter_cssFilter : '', // css class name added to the filter row & each input in the row (tablesorter-filter is ALWAYS added)
filter_defaultFilter : {}, // add a default column filter type "~{query}" to make fuzzy searches default; "{q1} AND {q2}" to make all searches use a logical AND.
filter_excludeFilter : {}, // filters to exclude, per column
filter_external : '', // jQuery selector string (or jQuery object) of external filters
filter_filteredRow : 'filtered', // class added to filtered rows; needed by pager plugin
filter_formatter : null, // add custom filter elements to the filter row
filter_functions : null, // add custom filter functions using this option
filter_hideEmpty : true, // hide filter row when table is empty
filter_hideFilters : false, // collapse filter row when mouse leaves the area
filter_ignoreCase : true, // if true, make all searches case-insensitive
filter_liveSearch : true, // if true, search column content while the user types (with a delay)
filter_onlyAvail : 'filter-onlyAvail', // a header with a select dropdown & this class name will only show available (visible) options within the drop down
filter_placeholder : { search : '', select : '' }, // default placeholder text (overridden by any header "data-placeholder" setting)
filter_reset : null, // jQuery selector string of an element used to reset the filters
filter_saveFilters : false, // Use the $.tablesorter.storage utility to save the most recent filters
filter_searchDelay : 300, // typing delay in milliseconds before starting a search
filter_searchFiltered: true, // allow searching through already filtered rows in special circumstances; will speed up searching in large tables if true
filter_selectSource : null, // include a function to return an array of values to be added to the column filter select
filter_startsWith : false, // if true, filter start from the beginning of the cell contents
filter_useParsedData : false, // filter all data using parsed content
filter_serversideFiltering : false, // if true, server-side filtering should be performed because client-side filtering will be disabled, but the ui and events will still be used.
filter_defaultAttrib : 'data-value', // data attribute in the header cell that contains the default filter value
filter_selectSourceSeparator : '|' // filter_selectSource array text left of the separator is added to the option value, right into the option text
},
format: function(table, c, wo) {
if (!c.$table.hasClass('hasFilters')) {
ts.filter.init(table, c, wo);
}
},
remove: function(table, c, wo) {
var tbodyIndex, $tbody,
$table = c.$table,
$tbodies = c.$tbodies;
$table
.removeClass('hasFilters')
// add .tsfilter namespace to all BUT search
.unbind('addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search '.split(' ').join(c.namespace + 'filter '))
.find('.' + ts.css.filterRow).remove();
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
$tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true); // remove tbody
$tbody.children().removeClass(wo.filter_filteredRow).show();
ts.processTbody(table, $tbody, false); // restore tbody
}
if (wo.filter_reset) {
$(document).undelegate(wo.filter_reset, 'click.tsfilter');
}
}
});
ts.filter = {
// regex used in filter "check" functions - not for general use and not documented
regex: {
regex : /^\/((?:\\\/|[^\/])+)\/([mig]{0,3})?$/, // regex to test for regex
child : /tablesorter-childRow/, // child row class name; this gets updated in the script
filtered : /filtered/, // filtered (hidden) row class name; updated in the script
type : /undefined|number/, // check type
exact : /(^[\"\'=]+)|([\"\'=]+$)/g, // exact match (allow '==')
nondigit : /[^\w,. \-()]/g, // replace non-digits (from digit & currency parser)
operators : /[<>=]/g, // replace operators
query : '(q|query)' // replace filter queries
},
// function( c, data ) { }
// c = table.config
// data.filter = array of filter input values;
// data.iFilter = same array, except lowercase (if wo.filter_ignoreCase is true)
// data.exact = table cell text (or parsed data if column parser enabled)
// data.iExact = same as data.exact, except lowercase (if wo.filter_ignoreCase is true)
// data.cache = table cell text from cache, so it has been parsed (& in all lower case if config.ignoreCase is true)
// data.index = column index; table = table element (DOM)
// data.parsed = array (by column) of boolean values (from filter_useParsedData or "filter-parsed" class)
types: {
// Look for regex
regex: function( c, data ) {
if ( ts.filter.regex.regex.test(data.iFilter) ) {
var matches,
regex = ts.filter.regex.regex.exec(data.iFilter);
try {
matches = new RegExp(regex[1], regex[2]).test( data.iExact );
} catch (error) {
matches = false;
}
return matches;
}
return null;
},
// Look for operators >, >=, < or <=
operators: function( c, data ) {
if ( /^[<>]=?/.test(data.iFilter) ) {
var cachedValue, result,
table = c.table,
index = data.index,
parsed = data.parsed[index],
query = ts.formatFloat( data.iFilter.replace(ts.filter.regex.operators, ''), table ),
parser = c.parsers[index],
savedSearch = query;
// parse filter value in case we're comparing numbers (dates)
if (parsed || parser.type === 'numeric') {
result = ts.filter.parseFilter(c, $.trim('' + data.iFilter.replace(ts.filter.regex.operators, '')), index, parsed, true);
query = ( typeof result === "number" && result !== '' && !isNaN(result) ) ? result : query;
}
// iExact may be numeric - see issue #149;
// check if cached is defined, because sometimes j goes out of range? (numeric columns)
cachedValue = ( parsed || parser.type === 'numeric' ) && !isNaN(query) && typeof data.cache !== 'undefined' ? data.cache :
isNaN(data.iExact) ? ts.formatFloat( data.iExact.replace(ts.filter.regex.nondigit, ''), table) :
ts.formatFloat( data.iExact, table );
if ( />/.test(data.iFilter) ) { result = />=/.test(data.iFilter) ? cachedValue >= query : cachedValue > query; }
if ( /</.test(data.iFilter) ) { result = /<=/.test(data.iFilter) ? cachedValue <= query : cachedValue < query; }
// keep showing all rows if nothing follows the operator
if ( !result && savedSearch === '' ) { result = true; }
return result;
}
return null;
},
// Look for a not match
notMatch: function( c, data ) {
if ( /^\!/.test(data.iFilter) ) {
var indx,
filter = ts.filter.parseFilter(c, data.iFilter.replace('!', ''), data.index, data.parsed[data.index]);
if (ts.filter.regex.exact.test(filter)) {
// look for exact not matches - see #628
filter = filter.replace(ts.filter.regex.exact, '');
return filter === '' ? true : $.trim(filter) !== data.iExact;
} else {
indx = data.iExact.search( $.trim(filter) );
return filter === '' ? true : !(c.widgetOptions.filter_startsWith ? indx === 0 : indx >= 0);
}
}
return null;
},
// Look for quotes or equals to get an exact match; ignore type since iExact could be numeric
exact: function( c, data ) {
/*jshint eqeqeq:false */
if (ts.filter.regex.exact.test(data.iFilter)) {
var filter = ts.filter.parseFilter(c, data.iFilter.replace(ts.filter.regex.exact, ''), data.index, data.parsed[data.index]);
return data.anyMatch ? $.inArray(filter, data.rowArray) >= 0 : filter == data.iExact;
}
return null;
},
// Look for an AND or && operator (logical and)
and : function( c, data ) {
if ( ts.filter.regex.andTest.test(data.filter) ) {
var index = data.index,
parsed = data.parsed[index],
query = data.iFilter.split( ts.filter.regex.andSplit ),
result = data.iExact.search( $.trim( ts.filter.parseFilter(c, query[0], index, parsed) ) ) >= 0,
indx = query.length - 1;
while (result && indx) {
result = result && data.iExact.search( $.trim( ts.filter.parseFilter(c, query[indx], index, parsed) ) ) >= 0;
indx--;
}
return result;
}
return null;
},
// Look for a range (using " to " or " - ") - see issue #166; thanks matzhu!
range : function( c, data ) {
if ( ts.filter.regex.toTest.test(data.iFilter) ) {
var result, tmp,
table = c.table,
index = data.index,
parsed = data.parsed[index],
// make sure the dash is for a range and not indicating a negative number
query = data.iFilter.split( ts.filter.regex.toSplit ),
range1 = ts.formatFloat( ts.filter.parseFilter(c, query[0].replace(ts.filter.regex.nondigit, ''), index, parsed), table ),
range2 = ts.formatFloat( ts.filter.parseFilter(c, query[1].replace(ts.filter.regex.nondigit, ''), index, parsed), table );
// parse filter value in case we're comparing numbers (dates)
if (parsed || c.parsers[index].type === 'numeric') {
result = c.parsers[index].format('' + query[0], table, c.$headers.eq(index), index);
range1 = (result !== '' && !isNaN(result)) ? result : range1;
result = c.parsers[index].format('' + query[1], table, c.$headers.eq(index), index);
range2 = (result !== '' && !isNaN(result)) ? result : range2;
}
result = ( parsed || c.parsers[index].type === 'numeric' ) && !isNaN(range1) && !isNaN(range2) ? data.cache :
isNaN(data.iExact) ? ts.formatFloat( data.iExact.replace(ts.filter.regex.nondigit, ''), table) :
ts.formatFloat( data.iExact, table );
if (range1 > range2) { tmp = range1; range1 = range2; range2 = tmp; } // swap
return (result >= range1 && result <= range2) || (range1 === '' || range2 === '');
}
return null;
},
// Look for wild card: ? = single, * = multiple, or | = logical OR
wild : function( c, data ) {
if ( /[\?\*\|]/.test(data.iFilter) || ts.filter.regex.orReplace.test(data.filter) ) {
var index = data.index,
parsed = data.parsed[index],
query = ts.filter.parseFilter(c, data.iFilter.replace(ts.filter.regex.orReplace, "|"), index, parsed);
// look for an exact match with the "or" unless the "filter-match" class is found
if (!c.$headers.filter('[data-column="' + index + '"]:last').hasClass('filter-match') && /\|/.test(query)) {
// show all results while using filter match. Fixes #727
if (query[ query.length - 1 ] === '|') { query += '*'; }
query = data.anyMatch && $.isArray(data.rowArray) ? '(' + query + ')' : '^(' + query + ')$';
}
// parsing the filter may not work properly when using wildcards =/
return new RegExp( query.replace(/\?/g, '\\S{1}').replace(/\*/g, '\\S*') ).test(data.iExact);
}
return null;
},
// fuzzy text search; modified from https://github.com/mattyork/fuzzy (MIT license)
fuzzy: function( c, data ) {
if ( /^~/.test(data.iFilter) ) {
var indx,
patternIndx = 0,
len = data.iExact.length,
pattern = ts.filter.parseFilter(c, data.iFilter.slice(1), data.index, data.parsed[data.index]);
for (indx = 0; indx < len; indx++) {
if (data.iExact[indx] === pattern[patternIndx]) {
patternIndx += 1;
}
}
if (patternIndx === pattern.length) {
return true;
}
return false;
}
return null;
}
},
init: function(table, c, wo) {
// filter language options
ts.language = $.extend(true, {}, {
to : 'to',
or : 'or',
and : 'and'
}, ts.language);
var options, string, txt, $header, column, filters, val, fxn, noSelect,
regex = ts.filter.regex;
c.$table.addClass('hasFilters');
// define timers so using clearTimeout won't cause an undefined error
wo.searchTimer = null;
wo.filter_initTimer = null;
wo.filter_formatterCount = 0;
wo.filter_formatterInit = [];
wo.filter_anyColumnSelector = '[data-column="all"],[data-column="any"]';
wo.filter_multipleColumnSelector = '[data-column*="-"],[data-column*=","]';
txt = '\\{' + ts.filter.regex.query + '\\}';
$.extend( regex, {
child : new RegExp(c.cssChildRow),
filtered : new RegExp(wo.filter_filteredRow),
alreadyFiltered : new RegExp('(\\s+(' + ts.language.or + '|-|' + ts.language.to + ')\\s+)', 'i'),
toTest : new RegExp('\\s+(-|' + ts.language.to + ')\\s+', 'i'),
toSplit : new RegExp('(?:\\s+(?:-|' + ts.language.to + ')\\s+)' ,'gi'),
andTest : new RegExp('\\s+(' + ts.language.and + '|&&)\\s+', 'i'),
andSplit : new RegExp('(?:\\s+(?:' + ts.language.and + '|&&)\\s+)', 'gi'),
orReplace : new RegExp('\\s+(' + ts.language.or + ')\\s+', 'gi'),
iQuery : new RegExp(txt, 'i'),
igQuery : new RegExp(txt, 'ig')
});
// don't build filter row if columnFilters is false or all columns are set to "filter-false" - issue #156
if (wo.filter_columnFilters !== false && c.$headers.filter('.filter-false, .parser-false').length !== c.$headers.length) {
// build filter row
ts.filter.buildRow(table, c, wo);
}
c.$table.bind('addRows updateCell update updateRows updateComplete appendCache filterReset filterEnd search '.split(' ').join(c.namespace + 'filter '), function(event, filter) {
c.$table.find('.' + ts.css.filterRow).toggle( !(wo.filter_hideEmpty && $.isEmptyObject(c.cache) && !(c.delayInit && event.type === 'appendCache')) ); // fixes #450
if ( !/(search|filter)/.test(event.type) ) {
event.stopPropagation();
ts.filter.buildDefault(table, true);
}
if (event.type === 'filterReset') {
c.$table.find('.' + ts.css.filter).add(wo.filter_$externalFilters).val('');
ts.filter.searching(table, []);
} else if (event.type === 'filterEnd') {
ts.filter.buildDefault(table, true);
} else {
// send false argument to force a new search; otherwise if the filter hasn't changed, it will return
filter = event.type === 'search' ? filter : event.type === 'updateComplete' ? c.$table.data('lastSearch') : '';
if (/(update|add)/.test(event.type) && event.type !== "updateComplete") {
// force a new search since content has changed
c.lastCombinedFilter = null;
c.lastSearch = [];
}
// pass true (skipFirst) to prevent the tablesorter.setFilters function from skipping the first input
// ensures all inputs are updated when a search is triggered on the table $('table').trigger('search', [...]);
ts.filter.searching(table, filter, true);
}
return false;
});
// reset button/link
if (wo.filter_reset) {
if (wo.filter_reset instanceof $) {
// reset contains a jQuery object, bind to it
wo.filter_reset.click(function(){
c.$table.trigger('filterReset');
});
} else if ($(wo.filter_reset).length) {
// reset is a jQuery selector, use event delegation
$(document)
.undelegate(wo.filter_reset, 'click.tsfilter')
.delegate(wo.filter_reset, 'click.tsfilter', function() {
// trigger a reset event, so other functions (filter_formatter) know when to reset
c.$table.trigger('filterReset');
});
}
}
if (wo.filter_functions) {
for (column = 0; column < c.columns; column++) {
fxn = ts.getColumnData( table, wo.filter_functions, column );
if (fxn) {
// remove "filter-select" from header otherwise the options added here are replaced with all options
$header = c.$headers.filter('[data-column="' + column + '"]:last').removeClass('filter-select');
// don't build select if "filter-false" or "parser-false" set
noSelect = !($header.hasClass('filter-false') || $header.hasClass('parser-false'));
options = '';
if ( fxn === true && noSelect ) {
ts.filter.buildSelect(table, column);
} else if ( typeof fxn === 'object' && noSelect ) {
// add custom drop down list
for (string in fxn) {
if (typeof string === 'string') {
options += options === '' ?
'<option value="">' + ($header.data('placeholder') || $header.attr('data-placeholder') || wo.filter_placeholder.select || '') + '</option>' : '';
val = string;
txt = string;
if (string.indexOf(wo.filter_selectSourceSeparator) >= 0) {
val = string.split(wo.filter_selectSourceSeparator);
txt = val[1];
val = val[0];
}
options += '<option ' + (txt === val ? '' : 'data-function-name="' + string + '" ') + 'value="' + val + '">' + txt + '</option>';
}
}
c.$table.find('thead').find('select.' + ts.css.filter + '[data-column="' + column + '"]').append(options);
}
}
}
}
// not really updating, but if the column has both the "filter-select" class & filter_functions set to true,
// it would append the same options twice.
ts.filter.buildDefault(table, true);
ts.filter.bindSearch( table, c.$table.find('.' + ts.css.filter), true );
if (wo.filter_external) {
ts.filter.bindSearch( table, wo.filter_external );
}
if (wo.filter_hideFilters) {
ts.filter.hideFilters(table, c);
}
// show processing icon
if (c.showProcessing) {
c.$table.bind('filterStart' + c.namespace + 'filter filterEnd' + c.namespace + 'filter', function(event, columns) {
// only add processing to certain columns to all columns
$header = (columns) ? c.$table.find('.' + ts.css.header).filter('[data-column]').filter(function() {
return columns[$(this).data('column')] !== '';
}) : '';
ts.isProcessing(table, event.type === 'filterStart', columns ? $header : '');
});
}
// set filtered rows count (intially unfiltered)
c.filteredRows = c.totalRows;
// add default values
c.$table.bind('tablesorter-initialized pagerBeforeInitialized', function() {
// redefine "wo" as it does not update properly inside this callback
var wo = this.config.widgetOptions;
filters = ts.filter.setDefaults(table, c, wo) || [];
if (filters.length) {
// prevent delayInit from triggering a cache build if filters are empty
if ( !(c.delayInit && filters.join('') === '') ) {
ts.setFilters(table, filters, true);
}
}
c.$table.trigger('filterFomatterUpdate');
// trigger init after setTimeout to prevent multiple filterStart/End/Init triggers
setTimeout(function(){
if (!wo.filter_initialized) {
ts.filter.filterInitComplete(c);
}
}, 100);
});
// if filter widget is added after pager has initialized; then set filter init flag
if (c.pager && c.pager.initialized && !wo.filter_initialized) {
c.$table.trigger('filterFomatterUpdate');
setTimeout(function(){
ts.filter.filterInitComplete(c);
}, 100);
}
},
// $cell parameter, but not the config, is passed to the
// filter_formatters, so we have to work with it instead
formatterUpdated: function($cell, column) {
var wo = $cell.closest('table')[0].config.widgetOptions;
if (!wo.filter_initialized) {
// add updates by column since this function
// may be called numerous times before initialization
wo.filter_formatterInit[column] = 1;
}
},
filterInitComplete: function(c){
var wo = c.widgetOptions,
count = 0,
completed = function(){
wo.filter_initialized = true;
c.$table.trigger('filterInit', c);
ts.filter.findRows(c.table, c.$table.data('lastSearch') || []);
};
if ( $.isEmptyObject( wo.filter_formatter ) ) {
completed();
} else {
$.each( wo.filter_formatterInit, function(i, val) {
if (val === 1) {
count++;
}
});
clearTimeout(wo.filter_initTimer);
if (!wo.filter_initialized && count === wo.filter_formatterCount) {
// filter widget initialized
completed();
} else if (!wo.filter_initialized) {
// fall back in case a filter_formatter doesn't call
// $.tablesorter.filter.formatterUpdated($cell, column), and the count is off
wo.filter_initTimer = setTimeout(function(){
completed();
}, 500);
}
}
},
setDefaults: function(table, c, wo) {
var isArray, saved, indx,
// get current (default) filters
filters = ts.getFilters(table) || [];
if (wo.filter_saveFilters && ts.storage) {
saved = ts.storage( table, 'tablesorter-filters' ) || [];
isArray = $.isArray(saved);
// make sure we're not just getting an empty array
if ( !(isArray && saved.join('') === '' || !isArray) ) { filters = saved; }
}
// if no filters saved, then check default settings
if (filters.join('') === '') {
for (indx = 0; indx < c.columns; indx++) {
filters[indx] = c.$headers.filter('[data-column="' + indx + '"]:last').attr(wo.filter_defaultAttrib) || filters[indx];
}
}
c.$table.data('lastSearch', filters);
return filters;
},
parseFilter: function(c, filter, column, parsed, forceParse){
return forceParse || parsed ?
c.parsers[column].format( filter, c.table, [], column ) :
filter;
},
buildRow: function(table, c, wo) {
var col, column, $header, buildSelect, disabled, name, ffxn,
// c.columns defined in computeThIndexes()
columns = c.columns,
arry = $.isArray(wo.filter_cellFilter),
buildFilter = '<tr role="row" class="' + ts.css.filterRow + '">';
for (column = 0; column < columns; column++) {
if (arry) {
buildFilter += '<td' + ( wo.filter_cellFilter[column] ? ' class="' + wo.filter_cellFilter[column] + '"' : '' ) + '></td>';
} else {
buildFilter += '<td' + ( wo.filter_cellFilter !== '' ? ' class="' + wo.filter_cellFilter + '"' : '' ) + '></td>';
}
}
c.$filters = $(buildFilter += '</tr>').appendTo( c.$table.children('thead').eq(0) ).find('td');
// build each filter input
for (column = 0; column < columns; column++) {
disabled = false;
// assuming last cell of a column is the main column
$header = c.$headers.filter('[data-column="' + column + '"]:last');
ffxn = ts.getColumnData( table, wo.filter_functions, column );
buildSelect = (wo.filter_functions && ffxn && typeof ffxn !== "function" ) ||
$header.hasClass('filter-select');
// get data from jQuery data, metadata, headers option or header class name
col = ts.getColumnData( table, c.headers, column );
disabled = ts.getData($header[0], col, 'filter') === 'false' || ts.getData($header[0], col, 'parser') === 'false';
if (buildSelect) {
buildFilter = $('<select>').appendTo( c.$filters.eq(column) );
} else {
ffxn = ts.getColumnData( table, wo.filter_formatter, column );
if (ffxn) {
wo.filter_formatterCount++;
buildFilter = ffxn( c.$filters.eq(column), column );
// no element returned, so lets go find it
if (buildFilter && buildFilter.length === 0) {
buildFilter = c.$filters.eq(column).children('input');
}
// element not in DOM, so lets attach it
if ( buildFilter && (buildFilter.parent().length === 0 ||
(buildFilter.parent().length && buildFilter.parent()[0] !== c.$filters[column])) ) {
c.$filters.eq(column).append(buildFilter);
}
} else {
buildFilter = $('<input type="search">').appendTo( c.$filters.eq(column) );
}
if (buildFilter) {
buildFilter.attr('placeholder', $header.data('placeholder') || $header.attr('data-placeholder') || wo.filter_placeholder.search || '');
}
}
if (buildFilter) {
// add filter class name
name = ( $.isArray(wo.filter_cssFilter) ?
(typeof wo.filter_cssFilter[column] !== 'undefined' ? wo.filter_cssFilter[column] || '' : '') :
wo.filter_cssFilter ) || '';
buildFilter.addClass( ts.css.filter + ' ' + name ).attr('data-column', column);
if (disabled) {
buildFilter.attr('placeholder', '').addClass('disabled')[0].disabled = true; // disabled!
}
}
}
},
bindSearch: function(table, $el, internal) {
table = $(table)[0];
$el = $($el); // allow passing a selector string
if (!$el.length) { return; }
var c = table.config,
wo = c.widgetOptions,
$ext = wo.filter_$externalFilters;
if (internal !== true) {
// save anyMatch element
wo.filter_$anyMatch = $el.filter(wo.filter_anyColumnSelector + ',' + wo.filter_multipleColumnSelector);
if ($ext && $ext.length) {
wo.filter_$externalFilters = wo.filter_$externalFilters.add( $el );
} else {
wo.filter_$externalFilters = $el;
}
// update values (external filters added after table initialization)
ts.setFilters(table, c.$table.data('lastSearch') || [], internal === false);
}
$el
// use data attribute instead of jQuery data since the head is cloned without including the data/binding
.attr('data-lastSearchTime', new Date().getTime())
.unbind('keypress keyup search change '.split(' ').join(c.namespace + 'filter '))
// include change for select - fixes #473
.bind('keyup' + c.namespace + 'filter', function(event) {
$(this).attr('data-lastSearchTime', new Date().getTime());
// emulate what webkit does.... escape clears the filter
if (event.which === 27) {
this.value = '';
// live search
} else if ( wo.filter_liveSearch === false ) {
return;
// don't return if the search value is empty (all rows need to be revealed)
} else if ( this.value !== '' && (
// liveSearch can contain a min value length; ignore arrow and meta keys, but allow backspace
( typeof wo.filter_liveSearch === 'number' && this.value.length < wo.filter_liveSearch ) ||
// let return & backspace continue on, but ignore arrows & non-valid characters
( event.which !== 13 && event.which !== 8 && ( event.which < 32 || (event.which >= 37 && event.which <= 40) ) ) ) ) {
return;
}
// change event = no delay; last true flag tells getFilters to skip newest timed input
ts.filter.searching( table, true, true );
})
.bind('search change keypress '.split(' ').join(c.namespace + 'filter '), function(event){
var column = $(this).data('column');
// don't allow "change" event to process if the input value is the same - fixes #685
if (event.which === 13 || event.type === 'search' || event.type === 'change' && this.value !== c.lastSearch[column]) {
event.preventDefault();
// init search with no delay
$(this).attr('data-lastSearchTime', new Date().getTime());
ts.filter.searching( table, false, true );
}
});
},
searching: function(table, filter, skipFirst) {
var wo = table.config.widgetOptions;
clearTimeout(wo.searchTimer);
if (typeof filter === 'undefined' || filter === true) {
// delay filtering
wo.searchTimer = setTimeout(function() {
ts.filter.checkFilters(table, filter, skipFirst );
}, wo.filter_liveSearch ? wo.filter_searchDelay : 10);
} else {
// skip delay
ts.filter.checkFilters(table, filter, skipFirst);
}
},
checkFilters: function(table, filter, skipFirst) {
var c = table.config,
wo = c.widgetOptions,
filterArray = $.isArray(filter),
filters = (filterArray) ? filter : ts.getFilters(table, true),
combinedFilters = (filters || []).join(''); // combined filter values
// prevent errors if delay init is set
if ($.isEmptyObject(c.cache)) {
// update cache if delayInit set & pager has initialized (after user initiates a search)
if (c.delayInit && c.pager && c.pager.initialized) {
c.$table.trigger('updateCache', [function(){
ts.filter.checkFilters(table, false, skipFirst);
}] );
}
return;
}
// add filter array back into inputs
if (filterArray) {
ts.setFilters( table, filters, false, skipFirst !== true );
if (!wo.filter_initialized) { c.lastCombinedFilter = ''; }
}
if (wo.filter_hideFilters) {
// show/hide filter row as needed
c.$table.find('.' + ts.css.filterRow).trigger( combinedFilters === '' ? 'mouseleave' : 'mouseenter' );
}
// return if the last search is the same; but filter === false when updating the search
// see example-widget-filter.html filter toggle buttons
if (c.lastCombinedFilter === combinedFilters && filter !== false) {
return;
} else if (filter === false) {
// force filter refresh
c.lastCombinedFilter = null;
c.lastSearch = [];
}
if (wo.filter_initialized) { c.$table.trigger('filterStart', [filters]); }
if (c.showProcessing) {
// give it time for the processing icon to kick in
setTimeout(function() {
ts.filter.findRows(table, filters, combinedFilters);
return false;
}, 30);
} else {
ts.filter.findRows(table, filters, combinedFilters);
return false;
}
},
hideFilters: function(table, c) {
var $filterRow, $filterRow2, timer;
$(table)
.find('.' + ts.css.filterRow)
.addClass('hideme')
.bind('mouseenter mouseleave', function(e) {
// save event object - http://bugs.jquery.com/ticket/12140
var event = e;
$filterRow = $(this);
clearTimeout(timer);
timer = setTimeout(function() {
if ( /enter|over/.test(event.type) ) {
$filterRow.removeClass('hideme');
} else {
// don't hide if input has focus
// $(':focus') needs jQuery 1.6+
if ( $(document.activeElement).closest('tr')[0] !== $filterRow[0] ) {
// don't hide row if any filter has a value
if (c.lastCombinedFilter === '') {
$filterRow.addClass('hideme');
}
}
}
}, 200);
})
.find('input, select').bind('focus blur', function(e) {
$filterRow2 = $(this).closest('tr');
clearTimeout(timer);
var event = e;
timer = setTimeout(function() {
// don't hide row if any filter has a value
if (ts.getFilters(c.$table).join('') === '') {
$filterRow2[ event.type === 'focus' ? 'removeClass' : 'addClass']('hideme');
}
}, 200);
});
},
defaultFilter: function(filter, mask){
if (filter === '') { return filter; }
var regex = ts.filter.regex.iQuery,
maskLen = mask.match( ts.filter.regex.igQuery ).length,
query = maskLen > 1 ? $.trim(filter).split(/\s/) : [ $.trim(filter) ],
len = query.length - 1,
indx = 0,
val = mask;
if ( len < 1 && maskLen > 1 ) {
// only one "word" in query but mask has >1 slots
query[1] = query[0];
}
// replace all {query} with query words...
// if query = "Bob", then convert mask from "!{query}" to "!Bob"
// if query = "Bob Joe Frank", then convert mask "{q} OR {q}" to "Bob OR Joe OR Frank"
while (regex.test(val)) {
val = val.replace(regex, query[indx++] || '');
if (regex.test(val) && indx < len && (query[indx] || '') !== '') {
val = mask.replace(regex, val);
}
}
return val;
},
getLatestSearch: function( $input ) {
return $input.sort(function(a, b) {
return $(b).attr('data-lastSearchTime') - $(a).attr('data-lastSearchTime');
});
},
multipleColumns: function( c, $input ) {
// look for multiple columns "1-3,4-6,8" in data-column
var ranges, singles, indx,
wo = c.widgetOptions,
// only target "all" column inputs on initialization
// & don't target "all" column inputs if they don't exist
targets = wo.filter_initialized || !$input.filter(wo.filter_anyColumnSelector).length,
columns = [],
val = $.trim( ts.filter.getLatestSearch( $input ).attr('data-column') );
// process column range
if ( targets && /-/.test( val ) ) {
ranges = val.match( /(\d+)\s*-\s*(\d+)/g );
$.each(ranges, function(i,v){
var t,
range = v.split( /\s*-\s*/ ),
start = parseInt( range[0], 10 ) || 0,
end = parseInt( range[1], 10 ) || ( c.columns - 1 );
if ( start > end ) { t = start; start = end; end = t; } // swap
if ( end >= c.columns ) { end = c.columns - 1; }
for ( ; start <= end; start++ ) {
columns.push(start);
}
// remove processed range from val
val = val.replace( v, '' );
});
}
// process single columns
if ( targets && /,/.test( val ) ) {
singles = val.split( /\s*,\s*/ );
$.each( singles, function(i,v) {
if (v !== '') {
indx = parseInt( v, 10 );
if ( indx < c.columns ) {
columns.push( indx );
}
}
});
}
// return all columns
if (!columns.length) {
for ( indx = 0; indx < c.columns; indx++ ) {
columns.push( indx );
}
}
return columns;
},
findRows: function(table, filters, combinedFilters) {
if (table.config.lastCombinedFilter === combinedFilters || !table.config.widgetOptions.filter_initialized) { return; }
var len, $rows, rowIndex, tbodyIndex, $tbody, $cells, $cell, columnIndex,
childRow, lastSearch, hasSelect, matches, result, showRow, time, val, indx,
notFiltered, searchFiltered, filterMatched, excludeMatch, fxn, ffxn,
regex = ts.filter.regex,
c = table.config,
wo = c.widgetOptions,
$tbodies = c.$table.children('tbody'), // target all tbodies #568
// data object passed to filters; anyMatch is a flag for the filters
data = { anyMatch: false },
// anyMatch really screws up with these types of filters
noAnyMatch = [ 'range', 'notMatch', 'operators' ];
// parse columns after formatter, in case the class is added at that point
data.parsed = c.$headers.map(function(columnIndex) {
return c.parsers && c.parsers[columnIndex] && c.parsers[columnIndex].parsed ||
// getData won't return "parsed" if other "filter-" class names exist (e.g. <th class="filter-select filter-parsed">)
ts.getData && ts.getData(c.$headers.filter('[data-column="' + columnIndex + '"]:last'), ts.getColumnData( table, c.headers, columnIndex ), 'filter') === 'parsed' ||
$(this).hasClass('filter-parsed');
}).get();
if (c.debug) {
ts.log('Starting filter widget search', filters);
time = new Date();
}
// filtered rows count
c.filteredRows = 0;
c.totalRows = 0;
// combindedFilters are undefined on init
combinedFilters = (filters || []).join('');
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
if ($tbodies.eq(tbodyIndex).hasClass(c.cssInfoBlock || ts.css.info)) { continue; } // ignore info blocks, issue #264
$tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true);
// skip child rows & widget added (removable) rows - fixes #448 thanks to @hempel!
// $rows = $tbody.children('tr').not(c.selectorRemove);
columnIndex = c.columns;
// convert stored rows into a jQuery object
$rows = $( $.map(c.cache[tbodyIndex].normalized, function(el){ return el[columnIndex].$row.get(); }) );
if (combinedFilters === '' || wo.filter_serversideFiltering) {
$rows.removeClass(wo.filter_filteredRow).not('.' + c.cssChildRow).show();
} else {
// filter out child rows
$rows = $rows.not('.' + c.cssChildRow);
len = $rows.length;
// optimize searching only through already filtered rows - see #313
searchFiltered = wo.filter_searchFiltered;
lastSearch = c.lastSearch || c.$table.data('lastSearch') || [];
if (searchFiltered) {
// cycle through all filters; include last (columnIndex + 1 = match any column). Fixes #669
for (indx = 0; indx < columnIndex + 1; indx++) {
val = filters[indx] || '';
// break out of loop if we've already determined not to search filtered rows
if (!searchFiltered) { indx = columnIndex; }
// search already filtered rows if...
searchFiltered = searchFiltered && lastSearch.length &&
// there are no changes from beginning of filter
val.indexOf(lastSearch[indx] || '') === 0 &&
// if there is NOT a logical "or", or range ("to" or "-") in the string
!regex.alreadyFiltered.test(val) &&
// if we are not doing exact matches, using "|" (logical or) or not "!"
!/[=\"\|!]/.test(val) &&
// don't search only filtered if the value is negative ('> -10' => '> -100' will ignore hidden rows)
!(/(>=?\s*-\d)/.test(val) || /(<=?\s*\d)/.test(val)) &&
// if filtering using a select without a "filter-match" class (exact match) - fixes #593
!( val !== '' && c.$filters && c.$filters.eq(indx).find('select').length && !c.$headers.filter('[data-column="' + indx + '"]:last').hasClass('filter-match') );
}
}
notFiltered = $rows.not('.' + wo.filter_filteredRow).length;
// can't search when all rows are hidden - this happens when looking for exact matches
if (searchFiltered && notFiltered === 0) { searchFiltered = false; }
if (c.debug) {
ts.log( "Searching through " + ( searchFiltered && notFiltered < len ? notFiltered : "all" ) + " rows" );
}
if ((wo.filter_$anyMatch && wo.filter_$anyMatch.length) || filters[c.columns]) {
data.anyMatchFlag = true;
data.anyMatchFilter = wo.filter_$anyMatch && ts.filter.getLatestSearch( wo.filter_$anyMatch ).val() || filters[c.columns] || '';
if (c.sortLocaleCompare) {
// replace accents
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
}
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || '')) {
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) );
// clear search filtered flag because default filters are not saved to the last search
searchFiltered = false;
}
// make iAnyMatchFilter lowercase unless both filter widget & core ignoreCase options are true
// when c.ignoreCase is true, the cache contains all lower case data
data.iAnyMatchFilter = !(wo.filter_ignoreCase && c.ignoreCase) ? data.anyMatchFilter : data.anyMatchFilter.toLocaleLowerCase();
}
// loop through the rows
for (rowIndex = 0; rowIndex < len; rowIndex++) {
data.cacheArray = c.cache[tbodyIndex].normalized[rowIndex];
childRow = $rows[rowIndex].className;
// skip child rows & already filtered rows
if ( regex.child.test(childRow) || (searchFiltered && regex.filtered.test(childRow)) ) { continue; }
showRow = true;
// *** nextAll/nextUntil not supported by Zepto! ***
childRow = $rows.eq(rowIndex).nextUntil('tr:not(.' + c.cssChildRow + ')');
// so, if "table.config.widgetOptions.filter_childRows" is true and there is
// a match anywhere in the child row, then it will make the row visible
// checked here so the option can be changed dynamically
data.childRowText = (childRow.length && wo.filter_childRows) ? childRow.text() : '';
data.childRowText = wo.filter_ignoreCase ? data.childRowText.toLocaleLowerCase() : data.childRowText;
$cells = $rows.eq(rowIndex).children();
if (data.anyMatchFlag) {
// look for multiple columns "1-3,4-6,8"
columnIndex = ts.filter.multipleColumns( c, wo.filter_$anyMatch );
data.anyMatch = true;
data.rowArray = $cells.map(function(i){
if ( $.inArray(i, columnIndex) > -1 ) {
var txt;
if (data.parsed[i]) {
txt = data.cacheArray[i];
} else {
txt = wo.filter_ignoreCase ? $(this).text().toLowerCase() : $(this).text();
if (c.sortLocaleCompare) {
txt = ts.replaceAccents(txt);
}
}
return txt;
}
}).get();
data.filter = data.anyMatchFilter;
data.iFilter = data.iAnyMatchFilter;
data.exact = data.rowArray.join(' ');
data.iExact = wo.filter_ignoreCase ? data.exact.toLowerCase() : data.exact;
data.cache = data.cacheArray.slice(0,-1).join(' ');
filterMatched = null;
$.each(ts.filter.types, function(type, typeFunction) {
if ($.inArray(type, noAnyMatch) < 0) {
matches = typeFunction( c, data );
if (matches !== null) {
filterMatched = matches;
return false;
}
}
});
if (filterMatched !== null) {
showRow = filterMatched;
} else {
if (wo.filter_startsWith) {
showRow = false;
columnIndex = c.columns;
while (!showRow && columnIndex > 0) {
columnIndex--;
showRow = showRow || data.rowArray[columnIndex].indexOf(data.iFilter) === 0;
}
} else {
showRow = (data.iExact + data.childRowText).indexOf(data.iFilter) >= 0;
}
}
data.anyMatch = false;
}
for (columnIndex = 0; columnIndex < c.columns; columnIndex++) {
data.filter = filters[columnIndex];
data.index = columnIndex;
// filter types to exclude, per column
excludeMatch = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
// ignore if filter is empty or disabled
if (data.filter) {
data.cache = data.cacheArray[columnIndex];
// check if column data should be from the cell or from parsed data
if (wo.filter_useParsedData || data.parsed[columnIndex]) {
data.exact = data.cache;
} else {
// using older or original tablesorter
data.exact = $.trim( $cells.eq(columnIndex).text() );
data.exact = c.sortLocaleCompare ? ts.replaceAccents(data.exact) : data.exact; // issue #405
}
data.iExact = !regex.type.test(typeof data.exact) && wo.filter_ignoreCase ? data.exact.toLocaleLowerCase() : data.exact;
result = showRow; // if showRow is true, show that row
// in case select filter option has a different value vs text "a - z|A through Z"
ffxn = wo.filter_columnFilters ?
c.$filters.add(c.$externalFilters).filter('[data-column="'+ columnIndex + '"]').find('select option:selected').attr('data-function-name') || '' : '';
// replace accents - see #357
data.filter = c.sortLocaleCompare ? ts.replaceAccents(data.filter) : data.filter;
val = true;
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '')) {
data.filter = ts.filter.defaultFilter( data.filter, ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) );
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
val = false;
}
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
fxn = ts.getColumnData( table, wo.filter_functions, columnIndex );
$cell = c.$headers.filter('[data-column="' + columnIndex + '"]:last');
hasSelect = $cell.hasClass('filter-select');
if ( fxn || ( hasSelect && val ) ) {
if (fxn === true || hasSelect) {
// default selector uses exact match unless "filter-match" class is found
result = ($cell.hasClass('filter-match')) ? data.iExact.search(data.iFilter) >= 0 : data.filter === data.exact;
} else if (typeof fxn === 'function') {
// filter callback( exact cell content, parser normalized content, filter input value, column index, jQuery row object )
result = fxn(data.exact, data.cache, data.filter, columnIndex, $rows.eq(rowIndex));
} else if (typeof fxn[ffxn || data.filter] === 'function') {
// selector option function
result = fxn[ffxn || data.filter](data.exact, data.cache, data.filter, columnIndex, $rows.eq(rowIndex));
}
} else {
filterMatched = null;
// cycle through the different filters
// filters return a boolean or null if nothing matches
$.each(ts.filter.types, function(type, typeFunction) {
if ($.inArray(type, excludeMatch) < 0) {
matches = typeFunction( c, data );
if (matches !== null) {
filterMatched = matches;
return false;
}
}
});
if (filterMatched !== null) {
result = filterMatched;
// Look for match, and add child row data for matching
} else {
data.exact = (data.iExact + data.childRowText).indexOf( ts.filter.parseFilter(c, data.iFilter, columnIndex, data.parsed[columnIndex]) );
result = ( (!wo.filter_startsWith && data.exact >= 0) || (wo.filter_startsWith && data.exact === 0) );
}
}
showRow = (result) ? showRow : false;
}
}
$rows.eq(rowIndex)
.toggle(showRow)
.toggleClass(wo.filter_filteredRow, !showRow);
if (childRow.length) {
childRow.toggleClass(wo.filter_filteredRow, !showRow);
}
}
}
c.filteredRows += $rows.not('.' + wo.filter_filteredRow).length;
c.totalRows += $rows.length;
ts.processTbody(table, $tbody, false);
}
c.lastCombinedFilter = combinedFilters; // save last search
c.lastSearch = filters;
c.$table.data('lastSearch', filters);
if (wo.filter_saveFilters && ts.storage) {
ts.storage( table, 'tablesorter-filters', filters );
}
if (c.debug) {
ts.benchmark("Completed filter widget search", time);
}
if (wo.filter_initialized) { c.$table.trigger('filterEnd', c ); }
setTimeout(function(){
c.$table.trigger('applyWidgets'); // make sure zebra widget is applied
}, 0);
},
getOptionSource: function(table, column, onlyAvail) {
var cts,
c = table.config,
wo = c.widgetOptions,
parsed = [],
arry = false,
source = wo.filter_selectSource,
last = c.$table.data('lastSearch') || [],
fxn = $.isFunction(source) ? true : ts.getColumnData( table, source, column );
if (onlyAvail && last[column] !== '') {
onlyAvail = false;
}
// filter select source option
if (fxn === true) {
// OVERALL source
arry = source(table, column, onlyAvail);
} else if ( fxn instanceof $ || ($.type(fxn) === 'string' && fxn.indexOf('</option>') >= 0) ) {
// selectSource is a jQuery object or string of options
return fxn;
} else if ($.isArray(fxn)) {
arry = fxn;
} else if ($.type(source) === 'object' && fxn) {
// custom select source function for a SPECIFIC COLUMN
arry = fxn(table, column, onlyAvail);
}
if (arry === false) {
// fall back to original method
arry = ts.filter.getOptions(table, column, onlyAvail);
}
// get unique elements and sort the list
// if $.tablesorter.sortText exists (not in the original tablesorter),
// then natural sort the list otherwise use a basic sort
arry = $.grep(arry, function(value, indx) {
return $.inArray(value, arry) === indx;
});
if (c.$headers.filter('[data-column="' + column + '"]:last').hasClass('filter-select-nosort')) {
// unsorted select options
return arry;
} else {
// parse select option values
$.each(arry, function(i, v){
// parse array data using set column parser; this DOES NOT pass the original
// table cell to the parser format function
parsed.push({ t : v, p : c.parsers && c.parsers[column].format( v, table, [], column ) });
});
// sort parsed select options
cts = c.textSorter || '';
parsed.sort(function(a, b){
// sortNatural breaks if you don't pass it strings
var x = a.p.toString(), y = b.p.toString();
if ($.isFunction(cts)) {
// custom OVERALL text sorter
return cts(x, y, true, column, table);
} else if (typeof(cts) === 'object' && cts.hasOwnProperty(column)) {
// custom text sorter for a SPECIFIC COLUMN
return cts[column](x, y, true, column, table);
} else if (ts.sortNatural) {
// fall back to natural sort
return ts.sortNatural(x, y);
}
// using an older version! do a basic sort
return true;
});
// rebuild arry from sorted parsed data
arry = [];
$.each(parsed, function(i, v){
arry.push(v.t);
});
return arry;
}
},
getOptions: function(table, column, onlyAvail) {
var rowIndex, tbodyIndex, len, row, cache, cell,
c = table.config,
wo = c.widgetOptions,
$tbodies = c.$table.children('tbody'),
arry = [];
for (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
if (!$tbodies.eq(tbodyIndex).hasClass(c.cssInfoBlock)) {
cache = c.cache[tbodyIndex];
len = c.cache[tbodyIndex].normalized.length;
// loop through the rows
for (rowIndex = 0; rowIndex < len; rowIndex++) {
// get cached row from cache.row (old) or row data object (new; last item in normalized array)
row = cache.row ? cache.row[rowIndex] : cache.normalized[rowIndex][c.columns].$row[0];
// check if has class filtered
if (onlyAvail && row.className.match(wo.filter_filteredRow)) { continue; }
// get non-normalized cell content
if (wo.filter_useParsedData || c.parsers[column].parsed || c.$headers.filter('[data-column="' + column + '"]:last').hasClass('filter-parsed')) {
arry.push( '' + cache.normalized[rowIndex][column] );
} else {
cell = row.cells[column];
if (cell) {
arry.push( $.trim( cell.textContent || cell.innerText || $(cell).text() ) );
}
}
}
}
}
return arry;
},
buildSelect: function(table, column, arry, updating, onlyAvail) {
table = $(table)[0];
column = parseInt(column, 10);
if (!table.config.cache || $.isEmptyObject(table.config.cache)) { return; }
var indx, val, txt, t, $filters, $filter,
c = table.config,
wo = c.widgetOptions,
node = c.$headers.filter('[data-column="' + column + '"]:last'),
// t.data('placeholder') won't work in jQuery older than 1.4.3
options = '<option value="">' + ( node.data('placeholder') || node.attr('data-placeholder') || wo.filter_placeholder.select || '' ) + '</option>',
// Get curent filter value
currentValue = c.$table.find('thead').find('select.' + ts.css.filter + '[data-column="' + column + '"]').val();
// nothing included in arry (external source), so get the options from filter_selectSource or column data
if (typeof arry === 'undefined' || arry === '') {
arry = ts.filter.getOptionSource(table, column, onlyAvail);
}
if ($.isArray(arry)) {
// build option list
for (indx = 0; indx < arry.length; indx++) {
txt = arry[indx] = ('' + arry[indx]).replace(/\"/g, """);
val = txt;
// allow including a symbol in the selectSource array
// "a-z|A through Z" so that "a-z" becomes the option value
// and "A through Z" becomes the option text
if (txt.indexOf(wo.filter_selectSourceSeparator) >= 0) {
t = txt.split(wo.filter_selectSourceSeparator);
val = t[0];
txt = t[1];
}
// replace quotes - fixes #242 & ignore empty strings - see http://stackoverflow.com/q/14990971/145346
options += arry[indx] !== '' ? '<option ' + (val === txt ? '' : 'data-function-name="' + arry[indx] + '" ') + 'value="' + val + '">' + txt + '</option>' : '';
}
// clear arry so it doesn't get appended twice
arry = [];
}
// update all selects in the same column (clone thead in sticky headers & any external selects) - fixes 473
$filters = ( c.$filters ? c.$filters : c.$table.children('thead') ).find('.' + ts.css.filter);
if (wo.filter_$externalFilters) {
$filters = $filters && $filters.length ? $filters.add(wo.filter_$externalFilters) : wo.filter_$externalFilters;
}
$filter = $filters.filter('select[data-column="' + column + '"]');
// make sure there is a select there!
if ($filter.length) {
$filter[ updating ? 'html' : 'append' ](options);
if (!$.isArray(arry)) {
// append options if arry is provided externally as a string or jQuery object
// options (default value) was already added
$filter.append(arry).val(currentValue);
}
$filter.val(currentValue);
}
},
buildDefault: function(table, updating) {
var columnIndex, $header, noSelect,
c = table.config,
wo = c.widgetOptions,
columns = c.columns;
// build default select dropdown
for (columnIndex = 0; columnIndex < columns; columnIndex++) {
$header = c.$headers.filter('[data-column="' + columnIndex + '"]:last');
noSelect = !($header.hasClass('filter-false') || $header.hasClass('parser-false'));
// look for the filter-select class; build/update it if found
if (($header.hasClass('filter-select') || ts.getColumnData( table, wo.filter_functions, columnIndex ) === true) && noSelect) {
ts.filter.buildSelect(table, columnIndex, '', updating, $header.hasClass(wo.filter_onlyAvail));
}
}
}
};
ts.getFilters = function(table, getRaw, setFilters, skipFirst) {
var i, $filters, $column, cols,
filters = false,
c = table ? $(table)[0].config : '',
wo = c ? c.widgetOptions : '';
if (getRaw !== true && wo && !wo.filter_columnFilters) {
return $(table).data('lastSearch');
}
if (c) {
if (c.$filters) {
$filters = c.$filters.find('.' + ts.css.filter);
}
if (wo.filter_$externalFilters) {
$filters = $filters && $filters.length ? $filters.add(wo.filter_$externalFilters) : wo.filter_$externalFilters;
}
if ($filters && $filters.length) {
filters = setFilters || [];
for (i = 0; i < c.columns + 1; i++) {
cols = ( i === c.columns ?
// "all" columns can now include a range or set of columms (data-column="0-2,4,6-7")
wo.filter_anyColumnSelector + ',' + wo.filter_multipleColumnSelector :
'[data-column="' + i + '"]' );
$column = $filters.filter(cols);
if ($column.length) {
// move the latest search to the first slot in the array
$column = ts.filter.getLatestSearch( $column );
if ($.isArray(setFilters)) {
// skip first (latest input) to maintain cursor position while typing
if (skipFirst) { $column.slice(1); }
if (i === c.columns) {
// prevent data-column="all" from filling data-column="0,1" (etc)
cols = $column.filter(wo.filter_anyColumnSelector);
$column = cols.length ? cols : $column;
}
$column
.val( setFilters[i] )
.trigger('change.tsfilter');
} else {
filters[i] = $column.val() || '';
// don't change the first... it will move the cursor
if (i === c.columns) {
// don't update range columns from "all" setting
$column.slice(1).filter('[data-column*="' + $column.attr('data-column') + '"]').val( filters[i] );
} else {
$column.slice(1).val( filters[i] );
}
}
// save any match input dynamically
if (i === c.columns && $column.length) {
wo.filter_$anyMatch = $column;
}
}
}
}
}
if (filters.length === 0) {
filters = false;
}
return filters;
};
ts.setFilters = function(table, filter, apply, skipFirst) {
var c = table ? $(table)[0].config : '',
valid = ts.getFilters(table, true, filter, skipFirst);
if (c && apply) {
// ensure new set filters are applied, even if the search is the same
c.lastCombinedFilter = null;
c.lastSearch = [];
ts.filter.searching(c.$table[0], filter, skipFirst);
c.$table.trigger('filterFomatterUpdate');
}
return !!valid;
};
// Widget: Sticky headers
// based on this awesome article:
// http://css-tricks.com/13465-persistent-headers/
// and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
// **************************
ts.addWidget({
id: "stickyHeaders",
priority: 60, // sticky widget must be initialized after the filter widget!
options: {
stickyHeaders : '', // extra class name added to the sticky header row
stickyHeaders_attachTo : null, // jQuery selector or object to attach sticky header to
stickyHeaders_xScroll : null, // jQuery selector or object to monitor horizontal scroll position (defaults: xScroll > attachTo > window)
stickyHeaders_yScroll : null, // jQuery selector or object to monitor vertical scroll position (defaults: yScroll > attachTo > window)
stickyHeaders_offset : 0, // number or jquery selector targeting the position:fixed element
stickyHeaders_filteredToTop: true, // scroll table top into view after filtering
stickyHeaders_cloneId : '-sticky', // added to table ID, if it exists
stickyHeaders_addResizeEvent : true, // trigger "resize" event on headers
stickyHeaders_includeCaption : true, // if false and a caption exist, it won't be included in the sticky header
stickyHeaders_zIndex : 2 // The zIndex of the stickyHeaders, allows the user to adjust this to their needs
},
format: function(table, c, wo) {
// filter widget doesn't initialize on an empty table. Fixes #449
if ( c.$table.hasClass('hasStickyHeaders') || ($.inArray('filter', c.widgets) >= 0 && !c.$table.hasClass('hasFilters')) ) {
return;
}
var $table = c.$table,
$attach = $(wo.stickyHeaders_attachTo),
namespace = c.namespace + 'stickyheaders ',
// element to watch for the scroll event
$yScroll = $(wo.stickyHeaders_yScroll || wo.stickyHeaders_attachTo || window),
$xScroll = $(wo.stickyHeaders_xScroll || wo.stickyHeaders_attachTo || window),
$thead = $table.children('thead:first'),
$header = $thead.children('tr').not('.sticky-false').children(),
$tfoot = $table.children('tfoot'),
$stickyOffset = isNaN(wo.stickyHeaders_offset) ? $(wo.stickyHeaders_offset) : '',
stickyOffset = $attach.length ? 0 : $stickyOffset.length ?
$stickyOffset.height() || 0 : parseInt(wo.stickyHeaders_offset, 10) || 0,
// is this table nested? If so, find parent sticky header wrapper (div, not table)
$nestedSticky = $table.parent().closest('.' + ts.css.table).hasClass('hasStickyHeaders') ?
$table.parent().closest('table.tablesorter')[0].config.widgetOptions.$sticky.parent() : [],
nestedStickyTop = $nestedSticky.length ? $nestedSticky.height() : 0,
// clone table, then wrap to make sticky header
$stickyTable = wo.$sticky = $table.clone()
.addClass('containsStickyHeaders ' + ts.css.sticky + ' ' + wo.stickyHeaders)
.wrap('<div class="' + ts.css.stickyWrap + '">'),
$stickyWrap = $stickyTable.parent().css({
position : $attach.length ? 'absolute' : 'fixed',
padding : parseInt( $stickyTable.parent().parent().css('padding-left'), 10 ),
top : stickyOffset + nestedStickyTop,
left : 0,
visibility : 'hidden',
zIndex : wo.stickyHeaders_zIndex || 2
}),
$stickyThead = $stickyTable.children('thead:first'),
$stickyCells,
laststate = '',
spacing = 0,
setWidth = function($orig, $clone){
$orig.filter(':visible').each(function(i) {
var width, border,
$cell = $clone.filter(':visible').eq(i),
$this = $(this);
// code from https://github.com/jmosbech/StickyTableHeaders
if ($this.css('box-sizing') === 'border-box') {
width = $this.outerWidth();
} else {
if ($cell.css('border-collapse') === 'collapse') {
if (window.getComputedStyle) {
width = parseFloat( window.getComputedStyle(this, null).width );
} else {
// ie8 only
border = parseFloat( $this.css('border-width') );
width = $this.outerWidth() - parseFloat( $this.css('padding-left') ) - parseFloat( $this.css('padding-right') ) - border;
}
} else {
width = $this.width();
}
}
$cell.css({
'min-width': width,
'max-width': width
});
});
},
resizeHeader = function() {
stickyOffset = $stickyOffset.length ? $stickyOffset.height() || 0 : parseInt(wo.stickyHeaders_offset, 10) || 0;
spacing = 0;
$stickyWrap.css({
left : $attach.length ? parseInt($attach.css('padding-left'), 10) || 0 :
$table.offset().left - parseInt($table.css('margin-left'), 10) - $xScroll.scrollLeft() - spacing,
width: $table.outerWidth()
});
setWidth( $table, $stickyTable );
setWidth( $header, $stickyCells );
};
// fix clone ID, if it exists - fixes #271
if ($stickyTable.attr('id')) { $stickyTable[0].id += wo.stickyHeaders_cloneId; }
// clear out cloned table, except for sticky header
// include caption & filter row (fixes #126 & #249) - don't remove cells to get correct cell indexing
$stickyTable.find('thead:gt(0), tr.sticky-false').hide();
$stickyTable.find('tbody, tfoot').remove();
$stickyTable.find('caption').toggle(wo.stickyHeaders_includeCaption);
// issue #172 - find td/th in sticky header
$stickyCells = $stickyThead.children().children();
$stickyTable.css({ height:0, width:0, margin: 0 });
// remove resizable block
$stickyCells.find('.' + ts.css.resizer).remove();
// update sticky header class names to match real header after sorting
$table
.addClass('hasStickyHeaders')
.bind('pagerComplete' + namespace, function() {
resizeHeader();
});
ts.bindEvents(table, $stickyThead.children().children('.tablesorter-header'));
// add stickyheaders AFTER the table. If the table is selected by ID, the original one (first) will be returned.
$table.after( $stickyWrap );
// onRenderHeader is defined, we need to do something about it (fixes #641)
if (c.onRenderHeader) {
$stickyThead.children('tr').children().each(function(index){
// send second parameter
c.onRenderHeader.apply( $(this), [ index, c, $stickyTable ] );
});
}
// make it sticky!
$xScroll.add($yScroll)
.unbind('scroll resize '.split(' ').join( namespace ) )
.bind('scroll resize '.split(' ').join( namespace ), function(event) {
if (!$table.is(':visible')) { return; } // fixes #278
// Detect nested tables - fixes #724
nestedStickyTop = $nestedSticky.length ? $nestedSticky.offset().top - $yScroll.scrollTop() + $nestedSticky.height() : 0;
var prefix = 'tablesorter-sticky-',
offset = $table.offset(),
yWindow = $.isWindow( $yScroll[0] ), // $.isWindow needs jQuery 1.4.3
xWindow = $.isWindow( $xScroll[0] ),
// scrollTop = ( $attach.length ? $attach.offset().top : $yScroll.scrollTop() ) + stickyOffset + nestedStickyTop,
scrollTop = ( $attach.length ? ( yWindow ? $yScroll.scrollTop() : $yScroll.offset().top ) : $yScroll.scrollTop() ) + stickyOffset + nestedStickyTop,
tableHeight = $table.height() - ($stickyWrap.height() + ($tfoot.height() || 0)),
isVisible = ( scrollTop > offset.top ) && ( scrollTop < offset.top + tableHeight ) ? 'visible' : 'hidden',
cssSettings = { visibility : isVisible };
if ($attach.length) {
cssSettings.top = yWindow ? scrollTop : $attach.scrollTop();
}
if (xWindow) {
// adjust when scrolling horizontally - fixes issue #143
cssSettings.left = $table.offset().left - parseInt($table.css('margin-left'), 10) - $xScroll.scrollLeft() - spacing;
}
if ($nestedSticky.length) {
cssSettings.top = ( cssSettings.top || 0 ) + stickyOffset + nestedStickyTop;
}
$stickyWrap
.removeClass(prefix + 'visible ' + prefix + 'hidden')
.addClass(prefix + isVisible)
.css(cssSettings);
if (isVisible !== laststate || event.type === 'resize') {
// make sure the column widths match
resizeHeader();
laststate = isVisible;
}
});
if (wo.stickyHeaders_addResizeEvent) {
ts.addHeaderResizeEvent(table);
}
// look for filter widget
if ($table.hasClass('hasFilters') && wo.filter_columnFilters) {
// scroll table into view after filtering, if sticky header is active - #482
$table.bind('filterEnd' + namespace, function() {
// $(':focus') needs jQuery 1.6+
var $td = $(document.activeElement).closest('td'),
column = $td.parent().children().index($td);
// only scroll if sticky header is active
if ($stickyWrap.hasClass(ts.css.stickyVis) && wo.stickyHeaders_filteredToTop) {
// scroll to original table (not sticky clone)
window.scrollTo(0, $table.position().top);
// give same input/select focus; check if c.$filters exists; fixes #594
if (column >= 0 && c.$filters) {
c.$filters.eq(column).find('a, select, input').filter(':visible').focus();
}
}
});
ts.filter.bindSearch( $table, $stickyCells.find('.' + ts.css.filter) );
// support hideFilters
if (wo.filter_hideFilters) {
ts.filter.hideFilters($stickyTable, c);
}
}
$table.trigger('stickyHeadersInit');
},
remove: function(table, c, wo) {
var namespace = c.namespace + 'stickyheaders ';
c.$table
.removeClass('hasStickyHeaders')
.unbind( 'pagerComplete filterEnd '.split(' ').join(namespace) )
.next('.' + ts.css.stickyWrap).remove();
if (wo.$sticky && wo.$sticky.length) { wo.$sticky.remove(); } // remove cloned table
// don't unbind if any table on the page still has stickyheaders applied
if (!$('.hasStickyHeaders').length) {
$(window).add(wo.stickyHeaders_xScroll).add(wo.stickyHeaders_yScroll).add(wo.stickyHeaders_attachTo)
.unbind( 'scroll resize '.split(' ').join(namespace) );
}
ts.addHeaderResizeEvent(table, false);
}
});
// Add Column resizing widget
// this widget saves the column widths if
// $.tablesorter.storage function is included
// **************************
ts.addWidget({
id: "resizable",
priority: 40,
options: {
resizable : true,
resizable_addLastColumn : false,
resizable_widths : [],
resizable_throttle : false // set to true (5ms) or any number 0-10 range
},
format: function(table, c, wo) {
if (c.$table.hasClass('hasResizable')) { return; }
c.$table.addClass('hasResizable');
ts.resizableReset(table, true); // set default widths
var $rows, $columns, $column, column, timer,
storedSizes = {},
$table = c.$table,
$wrap = $table.parent(),
overflow = $table.parent().css('overflow') === 'auto',
mouseXPosition = 0,
$target = null,
$next = null,
fullWidth = Math.abs($table.parent().width() - $table.width()) < 20,
mouseMove = function(event){
if (mouseXPosition === 0 || !$target) { return; }
// resize columns
var leftEdge = event.pageX - mouseXPosition,
targetWidth = $target.width();
$target.width( targetWidth + leftEdge );
if ($target.width() !== targetWidth && fullWidth) {
$next.width( $next.width() - leftEdge );
} else if (overflow) {
$table.width(function(i, w){
return w + leftEdge;
});
if (!$next.length) {
// if expanding right-most column, scroll the wrapper
$wrap[0].scrollLeft = $table.width();
}
}
mouseXPosition = event.pageX;
},
stopResize = function() {
if (ts.storage && $target && $next) {
storedSizes = {};
storedSizes[$target.index()] = $target.width();
storedSizes[$next.index()] = $next.width();
$target.width( storedSizes[$target.index()] );
$next.width( storedSizes[$next.index()] );
if (wo.resizable !== false) {
// save all column widths
ts.storage(table, 'tablesorter-resizable', c.$headers.map(function(){ return $(this).width(); }).get() );
}
}
mouseXPosition = 0;
$target = $next = null;
$(window).trigger('resize'); // will update stickyHeaders, just in case
};
storedSizes = (ts.storage && wo.resizable !== false) ? ts.storage(table, 'tablesorter-resizable') : {};
// process only if table ID or url match
if (storedSizes) {
for (column in storedSizes) {
if (!isNaN(column) && column < c.$headers.length) {
c.$headers.eq(column).width(storedSizes[column]); // set saved resizable widths
}
}
}
$rows = $table.children('thead:first').children('tr');
// add resizable-false class name to headers (across rows as needed)
$rows.children().each(function() {
var canResize,
$column = $(this);
column = $column.attr('data-column');
canResize = ts.getData( $column, ts.getColumnData( table, c.headers, column ), 'resizable') === "false";
$rows.children().filter('[data-column="' + column + '"]')[canResize ? 'addClass' : 'removeClass']('resizable-false');
});
// add wrapper inside each cell to allow for positioning of the resizable target block
$rows.each(function() {
$column = $(this).children().not('.resizable-false');
if (!$(this).find('.' + ts.css.wrapper).length) {
// Firefox needs this inner div to position the resizer correctly
$column.wrapInner('<div class="' + ts.css.wrapper + '" style="position:relative;height:100%;width:100%"></div>');
}
// don't include the last column of the row
if (!wo.resizable_addLastColumn) { $column = $column.slice(0,-1); }
$columns = $columns ? $columns.add($column) : $column;
});
$columns
.each(function() {
var $column = $(this),
padding = parseInt($column.css('padding-right'), 10) + 10; // 10 is 1/2 of the 20px wide resizer
$column
.find('.' + ts.css.wrapper)
.append('<div class="' + ts.css.resizer + '" style="cursor:w-resize;position:absolute;z-index:1;right:-' +
padding + 'px;top:0;height:100%;width:20px;"></div>');
})
.find('.' + ts.css.resizer)
.bind('mousedown', function(event) {
// save header cell and mouse position
$target = $(event.target).closest('th');
var $header = c.$headers.filter('[data-column="' + $target.attr('data-column') + '"]');
if ($header.length > 1) { $target = $target.add($header); }
// if table is not as wide as it's parent, then resize the table
$next = event.shiftKey ? $target.parent().find('th').not('.resizable-false').filter(':last') : $target.nextAll(':not(.resizable-false)').eq(0);
mouseXPosition = event.pageX;
});
$(document)
.bind('mousemove.tsresize', function(event) {
// ignore mousemove if no mousedown
if (mouseXPosition === 0 || !$target) { return; }
if (wo.resizable_throttle) {
clearTimeout(timer);
timer = setTimeout(function(){
mouseMove(event);
}, isNaN(wo.resizable_throttle) ? 5 : wo.resizable_throttle );
} else {
mouseMove(event);
}
})
.bind('mouseup.tsresize', function() {
stopResize();
});
// right click to reset columns to default widths
$table.find('thead:first').bind('contextmenu.tsresize', function() {
ts.resizableReset(table);
// $.isEmptyObject() needs jQuery 1.4+; allow right click if already reset
var allowClick = $.isEmptyObject ? $.isEmptyObject(storedSizes) : true;
storedSizes = {};
return allowClick;
});
},
remove: function(table, c) {
c.$table
.removeClass('hasResizable')
.children('thead')
.unbind('mouseup.tsresize mouseleave.tsresize contextmenu.tsresize')
.children('tr').children()
.unbind('mousemove.tsresize mouseup.tsresize')
// don't remove "tablesorter-wrapper" as uitheme uses it too
.find('.' + ts.css.resizer).remove();
ts.resizableReset(table);
}
});
ts.resizableReset = function(table, nosave) {
$(table).each(function(){
var $t,
c = this.config,
wo = c && c.widgetOptions;
if (table && c) {
c.$headers.each(function(i){
$t = $(this);
if (wo.resizable_widths[i]) {
$t.css('width', wo.resizable_widths[i]);
} else if (!$t.hasClass('resizable-false')) {
// don't clear the width of any column that is not resizable
$t.css('width','');
}
});
if (ts.storage && !nosave) { ts.storage(this, 'tablesorter-resizable', {}); }
}
});
};
// Save table sort widget
// this widget saves the last sort only if the
// saveSort widget option is true AND the
// $.tablesorter.storage function is included
// **************************
ts.addWidget({
id: 'saveSort',
priority: 20,
options: {
saveSort : true
},
init: function(table, thisWidget, c, wo) {
// run widget format before all other widgets are applied to the table
thisWidget.format(table, c, wo, true);
},
format: function(table, c, wo, init) {
var stored, time,
$table = c.$table,
saveSort = wo.saveSort !== false, // make saveSort active/inactive; default to true
sortList = { "sortList" : c.sortList };
if (c.debug) {
time = new Date();
}
if ($table.hasClass('hasSaveSort')) {
if (saveSort && table.hasInitialized && ts.storage) {
ts.storage( table, 'tablesorter-savesort', sortList );
if (c.debug) {
ts.benchmark('saveSort widget: Saving last sort: ' + c.sortList, time);
}
}
} else {
// set table sort on initial run of the widget
$table.addClass('hasSaveSort');
sortList = '';
// get data
if (ts.storage) {
stored = ts.storage( table, 'tablesorter-savesort' );
sortList = (stored && stored.hasOwnProperty('sortList') && $.isArray(stored.sortList)) ? stored.sortList : '';
if (c.debug) {
ts.benchmark('saveSort: Last sort loaded: "' + sortList + '"', time);
}
$table.bind('saveSortReset', function(event) {
event.stopPropagation();
ts.storage( table, 'tablesorter-savesort', '' );
});
}
// init is true when widget init is run, this will run this widget before all other widgets have initialized
// this method allows using this widget in the original tablesorter plugin; but then it will run all widgets twice.
if (init && sortList && sortList.length > 0) {
c.sortList = sortList;
} else if (table.hasInitialized && sortList && sortList.length > 0) {
// update sort change
$table.trigger('sorton', [sortList]);
}
}
},
remove: function(table) {
// clear storage
if (ts.storage) { ts.storage( table, 'tablesorter-savesort', '' ); }
}
});
})(jQuery, window);
| wdbo/webdocbook | www/webdocbook_assets/vendor/jquery.tablesorter/js/jquery.tablesorter.widgets.js | JavaScript | gpl-3.0 | 85,926 | [
30522,
1013,
1008,
999,
7251,
11589,
2121,
1006,
9292,
1007,
1016,
1012,
2385,
1009,
15536,
28682,
1011,
7172,
2260,
1013,
2570,
1013,
2297,
1006,
1058,
2475,
1012,
2324,
1012,
1018,
1007,
1008,
1008,
5930,
6782,
1008,
5930,
17736,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Detail\FileConversion\Client\Exception;
class ServerException extends OperationException
{
}
| ivan-wolf/dfw-fileconversion | src/Detail/FileConversion/Client/Exception/ServerException.php | PHP | mit | 111 | [
30522,
1026,
1029,
25718,
3415,
15327,
6987,
1032,
5371,
8663,
27774,
1032,
7396,
1032,
6453,
1025,
2465,
8241,
10288,
24422,
8908,
3169,
10288,
24422,
1063,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
extract:
${tooldir}/ecore2bgf BIBTEXML.ecore grammar.bgf
include ../../Makefile.grammar
| grammarware/slps | topics/grammars/bibtex/bibtex-1.2/Makefile | Makefile | bsd-3-clause | 90 | [
30522,
14817,
1024,
1002,
1063,
6994,
4305,
2099,
1065,
1013,
17338,
2890,
2475,
2497,
25708,
12170,
19279,
10288,
19968,
1012,
17338,
2890,
8035,
1012,
1038,
25708,
2421,
1012,
1012,
1013,
1012,
1012,
1013,
2191,
8873,
2571,
1012,
8035,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace UMRA\Bundle\MemberBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* Trans
*
* @ORM\Table(name="trans")
* @ORM\Entity(repositoryClass="UMRA\Bundle\MemberBundle\Entity\TransRepository")
*/
class Trans
{
/**
* @var \DateTime
*
* @ORM\Column(name="Trandate", type="date", nullable=false)
*/
private $trandate;
/**
* @var string
*
* @Assert\Choice(choices = {"MEMBERSHIP_NEW", "MEMBERSHIP_RENEW", "LUNCHEON_FEE", "PARKING_PASS", "OTHER"}, message = "Must be 'new membership', 'membership renewal', 'luncheon fee', 'parking pass' and 'other'.")
* @ORM\Column(name="Trantype", type="string", length=20, nullable=false)
*/
private $trantype;
/**
* @var string
*
* @ORM\Column(name="Amount", type="decimal", precision=10, scale=2, nullable=false)
*/
private $amount;
/**
* @var string
*
* @Assert\Choice(choices = {"CREDIT_CARD", "CHECK", "OTHER"}, message = "Must be credit card, check, or other.")
* @ORM\Column(name="Pmtmethod", type="string", length=20, nullable=false)
*/
private $pmtmethod;
/**
* @var string
*
* @ORM\Column(name="Servicechg", type="decimal", precision=10, scale=2, nullable=true)
*/
private $servicechg;
/**
* @var Person
*
* @ORM\ManyToOne(targetEntity="UMRA\Bundle\MemberBundle\Entity\Person")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="doneby_id", referencedColumnName="id")
* })
*/
private $doneby;
/**
* @var string
*
* @ORM\Column(name="Notes", type="string", length=255, nullable=true)
*/
private $notes;
/**
* @var string
*
* @Assert\Choice(choices = {"AWAITING_PROCESS", "PROCESSING", "PROCESSED"}, message = "Must be awaiting process, processing, or processed.")
* @ORM\Column(name="status", type="string", length=255, nullable=true)
*/
private $status;
/**
* @var \DateTime
*
* @ORM\Column(name="reconciled_date", type="date", nullable=true)
*/
private $reconciledDate;
/**
* @var string
*
* @ORM\Column(name="ProcTranID", type="string", length=255, nullable=true, options={"comment":"ID used by the payment processor to represent the transaction"})
*/
private $procTranId;
/**
* @var string
*
* @ORM\Column(name="InvoiceID", type="string", length=255, nullable=true, options={"comment":"Invoice ID for tracking transactions with a payment processor"})
*/
private $invoiceId;
/**
* @var Person
*
* @ORM\ManyToOne(targetEntity="UMRA\Bundle\MemberBundle\Entity\Person", inversedBy="transactions")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="PersonID", referencedColumnName="id")
* })
*/
private $person;
/**
*
*
* @ORM\ManyToOne(targetEntity="UMRA\Bundle\MemberBundle\Entity\Luncheon", inversedBy="transactions")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="LuncheonID", referencedColumnName="id")
* })
*/
private $luncheon;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
public function __toString()
{
$now = new \DateTime();
$tranDateStr = $this->trandate instanceof \DateTime ? $this->trandate->format('Y-m-d') : $now->format('Y-m-d');
$tranType = strlen($this->trantype) > 0 ? $this->trantype : "NEW";
$pmtMethod = strlen($this->pmtmethod) > 0 ? " ($this->pmtmethod)" : "";
return sprintf("%s - %s - $%.2f%s", $tranDateStr, $tranType, $this->amount, $pmtMethod);
}
/**
* @Assert\Callback
* @param ExecutionContextInterface $context
*/
public function validate(ExecutionContextInterface $context)
{
if ($this->getTrantype() === "LUNCHEON_FEE") {
if ($this->getLuncheon() === null) {
$context->buildViolation('Luncheon transactions must have a luncheon associated with them.')
->atPath('luncheon')
->addViolation();
}
} else {
if ($this->getLuncheon() !== null) {
$context->buildViolation('Only luncheon transactions can have a luncheon associated with them.')
->atPath('luncheon')
->addViolation();
}
}
}
/**
* Set trandate
*
* @param \DateTime $trandate
* @return Trans
*/
public function setTrandate($trandate)
{
$this->trandate = $trandate;
return $this;
}
/**
* Get trandate
*
* @return \DateTime
*/
public function getTrandate()
{
return $this->trandate;
}
/**
* Set trantype
*
* @param string $trantype
* @return Trans
*/
public function setTrantype($trantype)
{
$this->trantype = $trantype;
return $this;
}
/**
* Get trantype
*
* @return string
*/
public function getTrantype()
{
return $this->trantype;
}
/**
* Set amount
*
* @param float $amount
* @return Trans
*/
public function setAmount($amount)
{
$this->amount = $amount;
return $this;
}
/**
* Get amount
*
* @return float
*/
public function getAmount()
{
return $this->amount;
}
/**
* Set pmtmethod
*
* @param string $pmtmethod
* @return Trans
*/
public function setPmtmethod($pmtmethod)
{
$this->pmtmethod = $pmtmethod;
return $this;
}
/**
* Get pmtmethod
*
* @return string
*/
public function getPmtmethod()
{
return $this->pmtmethod;
}
/**
* Set servicechg
*
* @param string $servicechg
* @return Trans
*/
public function setServicechg($servicechg)
{
$this->servicechg = $servicechg;
return $this;
}
/**
* Get servicechg
*
* @return string
*/
public function getServicechg()
{
return $this->servicechg;
}
/**
* Set doneby
*
* @param Person $doneby
* @return Trans
*/
public function setDoneby(Person $doneby = null)
{
$this->doneby = $doneby;
return $this;
}
/**
* Get doneby
*
* @return Person
*/
public function getDoneby()
{
return $this->doneby;
}
/**
* Set notes
*
* @param string $notes
* @return Trans
*/
public function setNotes($notes)
{
$this->notes = $notes;
return $this;
}
/**
* Get notes
*
* @return string
*/
public function getNotes()
{
return $this->notes;
}
/**
* Set person
*
* @param Person $person
* @return Trans
*/
public function setPerson(Person $person = null)
{
$this->person = $person;
return $this;
}
/**
* Get person
*
* @return Person
*/
public function getPerson()
{
return $this->person;
}
/**
* Set luncheon
*
* @param Luncheon $luncheon
* @return Trans
*/
public function setLuncheon(Luncheon $luncheon = null)
{
$this->luncheon = $luncheon;
return $this;
}
/**
* Get luncheon
*
* @return Luncheon
*/
public function getLuncheon()
{
return $this->luncheon;
}
/**
* Set status
*
* @param string $status
* @return Trans
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* Get status
*
* @return string
*/
public function getStatus()
{
return $this->status;
}
/**
* Set reconciledDate
*
* @param \DateTime $reconciledDate
* @return Trans
*/
public function setReconciledDate($reconciledDate)
{
$this->reconciledDate = $reconciledDate;
return $this;
}
/**
* Get reconciledDate
*
* @return \DateTime
*/
public function getReconciledDate()
{
return $this->reconciledDate;
}
/**
* Set ProcTranID
*
* @param string $procTranId
* @return Trans
*/
public function setProcTranId($procTranId)
{
$this->procTranId = $procTranId;
return $this;
}
/**
* Get ProcTranID
*
* @return string
*/
public function getProcTranId()
{
return $this->procTranId;
}
/**
* Set invoiceId
*
* @param string $invoiceId
* @return Trans
*/
public function setInvoiceId($invoiceId)
{
$this->invoiceId = $invoiceId;
return $this;
}
/**
* Get invoiceId
*
* @return string
*/
public function getInvoiceId()
{
return $this->invoiceId;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
}
| cgjerdingen/UMNRetireesPlatform | src/UMRA/Bundle/MemberBundle/Entity/Trans.php | PHP | apache-2.0 | 9,447 | [
30522,
1026,
1029,
25718,
3415,
15327,
8529,
2527,
1032,
14012,
1032,
2266,
27265,
2571,
1032,
9178,
1025,
2224,
8998,
1032,
2030,
2213,
1032,
12375,
2004,
2030,
2213,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
9398,
8844,
1032... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2015, 2016 Simon Boyé
*
* This file is part of lair.
*
* lair is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* lair 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with lair. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <iostream>
#include <functional>
#include <SDL_mixer.h>
#include <lair/ldl/read.h>
#include <lair/ldl/write.h>
#include <lair/utils/game_state.h>
#include "lair/utils/game_base.h"
#define DEFAULT_LOG_LEVEL LogLevel::Debug
namespace lair {
// This function is declared in an auto-generated file
void registerLairResource(MemoryFileSystem& fs);
GameConfigBase::GameConfigBase()
: fullscreen(false)
, vSync (true)
, soundVolume(.25)
, musicVolume(.35)
, windowSize(1280, 720)
, debugGl(false)
{
}
void GameConfigBase::setFromArgs(int& argc, char** argv) {
int last = 1;
for(int argi = 1; argi < argc; ++ argi) {
char* arg = argv[argi];
if(std::strcmp(arg, "-f") == 0 || std::strcmp(arg, "--fullscreen") == 0) {
fullscreen = true;
}
else if(std::strcmp(arg, "--no-fullscreen") == 0) {
fullscreen = false;
}
else if(std::strcmp(arg, "--vsync") == 0) {
vSync = true;
}
else if(std::strcmp(arg, "--no-vsync") == 0) {
vSync = false;
}
else if(std::strcmp(arg, "--debug-gl") == 0) {
debugGl = true;
}
else {
argv[last++] = arg;
}
}
argv[last] = 0;
argc = last;
}
const PropertyList& GameConfigBase::properties() const {
return GameConfigBase::staticProperties();
}
const PropertyList& GameConfigBase::staticProperties() {
static PropertyList props;
if(!props.nProperties()) {
props.addProperty("fullscreen",
&GameConfigBase::fullscreen);
props.addProperty("vsync",
&GameConfigBase::vSync);
props.addProperty("sound_volume",
&GameConfigBase::soundVolume);
props.addProperty("music_volume",
&GameConfigBase::musicVolume);
props.addProperty("window_size",
&GameConfigBase::windowSize);
props.addProperty("debug_gl",
&GameConfigBase::debugGl);
}
return props;
}
GameBase::GameBase(int argc, char** argv)
: _mlogger(),
_logStream("log.txt"),
//#ifndef _WIN32
_stdlogBackend(std::clog, true),
//#endif
_fileBackend(_logStream, false),
_logger("game", &_mlogger, DEFAULT_LOG_LEVEL),
_argc(argc),
_argv(argv),
_dataPath(),
_sys(nullptr),
_window(nullptr),
_renderModule(nullptr),
_renderer(nullptr),
_audio(nullptr),
_assets(nullptr),
_loader(nullptr),
_nextState(nullptr),
_currentState(nullptr) {
//#ifndef _WIN32
_mlogger.addBackend(&_stdlogBackend);
//#endif
_mlogger.addBackend(&_fileBackend);
dbgLogger.setMaster(&_mlogger);
dbgLogger.setDefaultModuleName("DEBUG");
dbgLogger.setLevel(LogLevel::Debug);
}
GameBase::~GameBase() {
log().log("Stopping game...");
}
Path GameBase::dataPath() const {
return _dataPath;
}
FileSystemSP GameBase::fileSystem() const {
return _fileSystem;
}
PropertySerializer& GameBase::serializer() {
return _serializer;
}
SysModule* GameBase::sys() {
return _sys.get();
}
Window* GameBase::window() {
return _window;
}
AssetManager* GameBase::assets() {
return _assets.get();
}
LoaderManager* GameBase::loader() {
return _loader.get();
}
RenderModule* GameBase::renderModule() {
return _renderModule.get();
}
Renderer* GameBase::renderer() {
return _renderer;
}
AudioModule* GameBase::audio() {
return _audio.get();
}
int GameBase::argc() const {
return _argc;
}
char** GameBase::argv() const {
return _argv;
}
void GameBase::initialize(GameConfigBase& config) {
log().log("Starting game...");
_sys.reset(new SysModule(&_mlogger, LogLevel::Log));
_sys->initialize();
_sys->onQuit = std::bind(&GameBase::quit, this);
// Config
Path configLogicPath = "config.ldl";
Path configRealPath = sys()->basePath() / configLogicPath;
Path::IStream in(configRealPath.native().c_str());
if(in.good()) {
log().info("Read config \"", configRealPath, "\"...");
Variant confVar;
parseLdl(confVar, configRealPath, configLogicPath, log());
_serializer.read(config, confVar, log());
}
else {
log().info("Config not found, create one: \"", configLogicPath, "\"...");
ErrorList errors;
Path::OStream out(configRealPath.native().c_str());
if(out.good()) {
LdlWriter writer(&out, configLogicPath.utf8String(), &errors);
Variant confVar;
_serializer.write(confVar, config, log());
ldlWrite(writer, confVar);
errors.log(log());
}
else {
log().warning("Unable to create the config file \"", configRealPath, "\".");
}
}
// Command-line arguments override config files.
config.setFromArgs(_argc, _argv);
// Data path
const char* envPath = std::getenv("LAIR_DATA_DIR");
if(envPath) {
_dataPath = envPath;
} else {
_dataPath = _sys->basePath() / "assets";
}
log().log("Data directory: ", _dataPath);
// File systems
_realFs.reset(new RealFileSystem(_dataPath));
_memoryFs.reset(new MemoryFileSystem);
registerLairResource(*_memoryFs);
_fileSystem = std::make_shared<FileSystem>();
_fileSystem->addFileSystem("/", _realFs);
_fileSystem->addFileSystem("/", _memoryFs);
// Assets
_assets = make_unique(new AssetManager);
_loader = make_unique(new LoaderManager(_assets.get(), 1, _logger));
_loader->setFileSystem(fileSystem());
// Window
_window = _sys->createWindow("Lair", config.windowSize(0), config.windowSize(1));
_window->setFullscreen(config.fullscreen);
_sys->setVSyncEnabled(config.vSync);
log().info("VSync: ", _sys->isVSyncEnabled()? "on": "off");
// Render
_renderModule.reset(new RenderModule(sys(), assets(), &_mlogger, DEFAULT_LOG_LEVEL));
_renderModule->initialize(config.debugGl);
_renderer = _renderModule->createRenderer();
// Audio
_audio.reset(new AudioModule(&_mlogger));
_audio->initialize();
_audio->setMusicVolume(config.musicVolume);
}
void GameBase::shutdown() {
_assets->releaseAll();
_audio->shutdown();
_renderModule->shutdown();
_renderModule.reset();
_window->destroy();
_sys->shutdown();
_sys.reset();
}
void GameBase::setNextState(GameState* state) {
if(_nextState) {
log().warning("Setting next state while an other state is enqueued.");
}
_nextState = state;
}
void GameBase::run() {
while(_nextState) {
_currentState = _nextState;
_nextState = nullptr;
_currentState->run();
}
}
void GameBase::quit() {
if(_currentState) {
_currentState->quit();
}
}
}
| draklaw/lair | src/utils/game_base.cpp | C++ | lgpl-3.0 | 7,034 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2325,
1010,
2355,
4079,
2879,
2063,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
21039,
1012,
1008,
1008,
21039,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
// This file is part of Formal Languages block - https://bitbucket.org/oasychev/moodle-plugins/
//
// Formal Languages block is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Formal Languages block 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Formal Languages block. If not, see <http://www.gnu.org/licenses/>.
/**
* Defines abstract mapper from lexer to parser, which maps lexer tokens to parser AST
*
* @package blocks
* @subpackage formal_langs
* @copyright © 2011 Oleg Sychev, Volgograd State Technical University
* @author Oleg Sychev, Mamontov Dmitriy, Maria Birukova
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
global $CFG;
/**
* Class block_formal_langs_lexer_to_parser_mapper
*
* Defines a mapper, which maps lexer tokens, generated by JLexPHP to PHP_ParserGenerators tokens
*/
abstract class block_formal_langs_lexer_to_parser_mapper {
/**
* A stack as a collection of frames with types and other conflict-solving data
*/
protected $stack;
/**
* Constructs a mapper with mapped lexer and parser
*/
public function __construct()
{
$this->push_stack_frame();
}
/**
* Pushes a stack frame to a mapper
*/
public function push_stack_frame()
{
$this->stack[] = array();
}
/**
* Pops stack frame from mappers stacks list
*/
public function pop_stack_frame()
{
unset($this->stack[count($this->stack) - 1]);
}
/** Returns name of parser class
* @return name of parser class
*/
public abstract function parsername();
/** Returns mappings of lexer tokens to parser tokens
* @param string $any name for any value matching
* @return array mapping
*/
public abstract function maptable($any);
/** Maps token from lexer to parser, returning name of constant to parser
* @param block_formal_langs_token_base $token a token name
* @return string mapped token data
*/
public function map($token) {
$result = 0;
$any = '===ANY===';
$table = $this->maptable($any);
if (array_key_exists($token->type(), $table)) {
$maps = $table[$token->type()];
$value = (string)$token->value();
if (array_key_exists($value, $maps)) {
$result = $maps[$value];
} else {
$result = $maps[$any];
}
}
//echo $result . PHP_EOL;
return $result;
}
/**
* Creates new parser
* @return block_formal_langs_parser_cpp_language|mixed
*/
protected function make_parser() {
$parsername = $this->parsername();
// Note that this comment added to hint types for IDE.
/** @var block_formal_langs_parser_cpp_language $parser */
$parser = new $parsername();
$parser->mapper = $this;
$parser->repeatlookup = true;
return $parser;
}
/** Parses new string for text parser
* @param block_formal_langs_processed_string $processedstring string, which has been tokenized before
* @param bool $iscorrect
*/
public function parse($processedstring, $iscorrect) {
// TODO: What should we do with $iscorrect ?
// Nullify stateful effects
$oldstate = get_object_vars($this);
if (count($processedstring->stream->errors) == 0)
{
$parser = $this->make_parser();
$result = array();
$tokens = $processedstring->stream->tokens;
if (count($tokens))
{
$parser->currentid = count($tokens);
$tokens = array_values( $tokens );
$stuck = false;
for($i = 0; $i < count($tokens); $i++) {
$token = $tokens[$i];
// Parse next token
$this->parse_token($token, $parser);
// Handle parsing error
if ($parser->error) {
$oldid = $parser->currentid;
$root = $parser->root;
if ($stuck) {
$root []= $token;
} else {
--$i;
$stuck = true;
}
$parser = $this->make_parser();
$parser->currentid = $oldid;
if (count($result)) {
if (count($root)) {
$result = array_merge($result, $root);
}
} else {
$result = $root;
}
} else {
$stuck = false;
}
}
$parser->doParse(0, null);
$root = $parser->root;
if (count($result)) {
$result = array_merge($result, $root);
} else {
$result = $root;
}
$processedstring->set_syntax_tree($result);
}
}
// Nullify stateful effects
if (count($oldstate)) {
foreach($oldstate as $key => $value) {
$this->$key = $value;
}
}
}
/** Returns major code for specified token
* @param block_formal_langs_token_base $token a token
* @return int constant data
*/
public function major_code_for($token) {
$parsername = $this->parsername();
$major = $this->map($token);
$constant = 0;
if ($major != null) {
$constant = $parsername . '::' . $major;
// echo $constant . "\r\n";
$constant = constant($constant);
}
return $constant;
}
/**
* Makes parser parse specific token
* @param block_formal_langs_token_base $token parsed token
* @param mixed $parser a parser result
*/
protected function parse_token($token, $parser) {
$constant = $this->major_code_for($token);
// Note that this comment added to hint types for IDE.
/** @var block_formal_langs_parser_cpp_language $parser */
$parser->doParse($constant, $token);
}
}
| nitro2010/moodle | blocks/formal_langs/lexer_to_parser_mapper.php | PHP | gpl-3.0 | 7,003 | [
30522,
1026,
1029,
25718,
1013,
1013,
2023,
5371,
2003,
2112,
1997,
5337,
4155,
3796,
1011,
16770,
1024,
1013,
1013,
2978,
24204,
3388,
1012,
8917,
1013,
1051,
3022,
17994,
6777,
1013,
6888,
2571,
1011,
13354,
7076,
1013,
1013,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Gzips and deletes log files generated by glog http://github.com/golang/glog
Basic usage:
glogrotate -base=/var/log -maxage=240h myapp myotherapp
glogrotate will not touch the current log files. There are different timeouts for the INFO, WARNING, and ERROR log levels.
*/
package main
import (
"flag"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
)
const (
defaultDeleteInfoAfter = 30 * 24 * time.Hour
defaultWarnMult = 2
defaultErrorMult = 3
)
var (
base = flag.String("base", "/var/log/", "log subdir")
deleteInfoAfter = flag.Duration("maxage", defaultDeleteInfoAfter, "delete INFO files older than this")
warnMult = flag.Int("warn", defaultWarnMult, "multiplier relative to maxage for WARNING files")
errorMult = flag.Int("error", defaultErrorMult, "multiplier relative to maxage for ERROR/FATAL files")
verbose = flag.Bool("v", false, "verbose")
)
func main() {
flag.Parse()
for _, log := range flag.Args() {
clean(*base+"/"+log, log)
}
}
func clean(dir, name string) {
if *verbose {
fmt.Printf("clean %s/%s*...\n", dir, name)
}
fs, err := filepath.Glob(dir + "/" + name + "*")
if err != nil {
fatalf("file error: %s", err)
}
doNotTouch := map[string]struct{}{}
var candidates []string
for _, f := range fs {
if t, err := os.Readlink(f); err == nil {
// it's a symlink to the current file.
a := filepath.Join(filepath.Dir(f), t)
doNotTouch[a] = struct{}{}
continue
}
candidates = append(candidates, f)
}
for _, f := range candidates {
if _, ok := doNotTouch[f]; ok {
if *verbose {
fmt.Printf("don't touch: %s\n", f)
}
continue
}
// we want the date from 'one.rz-reqmngt1-eu.root.log.ERROR.20150320-103857.29198'
// (might have a .gz suffix)
fields := strings.Split(f, ".")
if len(fields) < 3 {
fatalf("unexpected filename: %q", f)
}
if fields[len(fields)-1] == `gz` {
fields = fields[:len(fields)-1]
}
var dAfter time.Duration
level := fields[len(fields)-3]
switch level {
case "INFO":
dAfter = *deleteInfoAfter
case "WARNING":
dAfter = time.Duration(*warnMult) * (*deleteInfoAfter)
case "ERROR", "FATAL":
dAfter = time.Duration(*errorMult) * (*deleteInfoAfter)
default:
fatalf("weird log level: %q", level)
}
d, err := time.Parse("20060102", strings.SplitN(fields[len(fields)-2], "-", 2)[0])
if err != nil {
fatalf("invalid date: %s", err)
}
if d.Before(time.Now().Add(-dAfter)) {
if *verbose {
fmt.Printf("delete %s\n", f)
}
os.Remove(f)
continue
}
if !strings.HasSuffix(f, ".gz") {
if *verbose {
fmt.Printf("gzipping %s...\n", f)
}
if err := exec.Command("gzip", f).Run(); err != nil {
fatalf("gzip: %s", err)
}
}
}
}
func fatalf(f string, args ...interface{}) {
fmt.Fprintf(os.Stderr, f, args)
fmt.Fprint(os.Stderr, "\n")
os.Exit(1)
}
| realzeitmedia/glogrotate | glogrotate.go | GO | isc | 2,889 | [
30522,
1013,
1008,
1043,
5831,
4523,
1998,
3972,
12870,
2015,
8833,
6764,
7013,
2011,
1043,
21197,
8299,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
2175,
25023,
1013,
1043,
21197,
3937,
8192,
1024,
1043,
21197,
21709,
3686,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>GoJS® CommandHandler Class</title>
<script src="../../assets/js/jquery.min.js"></script>
<script src="../../assets/js/bootstrap.min.js"></script>
<script src="../../assets/js/highlight.js"></script>
<script src="../../assets/js/api.js"></script>
<link href="../../assets/css/bootstrap.min.css" rel="stylesheet" >
<!-- custom CSS after bootstrap -->
<link href="../../assets/css/main.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/css/api.css" rel="stylesheet" type="text/css"/>
<!--<link rel="stylesheet" href="../../assets/css/api.css" type="text/css" media="all" />-->
<link rel="stylesheet" href="../../assets/css/highlight.css" type="text/css" media="all" />
</head>
<body>
<!-- non-fixed navbar -->
<nav id="non-fixed-nav" class="navbar navbar-inverse navbar-top">
<div class="container-fluid">
<div class="navbar-header">
<div class="navheader-container">
<div class="navheader-collapse" data-toggle="collapse" data-target="#navbar">
<a id="toplogo" class="navbar-brand" href="../../index.html">GoJS</a>
<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>
</div>
</div>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="../../index.html">Home</a></li>
<li><a href="../../learn/index.html">Learn</a></li>
<li><a href="../../samples/index.html">Samples</a></li>
<li><a href="../../intro/index.html">Intro</a></li>
<li><a href="../../api/index.html">API</a></li>
<li><a href="https://www.nwoods.com/components/evalform.htm">Register</a></li>
<li><a href="../../doc/download.html">Download</a></li>
<li><a href="https://forum.nwoods.com/c/gojs">Forum</a></li>
<li><a href="https://www.nwoods.com/contact.html" onclick="ga('send','event','Outbound Link','click','contact');">Contact</a></li>
<li class="buy"><a href="https://www.nwoods.com/sales/index.html" onclick="ga('send','event','Outbound Link','click','buy');">Buy</a></li>
<li class="activate"><a href="https://www.nwoods.com/app/activate.aspx?sku=gojs">Activate</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container-fluid">
<!-- ============================== classes index ============================ -->
<div id="navindex" class="col-md-2">
<!-- begin publish.classesIndex -->
<!-- <div><a href="../index.html">GoJS Class Index</a></div> -->
<div class="sidebar-nav">
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<div class="navheader-container">
<div class="navheader-collapse" data-toggle="collapse" data-target="#DiagramNavbar">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#DiagramNavbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<span class="navbar-brand">Diagram Classes</span>
</div>
</div>
<div id="DiagramNavbar" class="navbar-collapse collapse sidebar-navbar-collapse">
<ul class="classList nav navbar-nav">
<li><a href="../symbols/Adornment.html" class="linkConstructor">Adornment</a></li>
<li><a href="../symbols/AnimationManager.html" class="linkConstructor">AnimationManager</a></li>
<li><a href="../symbols/CommandHandler.html" class="linkConstructor">CommandHandler</a></li>
<li><a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a></li>
<li><a href="../symbols/DiagramEvent.html" class="linkConstructor">DiagramEvent</a></li>
<li><a href="../symbols/GraphObject.html" class="linkConstructor">GraphObject</a></li>
<li><a href="../symbols/Group.html" class="linkConstructor">Group</a></li>
<li><a href="../symbols/InputEvent.html" class="linkConstructor">InputEvent</a></li>
<li><a href="../symbols/Layer.html" class="linkConstructor">Layer</a></li>
<li><a href="../symbols/Link.html" class="linkConstructor">Link</a></li>
<li><a href="../symbols/Node.html" class="linkConstructor">Node</a></li>
<li><a href="../symbols/Overview.html" class="linkConstructor">Overview</a></li>
<li><a href="../symbols/Palette.html" class="linkConstructor">Palette</a></li>
<li><a href="../symbols/Panel.html" class="linkConstructor">Panel</a></li>
<li><a href="../symbols/Part.html" class="linkConstructor">Part</a></li>
<li><a href="../symbols/Picture.html" class="linkConstructor">Picture</a></li>
<li><a href="../symbols/Placeholder.html" class="linkConstructor">Placeholder</a></li>
<li><a href="../symbols/RowColumnDefinition.html" class="linkConstructor">RowColumnDefinition</a></li>
<li><a href="../symbols/Shape.html" class="linkConstructor">Shape</a></li>
<li><a href="../symbols/TextBlock.html" class="linkConstructor">TextBlock</a></li>
</ul>
</div>
</div>
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<div class="navheader-container">
<div class="navheader-collapse" data-toggle="collapse" data-target="#GeometryNavbar">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#GeometryNavbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<span class="navbar-brand">Geometry Classes</span>
</div>
</div>
<div id="GeometryNavbar" class="navbar-collapse collapse sidebar-navbar-collapse">
<ul class="classList nav navbar-nav">
<li><a href="../symbols/Brush.html" class="linkConstructor">Brush</a></li>
<li><a href="../symbols/Geometry.html" class="linkConstructor">Geometry</a></li>
<li><a href="../symbols/Margin.html" class="linkConstructor">Margin</a></li>
<li><a href="../symbols/PathFigure.html" class="linkConstructor">PathFigure</a></li>
<li><a href="../symbols/PathSegment.html" class="linkConstructor">PathSegment</a></li>
<li><a href="../symbols/Point.html" class="linkConstructor">Point</a></li>
<li><a href="../symbols/Rect.html" class="linkConstructor">Rect</a></li>
<li><a href="../symbols/Size.html" class="linkConstructor">Size</a></li>
<li><a href="../symbols/Spot.html" class="linkConstructor">Spot</a></li>
</ul>
</div>
</div>
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<div class="navheader-container">
<div class="navheader-collapse" data-toggle="collapse" data-target="#ModelNavbar">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#ModelNavbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<span class="navbar-brand">Model Classes</span>
</div>
</div>
<div id="ModelNavbar" class="navbar-collapse collapse sidebar-navbar-collapse">
<ul class="classList nav navbar-nav">
<li><a href="../symbols/Binding.html" class="linkConstructor">Binding</a></li>
<li><a href="../symbols/ChangedEvent.html" class="linkConstructor">ChangedEvent</a></li>
<li><a href="../symbols/GraphLinksModel.html" class="linkConstructor">GraphLinksModel</a></li>
<li><a href="../symbols/Model.html" class="linkConstructor">Model</a></li>
<li><a href="../symbols/Transaction.html" class="linkConstructor">Transaction</a></li>
<li><a href="../symbols/TreeModel.html" class="linkConstructor">TreeModel</a></li>
<li><a href="../symbols/UndoManager.html" class="linkConstructor">UndoManager</a></li>
</ul>
</div>
</div>
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<div class="navheader-container">
<div class="navheader-collapse" data-toggle="collapse" data-target="#LayoutNavbar">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#LayoutNavbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<span class="navbar-brand">Layout Classes</span>
</div>
</div>
<div id="LayoutNavbar" class="navbar-collapse collapse sidebar-navbar-collapse">
<ul class="classList nav navbar-nav">
<li><a href="../symbols/CircularLayout.html" class="linkConstructor">CircularLayout</a></li>
<li><a href="../symbols/ForceDirectedLayout.html" class="linkConstructor">ForceDirectedLayout</a></li>
<li><a href="../symbols/GridLayout.html" class="linkConstructor">GridLayout</a></li>
<li><a href="../symbols/LayeredDigraphLayout.html" class="linkConstructor">LayeredDigraphLayout</a></li>
<li><a href="../symbols/Layout.html" class="linkConstructor">Layout</a></li>
<li><a href="../symbols/LayoutNetwork.html" class="linkConstructor">LayoutNetwork</a></li>
<li><a href="../symbols/TreeLayout.html" class="linkConstructor">TreeLayout</a></li>
</ul>
</div>
</div>
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<div class="navheader-container">
<div class="navheader-collapse" data-toggle="collapse" data-target="#ToolNavbar">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#ToolNavbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<span class="navbar-brand">Tool Classes</span>
</div>
</div>
<div id="ToolNavbar" class="navbar-collapse collapse sidebar-navbar-collapse">
<ul class="classList nav navbar-nav">
<li><a href="../symbols/ActionTool.html" class="linkConstructor">ActionTool</a></li>
<li><a href="../symbols/ClickCreatingTool.html" class="linkConstructor">ClickCreatingTool</a></li>
<li><a href="../symbols/ClickSelectingTool.html" class="linkConstructor">ClickSelectingTool</a></li>
<li><a href="../symbols/ContextMenuTool.html" class="linkConstructor">ContextMenuTool</a></li>
<li><a href="../symbols/DraggingTool.html" class="linkConstructor">DraggingTool</a></li>
<li><a href="../symbols/DragSelectingTool.html" class="linkConstructor">DragSelectingTool</a></li>
<li><a href="../symbols/HTMLInfo.html" class="linkConstructor">HTMLInfo</a></li>
<li><a href="../symbols/LinkingBaseTool.html" class="linkConstructor">LinkingBaseTool</a></li>
<li><a href="../symbols/LinkingTool.html" class="linkConstructor">LinkingTool</a></li>
<li><a href="../symbols/LinkReshapingTool.html" class="linkConstructor">LinkReshapingTool</a></li>
<li><a href="../symbols/PanningTool.html" class="linkConstructor">PanningTool</a></li>
<li><a href="../symbols/RelinkingTool.html" class="linkConstructor">RelinkingTool</a></li>
<li><a href="../symbols/ResizingTool.html" class="linkConstructor">ResizingTool</a></li>
<li><a href="../symbols/RotatingTool.html" class="linkConstructor">RotatingTool</a></li>
<li><a href="../symbols/TextEditingTool.html" class="linkConstructor">TextEditingTool</a></li>
<li><a href="../symbols/Tool.html" class="linkConstructor">Tool</a></li>
<li><a href="../symbols/ToolManager.html" class="linkConstructor">ToolManager</a></li>
</ul>
</div>
</div>
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<div class="navheader-container">
<div class="navheader-collapse" data-toggle="collapse" data-target="#CollectionNavbar">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#CollectionNavbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<span class="navbar-brand">Collection Classes</span>
</div>
</div>
<div id="CollectionNavbar" class="navbar-collapse collapse sidebar-navbar-collapse">
<ul class="classList nav navbar-nav">
<li><a href="../symbols/Iterable.html" class="linkConstructor">Iterable</a></li>
<li><a href="../symbols/Iterator.html" class="linkConstructor">Iterator</a></li>
<li><a href="../symbols/List.html" class="linkConstructor">List</a></li>
<li><a href="../symbols/Map.html" class="linkConstructor">Map</a></li>
<li><a href="../symbols/Set.html" class="linkConstructor">Set</a></li>
</ul>
</div>
</div>
</div> <!-- /class="sidebar-nav -->
<!-- end publish.classesIndex -->
</div>
<div id="contentBody" class="col-md-10">
<!-- ============================== header ================================= -->
<div id="header" class="fineprint mt30">
<b>GoJS</b>® Diagramming Components<br/>version 1.7.21 for JavaScript/HTML<br/>by <a href="https://www.nwoods.com/">Northwoods Software®</a>
</div>
<!-- ============================== class title ============================ -->
<h2 class="classTitle mt30">
Class CommandHandler
</h2>
<!-- ============================== class summary ========================== -->
<span class="hideshowall">
<span class="nodetails"><button id="buttonShow">Show Details</button></span>
<span class="details"><button id="buttonHide">Show Summaries</button></span>
</span>
<p class="classsummary">
The <a href="../symbols/Diagram.html#commandHandler" class="linkProperty">Diagram.commandHandler</a> implements various
commands such as <a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">CommandHandler.deleteSelection</a> or <a href="../symbols/CommandHandler.html#redo" class="linkMethod">CommandHandler.redo</a>.
The CommandHandler includes keyboard event handling to interpret
key presses as commands.
<p>
CommandHandlers cannot be shared amongst multiple Diagrams.
<p>
You may define a CommandHandler subclass and override methods.
However you must seriously consider calling the base method in order to get its default behavior.
There may be situations where not calling the base method may cause subtle bugs,
but that depends on the method.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call a base method.
<p>
There is an example custom CommandHandler in the extensions directory: <a href="../../extensions/DrawCommandHandler.js">DrawCommandHandler.js</a>,
which provides alignment commands and additional behaviors for the arrow keys.
<p class="boxread">
For additional discussion, please read the <a href="../../intro/commands.html">Introduction page on Commands</a>.
<h3>Keyboard Shortcuts</h3>
The CommandHandler implements the following command bindings for keyboard input in <a href="../symbols/CommandHandler.html#doKeyDown" class="linkMethod">doKeyDown</a>:
<ul>
<li><code>Ctrl-X</code> & <code>Shift-Del</code> invoke <a href="../symbols/CommandHandler.html#cutSelection" class="linkMethod">cutSelection</a></li>
<li><code>Ctrl-C</code> & <code>Ctrl-Insert</code> invoke <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a></li>
<li><code>Ctrl-V</code> & <code>Shift-Insert</code> invoke <a href="../symbols/CommandHandler.html#pasteSelection" class="linkMethod">pasteSelection</a></li>
<li><code>Del</code> & <code>Backspace</code> invoke <a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">deleteSelection</a></li>
<li><code>Ctrl-A</code> invokes <a href="../symbols/CommandHandler.html#selectAll" class="linkMethod">selectAll</a></li>
<li><code>Ctrl-Z</code> & <code>Alt-Backspace</code> invoke <a href="../symbols/CommandHandler.html#undo" class="linkMethod">undo</a></li>
<li><code>Ctrl-Y</code> & <code>Alt-Shift-Backspace</code> invoke <a href="../symbols/CommandHandler.html#redo" class="linkMethod">redo</a></li>
<li><code>Up</code> & <code>Down</code> & <code>Left</code> & <code>Right</code> (arrow keys) call <a href="../symbols/Diagram.html#scroll" class="linkMethod">Diagram.scroll</a></li>
<li><code>PageUp</code> & <code>PageDown</code> call <a href="../symbols/Diagram.html#scroll" class="linkMethod">Diagram.scroll</a></li>
<li><code>Home</code> & <code>End</code> call <a href="../symbols/Diagram.html#scroll" class="linkMethod">Diagram.scroll</a></li>
<li><code>Space</code> invokes <a href="../symbols/CommandHandler.html#scrollToPart" class="linkMethod">scrollToPart</a></li>
<li><code>Ctrl-- & Keypad--</code> (minus) invoke <a href="../symbols/CommandHandler.html#decreaseZoom" class="linkMethod">decreaseZoom</a></li>
<li><code>Ctrl-+ & Keypad-+</code> (plus) invoke <a href="../symbols/CommandHandler.html#increaseZoom" class="linkMethod">increaseZoom</a></li>
<li><code>Ctrl-0</code> invokes <a href="../symbols/CommandHandler.html#resetZoom" class="linkMethod">resetZoom</a></li>
<li><code>Shift-Z</code> invokes <a href="../symbols/CommandHandler.html#zoomToFit" class="linkMethod">zoomToFit</a>; repeat to return to the original scale and position</li>
<li><code>Ctrl-G</code> invokes <a href="../symbols/CommandHandler.html#groupSelection" class="linkMethod">groupSelection</a></li>
<li><code>Ctrl-Shift-G</code> invokes <a href="../symbols/CommandHandler.html#ungroupSelection" class="linkMethod">ungroupSelection</a></li>
<li><code>F2</code> invokes <a href="../symbols/CommandHandler.html#editTextBlock" class="linkMethod">editTextBlock</a></li>
<li><code>Menu Key</code> invokes <a href="../symbols/CommandHandler.html#showContextMenu" class="linkMethod">showContextMenu</a></li>
<li><code>Esc</code> invokes <a href="../symbols/CommandHandler.html#stopCommand" class="linkMethod">stopCommand</a></li>
</ul>
<p>
On a Macintosh the Command key is used as the modifier instead of the Control key.
</p>
<p>
On touch devices there is a default context menu that shows many commonly-used commands
when you hold a finger down on the diagram.
</p>
</p>
<!-- ============================== constructor summary ==================== -->
<h2 id="constructor" class="summaryCaption"> Constructor <span class="nodetails"> Summary</span><span class="details"> Details</span></h2>
<div class="table-responsive">
<table class="summaryTable table table-bordered table-condensed" summary="A summary of the constructor documented in the class CommandHandler.">
<thead>
<tr>
<th scope="col" class="name">Name</th>
<th scope="col" class="description">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name" >
<div class="name">
CommandHandler()
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>The constructor produces a CommandHandler with the default key bindings.
</div>
</td>
</tr>
</tbody>
</table>
</div><!-- class="table-responsive">-->
<!-- ============================== properties summary ===================== -->
<h2 class="summaryCaption">Properties<span class="nodetails"> Summary</span><span class="details"> Details</span></h2>
<div class="table-responsive">
<table class="summaryTable table table-bordered table-condensed" summary="A summary of the properties documented in the class CommandHandler.">
<thead>
<tr>
<th scope="col" class="name">Name, Value Type</th>
<th scope="col" class="description">Description</th>
</tr>
</thead>
<tbody>
<tr id="archetypeGroupData" >
<td class="name">
<div class="name">
archetypeGroupData
</div>
<div class="attributes">
<span class="light">{Object}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>Gets or sets a data object that is copied by <a href="../symbols/CommandHandler.html#groupSelection" class="linkMethod">groupSelection</a>
when creating a new Group.<span class="nodetails" id="xproparchetypeGroupData"><a class="morelink" onclick="hst('proparchetypeGroupData')">More...</a></span> <span class="details" id="proparchetypeGroupData">
</span><div class="details" id="dproparchetypeGroupData"><p>
The default value is null.
If you set this to an Object, be sure that <a href="../symbols/GraphLinksModel.html#isGroupForNodeData" class="linkMethod">GraphLinksModel.isGroupForNodeData</a> is true for that object.
Setting this property does not raise any events.</div>
</div>
</td>
</tr>
<tr id="copiesConnectedLinks" >
<td class="name">
<div class="name">
copiesConnectedLinks
</div>
<div class="attributes">
<span class="light">{boolean}</span>
<span class="since" title="since">1.5</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>Gets or sets whether <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a> should also copy Links that connect with selected Nodes.<span class="nodetails" id="xpropcopiesConnectedLinks"><a class="morelink" onclick="hst('propcopiesConnectedLinks')">More...</a></span> <span class="details" id="propcopiesConnectedLinks">
The default value is true.
Setting this property does not raise any events.
</span><div class="details" id="dpropcopiesConnectedLinks"><p>
The <a href="../symbols/DraggingTool.html#copiesEffectiveCollection" class="linkProperty">DraggingTool.copiesEffectiveCollection</a> property serves a similar role for the <a href="../symbols/DraggingTool.html" class="linkConstructor">DraggingTool</a>
when the user holds down the control key to modify the drag into a copy operation.</div>
</div>
</td>
</tr>
<tr id="copiesGroupKey" >
<td class="name">
<div class="name">
copiesGroupKey
</div>
<div class="attributes">
<span class="light">{boolean}</span>
<span class="since" title="since">1.3</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>Gets or sets whether <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a> and <a href="../symbols/CommandHandler.html#copyToClipboard" class="linkMethod">copyToClipboard</a> copy the node data property
whose value is the containing group data's key.<span class="nodetails" id="xpropcopiesGroupKey"><a class="morelink" onclick="hst('propcopiesGroupKey')">More...</a></span> <span class="details" id="propcopiesGroupKey">
</span><div class="details" id="dpropcopiesGroupKey"><p>
Set this property to true if you want a copy/paste of a node to automatically have the new node be a member of the original group.
Caution: this only has an effect if the Diagram's <a href="../symbols/Diagram.html#model" class="linkProperty">Diagram.model</a> is a <a href="../symbols/GraphLinksModel.html" class="linkConstructor">GraphLinksModel</a>.
<p>
The default value is false.</div>
</div>
</td>
</tr>
<tr id="copiesParentKey" >
<td class="name">
<div class="name">
copiesParentKey
</div>
<div class="attributes">
<span class="light">{boolean}</span>
<span class="since" title="since">1.3</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>Gets or sets whether <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a> and <a href="../symbols/CommandHandler.html#copyToClipboard" class="linkMethod">copyToClipboard</a> copy the node data property
whose value is the tree-parent node data's key.<span class="nodetails" id="xpropcopiesParentKey"><a class="morelink" onclick="hst('propcopiesParentKey')">More...</a></span> <span class="details" id="propcopiesParentKey">
</span><div class="details" id="dpropcopiesParentKey"><p>
Set this property to true if you want a copy/paste of a node to automatically have the new node be a tree-child of the original tree-parent node.
Caution: this only has an effect if the Diagram's <a href="../symbols/Diagram.html#model" class="linkProperty">Diagram.model</a> is a <a href="../symbols/TreeModel.html" class="linkConstructor">TreeModel</a>.
<p>
The default value is false.</div>
</div>
</td>
</tr>
<tr id="copiesTree" >
<td class="name">
<div class="name">
copiesTree
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>Gets or sets whether <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a> should also copy subtrees.<span class="nodetails" id="xpropcopiesTree"><a class="morelink" onclick="hst('propcopiesTree')">More...</a></span> <span class="details" id="propcopiesTree">
The default value is false.
Setting this property does not raise any events.
</span><div class="details" id="dpropcopiesTree"><p>
The <a href="../symbols/DraggingTool.html#dragsTree" class="linkProperty">DraggingTool.dragsTree</a> property serves a similar role for the <a href="../symbols/DraggingTool.html" class="linkConstructor">DraggingTool</a>
for both moving and copying operations.</div>
</div>
</td>
</tr>
<tr id="defaultScale" >
<td class="name">
<div class="name">
defaultScale
</div>
<div class="attributes">
<span class="light">{number}</span>
<span class="since" title="since">1.3</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>Gets or sets the <a href="../symbols/Diagram.html#scale" class="linkProperty">Diagram.scale</a> set by <a href="../symbols/CommandHandler.html#resetZoom" class="linkMethod">resetZoom</a>.<span class="nodetails" id="xpropdefaultScale"><a class="morelink" onclick="hst('propdefaultScale')">More...</a></span> <span class="details" id="propdefaultScale">
</span><div class="details" id="dpropdefaultScale"><p>
The default value is 1.0.
The value must be a number larger than 0.
Setting this property does not raise any events.</div>
</div>
</td>
</tr>
<tr id="deletesConnectedLinks" >
<td class="name">
<div class="name">
deletesConnectedLinks
</div>
<div class="attributes">
<span class="light">{boolean}</span>
<span class="since" title="since">1.6</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>Gets or sets whether <a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">deleteSelection</a> should also delete links that are connected to nodes that are deleted.<span class="nodetails" id="xpropdeletesConnectedLinks"><a class="morelink" onclick="hst('propdeletesConnectedLinks')">More...</a></span> <span class="details" id="propdeletesConnectedLinks">
The default value is true.
Setting this property does not raise any events.</span>
</div>
</td>
</tr>
<tr id="deletesTree" >
<td class="name">
<div class="name">
deletesTree
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>Gets or sets whether <a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">deleteSelection</a> should also delete subtrees.<span class="nodetails" id="xpropdeletesTree"><a class="morelink" onclick="hst('propdeletesTree')">More...</a></span> <span class="details" id="propdeletesTree">
The default value is false.
Setting this property does not raise any events.</span>
</div>
</td>
</tr>
<tr id="diagram" >
<td class="name">
<div class="name">
diagram
</div>
<div class="attributes">
<span class="light">{<a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a>}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>This read-only property returns the <a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a> that is using this CommandHandler,
after <a href="../symbols/Diagram.html#commandHandler" class="linkProperty">Diagram.commandHandler</a> has been set to this object.
</div>
</td>
</tr>
<tr id="memberValidation" >
<td class="name">
<div class="name">
memberValidation
</div>
<div class="attributes">
<span class="light">{function(Group, Part):boolean | null}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>Gets or sets the predicate that determines whether or not a node may become a member of a group.<span class="nodetails" id="xpropmemberValidation"><a class="morelink" onclick="hst('propmemberValidation')">More...</a></span> <span class="details" id="propmemberValidation">
This predicate is called in addition to any existing group's <a href="../symbols/Group.html#memberValidation" class="linkProperty">Group.memberValidation</a> predicate.
The default predicate is null, which is equivalent to simply returning true.
The predicate may be called passing null as the first argument (the Group) --
this asks whether it is OK to make the second argument (the Part, but not a Link) a top-level Part of the diagram.
<p class="box">
For a more general discussion of validation, see <a href="../../intro/validation.html">Introduction to Validation</a>.
</span><div class="details" id="dpropmemberValidation"><p>
The function, if supplied, must not have any side-effects.</div>
</div>
</td>
</tr>
<tr id="zoomFactor" >
<td class="name">
<div class="name">
zoomFactor
</div>
<div class="attributes">
<span class="light">{number}</span>
<span class="since" title="since">1.1</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp <p> -->
<p>Gets or sets the amount by which <a href="../symbols/CommandHandler.html#decreaseZoom" class="linkMethod">decreaseZoom</a> and <a href="../symbols/CommandHandler.html#increaseZoom" class="linkMethod">increaseZoom</a> change
the <a href="../symbols/Diagram.html#scale" class="linkProperty">Diagram.scale</a>.<span class="nodetails" id="xpropzoomFactor"><a class="morelink" onclick="hst('propzoomFactor')">More...</a></span> <span class="details" id="propzoomFactor">
</span><div class="details" id="dpropzoomFactor"><p>
The default value is 1.05 (5%).
The value must be a number larger than 1.0.
Setting this property does not raise any events.</div>
</div>
</td>
</tr>
</tbody>
</table>
</div><!-- class="table-responsive">-->
<!-- ============================== methods summary ======================== -->
<h2 class="summaryCaption">Method <span class="nodetails"> Summary</span><span class="details"> Details</span></h2>
<div class="table-responsive">
<table class="summaryTable table table-bordered table-condensed" summary="A summary of the methods documented in the class CommandHandler.">
<thead>
<tr>
<th scope="col" class="name">Name, Return Type</th>
<th scope="col" class="description">Description</th>
</tr>
</thead>
<tbody>
<tr id="addTopLevelParts">
<td class="name">
<div class="name">
addTopLevelParts(coll, check)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>Make sure all of the unnested <a href="../symbols/Part.html" class="linkConstructor">Part</a>s in the given collection
are removed from any containing <a href="../symbols/Group.html" class="linkConstructor">Group</a>s.<span class="nodetails" id="xmethaddTopLevelParts"><a class="morelink" onclick="hst('methaddTopLevelParts')">More...</a></span> <span class="details" id="methaddTopLevelParts">
</span><div class="details" id="dmethaddTopLevelParts"><p>
This sets <a href="../symbols/Part.html#containingGroup" class="linkProperty">Part.containingGroup</a> to null on each Part that is
not a member of another Part in the argument collection.
If the check argument to this method is supplied and true,
this will call <a href="../symbols/CommandHandler.html#isValidMember" class="linkMethod">isValidMember</a> on each part, passing null as the first argument.
<p>
This functionality is similar to <a href="../symbols/CommandHandler.html#ungroupSelection" class="linkMethod">ungroupSelection</a>,
except that this is not a command (there is no transaction and this does not raise a <a href="../symbols/DiagramEvent.html" class="linkConstructor">DiagramEvent</a>)
and the parts are necessarily becoming top-level parts
(whereas ungrouping would add them to the Group containing the Group being ungrouped).
<p>
This function is typically called in a <a href="../symbols/Diagram.html#mouseDrop" class="linkProperty">Diagram.mouseDrop</a> event handler
in order to remove the selected Parts from whatever <a href="../symbols/Group.html" class="linkConstructor">Group</a> they had been in.
<p>
If you want to add Parts to be members of a Group, call <a href="../symbols/Group.html#addMembers" class="linkMethod">Group.addMembers</a>.
If you want to remove Parts completely from a Diagram, call <a href="../symbols/Diagram.html#removeParts" class="linkMethod">Diagram.removeParts</a>.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{Iterable.<Part>}</span> <b>coll</b>
</dt>
<dd>a collection of Parts.</dd>
<dt>
<span class="light fixedFont">{boolean=}</span> <b>check</b>
</dt>
<dd>whether to call <a href="../symbols/CommandHandler.html#isValidMember" class="linkMethod">isValidMember</a> to confirm that changing the Part to be a top-level Part is valid.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> true if all non-Links were changed to be top-level Parts in this Diagram; false if some Parts or Nodes were not able to be added.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canCollapseSubGraph">
<td class="name">
<div class="name">
canCollapseSubGraph(group)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether the user can collapse expanded <a href="../symbols/Group.html" class="linkConstructor">Group</a>s.<span class="nodetails" id="xmethcanCollapseSubGraph"><a class="morelink" onclick="hst('methcanCollapseSubGraph')">More...</a></span> <span class="details" id="methcanCollapseSubGraph">
</span><div class="details" id="dmethcanCollapseSubGraph"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#collapseSubGraph" class="linkMethod">collapseSubGraph</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Group.html" class="linkConstructor">Group</a>=}</span> <b>group</b>
</dt>
<dd>if supplied, ignore the selection and consider collapsing this particular Group.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> </dt>
</dl>
</div>
</td>
</tr>
<tr id="canCollapseTree">
<td class="name">
<div class="name">
canCollapseTree(node)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether the user can collapse expanded subtrees of <a href="../symbols/Node.html" class="linkConstructor">Node</a>s.<span class="nodetails" id="xmethcanCollapseTree"><a class="morelink" onclick="hst('methcanCollapseTree')">More...</a></span> <span class="details" id="methcanCollapseTree">
</span><div class="details" id="dmethcanCollapseTree"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#collapseTree" class="linkMethod">collapseTree</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Node.html" class="linkConstructor">Node</a>=}</span> <b>node</b>
</dt>
<dd>if supplied, ignore the selection and consider collapsing this particular Node.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> </dt>
</dl>
</div>
</td>
</tr>
<tr id="canCopySelection">
<td class="name">
<div class="name">
canCopySelection()
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a> command.<span class="nodetails" id="xmethcanCopySelection"><a class="morelink" onclick="hst('methcanCopySelection')">More...</a></span> <span class="details" id="methcanCopySelection">
</span><div class="details" id="dmethcanCopySelection"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true:
if <a href="../symbols/Diagram.html#allowCopy" class="linkProperty">Diagram.allowCopy</a> is true,
if <a href="../symbols/Diagram.html#allowClipboard" class="linkProperty">Diagram.allowClipboard</a> is true, and
if there are some selected <a href="../symbols/Part.html" class="linkConstructor">Part</a>s.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canCutSelection">
<td class="name">
<div class="name">
canCutSelection()
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#cutSelection" class="linkMethod">cutSelection</a> command.<span class="nodetails" id="xmethcanCutSelection"><a class="morelink" onclick="hst('methcanCutSelection')">More...</a></span> <span class="details" id="methcanCutSelection">
</span><div class="details" id="dmethcanCutSelection"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#cutSelection" class="linkMethod">cutSelection</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true:
if the diagram is not <a href="../symbols/Diagram.html#isReadOnly" class="linkProperty">Diagram.isReadOnly</a>,
if <a href="../symbols/Diagram.html#allowCopy" class="linkProperty">Diagram.allowCopy</a> is true,
if <a href="../symbols/Diagram.html#allowDelete" class="linkProperty">Diagram.allowDelete</a> is true,
if <a href="../symbols/Diagram.html#allowClipboard" class="linkProperty">Diagram.allowClipboard</a> is true, and
if there are some selected <a href="../symbols/Part.html" class="linkConstructor">Part</a>s.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canDecreaseZoom">
<td class="name">
<div class="name">
canDecreaseZoom(factor)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#decreaseZoom" class="linkMethod">decreaseZoom</a> command.<span class="nodetails" id="xmethcanDecreaseZoom"><a class="morelink" onclick="hst('methcanDecreaseZoom')">More...</a></span> <span class="details" id="methcanDecreaseZoom">
</span><div class="details" id="dmethcanDecreaseZoom"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#decreaseZoom" class="linkMethod">decreaseZoom</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{number=}</span> <b>factor</b>
</dt>
<dd>This defaults to 1/<a href="../symbols/CommandHandler.html#zoomFactor" class="linkProperty">zoomFactor</a>. The value should be less than one and greater than zero.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true if <a href="../symbols/Diagram.html#allowZoom" class="linkProperty">Diagram.allowZoom</a> is true
and if the new scale is within the range of <a href="../symbols/Diagram.html#minScale" class="linkProperty">Diagram.minScale</a> and <a href="../symbols/Diagram.html#maxScale" class="linkProperty">Diagram.maxScale</a>.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canDeleteSelection">
<td class="name">
<div class="name">
canDeleteSelection()
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">deleteSelection</a> command.<span class="nodetails" id="xmethcanDeleteSelection"><a class="morelink" onclick="hst('methcanDeleteSelection')">More...</a></span> <span class="details" id="methcanDeleteSelection">
</span><div class="details" id="dmethcanDeleteSelection"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">deleteSelection</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true:
if the diagram is not <a href="../symbols/Diagram.html#isReadOnly" class="linkProperty">Diagram.isReadOnly</a>,
if <a href="../symbols/Diagram.html#allowDelete" class="linkProperty">Diagram.allowDelete</a> is true, and
if there are some selected <a href="../symbols/Part.html" class="linkConstructor">Part</a>s.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canEditTextBlock">
<td class="name">
<div class="name">
canEditTextBlock(textblock)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#editTextBlock" class="linkMethod">editTextBlock</a> command.<span class="nodetails" id="xmethcanEditTextBlock"><a class="morelink" onclick="hst('methcanEditTextBlock')">More...</a></span> <span class="details" id="methcanEditTextBlock">
</span><div class="details" id="dmethcanEditTextBlock"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#editTextBlock" class="linkMethod">editTextBlock</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/TextBlock.html" class="linkConstructor">TextBlock</a>=}</span> <b>textblock</b>
</dt>
<dd>the <a href="../symbols/TextBlock.html" class="linkConstructor">TextBlock</a> to consider editing.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true:
if the diagram is not <a href="../symbols/Diagram.html#isReadOnly" class="linkProperty">Diagram.isReadOnly</a>,
if <a href="../symbols/Diagram.html#allowTextEdit" class="linkProperty">Diagram.allowTextEdit</a> is true,
if there is a <a href="../symbols/ToolManager.html#textEditingTool" class="linkProperty">ToolManager.textEditingTool</a>, and
if there is any selected <a href="../symbols/Part.html" class="linkConstructor">Part</a> for which <a href="../symbols/Part.html#canEdit" class="linkMethod">Part.canEdit</a> is true.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canExpandSubGraph">
<td class="name">
<div class="name">
canExpandSubGraph(group)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether the user can expand collapsed <a href="../symbols/Group.html" class="linkConstructor">Group</a>s.<span class="nodetails" id="xmethcanExpandSubGraph"><a class="morelink" onclick="hst('methcanExpandSubGraph')">More...</a></span> <span class="details" id="methcanExpandSubGraph">
</span><div class="details" id="dmethcanExpandSubGraph"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#expandSubGraph" class="linkMethod">expandSubGraph</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Group.html" class="linkConstructor">Group</a>=}</span> <b>group</b>
</dt>
<dd>if supplied, ignore the selection and consider expanding this particular Group.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> </dt>
</dl>
</div>
</td>
</tr>
<tr id="canExpandTree">
<td class="name">
<div class="name">
canExpandTree(node)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether the user can expand collapsed subtrees of <a href="../symbols/Node.html" class="linkConstructor">Node</a>s.<span class="nodetails" id="xmethcanExpandTree"><a class="morelink" onclick="hst('methcanExpandTree')">More...</a></span> <span class="details" id="methcanExpandTree">
</span><div class="details" id="dmethcanExpandTree"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#expandTree" class="linkMethod">expandTree</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Node.html" class="linkConstructor">Node</a>=}</span> <b>node</b>
</dt>
<dd>if supplied, ignore the selection and consider expanding this particular Node.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> </dt>
</dl>
</div>
</td>
</tr>
<tr id="canGroupSelection">
<td class="name">
<div class="name">
canGroupSelection()
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#groupSelection" class="linkMethod">groupSelection</a> command.<span class="nodetails" id="xmethcanGroupSelection"><a class="morelink" onclick="hst('methcanGroupSelection')">More...</a></span> <span class="details" id="methcanGroupSelection">
</span><div class="details" id="dmethcanGroupSelection"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#groupSelection" class="linkMethod">groupSelection</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true:
if the <a href="../symbols/CommandHandler.html#archetypeGroupData" class="linkProperty">archetypeGroupData</a> is not null,
if the diagram is not <a href="../symbols/Diagram.html#isReadOnly" class="linkProperty">Diagram.isReadOnly</a>,
if <a href="../symbols/Diagram.html#allowInsert" class="linkProperty">Diagram.allowInsert</a> is true,
if <a href="../symbols/Diagram.html#allowGroup" class="linkProperty">Diagram.allowGroup</a> is true,
if <a href="../symbols/Diagram.html#model" class="linkProperty">Diagram.model</a> is a <a href="../symbols/GraphLinksModel.html" class="linkConstructor">GraphLinksModel</a>, and
if there is any selected <a href="../symbols/Part.html" class="linkConstructor">Part</a> that can be <a href="../symbols/Part.html#canGroup" class="linkMethod">Part.canGroup</a>ed.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canIncreaseZoom">
<td class="name">
<div class="name">
canIncreaseZoom(factor)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#increaseZoom" class="linkMethod">increaseZoom</a> command.<span class="nodetails" id="xmethcanIncreaseZoom"><a class="morelink" onclick="hst('methcanIncreaseZoom')">More...</a></span> <span class="details" id="methcanIncreaseZoom">
</span><div class="details" id="dmethcanIncreaseZoom"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#increaseZoom" class="linkMethod">increaseZoom</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{number=}</span> <b>factor</b>
</dt>
<dd>This defaults to <a href="../symbols/CommandHandler.html#zoomFactor" class="linkProperty">zoomFactor</a>. The value should be greater than one.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true if <a href="../symbols/Diagram.html#allowZoom" class="linkProperty">Diagram.allowZoom</a> is true
and if the new scale is within the range of <a href="../symbols/Diagram.html#minScale" class="linkProperty">Diagram.minScale</a> and <a href="../symbols/Diagram.html#maxScale" class="linkProperty">Diagram.maxScale</a>.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canPasteSelection">
<td class="name">
<div class="name">
canPasteSelection()
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#pasteSelection" class="linkMethod">pasteSelection</a> command.<span class="nodetails" id="xmethcanPasteSelection"><a class="morelink" onclick="hst('methcanPasteSelection')">More...</a></span> <span class="details" id="methcanPasteSelection">
</span><div class="details" id="dmethcanPasteSelection"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#pasteSelection" class="linkMethod">pasteSelection</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true:
if the diagram is not <a href="../symbols/Diagram.html#isReadOnly" class="linkProperty">Diagram.isReadOnly</a>,
if <a href="../symbols/Diagram.html#allowInsert" class="linkProperty">Diagram.allowInsert</a> is true,
if <a href="../symbols/Diagram.html#allowClipboard" class="linkProperty">Diagram.allowClipboard</a> is true, and
if the clipboard has parts in it.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canRedo">
<td class="name">
<div class="name">
canRedo()
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#redo" class="linkMethod">redo</a> command.<span class="nodetails" id="xmethcanRedo"><a class="morelink" onclick="hst('methcanRedo')">More...</a></span> <span class="details" id="methcanRedo">
</span><div class="details" id="dmethcanRedo"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#redo" class="linkMethod">redo</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true:
if the diagram is not <a href="../symbols/Diagram.html#isReadOnly" class="linkProperty">Diagram.isReadOnly</a>,
if <a href="../symbols/Diagram.html#allowUndo" class="linkProperty">Diagram.allowUndo</a> is true, and
if the <a href="../symbols/UndoManager.html#canRedo" class="linkMethod">UndoManager.canRedo</a> predicate returns true.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canResetZoom">
<td class="name">
<div class="name">
canResetZoom(newscale)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#resetZoom" class="linkMethod">resetZoom</a> command.<span class="nodetails" id="xmethcanResetZoom"><a class="morelink" onclick="hst('methcanResetZoom')">More...</a></span> <span class="details" id="methcanResetZoom">
</span><div class="details" id="dmethcanResetZoom"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#resetZoom" class="linkMethod">resetZoom</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{number=}</span> <b>newscale</b>
</dt>
<dd>This defaults to <a href="../symbols/CommandHandler.html#defaultScale" class="linkProperty">defaultScale</a>, which is normally 1.0. The value should be greater than zero.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true if <a href="../symbols/Diagram.html#allowZoom" class="linkProperty">Diagram.allowZoom</a> is true.
and if the new scale is within the range of <a href="../symbols/Diagram.html#minScale" class="linkProperty">Diagram.minScale</a> and <a href="../symbols/Diagram.html#maxScale" class="linkProperty">Diagram.maxScale</a>.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canScrollToPart">
<td class="name">
<div class="name">
canScrollToPart(part)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
<span class="since" title="since">1.6</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#scrollToPart" class="linkMethod">scrollToPart</a> command.<span class="nodetails" id="xmethcanScrollToPart"><a class="morelink" onclick="hst('methcanScrollToPart')">More...</a></span> <span class="details" id="methcanScrollToPart">
This returns false if there is no argument Part and there are no selected Parts.
</span><div class="details" id="dmethcanScrollToPart"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#scrollToPart" class="linkMethod">scrollToPart</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Part.html" class="linkConstructor">Part</a>=}</span> <b>part</b>
</dt>
<dd>This defaults to the first selected Part of <a href="../symbols/Diagram.html#selection" class="linkProperty">Diagram.selection</a></dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true if <a href="../symbols/Diagram.html#allowHorizontalScroll" class="linkProperty">Diagram.allowHorizontalScroll</a> and <a href="../symbols/Diagram.html#allowVerticalScroll" class="linkProperty">Diagram.allowVerticalScroll</a> are true.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canSelectAll">
<td class="name">
<div class="name">
canSelectAll()
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#selectAll" class="linkMethod">selectAll</a> command.<span class="nodetails" id="xmethcanSelectAll"><a class="morelink" onclick="hst('methcanSelectAll')">More...</a></span> <span class="details" id="methcanSelectAll">
</span><div class="details" id="dmethcanSelectAll"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#selectAll" class="linkMethod">selectAll</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true if <a href="../symbols/Diagram.html#allowSelect" class="linkProperty">Diagram.allowSelect</a> is true.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canShowContextMenu">
<td class="name">
<div class="name">
canShowContextMenu(obj)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#showContextMenu" class="linkMethod">showContextMenu</a> command.<span class="nodetails" id="xmethcanShowContextMenu"><a class="morelink" onclick="hst('methcanShowContextMenu')">More...</a></span> <span class="details" id="methcanShowContextMenu">
</span><div class="details" id="dmethcanShowContextMenu"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#showContextMenu" class="linkMethod">showContextMenu</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/GraphObject.html" class="linkConstructor">GraphObject</a>|<a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a>=}</span> <b>obj</b>
</dt>
<dd>a GraphObject or Diagram with a contextMenu defined.
If none is given, this method will use the first selected object, or else the Diagram.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> </dt>
</dl>
</div>
</td>
</tr>
<tr id="canStopCommand">
<td class="name">
<div class="name">
canStopCommand()
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether the user may stop the current tool.<span class="nodetails" id="xmethcanStopCommand"><a class="morelink" onclick="hst('methcanStopCommand')">More...</a></span> <span class="details" id="methcanStopCommand">
This just returns true.
</span><div class="details" id="dmethcanStopCommand"><p>
This method may be overridden, but probably should not be overridden.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#stopCommand" class="linkMethod">stopCommand</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> true.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canUndo">
<td class="name">
<div class="name">
canUndo()
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#undo" class="linkMethod">undo</a> command.<span class="nodetails" id="xmethcanUndo"><a class="morelink" onclick="hst('methcanUndo')">More...</a></span> <span class="details" id="methcanUndo">
</span><div class="details" id="dmethcanUndo"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#undo" class="linkMethod">undo</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true:
if the diagram is not <a href="../symbols/Diagram.html#isReadOnly" class="linkProperty">Diagram.isReadOnly</a>,
if <a href="../symbols/Diagram.html#allowUndo" class="linkProperty">Diagram.allowUndo</a> is true, and
if the <a href="../symbols/UndoManager.html#canUndo" class="linkMethod">UndoManager.canUndo</a> predicate returns true.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canUngroupSelection">
<td class="name">
<div class="name">
canUngroupSelection(group)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#ungroupSelection" class="linkMethod">ungroupSelection</a> command.<span class="nodetails" id="xmethcanUngroupSelection"><a class="morelink" onclick="hst('methcanUngroupSelection')">More...</a></span> <span class="details" id="methcanUngroupSelection">
</span><div class="details" id="dmethcanUngroupSelection"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#ungroupSelection" class="linkMethod">ungroupSelection</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Group.html" class="linkConstructor">Group</a>=}</span> <b>group</b>
</dt>
<dd>if supplied, ignore the selection and consider ungrouping this particular Group.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true:
if the diagram is not <a href="../symbols/Diagram.html#isReadOnly" class="linkProperty">Diagram.isReadOnly</a>,
if <a href="../symbols/Diagram.html#allowDelete" class="linkProperty">Diagram.allowDelete</a> is true,
if <a href="../symbols/Diagram.html#allowUngroup" class="linkProperty">Diagram.allowUngroup</a> is true,
if <a href="../symbols/Diagram.html#model" class="linkProperty">Diagram.model</a> is a <a href="../symbols/GraphLinksModel.html" class="linkConstructor">GraphLinksModel</a>, and
if there are any selected <a href="../symbols/Group.html" class="linkConstructor">Group</a>s that are <a href="../symbols/Group.html#ungroupable" class="linkProperty">Group.ungroupable</a>.</dt>
</dl>
</div>
</td>
</tr>
<tr id="canZoomToFit">
<td class="name">
<div class="name">
canZoomToFit()
</div>
<div class="attributes">
<span class="light">{boolean}</span>
<span class="since" title="since">1.1</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate controls whether or not the user can invoke the <a href="../symbols/CommandHandler.html#zoomToFit" class="linkMethod">zoomToFit</a> command.<span class="nodetails" id="xmethcanZoomToFit"><a class="morelink" onclick="hst('methcanZoomToFit')">More...</a></span> <span class="details" id="methcanZoomToFit">
</span><div class="details" id="dmethcanZoomToFit"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
This method must not have any side-effects.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#zoomToFit" class="linkMethod">zoomToFit</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> This returns true if <a href="../symbols/Diagram.html#allowZoom" class="linkProperty">Diagram.allowZoom</a> is true.</dt>
</dl>
</div>
</td>
</tr>
<tr id="collapseSubGraph">
<td class="name">
<div class="name">
collapseSubGraph(group)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command collapses all expanded selected <a href="../symbols/Group.html" class="linkConstructor">Group</a>s.<span class="nodetails" id="xmethcollapseSubGraph"><a class="morelink" onclick="hst('methcollapseSubGraph')">More...</a></span> <span class="details" id="methcollapseSubGraph">
This operation is performed within a "Collapse SubGraph" transaction.
Just before the end of the transaction this raises the "SubGraphCollapsed" <a href="../symbols/DiagramEvent.html" class="linkConstructor">DiagramEvent</a>,
with a collection of collapsed <a href="../symbols/Group.html" class="linkConstructor">Group</a>s as the subject.
This currently has no default keyboard shortcut.
</span><div class="details" id="dmethcollapseSubGraph"><p>
This calls <a href="../symbols/Group.html#collapseSubGraph" class="linkMethod">Group.collapseSubGraph</a> to perform the collapse, which will set <a href="../symbols/Group.html#isSubGraphExpanded" class="linkProperty">Group.isSubGraphExpanded</a> to false.
You may want to save the collapsed/expanded state to the model by using a TwoWay <a href="../symbols/Binding.html" class="linkConstructor">Binding</a> on the "isSubGraphExpanded" property of your Groups,
and perhaps also on the <a href="../symbols/Group.html#wasSubGraphExpanded" class="linkProperty">Group.wasSubGraphExpanded</a> property.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canCollapseSubGraph" class="linkMethod">canCollapseSubGraph</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Group.html" class="linkConstructor">Group</a>=}</span> <b>group</b>
</dt>
<dd>if supplied, ignore the selection and collapse this particular Group.</dd>
</dl>
</div>
</td>
</tr>
<tr id="collapseTree">
<td class="name">
<div class="name">
collapseTree(node)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command collapses all expanded selected <a href="../symbols/Node.html" class="linkConstructor">Node</a>s.<span class="nodetails" id="xmethcollapseTree"><a class="morelink" onclick="hst('methcollapseTree')">More...</a></span> <span class="details" id="methcollapseTree">
This operation is performed within a "Collapse Tree" transaction.
Just before the end of the transaction this raises the "TreeCollapsed" <a href="../symbols/DiagramEvent.html" class="linkConstructor">DiagramEvent</a>,
with a collection of collapsed <a href="../symbols/Node.html" class="linkConstructor">Node</a>s as the subject.
This currently has no default keyboard shortcut.
</span><div class="details" id="dmethcollapseTree"><p>
This calls <a href="../symbols/Node.html#collapseTree" class="linkMethod">Node.collapseTree</a> to perform the collapse, which will set <a href="../symbols/Node.html#isTreeExpanded" class="linkProperty">Node.isTreeExpanded</a> to false.
You may want to save the collapsed/expanded state to the model by using a TwoWay <a href="../symbols/Binding.html" class="linkConstructor">Binding</a> on the "isTreeExpanded" property of your Nodes,
and perhaps also on the <a href="../symbols/Node.html#wasTreeExpanded" class="linkProperty">Node.wasTreeExpanded</a> property.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canCollapseTree" class="linkMethod">canCollapseTree</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Node.html" class="linkConstructor">Node</a>=}</span> <b>node</b>
</dt>
<dd>if supplied, ignore the selection and collapse this particular Node subtree.</dd>
</dl>
</div>
</td>
</tr>
<tr id="copySelection">
<td class="name">
<div class="name">
copySelection()
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command copies the currently selected parts, <a href="../symbols/Diagram.html#selection" class="linkProperty">Diagram.selection</a>, from the <a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a> into the clipboard.<span class="nodetails" id="xmethcopySelection"><a class="morelink" onclick="hst('methcopySelection')">More...</a></span> <span class="details" id="methcopySelection">
This is normally invoked by the <code>Ctrl-C</code> keyboard shortcut.
</span><div class="details" id="dmethcopySelection"><p>
This makes a copy of the current selection by calling <a href="../symbols/CommandHandler.html#copyToClipboard" class="linkMethod">copyToClipboard</a>.
This also raises the "ClipboardChanged" diagram event.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canCopySelection" class="linkMethod">canCopySelection</a></li>
</ul></div>
</div>
</td>
</tr>
<tr id="copyToClipboard">
<td class="name">
<div class="name">
copyToClipboard(coll)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>Make a copy of the given collection of <a href="../symbols/Part.html" class="linkConstructor">Part</a>s
and stores it in a static variable acting as the clipboard.<span class="nodetails" id="xmethcopyToClipboard"><a class="morelink" onclick="hst('methcopyToClipboard')">More...</a></span> <span class="details" id="methcopyToClipboard">
</span><div class="details" id="dmethcopyToClipboard"><p>
The clipboard is initially null.
It can hold a collection of copied <a href="../symbols/Part.html" class="linkConstructor">Part</a>s.
It also remembers the <a href="../symbols/Model.html#dataFormat" class="linkProperty">Model.dataFormat</a> of the diagram
from which the parts were copied.
<p>
This calls <a href="../symbols/Diagram.html#copyParts" class="linkMethod">Diagram.copyParts</a> in order to make a copy of the Parts for the clipboard.
The values of <a href="../symbols/CommandHandler.html#copiesParentKey" class="linkProperty">copiesParentKey</a> and <a href="../symbols/CommandHandler.html#copiesGroupKey" class="linkProperty">copiesGroupKey</a> affect whether
a copied node data remembers its tree parent node (if in a <a href="../symbols/TreeModel.html" class="linkConstructor">TreeModel</a>) or
its containing group (if in a <a href="../symbols/GraphLinksModel.html" class="linkConstructor">GraphLinksModel</a>).
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#pasteFromClipboard" class="linkMethod">pasteFromClipboard</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{Iterable.<Part>}</span> <b>coll</b>
</dt>
<dd>A collection of <a href="../symbols/Part.html" class="linkConstructor">Part</a>s.
If the value is null, the clipboard is cleared of all data.</dd>
</dl>
</div>
</td>
</tr>
<tr id="cutSelection">
<td class="name">
<div class="name">
cutSelection()
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command executes a <a href="../symbols/CommandHandler.html#copySelection" class="linkMethod">copySelection</a> followed by a <a href="../symbols/CommandHandler.html#deleteSelection" class="linkMethod">deleteSelection</a>.<span class="nodetails" id="xmethcutSelection"><a class="morelink" onclick="hst('methcutSelection')">More...</a></span> <span class="details" id="methcutSelection">
This is normally invoked by the <code>Ctrl-X</code> keyboard shortcut.
</span><div class="details" id="dmethcutSelection"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canCutSelection" class="linkMethod">canCutSelection</a></li>
</ul></div>
</div>
</td>
</tr>
<tr id="decreaseZoom">
<td class="name">
<div class="name">
decreaseZoom(factor)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command decreases the <a href="../symbols/Diagram.html#scale" class="linkProperty">Diagram.scale</a> by a given factor.<span class="nodetails" id="xmethdecreaseZoom"><a class="morelink" onclick="hst('methdecreaseZoom')">More...</a></span> <span class="details" id="methdecreaseZoom">
This is normally invoked by the <code>Ctrl--</code> and <code>Keypad--</code> keyboard shortcuts.
</span><div class="details" id="dmethdecreaseZoom"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canDecreaseZoom" class="linkMethod">canDecreaseZoom</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{number=}</span> <b>factor</b>
</dt>
<dd>This defaults to 1/<a href="../symbols/CommandHandler.html#zoomFactor" class="linkProperty">zoomFactor</a>. The value should be less than one and greater than zero.</dd>
</dl>
</div>
</td>
</tr>
<tr id="deleteSelection">
<td class="name">
<div class="name">
deleteSelection()
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command deletes the currently selected parts from the diagram.<span class="nodetails" id="xmethdeleteSelection"><a class="morelink" onclick="hst('methdeleteSelection')">More...</a></span> <span class="details" id="methdeleteSelection">
This is normally invoked by the <code>Del</code> keyboard shortcut.
</span><div class="details" id="dmethdeleteSelection"><p>
This will first raise the "SelectionDeleting" <a href="../symbols/DiagramEvent.html" class="linkConstructor">DiagramEvent</a>,
then start a "Delete" transaction, call <a href="../symbols/Diagram.html#removeParts" class="linkMethod">Diagram.removeParts</a>,
raise the "SelectionDeleted" diagram event, and finally commit the transaction.
<p>
Because this command changes the selection,
this method also raises the "ChangingSelection" and "ChangedSelection" diagram events.
All changes are performed within a transaction.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canDeleteSelection" class="linkMethod">canDeleteSelection</a></li>
</ul></div>
</div>
</td>
</tr>
<tr id="doKeyDown">
<td class="name">
<div class="name">
doKeyDown()
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This is called by tools to handle keyboard commands.<span class="nodetails" id="xmethdoKeyDown"><a class="morelink" onclick="hst('methdoKeyDown')">More...</a></span> <span class="details" id="methdoKeyDown">
For most commands, this calls the "can..." predicate; if that returns true it calls the command method.
If GoJS handles a key-down event as a keyboard command, the underlying event will not bubble.
</span><div class="details" id="dmethdoKeyDown"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.
<p>
There is an example custom CommandHandler in the extensions directory: <a href="../../extensions/DrawCommandHandler.js">DrawCommandHandler.js</a>,
which implements additional behaviors for the arrow keys by overriding this method.
For additional discussion, please read the <a href="../../intro/commands.html">Introduction page on Commands</a>.</div>
</div>
</td>
</tr>
<tr id="doKeyUp">
<td class="name">
<div class="name">
doKeyUp()
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This is called by tools to handle keyboard commands.<span class="nodetails" id="xmethdoKeyUp"><a class="morelink" onclick="hst('methdoKeyUp')">More...</a></span> <span class="details" id="methdoKeyUp">
</span><div class="details" id="dmethdoKeyUp"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</div>
</td>
</tr>
<tr id="editTextBlock">
<td class="name">
<div class="name">
editTextBlock(textblock)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command starts in-place editing of a <a href="../symbols/TextBlock.html" class="linkConstructor">TextBlock</a> in the selected <a href="../symbols/Part.html" class="linkConstructor">Part</a>.<span class="nodetails" id="xmetheditTextBlock"><a class="morelink" onclick="hst('metheditTextBlock')">More...</a></span> <span class="details" id="metheditTextBlock">
This is normally invoked by the <code>F2</code> keyboard shortcut.
</span><div class="details" id="dmetheditTextBlock"><p>
This starts the <a href="../symbols/TextEditingTool.html" class="linkConstructor">TextEditingTool</a> to have the user enter or modify the text string and finally set the <a href="../symbols/TextBlock.html#text" class="linkProperty">TextBlock.text</a>.
You may want to save the new string to the model by using a TwoWay <a href="../symbols/Binding.html" class="linkConstructor">Binding</a> on the "text" property of your TextBlock.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canEditTextBlock" class="linkMethod">canEditTextBlock</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/TextBlock.html" class="linkConstructor">TextBlock</a>=}</span> <b>textblock</b>
</dt>
<dd>the <a href="../symbols/TextBlock.html" class="linkConstructor">TextBlock</a> to start editing.</dd>
</dl>
</div>
</td>
</tr>
<tr id="expandSubGraph">
<td class="name">
<div class="name">
expandSubGraph(group)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command expands all collapsed selected <a href="../symbols/Group.html" class="linkConstructor">Group</a>s.<span class="nodetails" id="xmethexpandSubGraph"><a class="morelink" onclick="hst('methexpandSubGraph')">More...</a></span> <span class="details" id="methexpandSubGraph">
This operation is performed within an "Expand SubGraph" transaction.
Just before the end of the transaction this raises the "SubGraphExpanded" <a href="../symbols/DiagramEvent.html" class="linkConstructor">DiagramEvent</a>,
with a collection of expanded <a href="../symbols/Group.html" class="linkConstructor">Group</a>s as the subject.
This currently has no default keyboard shortcut.
</span><div class="details" id="dmethexpandSubGraph"><p>
This calls <a href="../symbols/Group.html#expandSubGraph" class="linkMethod">Group.expandSubGraph</a> to perform the collapse, which will set <a href="../symbols/Group.html#isSubGraphExpanded" class="linkProperty">Group.isSubGraphExpanded</a> to true.
You may want to save the collapsed/expanded state to the model by using a TwoWay <a href="../symbols/Binding.html" class="linkConstructor">Binding</a> on the "isSubGraphExpanded" property of your Groups,
and perhaps also on the <a href="../symbols/Group.html#wasSubGraphExpanded" class="linkProperty">Group.wasSubGraphExpanded</a> property.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canExpandSubGraph" class="linkMethod">canExpandSubGraph</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Group.html" class="linkConstructor">Group</a>=}</span> <b>group</b>
</dt>
<dd>if supplied, ignore the selection and expand this particular Group.</dd>
</dl>
</div>
</td>
</tr>
<tr id="expandTree">
<td class="name">
<div class="name">
expandTree(node)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command expands all collapsed selected <a href="../symbols/Node.html" class="linkConstructor">Node</a>s.<span class="nodetails" id="xmethexpandTree"><a class="morelink" onclick="hst('methexpandTree')">More...</a></span> <span class="details" id="methexpandTree">
This operation is performed within an "Expand Tree" transaction.
Just before the end of the transaction this raises the "TreeExpanded" <a href="../symbols/DiagramEvent.html" class="linkConstructor">DiagramEvent</a>,
with a collection of expanded <a href="../symbols/Node.html" class="linkConstructor">Node</a>s as the subject.
This currently has no default keyboard shortcut.
</span><div class="details" id="dmethexpandTree"><p>
This calls <a href="../symbols/Node.html#expandTree" class="linkMethod">Node.expandTree</a> to perform the expand, which will set <a href="../symbols/Node.html#isTreeExpanded" class="linkProperty">Node.isTreeExpanded</a> to true.
You may want to save the collapsed/expanded state to the model by using a TwoWay <a href="../symbols/Binding.html" class="linkConstructor">Binding</a> on the "isTreeExpanded" property of your Nodes,
and perhaps also on the <a href="../symbols/Node.html#wasTreeExpanded" class="linkProperty">Node.wasTreeExpanded</a> property.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canExpandTree" class="linkMethod">canExpandTree</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Node.html" class="linkConstructor">Node</a>=}</span> <b>node</b>
</dt>
<dd>if supplied, ignore the selection and collapse this particular Node subtree.</dd>
</dl>
</div>
</td>
</tr>
<tr id="followCollapsedPart">
<td class="name">
<div class="name">
followCollapsedPart(part, found)
</div>
<div class="attributes">
<span class="light">{Array}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p><span class="nodetails" id="xmethfollowCollapsedPart"><a class="morelink" onclick="hst('methfollowCollapsedPart')">More...</a></span> <span class="details" id="methfollowCollapsedPart"></span>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Part.html" class="linkConstructor">Part</a>}</span> <b>part</b>
</dt>
<dd></dd>
<dt>
<span class="light fixedFont">{Array}</span> <b>found</b>
</dt>
<dd></dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{Array}</span> </dt>
</dl>
</div>
</td>
</tr>
<tr id="groupSelection">
<td class="name">
<div class="name">
groupSelection()
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command adds a copy of <a href="../symbols/CommandHandler.html#archetypeGroupData" class="linkProperty">archetypeGroupData</a> to the diagram's model
to create a new <a href="../symbols/Group.html" class="linkConstructor">Group</a> and then adds the selected <a href="../symbols/Part.html" class="linkConstructor">Part</a>s to that new group.<span class="nodetails" id="xmethgroupSelection"><a class="morelink" onclick="hst('methgroupSelection')">More...</a></span> <span class="details" id="methgroupSelection">
This is normally invoked by the <code>Ctrl-G</code> keyboard shortcut.
</span><div class="details" id="dmethgroupSelection"><p>
This creates a new <a href="../symbols/Group.html" class="linkConstructor">Group</a> by adding a copy of the <a href="../symbols/CommandHandler.html#archetypeGroupData" class="linkProperty">archetypeGroupData</a> to the model.
Each of the selected parts for which <a href="../symbols/Part.html#canGroup" class="linkMethod">Part.canGroup</a> is true
and for which <a href="../symbols/CommandHandler.html#isValidMember" class="linkMethod">isValidMember</a> is true
is made a member of that new group.
If all of the selected groupable parts were members of a pre-existing group,
the new group also becomes a member of that pre-existing group,
if <a href="../symbols/CommandHandler.html#isValidMember" class="linkMethod">isValidMember</a> is true for that existing group with the new group.
The new group becomes the only selected part.
This raises the "SelectionGrouped" diagram event.
This method also raises the "ChangingSelection" and "ChangedSelection" diagram events.
All of the changes are performed in a "Group" transaction.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canGroupSelection" class="linkMethod">canGroupSelection</a></li>
</ul></div>
</div>
</td>
</tr>
<tr id="increaseZoom">
<td class="name">
<div class="name">
increaseZoom(factor)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command increases the <a href="../symbols/Diagram.html#scale" class="linkProperty">Diagram.scale</a> by a given factor.<span class="nodetails" id="xmethincreaseZoom"><a class="morelink" onclick="hst('methincreaseZoom')">More...</a></span> <span class="details" id="methincreaseZoom">
This is normally invoked by the <code>Ctrl-+</code> and <code>Keypad-+</code> keyboard shortcuts.
</span><div class="details" id="dmethincreaseZoom"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canIncreaseZoom" class="linkMethod">canIncreaseZoom</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{number=}</span> <b>factor</b>
</dt>
<dd>This defaults to <a href="../symbols/CommandHandler.html#zoomFactor" class="linkProperty">zoomFactor</a>. The value should be greater than one.</dd>
</dl>
</div>
</td>
</tr>
<tr id="isValidMember">
<td class="name">
<div class="name">
isValidMember(group, part)
</div>
<div class="attributes">
<span class="light">{boolean}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This predicate is called to determine whether a Node may be added as a member of a Group.<span class="nodetails" id="xmethisValidMember"><a class="morelink" onclick="hst('methisValidMember')">More...</a></span> <span class="details" id="methisValidMember">
This always checks to make sure no group might become a member of itself, either directly or indirectly.
If the Group has a <a href="../symbols/Group.html#memberValidation" class="linkProperty">Group.memberValidation</a> predicate and if it returns false, this method returns false.
If this CommandHandler has a <a href="../symbols/CommandHandler.html#memberValidation" class="linkProperty">memberValidation</a> predicate and if it returns false, this method returns false.
Otherwise this will return true.
<p class="box">
For a more general discussion of validation, see <a href="../../intro/validation.html">Introduction to Validation</a>.
</span><div class="details" id="dmethisValidMember"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Group.html" class="linkConstructor">Group</a>}</span> <b>group</b>
</dt>
<dd>this may be null if the node is being added as a top-level node.</dd>
<dt>
<span class="light fixedFont">{<a href="../symbols/Part.html" class="linkConstructor">Part</a>}</span> <b>part</b>
</dt>
<dd>a Part, usually a Node, possibly another Group, but not a Link or an Adornment.</dd>
</dl>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{boolean}</span> true if OK to add the node to the group.</dt>
</dl>
</div>
</td>
</tr>
<tr id="pasteFromClipboard">
<td class="name">
<div class="name">
pasteFromClipboard()
</div>
<div class="attributes">
<span class="light">{Set.<Part>}</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>If the clipboard holds a collection of <a href="../symbols/Part.html" class="linkConstructor">Part</a>s,
and if the <a href="../symbols/Model.html#dataFormat" class="linkProperty">Model.dataFormat</a> matches that stored in the clipboard,
this makes a copy of the clipboard's parts and adds the copies to this <a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a>.<span class="nodetails" id="xmethpasteFromClipboard"><a class="morelink" onclick="hst('methpasteFromClipboard')">More...</a></span> <span class="details" id="methpasteFromClipboard">
</span><div class="details" id="dmethpasteFromClipboard"><p>
This calls <a href="../symbols/Diagram.html#copyParts" class="linkMethod">Diagram.copyParts</a> in order to make a copy of the Parts in the clipboard and add them to this diagram.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#copyToClipboard" class="linkMethod">copyToClipboard</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Returns:</dt>
<dt><span class="light fixedFont">{Set.<Part>}</span> a collection of the newly pasted <a href="../symbols/Part.html" class="linkConstructor">Part</a>s,
or an empty Set if there was no data in the clipboard.</dt>
</dl>
</div>
</td>
</tr>
<tr id="pasteSelection">
<td class="name">
<div class="name">
pasteSelection(pos)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command copies the contents of the clipboard into this diagram and makes those new parts the new selection.<span class="nodetails" id="xmethpasteSelection"><a class="morelink" onclick="hst('methpasteSelection')">More...</a></span> <span class="details" id="methpasteSelection">
This is normally invoked by the <code>Ctrl-V</code> keyboard shortcut.
</span><div class="details" id="dmethpasteSelection"><p>
This calls <a href="../symbols/CommandHandler.html#pasteFromClipboard" class="linkMethod">pasteFromClipboard</a> to add copies of <a href="../symbols/Part.html" class="linkConstructor">Part</a>s
into this diagram, and then selects all of the newly created parts.
This also raises the "ClipboardPasted" diagram event.
This method raises the "ChangingSelection" and "ChangedSelection" diagram events.
All of the changes are performed in a transaction.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canPasteSelection" class="linkMethod">canPasteSelection</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Point.html" class="linkConstructor">Point</a>=}</span> <b>pos</b>
</dt>
<dd>Point at which to center the newly pasted parts; if not present the parts are not moved.</dd>
</dl>
</div>
</td>
</tr>
<tr id="redo">
<td class="name">
<div class="name">
redo()
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command calls <a href="../symbols/UndoManager.html#redo" class="linkMethod">UndoManager.redo</a>.<span class="nodetails" id="xmethredo"><a class="morelink" onclick="hst('methredo')">More...</a></span> <span class="details" id="methredo">
This is normally invoked by the <code>Ctrl-Y</code> keyboard shortcut.
</span><div class="details" id="dmethredo"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canRedo" class="linkMethod">canRedo</a></li>
</ul></div>
</div>
</td>
</tr>
<tr id="resetZoom">
<td class="name">
<div class="name">
resetZoom(newscale)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command sets the <a href="../symbols/Diagram.html#scale" class="linkProperty">Diagram.scale</a> to a new scale value, by default 1.<span class="nodetails" id="xmethresetZoom"><a class="morelink" onclick="hst('methresetZoom')">More...</a></span> <span class="details" id="methresetZoom">
This is normally invoked by the <code>Ctrl-0</code> keyboard shortcut.
</span><div class="details" id="dmethresetZoom"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canResetZoom" class="linkMethod">canResetZoom</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{number=}</span> <b>newscale</b>
</dt>
<dd>This defaults to <a href="../symbols/CommandHandler.html#defaultScale" class="linkProperty">defaultScale</a>, which is normally 1.0. The value should be greater than zero.</dd>
</dl>
</div>
</td>
</tr>
<tr id="scrollToPart">
<td class="name">
<div class="name">
scrollToPart(part)
</div>
<div class="attributes">
<span class="since" title="since">1.6</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command scrolls the diagram to make a highlighted or selected Part visible in the viewport.<span class="nodetails" id="xmethscrollToPart"><a class="morelink" onclick="hst('methscrollToPart')">More...</a></span> <span class="details" id="methscrollToPart">
Call this command repeatedly to cycle through the <a href="../symbols/Diagram.html#highlighteds" class="linkProperty">Diagram.highlighteds</a> collection,
if there are any Parts in that collection, or else in the <a href="../symbols/Diagram.html#selection" class="linkProperty">Diagram.selection</a> collection,
scrolling to each one in turn by calling <a href="../symbols/Diagram.html#centerRect" class="linkMethod">Diagram.centerRect</a>.
</span><div class="details" id="dmethscrollToPart"><p>
This is normally invoked by the <code>Space</code> keyboard shortcut.
If there is no argument and there is no highlighted or selected Part, this command does nothing.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canScrollToPart" class="linkMethod">canScrollToPart</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Part.html" class="linkConstructor">Part</a>=}</span> <b>part</b>
</dt>
<dd>This defaults to the first highlighted Part of <a href="../symbols/Diagram.html#highlighteds" class="linkProperty">Diagram.highlighteds</a>,
or, if there are no highlighted Parts, the first selected Part.</dd>
</dl>
</div>
</td>
</tr>
<tr id="selectAll">
<td class="name">
<div class="name">
selectAll()
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command selects all of the selectable <a href="../symbols/Part.html" class="linkConstructor">Part</a>s in the diagram by setting <a href="../symbols/Part.html#isSelected" class="linkProperty">Part.isSelected</a> to true on each one.<span class="nodetails" id="xmethselectAll"><a class="morelink" onclick="hst('methselectAll')">More...</a></span> <span class="details" id="methselectAll">
This is normally invoked by the <code>Ctrl-A</code> keyboard shortcut.
</span><div class="details" id="dmethselectAll"><p>
This method raises the "ChangingSelection" and "ChangedSelection" diagram events.
This ignores all parts in temporary layers.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canSelectAll" class="linkMethod">canSelectAll</a></li>
</ul></div>
</div>
</td>
</tr>
<tr id="showContextMenu">
<td class="name">
<div class="name">
showContextMenu(obj)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command opens the context menu for a selected Part or given GraphObject, or else for the whole Diagram.<span class="nodetails" id="xmethshowContextMenu"><a class="morelink" onclick="hst('methshowContextMenu')">More...</a></span> <span class="details" id="methshowContextMenu">
This is normally invoked by the <code>Menu</code> keyboard shortcut.
</span><div class="details" id="dmethshowContextMenu"><p>
The given GraphObject must have a <a href="../symbols/GraphObject.html#contextMenu" class="linkProperty">GraphObject.contextMenu</a>
defined in order to show anything.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canShowContextMenu" class="linkMethod">canShowContextMenu</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/GraphObject.html" class="linkConstructor">GraphObject</a>|<a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a>=}</span> <b>obj</b>
</dt>
<dd>a GraphObject or Diagram with a contextMenu defined.
If none is given, this method will use the first selected object, or else the Diagram.
The method will simulate a right-button click at the middle of the GraphObject or,
if a Diagram, at the current mouse position if it is in the viewport.</dd>
</dl>
</div>
</td>
</tr>
<tr id="stopCommand">
<td class="name">
<div class="name">
stopCommand()
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command cancels the operation of the current tool.<span class="nodetails" id="xmethstopCommand"><a class="morelink" onclick="hst('methstopCommand')">More...</a></span> <span class="details" id="methstopCommand">
This is typically called when the user presses ESCAPE.
</span><div class="details" id="dmethstopCommand"><p>
If the current tool is a <a href="../symbols/ToolManager.html" class="linkConstructor">ToolManager</a>, this clears the diagram's selection.
This then calls <a href="../symbols/Tool.html#doCancel" class="linkMethod">Tool.doCancel</a> on the current tool.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canStopCommand" class="linkMethod">canStopCommand</a></li>
</ul></div>
</div>
</td>
</tr>
<tr id="undo">
<td class="name">
<div class="name">
undo()
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command calls <a href="../symbols/UndoManager.html#undo" class="linkMethod">UndoManager.undo</a>.<span class="nodetails" id="xmethundo"><a class="morelink" onclick="hst('methundo')">More...</a></span> <span class="details" id="methundo">
This is normally invoked by the <code>Ctrl-Z</code> keyboard shortcut.
</span><div class="details" id="dmethundo"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canUndo" class="linkMethod">canUndo</a></li>
</ul></div>
</div>
</td>
</tr>
<tr id="ungroupSelection">
<td class="name">
<div class="name">
ungroupSelection(group)
</div>
<div class="attributes">
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command removes selected groups from the diagram without removing their members from the diagram.<span class="nodetails" id="xmethungroupSelection"><a class="morelink" onclick="hst('methungroupSelection')">More...</a></span> <span class="details" id="methungroupSelection">
This is normally invoked by the <code>Ctrl-Shift-G</code> keyboard shortcut.
</span><div class="details" id="dmethungroupSelection"><p>
For the given group, or if not supplied, each selected <a href="../symbols/Group.html" class="linkConstructor">Group</a> that is <a href="../symbols/Group.html#ungroupable" class="linkProperty">Group.ungroupable</a>,
expand the subgraph and change all of its member parts to be members of the group that the selected group node is in.
(If the selected group is a top-level node, i.e. not a member of any group node, its members become top-level parts too.)
All of those selected groups are deleted.
All of the reparented member parts are selected.
<p>
This raises the "SelectionUngrouped" diagram event.
This method also raises the "ChangingSelection" and "ChangedSelection" diagram events.
All of the changes are performed in an "Ungroup" transaction.
<p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canUngroupSelection" class="linkMethod">canUngroupSelection</a></li>
</ul></div>
<dl class="detailList">
<dt class="heading">Parameters:</dt>
<dt>
<span class="light fixedFont">{<a href="../symbols/Group.html" class="linkConstructor">Group</a>=}</span> <b>group</b>
</dt>
<dd>if supplied, ignore the selection and consider ungrouping this particular Group.</dd>
</dl>
</div>
</td>
</tr>
<tr id="zoomToFit">
<td class="name">
<div class="name">
zoomToFit()
</div>
<div class="attributes">
<span class="since" title="since">1.1</span>
</div>
</td>
<td class="description">
<div class="description">
<!--newp--><p><p>This command changes the <a href="../symbols/Diagram.html#scale" class="linkProperty">Diagram.scale</a> so that the <a href="../symbols/Diagram.html#documentBounds" class="linkProperty">Diagram.documentBounds</a> fits within the viewport.<span class="nodetails" id="xmethzoomToFit"><a class="morelink" onclick="hst('methzoomToFit')">More...</a></span> <span class="details" id="methzoomToFit">
If this command had been called before without any other zooming since then,
the original Diagram scale and position are restored.
This is normally invoked by the <code>Shift-Z</code> keyboard shortcut.
</span><div class="details" id="dmethzoomToFit"><p>
This method may be overridden, but you should consider calling this base method in order to get all of its functionality.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div>
</p><div class="seealso">See also:
<ul class="seealsolist">
<li><a href="../symbols/CommandHandler.html#canZoomToFit" class="linkMethod">canZoomToFit</a></li>
</ul></div>
</div>
</td>
</tr>
</tbody>
</table>
</div><!-- class="table-responsive">-->
<!-- ============================== events summary ======================== -->
<!-- ============================== fields summary ===================== -->
<!-- ============================== constructor details ==================== -->
</div> <!-- end contentBody -->
</div> <!-- end container-fluid -->
<!-- ============================== footer ================================= -->
<div id="footer" class="fineprint" style="clear:both">
Copyright © 1998-2017 by <a href="https://www.nwoods.com/">Northwoods Software Corporation.</a>
</div>
</body>
</html>
| dads-software-brotherhood/sekc | src/main/webapp/bower_components/goJs/api/symbols/CommandHandler.html | HTML | apache-2.0 | 176,345 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
4180,
1027,
1000,
9381,
1027,
5080... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package edu.mayo.cts2.framework.webapp.soap.wsdl;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter;
import edu.mayo.cts2.framework.core.config.ServerContext;
public class LocationAdjustingWsdlDefinitionHandlerAdapter extends WsdlDefinitionHandlerAdapter {
private static final String SOAP_URL_PREFIX = "/soap/service/";
@Resource
private ServerContext serverContext;
@Override
protected String transformLocation(String location, HttpServletRequest request) {
return this.serverContext.getServerRootWithAppName() +
SOAP_URL_PREFIX +
this.getServiceName(location);
}
private String getServiceName(String location){
return StringUtils.substringAfterLast(location, "/");
}
}
| bernardator/cts2-framework | cts2-webapp/src/main/java/edu/mayo/cts2/framework/webapp/soap/wsdl/LocationAdjustingWsdlDefinitionHandlerAdapter.java | Java | apache-2.0 | 854 | [
30522,
7427,
3968,
2226,
1012,
14415,
1012,
14931,
2015,
2475,
1012,
7705,
1012,
4773,
29098,
1012,
7815,
1012,
1059,
16150,
2140,
1025,
12324,
9262,
2595,
1012,
5754,
17287,
3508,
1012,
7692,
1025,
12324,
9262,
2595,
1012,
14262,
2615,
748... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*-------------------------
Simple reset
--------------------------*/
*{
margin:0;
padding:0;
}
/*-------------------------
General Styles
--------------------------*/
html{
background:url('../img/bg_tile.jpg') #161718;
}
body{
background:url('../img/bg_center.jpg') no-repeat center center;
min-height: 600px;
padding: 200px 0 0;
font:14px/1.3 'Segoe UI',Arial, sans-serif;
}
a, a:visited {
text-decoration:none;
outline:none;
color:#54a6de;
}
a:hover{
text-decoration:underline;
}
section, footer{
display: block;
}
/*----------------------------
Styling the forms
-----------------------------*/
#formContainer{
width:288px;
height:321px;
margin:0 auto;
position:relative;
z-index:1;
-moz-perspective: 800px;
-webkit-perspective: 800px;
perspective: 800px;
}
#formContainer form{
width:100%;
height:100%;
position:absolute;
top:0;
left:0;
/* Enabling 3d space for the transforms */
-moz-transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
/* When the forms are flipped, they will be hidden */
-moz-backface-visibility: hidden;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
/* Enabling a smooth animated transition */
-moz-transition:0.8s;
-webkit-transition:0.8s;
transition:0.8s;
/* Configure a keyframe animation for Firefox */
-moz-animation: pulse 2s infinite;
/* Configure it for Chrome and Safari */
-webkit-animation: pulse 2s infinite;
}
/* Firefox Keyframe Animation */
@-moz-keyframes pulse{
0%{ box-shadow:0 0 1px #008aff;}
50%{ box-shadow:0 0 8px #008aff;}
100%{ box-shadow:0 0 1px #008aff;}
}
/* Webkit keyframe animation */
@-webkit-keyframes pulse{
0%{ box-shadow:0 0 1px #008aff;}
50%{ box-shadow:0 0 10px #008aff;}
100%{ box-shadow:0 0 1px #008aff;}
}
#login{
background:url('../img/login_form_bg.jpg') no-repeat;
z-index:100;
}
#recover{
background:url('../img/recover_form_bg.jpg') no-repeat;
z-index:1;
opacity:0;
/* Rotating the recover password form by default */
-moz-transform:rotateY(180deg);
-webkit-transform:rotateY(180deg);
transform:rotateY(180deg);
}
#formContainer.flipped #login{
opacity:0;
/**
* Rotating the login form when the
* flipped class is added to the container
*/
-moz-transform:rotateY(-180deg);
-webkit-transform:rotateY(-180deg);
transform:rotateY(-180deg);
}
#formContainer.flipped #recover{
opacity:1;
/* Rotating the recover div into view */
-moz-transform:rotateY(0deg);
-webkit-transform:rotateY(0deg);
transform:rotateY(0deg);
}
/*----------------------------
Inputs, Buttons & Links
-----------------------------*/
#login .flipLink,
#recover .flipLink{
/* The blue ribbon links */
height: 65px;
overflow: hidden;
position: absolute;
right: 0;
text-indent: -9999px;
top: 0;
width: 65px;
}
#recover .flipLink{
right:auto;
left:0;
}
#login:after{
/* The "Click here" tooltip */
width:98px;
height:16px;
content:'';
position:absolute;
right:-120px;
top:22px;
}
input[type=text],input[type=password]{
/* The text fields */
font: 15px 'Segoe UI',Arial,sans-serif;
border: none;
background:none;
height: 36px;
left: 26px;
position: absolute;
top: 176px;
width: 234px;
text-indent: 8px;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
color:#eee;
outline:none;
}
#loginPass{
top: 215px;
}
#recoverEmail{
top:215px;
}
input[type=submit]{
/* Submit button */
opacity:0.9;
position:absolute;
top:262px;
left:25px;
width: 239px;
height:36px;
cursor:pointer;
border-radius:6px;
box-shadow:0 1px 1px #888;
border:none;
color:#fff;
font:14px/36px 'Segoe UI Light','Segoe UI',Arial,sans-serif;
/* CSS3 Gradients */
background-image: linear-gradient(bottom, rgb(80,102,127) 50%, rgb(87,109,136) 50%, rgb(106,129,155) 100%);
background-image: -o-linear-gradient(bottom, rgb(80,102,127) 50%, rgb(87,109,136) 50%, rgb(106,129,155) 100%);
background-image: -moz-linear-gradient(bottom, rgb(80,102,127) 50%, rgb(87,109,136) 50%, rgb(106,129,155) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(80,102,127) 50%, rgb(87,109,136) 50%, rgb(106,129,155) 100%);
background-image: -ms-linear-gradient(bottom, rgb(80,102,127) 50%, rgb(87,109,136) 50%, rgb(106,129,155) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.5, rgb(80,102,127)),
color-stop(0.5, rgb(87,109,136)),
color-stop(1, rgb(106,129,155))
);
}
input[type=submit]:hover{
opacity:1;
}
input::-webkit-input-placeholder {
color:#eee;
}
/*----------------------------
The Footer
-----------------------------*/
footer{
background-color: #111111;
bottom: 0;
box-shadow: 0 -1px 2px #111111;
height: 45px;
left: 0;
position: fixed;
width: 100%;
z-index: 100000;
}
footer h2{
color: #EEEEEE;
font-size: 14px;
font-weight: normal;
left: 50%;
margin-left: -400px;
padding: 13px 0 0;
position: absolute;
width: 540px;
}
footer h2 i{
font-style:normal;
color:#888;
}
footer a.tzine,a.tzine:visited{
color: #999999;
font-size: 12px;
left: 50%;
margin: 16px 0 0 110px;
position: absolute;
text-decoration: none;
top: 0;
}
footer a i{
color:#ccc;
font-style: normal;
}
footer a i b{
color:#c92020;
font-weight: normal;
}
| OnlyD/Agenda_ILM | src/AppBundle/Resources/librerias/css/styles.css | CSS | mit | 5,293 | [
30522,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
3722,
25141,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package main
import (
"fmt"
"sort"
)
func main() {
var colors = []string{"Red", "Green", "Blue"}
fmt.Println(colors)
colors = append(colors, "Purple")
fmt.Println(colors)
colors = append(colors[1:len(colors)])
fmt.Println(colors)
colors = append(colors[1:])
fmt.Println(colors)
colors = append(colors[:len(colors)-1])
fmt.Println(colors)
numbers := make([]int, 5, 5)
numbers[0] = 134
numbers[1] = 72
numbers[2] = 32
numbers[3] = 12
numbers[4] = 156
fmt.Println(numbers)
numbers = append(numbers, 235)
fmt.Println(numbers)
fmt.Println(cap(numbers))
sort.Ints(numbers)
fmt.Println(numbers)
} | franklinsales/go-fundamentals | Ch04/04_03/slices.go | GO | mit | 626 | [
30522,
7427,
2364,
12324,
1006,
1000,
4718,
2102,
1000,
1000,
4066,
1000,
1007,
4569,
2278,
2364,
1006,
1007,
1063,
13075,
6087,
1027,
1031,
1033,
5164,
1063,
1000,
2417,
1000,
1010,
1000,
2665,
1000,
1010,
1000,
2630,
1000,
1065,
4718,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var utils = {
handleError: function(dataToLogToConsole, errorMessage, errorObj) {
console.log(dataToLogToConsole || errorMessage);
if (errorMessage) {
var alertMessage = errorMessage;
// if error object is passed, then append error message in the error object
if (errorObj && errorObj.hasOwnProperty('message')) {
// message returned from the server is actually stringified json. Try to parse it as json
// It contains code and message
var errorJSON = JSON.parse(errorObj.message);
if (errorJSON.hasOwnProperty('message')) {
alertMessage += ". " + errorJSON.message;
}
else {
alertMessage += ". " + errorObj.message;
}
}
alert(alertMessage);
}
}
}
module.exports = utils;
| typekit/platform-demo-browse | js/modules/utils.js | JavaScript | mit | 795 | [
30522,
13075,
21183,
12146,
1027,
1063,
5047,
2121,
29165,
1024,
3853,
1006,
2951,
3406,
21197,
3406,
8663,
19454,
2063,
1010,
7561,
7834,
3736,
3351,
1010,
7561,
16429,
3501,
1007,
1063,
10122,
1012,
8833,
1006,
2951,
3406,
21197,
3406,
86... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import { expect } from "chai";
import { createStore, applyMiddleware } from 'redux';
import Immutable from 'immutable';
import reducers from '../src/lib/reducers';
import * as Utils from '../src/lib/utils';
describe('utils', function () {
beforeEach(function () {
this.state = Immutable.fromJS([
{title: "alpha"},
{title: "beta", children: [
{title: "foo"},
{title: "bar", children: [
{title: "quux"},
{title: "xyzzy"}
]},
{title: "baz"}
]},
{title: "gamma"},
{title: "level1", children: [
{title: 'level2', children: [
{title: 'level3', children: [
{title: 'level4'}
]}
]}
]},
{title: 'thud'}
]);
this.store = createStore(reducers, {
nodes: this.state
});
this.expectedSeries = [
'0',
'1',
'1.children.0',
'1.children.1',
'1.children.1.children.0',
'1.children.1.children.1',
'1.children.2',
'2',
'3',
'3.children.0',
'3.children.0.children.0',
'3.children.0.children.0.children.0',
'4'
];
this.expectedSiblings = [
['0', '1', '2', '3', '4'],
['1.children.0', '1.children.1', '1.children.2'],
['1.children.1.children.0', '1.children.1.children.1'],
['3.children.0']
['3.children.0.children.0'],
['3.children.0.children.0.children.0'],
];
});
describe('splitPath', function () {
it('should split a dot-delimited path into a key array', function () {
expect(Utils.splitPath('1.children.1.children.2'))
.to.deep.equal(['1', 'children', '1', 'children', '2']);
})
})
describe('getNodeContext', function () {
it('should construct contextual information for a node path', function () {
var path = '1.children.1.children.0';
var expected = {
key: ['1', 'children', '1', 'children', '0'],
parentKey: ['1', 'children', '1'],
index: 0,
value: this.state.getIn(['1', 'children', '1', 'children', '0']),
siblings: this.state.getIn(['1', 'children', '1', 'children'])
};
var result = Utils.getNodeContext(this.state, path);
expect(result).to.deep.equal(expected);
})
});
function commonSiblingPathTest (inReverse, state, expectedSiblings) {
var traversal = inReverse ?
Utils.getPreviousSiblingPath :
Utils.getNextSiblingPath;
var siblingList;
while (siblingList = expectedSiblings.shift()) {
if (inReverse) { siblingList.reverse(); }
var current, expected, result;
current = siblingList.shift();
while (siblingList.length) {
expected = siblingList.shift();
result = traversal(state, current);
expect(result).to.equal(expected);
current = expected;
}
result = traversal(state, current);
expect(result).to.equal(null);
}
}
describe('getNextSiblingPath', function () {
it('should find the path to the next sibling', function () {
commonSiblingPathTest(false, this.state, this.expectedSiblings);
});
});
describe('getPreviousSiblingPath', function () {
it('should find the path to the previous sibling', function () {
commonSiblingPathTest(true, this.state, this.expectedSiblings);
});
});
function commonNodePathTest (inReverse, state, expectedSeries) {
var current, expected, result;
var traversal = (inReverse) ?
Utils.getPreviousNodePath : Utils.getNextNodePath;
if (inReverse) { expectedSeries.reverse(); }
current = expectedSeries.shift();
while (expectedSeries.length) {
expected = expectedSeries.shift();
result = traversal(state, current);
expect(result).to.equal(expected);
current = expected;
}
}
describe('getNextNodePath', function () {
it('should find the path to the next node', function () {
commonNodePathTest(false, this.state, this.expectedSeries);
})
it('should skip children of collapsed nodes', function () {
let state = this.state;
['1', '3.children.0'].forEach(path => {
state = state.updateIn(
path.split('.'),
n => n.set('collapsed', true));
});
commonNodePathTest(false, state,
['0', '1', '2', '3', '3.children.0', '4']);
});
});
describe('getPreviousNodePath', function () {
it('should find the path to the previous node', function () {
commonNodePathTest(true, this.state, this.expectedSeries);
});
it('should skip children of collapsed nodes', function () {
let state = this.state;
['1', '3.children.0'].forEach(path => {
state = state.updateIn(
path.split('.'),
n => n.set('collapsed', true));
});
commonNodePathTest(true, state,
['0', '1', '2', '3', '3.children.0', '4']);
});
});
});
| lmorchard/arboretum | test/test-utils.js | JavaScript | mit | 4,905 | [
30522,
12324,
1063,
5987,
1065,
2013,
1000,
15775,
2072,
1000,
1025,
12324,
1063,
9005,
19277,
1010,
6611,
4328,
20338,
8059,
1065,
2013,
30524,
2497,
1013,
21183,
12146,
1005,
1025,
6235,
1006,
1005,
21183,
12146,
1005,
1010,
3853,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package github
import (
"github.com/drone/config"
"github.com/armab/drone/plugin/remote"
)
var (
// GitHub cloud configuration details
githubClient = config.String("github-client", "")
githubSecret = config.String("github-secret", "")
githubOrgs = config.Strings("github-orgs")
githubOpen = config.Bool("github-open", false)
// GitHub Enterprise configuration details
githubEnterpriseURL = config.String("github-enterprise-url", "")
githubEnterpriseAPI = config.String("github-enterprise-api", "")
githubEnterpriseClient = config.String("github-enterprise-client", "")
githubEnterpriseSecret = config.String("github-enterprise-secret", "")
githubEnterprisePrivate = config.Bool("github-enterprise-private-mode", true)
githubEnterpriseSkipVerify = config.Bool("github-enterprise-skip-verify", false)
githubEnterpriseOrgs = config.Strings("github-enterprise-orgs")
githubEnterpriseOpen = config.Bool("github-enterprise-open", false)
)
// Registers the GitHub plugins using the default
// settings from the config file or environment
// variables.
func Register() {
registerGitHub()
registerGitHubEnterprise()
}
// registers the GitHub (github.com) plugin
func registerGitHub() {
if len(*githubClient) == 0 || len(*githubSecret) == 0 {
return
}
remote.Register(
NewDefault(*githubClient, *githubSecret, *githubOrgs, *githubOpen),
)
}
// registers the GitHub Enterprise plugin
func registerGitHubEnterprise() {
if len(*githubEnterpriseURL) == 0 ||
len(*githubEnterpriseAPI) == 0 ||
len(*githubEnterpriseClient) == 0 ||
len(*githubEnterpriseSecret) == 0 {
return
}
remote.Register(
New(
*githubEnterpriseURL,
*githubEnterpriseAPI,
*githubEnterpriseClient,
*githubEnterpriseSecret,
*githubEnterprisePrivate,
*githubEnterpriseSkipVerify,
*githubEnterpriseOrgs,
*githubEnterpriseOpen,
),
)
}
| armab/drone | plugin/remote/github/register.go | GO | apache-2.0 | 1,897 | [
30522,
7427,
21025,
2705,
12083,
12324,
1006,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
18465,
1013,
9530,
8873,
2290,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
2849,
7875,
1013,
18465,
1013,
13354,
2378,
1013,
6556,
1000,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "cuehandler.hpp"
CueHandler *CueHandler::New(){
return new CueHandler;
}
/*void CueHandler::Execute(vtkObject *vtkNotUsed(caller), unsigned long event, void *calldata){
if((this->animator != 0) && (this->renderer != 0)){
vtkAnimationCue::AnimationCueInfo *info =
static_cast<vtkAnimationCue::AnimationCueInfo *>(calldata);
switch(event){
case vtkCommand::StartAnimationCueEvent:
animator->Start(info, this->renderer);
break;
case vtkCommand::AnimationCueTickEvent:
animator->Tick(info, this->renderer);
break;
case vtkCommand::EndAnimationCueEvent:
animator->Stop(info, this->renderer);
break;
}
}
}
*/
void CueHandler::Execute(vtkObject *vtkNotUsed(caller), unsigned long event, void *calldata){
animator->render();
}
void CueHandler::RegisterAnimator(std::shared_ptr<ImageAnimator> animatorptr){
this->animator = animatorptr;
}
void CueHandler::RegisterRenderer(vtkRenderer* renderptr){
this->renderer = renderptr;
}
| Telemin/buddhabrot | cuehandler.cpp | C++ | unlicense | 1,030 | [
30522,
1001,
2421,
1000,
16091,
11774,
3917,
1012,
6522,
2361,
1000,
16091,
11774,
3917,
1008,
16091,
11774,
3917,
1024,
1024,
2047,
1006,
1007,
1063,
2709,
2047,
16091,
11774,
3917,
1025,
1065,
1013,
1008,
11675,
16091,
11774,
3917,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<title>Uses of Class org.eclipse.emf.cdo.server.db.mapping.ColumnTypeModifier.Factory (CDO Model Repository Documentation)</title>
<meta name="date" content="">
<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 org.eclipse.emf.cdo.server.db.mapping.ColumnTypeModifier.Factory (CDO Model Repository Documentation)";
}
}
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="../../../../../../../../org/eclipse/emf/cdo/server/db/mapping/ColumnTypeModifier.Factory.html" title="class in org.eclipse.emf.cdo.server.db.mapping">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../index.html?org/eclipse/emf/cdo/server/db/mapping/class-use/ColumnTypeModifier.Factory.html" target="_top">Frames</a></li>
<li><a href="ColumnTypeModifier.Factory.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 org.eclipse.emf.cdo.server.db.mapping.ColumnTypeModifier.Factory" class="title">Uses of Class<br>org.eclipse.emf.cdo.server.db.mapping.ColumnTypeModifier.Factory</h2>
</div>
<div class="classUseContainer">No usage of org.eclipse.emf.cdo.server.db.mapping.ColumnTypeModifier.Factory</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="../../../../../../../../org/eclipse/emf/cdo/server/db/mapping/ColumnTypeModifier.Factory.html" title="class in org.eclipse.emf.cdo.server.db.mapping">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../index.html?org/eclipse/emf/cdo/server/db/mapping/class-use/ColumnTypeModifier.Factory.html" target="_top">Frames</a></li>
<li><a href="ColumnTypeModifier.Factory.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><i>Copyright (c) 2011-2015 Eike Stepper (Berlin, Germany) and others.</i></small></p>
</body>
</html>
| kribe48/wasp-mbse | WASP-turtlebot-DSL/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/org.eclipse.osgi/142/0/.cp/javadoc/org/eclipse/emf/cdo/server/db/mapping/class-use/ColumnTypeModifier.Factory.html | HTML | mit | 4,816 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!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 (version 1.7.0_72) on Wed Nov 05 20:55:55 EST 2014 -->
<title>Uses of Class org.apache.cassandra.streaming.ProgressInfo.Direction (apache-cassandra API)</title>
<meta name="date" content="2014-11-05">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.cassandra.streaming.ProgressInfo.Direction (apache-cassandra API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/cassandra/streaming/class-use/ProgressInfo.Direction.html" target="_top">Frames</a></li>
<li><a href="ProgressInfo.Direction.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 org.apache.cassandra.streaming.ProgressInfo.Direction" class="title">Uses of Class<br>org.apache.cassandra.streaming.ProgressInfo.Direction</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</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="#org.apache.cassandra.streaming">org.apache.cassandra.streaming</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.apache.cassandra.streaming">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</a> in <a href="../../../../../org/apache/cassandra/streaming/package-summary.html">org.apache.cassandra.streaming</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation">
<caption><span>Fields in <a href="../../../../../org/apache/cassandra/streaming/package-summary.html">org.apache.cassandra.streaming</a> declared as <a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</a></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>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</a></code></td>
<td class="colLast"><span class="strong">ProgressInfo.</span><code><strong><a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.html#direction">direction</a></strong></code> </td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/apache/cassandra/streaming/package-summary.html">org.apache.cassandra.streaming</a> that return <a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</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>static <a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</a></code></td>
<td class="colLast"><span class="strong">ProgressInfo.Direction.</span><code><strong><a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html#fromByte(byte)">fromByte</a></strong>(byte direction)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</a></code></td>
<td class="colLast"><span class="strong">ProgressInfo.Direction.</span><code><strong><a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html#valueOf(java.lang.String)">valueOf</a></strong>(java.lang.String name)</code>
<div class="block">Returns the enum constant of this type with the specified name.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</a>[]</code></td>
<td class="colLast"><span class="strong">ProgressInfo.Direction.</span><code><strong><a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html#values()">values</a></strong>()</code>
<div class="block">Returns an array containing the constants of this enum type, in
the order they are declared.</div>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/apache/cassandra/streaming/package-summary.html">org.apache.cassandra.streaming</a> with parameters of type <a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</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>void</code></td>
<td class="colLast"><span class="strong">StreamSession.</span><code><strong><a href="../../../../../org/apache/cassandra/streaming/StreamSession.html#progress(org.apache.cassandra.io.sstable.Descriptor,%20org.apache.cassandra.streaming.ProgressInfo.Direction,%20long,%20long)">progress</a></strong>(<a href="../../../../../org/apache/cassandra/io/sstable/Descriptor.html" title="class in org.apache.cassandra.io.sstable">Descriptor</a> desc,
<a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</a> direction,
long bytes,
long total)</code> </td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructors in <a href="../../../../../org/apache/cassandra/streaming/package-summary.html">org.apache.cassandra.streaming</a> with parameters of type <a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colLast"><code><strong><a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.html#ProgressInfo(java.net.InetAddress,%20int,%20java.lang.String,%20org.apache.cassandra.streaming.ProgressInfo.Direction,%20long,%20long)">ProgressInfo</a></strong>(java.net.InetAddress peer,
int sessionIndex,
java.lang.String fileName,
<a href="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">ProgressInfo.Direction</a> direction,
long currentBytes,
long totalBytes)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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="../../../../../org/apache/cassandra/streaming/ProgressInfo.Direction.html" title="enum in org.apache.cassandra.streaming">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/cassandra/streaming/class-use/ProgressInfo.Direction.html" target="_top">Frames</a></li>
<li><a href="ProgressInfo.Direction.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>Copyright © 2014 The Apache Software Foundation</small></p>
</body>
</html>
| vangav/vos_backend | apache-cassandra-2.1.2/javadoc/org/apache/cassandra/streaming/class-use/ProgressInfo.Direction.html | HTML | mit | 11,500 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.tbp.safemaps;
import the.safemaps.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MarkUnsafe extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.marksafe);
//Button back = (Button)findViewById(R.id.mbuttonBack);
Button done = (Button)findViewById(R.id.done);
done.setOnClickListener(onClickListener);
// back.setOnClickListener(onClickListener);
}
private OnClickListener onClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
switch(v.getId()){
// case R.id.go:
// Intent go= new Intent(Markunsafe.this,mapdirections.class);
//startActivity(go);
//break;
}
}
};
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
super.onOptionsItemSelected(item);
switch(item.getItemId())
{
case R.id.action_bar:
//Toast.makeText(getBaseContext(), "back", Toast.LENGTH_SHORT).show();
Intent back= new Intent(MarkUnsafe.this,MainActivity.class);
startActivity(back);
break;
}
return true;
}
}
| thebachchaoproject/safemaps | safemaps_android/src/com/tbp/safemaps/MarkUnsafe.java | Java | mit | 1,557 | [
30522,
7427,
4012,
1012,
26419,
2361,
1012,
3647,
2863,
4523,
1025,
12324,
1996,
1012,
3647,
2863,
4523,
1012,
1054,
1025,
30524,
2213,
1025,
12324,
11924,
1012,
3193,
1012,
3193,
1025,
12324,
11924,
1012,
3193,
1012,
3193,
1012,
2006,
2046... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/***************************************************************
*
* Copyright (C) 1990-2009, Condor Team, Computer Sciences Department,
* University of Wisconsin-Madison, WI.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
***************************************************************/
#include "condor_common.h"
#include "condor_open.h"
#include "condor_debug.h"
#include <stdarg.h>
#include "read_user_log.h"
#include <time.h>
#include "MyString.h"
#include "condor_uid.h"
#include "condor_config.h"
#include "stat_wrapper.h"
#include "file_lock.h"
#include "read_user_log_state.h"
#include "user_log_header.h"
static const char SynchDelimiter[] = "...\n";
// Values for min scores
const int SCORE_THRESH_RESTORE = 10;
const int SCORE_THRESH_FWSEARCH = 4;
const int SCORE_THRESH_NONROT = 3;
const int SCORE_MIN_MATCH = 1;
// Score factor values
// For Windoze:
// st_ino is meaningless, so we ignore it; set it's factor to zero
// UNIX:
// We look at the inode & ctime
// Note: inodes are recycled; and thus an idential inode number
// does *not* garentee the we have the same file
// Also note that ctime is "change time" of the inode *not*
// creation time, we can't completely rely on it, either :(
const int SCORE_FACTOR_UNIQ_MATCH = 100;
# if defined(WIN32)
const int SCORE_FACTOR_CTIME = 2;
const int SCORE_FACTOR_INODE = 0;
# else
const int SCORE_FACTOR_CTIME = 1;
const int SCORE_FACTOR_INODE = 2;
# endif
const int SCORE_FACTOR_SAME_SIZE = 2;
const int SCORE_FACTOR_GROWN = 1;
const int SCORE_FACTOR_SHRUNK = -5;
// Threshold to consider file stat's as recent (seconds)
const int SCORE_RECENT_THRESH = 60;
// Class to manage score the user logs
// This class was created because you can't pre-declare the
// StructStatType in the main header file, so I created this simple
// class to manage all related stuff
class ReadUserLogMatch
{
public:
// Constructor & destructor
ReadUserLogMatch( ReadUserLogState *state ) {
m_state = state;
};
// Note: *Don't* delete m_state -- see the comment below
~ReadUserLogMatch( void ) { };
// Results of file compare
enum MatchResult {
MATCH_ERROR = -1, MATCH = 0, UNKNOWN, NOMATCH,
};
// Compare the specified file / file info with the cached info
MatchResult Match(
int rot,
int match_thresh,
int *score = NULL ) const;
MatchResult Match(
const char *path,
int rot,
int match_thresh,
int *score = NULL ) const;
MatchResult Match(
StatStructType &statbuf,
int rot,
int match_thresh,
int *score = NULL ) const;
// Get a string to match the result value
const char *MatchStr( MatchResult value ) const;
private:
MatchResult MatchInternal(
int rot,
const char *path,
int match_thresh,
int *state_score ) const;
MatchResult EvalScore(
int max_thresh,
int score ) const;
// NOTE: m_state is *not* owned by this object, but, rather,
// we store a pointer to it for easy access
ReadUserLogState *m_state; // File state info
};
// **********************************
// ReadUserLog class methods
// **********************************
ReadUserLog::ReadUserLog ( bool isEventLog )
{
clear();
if ( isEventLog ) {
initialize( );
}
}
ReadUserLog::ReadUserLog (const char * filename, bool read_only )
{
clear();
if (!initialize(filename, false, false, read_only )) {
dprintf(D_ALWAYS, "Failed to open %s\n", filename);
}
}
// Constructor that takes a state
ReadUserLog::ReadUserLog (const FileState &state, bool read_only )
{
clear();
if (!initialize(state, read_only )) {
dprintf(D_ALWAYS, "Failed to initialize from state\n");
}
}
// Create a log reader with minimal functionality
// Only reads from the file, will not lock, write the header, etc.
ReadUserLog::ReadUserLog ( FILE *fp, bool is_xml, bool enable_close )
{
clear();
if ( ! fp ) {
return;
}
m_fp = fp;
m_fd = fileno( fp );
m_enable_close = enable_close;
m_lock = new FakeFileLock( );
m_state = new ReadUserLogState( );
m_match = new ReadUserLogMatch( m_state );
m_initialized = true;
setIsXMLLog( is_xml );
}
// ***************************************
// * Initializers which take a file name
// ***************************************
// Initialize to read the global event log
bool
ReadUserLog::initialize( void )
{
char *path = param( "EVENT_LOG" );
if ( NULL == path ) {
Error( LOG_ERROR_FILE_NOT_FOUND,__LINE__ );
return false;
}
int max_rotations = param_integer( "EVENT_LOG_MAX_ROTATIONS", 1, 0 );
bool status = initialize( path, max_rotations, true );
free( path );
return status;
}
// Default initializer
bool
ReadUserLog::initialize( const char *filename,
bool handle_rotation,
bool check_for_old,
bool read_only )
{
return initialize( filename,
handle_rotation ? 1 : 0,
check_for_old,
read_only );
}
// Initializer which allows the specifying of the max rotation level
bool
ReadUserLog::initialize( const char *filename,
int max_rotations,
bool check_for_old,
bool read_only )
{
if ( m_initialized ) {
Error( LOG_ERROR_RE_INITIALIZE, __LINE__ );
return false;
}
bool handle_rotation = ( max_rotations > 0 );
m_state = new ReadUserLogState( filename, max_rotations,
SCORE_RECENT_THRESH );
if ( ! m_state->Initialized() ) {
Error( LOG_ERROR_NOT_INITIALIZED, __LINE__ );
return false;
}
m_match = new ReadUserLogMatch( m_state );
if (! InternalInitialize( max_rotations,
check_for_old,
false,
handle_rotation,
read_only ) ) {
return false;
}
return true;
}
// ***************************************
// * Initializers which take a state
// ***************************************
// Restore from state, use rotation parameters from state, too.
bool
ReadUserLog::initialize( const ReadUserLog::FileState &state,
bool read_only )
{
return InternalInitialize( state, false, 0, read_only );
}
// Restore from state, setting the rotation parameters
bool
ReadUserLog::initialize( const ReadUserLog::FileState &state,
int max_rotations,
bool read_only )
{
return InternalInitialize( state, true, max_rotations, read_only );
}
// Get / set rotation parameters
int
ReadUserLog::getMaxRot( bool handle_rotation )
{
return (handle_rotation ? 1 : 0);
}
void
ReadUserLog::initRotParms( int max_rotation )
{
m_handle_rot = max_rotation ? true : false;
m_max_rotations = max_rotation;
}
// ***************************************
// * Internal Initializers
// ***************************************
// Internal initialization from state
// In this case, we don't stat the file, but use the stat info
// restored in "state" passed to us by the application
bool
ReadUserLog::InternalInitialize( const ReadUserLog::FileState &state,
bool set_rotations,
int max_rotations,
bool read_only )
{
if ( m_initialized ) {
Error( LOG_ERROR_RE_INITIALIZE, __LINE__ );
return false;
}
m_state = new ReadUserLogState( state, SCORE_RECENT_THRESH );
if ( ( m_state->InitializeError() ) || ( !m_state->Initialized() ) ) {
Error( LOG_ERROR_STATE_ERROR, __LINE__ );
return false;
}
// If max rotations specified, store it away
if ( set_rotations ) {
m_state->MaxRotations( max_rotations );
}
else {
max_rotations = m_state->MaxRotations( );
}
m_match = new ReadUserLogMatch( m_state );
return InternalInitialize( max_rotations, false, true, true, read_only );
}
// Internal only initialization
bool
ReadUserLog::InternalInitialize ( int max_rotations,
bool check_for_rotation,
bool restore,
bool enable_header_read,
bool read_only )
{
if ( m_initialized ) {
Error( LOG_ERROR_RE_INITIALIZE, __LINE__ );
return false;
}
m_handle_rot = ( max_rotations > 0 );
m_max_rotations = max_rotations;
m_read_header = enable_header_read;
m_lock = NULL;
m_read_only = read_only;
// Set the score factor in the file state manager
m_state->SetScoreFactor( ReadUserLogState::SCORE_CTIME,
SCORE_FACTOR_CTIME );
m_state->SetScoreFactor( ReadUserLogState::SCORE_INODE,
SCORE_FACTOR_INODE );
m_state->SetScoreFactor( ReadUserLogState::SCORE_SAME_SIZE,
SCORE_FACTOR_SAME_SIZE );
m_state->SetScoreFactor( ReadUserLogState::SCORE_GROWN,
SCORE_FACTOR_GROWN );
m_state->SetScoreFactor( ReadUserLogState::SCORE_SHRUNK,
SCORE_FACTOR_SHRUNK );
if ( restore ) {
// Do nothing
}
else if ( m_handle_rot && check_for_rotation ) {
if (! FindPrevFile( m_max_rotations, 0, true ) ) {
releaseResources();
Error( LOG_ERROR_FILE_NOT_FOUND, __LINE__ );
return false;
}
}
else {
m_max_rotations = 0;
if ( m_state->Rotation( 0, true ) ) {
releaseResources();
Error( LOG_ERROR_FILE_NOT_FOUND, __LINE__ );
return false;
}
}
// Should we be locking?
if ( read_only ) {
m_lock_enable = false;
} else {
m_lock_enable = param_boolean( "ENABLE_USERLOG_LOCKING", false );
}
// Should we close the file between operations?
m_close_file = param_boolean( "ALWAYS_CLOSE_USERLOG", false );
# if defined(WIN32)
if ( m_handle_rot ) {
m_close_file = true; // Can't rely on open FD with unlink / rename
}
# endif
// Now, open the file, setup locks, read the header, etc.
if ( restore ) {
dprintf( D_FULLDEBUG, "init: ReOpening file %s\n",
m_state->CurPath() );
ULogEventOutcome status = ReopenLogFile( true );
if ( ULOG_MISSED_EVENT == status ) {
m_missed_event = true; // We'll check this during readEvent()
dprintf( D_FULLDEBUG,
"ReadUserLog::initialize: Missed event\n" );
}
else if ( status != ULOG_OK ) {
dprintf( D_ALWAYS,
"ReadUserLog::initialize: error re-opening file: %d (%d @ %d)\n", status, m_error, m_line_num );
releaseResources();
Error( LOG_ERROR_FILE_NOT_FOUND, __LINE__ );
return false;
}
}
else {
dprintf( D_FULLDEBUG, "init: Opening file %s\n", m_state->CurPath() );
if ( ULOG_OK != OpenLogFile( restore ) ) {
dprintf( D_ALWAYS,
"ReadUserLog::initialize: error opening file\n" );
releaseResources();
Error( LOG_ERROR_FILE_NOT_FOUND, __LINE__ );
return false;
}
}
// Close the file between operations
CloseLogFile( false );
m_initialized = true;
return true;
} // InternalInitialize()
ReadUserLog::FileStatus
ReadUserLog::CheckFileStatus( void )
{
bool is_empty;
if ( !m_state ) {
return ReadUserLog::LOG_STATUS_ERROR;
}
return m_state->CheckFileStatus( m_fd, is_empty );
}
ReadUserLog::FileStatus
ReadUserLog::CheckFileStatus( bool &is_empty )
{
if ( !m_state ) {
return ReadUserLog::LOG_STATUS_ERROR;
}
return m_state->CheckFileStatus( m_fd, is_empty );
}
bool
ReadUserLog::CloseLogFile( bool force )
{
if ( force || m_close_file ) {
if ( m_lock && m_lock->isLocked() ) {
m_lock->release();
m_lock_rot = -1;
}
if ( m_enable_close ) {
if ( m_fp ) {
fclose( m_fp );
m_fp = NULL;
m_fd = -1;
}
else if ( m_fd >= 0 ) {
close(m_fd);
m_fd = -1;
}
}
}
return true;
}
ULogEventOutcome
ReadUserLog::OpenLogFile( bool do_seek, bool read_header )
{
// Note: For whatever reason, we obtain a WRITE lock in method
// readEvent. On Linux, if the file is opened O_RDONLY, then a
// WRITE_LOCK never blocks. Thus open the file RDWR so the
// WRITE_LOCK below works correctly.
//
// NOTE: we tried changing this to O_READONLY once and things
// stopped working right, so don't try it again, smarty-pants!
// Is the lock current?
bool is_lock_current = ( m_state->Rotation() == m_lock_rot );
dprintf( D_FULLDEBUG, "Opening log file #%d '%s'"
"(is_lock_cur=%s,seek=%s,read_header=%s)\n",
m_state->Rotation(), m_state->CurPath(),
is_lock_current ? "true" : "false",
do_seek ? "true" : "false",
read_header ? "true" : "false" );
if ( m_state->Rotation() < 0 ) {
if ( m_state->Rotation(-1) < 0 ) {
return ULOG_RD_ERROR;
}
}
m_fd = safe_open_wrapper_follow( m_state->CurPath(),
m_read_only ? O_RDONLY : O_RDWR,
0 );
if ( m_fd < 0 ) {
dprintf(D_ALWAYS, "ReadUserLog::OpenLogFile safe_open_wrapper on %s returns %d: error %d(%s)\n", m_state->CurPath(), m_fd, errno, strerror(errno));
return ULOG_RD_ERROR;
}
m_fp = fdopen( m_fd, "r" );
if ( m_fp == NULL ) {
CloseLogFile( true );
dprintf(D_ALWAYS, "ReadUserLog::OpenLogFile fdopen returns NULL\n");
return ULOG_RD_ERROR;
}
// Seek to the previous location
if ( do_seek && m_state->Offset() ) {
if( fseek( m_fp, m_state->Offset(), SEEK_SET) ) {
CloseLogFile( true );
dprintf(D_ALWAYS, "ReadUserLog::OpenLogFile fseek returns NULL\n");
return ULOG_RD_ERROR;
}
}
// Prepare to lock the file
if ( m_lock_enable ) {
// If the lock isn't for the current file (rotation #), destroy it
if ( ( !is_lock_current ) && m_lock ) {
delete m_lock;
m_lock = NULL;
m_lock_rot = -1;
}
// Create a lock if none exists
// otherwise, update the lock's fd & fp
if ( ! m_lock ) {
dprintf( D_FULLDEBUG, "Creating file lock(%d,%p,%s)\n",
m_fd, m_fp, m_state->CurPath() );
bool new_locking = param_boolean("CREATE_LOCKS_ON_LOCAL_DISK", true);
#if defined(WIN32)
new_locking = false;
#endif
if (new_locking) {
m_lock = new FileLock(m_state->CurPath(), true, false);
if (! m_lock->initSucceeded() ) {
delete m_lock;
m_lock = new FileLock( m_fd, m_fp, m_state->CurPath() );
}
} else {
m_lock = new FileLock( m_fd, m_fp, m_state->CurPath() );
}
if( ! m_lock ) {
CloseLogFile( true );
dprintf(D_ALWAYS, "ReadUserLog::OpenLogFile FileLock returns NULL\n");
return ULOG_RD_ERROR;
}
m_lock_rot = m_state->Rotation( );
}
else {
m_lock->SetFdFpFile( m_fd, m_fp, m_state->CurPath() );
}
}
else {
if ( m_lock ) {
delete m_lock;
m_lock = NULL;
m_lock_rot = -1;
}
m_lock = new FakeFileLock;
}
// Determine the type of the log file (if needed)
if ( m_state->IsLogType( ReadUserLogState::LOG_TYPE_UNKNOWN) ) {
if ( !determineLogType() ) {
dprintf( D_ALWAYS,
"ReadUserLog::OpenLogFile(): Can't log type\n" );
releaseResources();
return ULOG_RD_ERROR;
}
}
// Read the file's header event
if ( read_header && m_read_header && ( !m_state->ValidUniqId()) ) {
const char *path = m_state->CurPath( );
// If no path provided, generate one
MyString temp_path;
if ( NULL == path ) {
m_state->GeneratePath( m_state->Rotation(), temp_path );
path = temp_path.Value( );
}
// Now, try read the header
ReadUserLog log_reader;
ReadUserLogHeader header_reader;
if ( ( path ) &&
( log_reader.initialize( path, false, false, true ) ) &&
( header_reader.Read( log_reader ) == ULOG_OK ) ) {
m_state->UniqId( header_reader.getId() );
m_state->Sequence( header_reader.getSequence() );
m_state->LogPosition( header_reader.getFileOffset() );
if ( header_reader.getEventOffset() ) {
m_state->LogRecordNo( header_reader.getEventOffset() );
}
dprintf( D_FULLDEBUG,
"%s: Set UniqId to '%s', sequence to %d\n",
m_state->CurPath(),
header_reader.getId().Value(),
header_reader.getSequence() );
}
// Finally, no path -- give up
else {
dprintf( D_FULLDEBUG, "%s: Failed to read file header\n",
m_state->CurPath() );
}
}
return ULOG_OK;
}
bool
ReadUserLog::determineLogType( void )
{
// now determine if the log file is XML and skip over the header (if
// there is one) if it is XML
// we obtain a write lock here not because we want to write
// anything, but because we want to ensure we don't read
// mid-way through someone else's write
Lock( false );
// store file position so we can rewind to this location
long filepos = ftell( m_fp );
if( filepos < 0 ) {
dprintf(D_ALWAYS, "ftell failed in ReadUserLog::determineLogType\n");
Unlock( false );
Error( LOG_ERROR_FILE_OTHER, __LINE__ );
return false;
}
m_state->Offset( filepos );
char afterangle;
if ( fseek( m_fp, 0, SEEK_SET ) < 0 ) {
dprintf(D_ALWAYS,
"fseek(0) failed in ReadUserLog::determineLogType\n");
Unlock( false );
Error( LOG_ERROR_FILE_OTHER, __LINE__ );
return false;
}
int scanf_result = fscanf(m_fp, " <%c", &afterangle);
if( scanf_result > 0 ) {
m_state->LogType( ReadUserLogState::LOG_TYPE_XML );
// If we're at the start of the file, skip the header
if ( filepos == 0 ) {
if( !skipXMLHeader(afterangle, filepos) ) {
m_state->LogType( ReadUserLogState::LOG_TYPE_UNKNOWN );
Unlock( false );
Error( LOG_ERROR_FILE_OTHER, __LINE__ );
return false;
}
}
// File type set, we're all done.
Unlock( false );
return true;
}
// the first non whitespace char is not <, so this doesn't look like
// XML; go back to the beginning and take another look
int nothing;
if( fseek( m_fp, 0, SEEK_SET) ) {
dprintf(D_ALWAYS,
"fseek failed in ReadUserLog::determineLogType");
Unlock( false );
Error( LOG_ERROR_FILE_OTHER, __LINE__ );
return false;
}
if( fscanf( m_fp, " %d", ¬hing ) > 0 ) {
setIsOldLog(true);
}
else {
// what sort of log is this???
dprintf(D_FULLDEBUG, "Error, apparently invalid user log file\n");
m_state->LogType( ReadUserLogState::LOG_TYPE_UNKNOWN );
}
if( fseek( m_fp, filepos, SEEK_SET ) ) {
dprintf( D_ALWAYS,
"fseek failed in ReadUserLog::determineLogType");
Unlock( false );
Error( LOG_ERROR_FILE_OTHER, __LINE__ );
return false;
}
Unlock( false );
return true;
}
bool
ReadUserLog::skipXMLHeader(char afterangle, long filepos)
{
// now figure out if there is a header, and if so, advance _fp past
// it - this is really ugly
int nextchar = afterangle;
if( nextchar == '?' || nextchar == '!' ) {
// we're probably in the document prolog
while( nextchar == '?' || nextchar == '!' ) {
// skip until we get out of this tag
nextchar = fgetc(m_fp);
while( nextchar != EOF && nextchar != '>' ) {
nextchar = fgetc(m_fp);
}
if( nextchar == EOF ) {
Error( LOG_ERROR_FILE_OTHER, __LINE__ );
return false;
}
// skip until we get to the next tag, saving our location as
// we go so we can skip back two chars later
while( nextchar != EOF && nextchar != '<' ) {
filepos = ftell(m_fp);
nextchar = fgetc(m_fp);
}
if( nextchar == EOF ) {
Error( LOG_ERROR_FILE_OTHER, __LINE__ );
return false;
}
nextchar = fgetc(m_fp);
}
// now we are in a tag like <[^?!]*>, so go back two chars and
// we're all set
if( fseek(m_fp, filepos, SEEK_SET) ) {
dprintf(D_ALWAYS, "fseek failed in ReadUserLog::skipXMLHeader");
Error( LOG_ERROR_FILE_OTHER, __LINE__ );
return false;
}
} else {
// there was no prolog, so go back to the beginning
if( fseek(m_fp, filepos, SEEK_SET) ) {
dprintf(D_ALWAYS, "fseek failed in ReadUserLog::skipXMLHeader");
Error( LOG_ERROR_FILE_OTHER, __LINE__ );
return false;
}
}
m_state->Offset( filepos );
return true;
}
bool
ReadUserLog::FindPrevFile( int start, int num, bool store_stat )
{
if ( !m_handle_rot ) {
return true;
}
// Deterine the range to look at
int end;
if ( 0 == num ) {
end = 0;
} else {
end = start - num + 1;
if ( end < 0 ) {
end = 0;
}
}
// Search for the previous file
for ( int rot = start; rot >= end; rot-- ) {
if ( 0 == m_state->Rotation( rot, store_stat ) ) {
dprintf( D_FULLDEBUG, "Found: '%s'\n", m_state->CurPath() );
return true;
}
}
Error( LOG_ERROR_FILE_NOT_FOUND, __LINE__ );
return false;
}
ULogEventOutcome
ReadUserLog::ReopenLogFile( bool restore )
{
// First, if the file's open, we're done. :)
if ( m_fp ) {
return ULOG_OK;
}
// If we're not handling rotation, just try to reopen the file
if ( ! m_handle_rot ) {
return OpenLogFile( true );
}
// If we don't have valid info, do a new file search, just like init
if ( ! m_state->IsValid() ) {
if ( m_handle_rot ) {
dprintf( D_FULLDEBUG, "reopen: looking for previous file...\n" );
if (! FindPrevFile( m_max_rotations, 0, true ) ) {
Error( LOG_ERROR_FILE_NOT_FOUND, __LINE__ );
return ULOG_NO_EVENT;
}
}
else {
if ( m_state->Rotation( 0, true ) ) {
Error( LOG_ERROR_FILE_NOT_FOUND, __LINE__ );
return ULOG_NO_EVENT;
}
}
return OpenLogFile( false );
}
// Search forward, starting with the "current" file, looking
// for a file with the same "signature", or the highest score.
int new_rot = -1;
int max_score = -1;
int max_score_rot = -1;
int *scores = new int[m_max_rotations+1];
int start = m_state->Rotation();
int thresh = restore ? SCORE_THRESH_RESTORE : SCORE_THRESH_FWSEARCH;
for( int rot = start; (rot <= m_max_rotations) && (new_rot < 0); rot++ ) {
int score;
ReadUserLogMatch::MatchResult result =
m_match->Match( rot, thresh, &score );
if ( ReadUserLogMatch::MATCH_ERROR == result ) {
scores[rot] = -1;
}
else if ( ReadUserLogMatch::MATCH == result ) {
new_rot = rot;
}
else if ( ReadUserLogMatch::UNKNOWN == result ) {
scores[rot] = score;
if ( score > max_score ) {
max_score_rot = rot;
max_score = score;
}
}
}
delete [] scores;
// No good match found, fall back to highest score
if ( ( new_rot < 0 ) && ( max_score > 0 ) ) {
if ( restore ) {
return ULOG_MISSED_EVENT;
}
new_rot = max_score_rot;
}
// If we've found a good match, or a high score, do it
if ( new_rot >= 0 ) {
if ( m_state->Rotation( new_rot ) ) {
Error( LOG_ERROR_FILE_NOT_FOUND, __LINE__ );
return ULOG_RD_ERROR;
}
return OpenLogFile( true );
}
// If we got here, no match found. :(
m_state->Reset( ); // We know nothing about the state now!
return ULOG_MISSED_EVENT;
}
ULogEventOutcome
ReadUserLog::readEvent (ULogEvent *& event )
{
return readEvent( event, true );
}
ULogEventOutcome
ReadUserLog::readEvent (ULogEvent *& event, bool store_state )
{
if ( !m_initialized ) {
Error( LOG_ERROR_NOT_INITIALIZED, __LINE__ );
return ULOG_RD_ERROR;
}
// Previous operation (initialization) detected a missed event
// but couldn't report it to the application (the API doesn't
// allow us to reliably return that type of info).
if ( m_missed_event ) {
m_missed_event = false;
return ULOG_MISSED_EVENT;
}
int starting_seq = m_state->Sequence( );
int starting_event = (int) m_state->EventNum( );
filesize_t starting_recno = m_state->LogRecordNo();
// If the file was closed on us, try to reopen it
if ( !m_fp ) {
ULogEventOutcome status = ReopenLogFile( );
if ( ULOG_OK != status ) {
return status;
}
}
if ( !m_fp ) {
return ULOG_NO_EVENT;
}
/*
09/27/2010 (cweiss): Added this check because so far the reader could get stuck
in a non-recoverable state when ending up in feof. (Example scenario: XML writer
and reader on the same file, reader reads in
while (reader.readEvent(event) == ULOG_OK) ...
mode, locks are *not* on the file but on designated local disk lock files, which
means that the reader's file pointer is not tampered with. Then XML writer
writes another event -- this will never be discovered by the reader.)
*/
if ( feof(m_fp) ) {
clearerr(m_fp);
}
ULogEventOutcome outcome = ULOG_OK;
bool try_again = false;
if( m_state->IsLogType( ReadUserLogState::LOG_TYPE_UNKNOWN ) ) {
if( !determineLogType() ) {
outcome = ULOG_RD_ERROR;
Error( LOG_ERROR_FILE_OTHER, __LINE__ );
goto CLEANUP;
}
}
// Now, read the actual event (depending on the file type)
outcome = readEvent( event, &try_again );
if ( ! m_handle_rot ) {
try_again = false;
}
// If we hit the end of a rotated file, try the previous one
if ( try_again ) {
// We've hit the end of file and file has been closed
// This means that we've missed an event :(
if ( m_state->Rotation() < 0 ) {
return ULOG_MISSED_EVENT;
}
// We've hit the end of a non-rotated file
// (a file that isn't a ".old" or ".1", etc.)
else if ( m_state->Rotation() == 0 ) {
// Same file?
ReadUserLogMatch::MatchResult result;
result = m_match->Match( m_state->CurPath(),
m_state->Rotation(),
SCORE_THRESH_NONROT );
dprintf( D_FULLDEBUG,
"readEvent: checking to see if file (%s) matches: %s\n",
m_state->CurPath(), m_match->MatchStr(result) );
if ( result == ReadUserLogMatch::NOMATCH ) {
CloseLogFile( true );
}
else {
try_again = false;
}
}
// We've hit the end of a ".old" or ".1", ".2" ... file
else {
CloseLogFile( true );
bool found = FindPrevFile( m_state->Rotation() - 1, 1, true );
dprintf( D_FULLDEBUG,
"readEvent: checking for previous file (# %d): %s\n",
m_state->Rotation(), found ? "Found" : "Not found" );
if ( found ) {
CloseLogFile( true );
}
else {
try_again = false;
}
}
}
// Finally, one more attempt to read an event
if ( try_again ) {
outcome = ReopenLogFile();
if ( ULOG_OK == outcome ) {
outcome = readEvent( event, (bool*)NULL );
}
}
// Store off our current offset
if ( ( ULOG_OK == outcome ) && ( store_state ) ) {
long pos = ftell( m_fp );
if ( pos > 0 ) {
m_state->Offset( pos );
}
if ( ( m_state->Sequence() != starting_seq ) &&
( 0 == m_state->LogRecordNo() ) ) {
// Don't count the header record in the count below
m_state->LogRecordNo( starting_recno + starting_event - 1 );
}
m_state->EventNumInc();
m_state->StatFile( m_fd );
}
// Close the file between operations
CLEANUP:
CloseLogFile( false );
return outcome;
}
ULogEventOutcome
ReadUserLog::readEvent( ULogEvent *& event, bool *try_again )
{
ULogEventOutcome outcome;
if( m_state->IsLogType( ReadUserLogState::LOG_TYPE_XML ) ) {
outcome = readEventXML( event );
if ( try_again ) {
*try_again = (outcome == ULOG_NO_EVENT );
}
} else if( m_state->IsLogType( ReadUserLogState::LOG_TYPE_OLD ) ) {
outcome = readEventOld( event );
if ( try_again ) {
*try_again = (outcome == ULOG_NO_EVENT );
}
} else {
outcome = ULOG_NO_EVENT;
if ( try_again ) {
*try_again = false;
}
}
return outcome;
}
ULogEventOutcome
ReadUserLog::readEventXML( ULogEvent *& event )
{
classad::ClassAdXMLParser xmlp;
// we obtain a write lock here not because we want to write
// anything, but because we want to ensure we don't read
// mid-way through someone else's write
Lock( true );
// store file position so that if we are unable to read the event, we can
// rewind to this location
long filepos;
if (!m_fp || ((filepos = ftell(m_fp)) == -1L))
{
Unlock( true );
event = NULL;
return ULOG_UNK_ERROR;
}
ClassAd* eventad = new ClassAd();
if ( !xmlp.ParseClassAd(m_fp, *eventad) ) {
delete eventad;
eventad = NULL;
}
Unlock( true );
if( !eventad ) {
// we don't have the full event in the stream yet; restore file
// position and return
if( fseek(m_fp, filepos, SEEK_SET) ) {
dprintf(D_ALWAYS, "fseek() failed in ReadUserLog::readEvent");
return ULOG_UNK_ERROR;
}
clearerr(m_fp);
event = NULL;
return ULOG_NO_EVENT;
}
int enmbr;
if( !eventad->LookupInteger("EventTypeNumber", enmbr) ) {
event = NULL;
delete eventad;
return ULOG_NO_EVENT;
}
if( !(event = instantiateEvent((ULogEventNumber) enmbr)) ) {
event = NULL;
delete eventad;
return ULOG_UNK_ERROR;
}
event->initFromClassAd(eventad);
delete eventad;
return ULOG_OK;
}
ULogEventOutcome
ReadUserLog::readEventOld( ULogEvent *& event )
{
long filepos;
int eventnumber;
int retval1, retval2;
// we obtain a write lock here not because we want to write
// anything, but because we want to ensure we don't read
// mid-way through someone else's write
if ( m_lock->isUnlocked() ) {
m_lock->obtain( WRITE_LOCK );
}
// store file position so that if we are unable to read the event, we can
// rewind to this location
if (!m_fp || ((filepos = ftell(m_fp)) == -1L))
{
dprintf( D_FULLDEBUG,
"ReadUserLog: invalid m_fp, or ftell() failed\n" );
if ( m_lock->isLocked() ) {
m_lock->release();
}
return ULOG_UNK_ERROR;
}
retval1 = fscanf (m_fp, "%d", &eventnumber);
// so we don't dump core if the above fscanf failed
if (retval1 != 1) {
eventnumber = 1;
// check for end of file -- why this is needed has been
// lost, but it was removed once and everything went to
// hell, so don't touch it...
// Note: this is needed because if this method is called and
// you're at the end of the file, fscanf returns EOF (-1) and
// you get here. If you're at EOF you had better bail out...
// (This is not uncommon -- any time you try to read an event
// and there aren't any events to read you get here.)
// If fscanf returns 0, you're probably *really* in trouble.
// wenger 2004-10-07.
if( feof( m_fp ) ) {
event = NULL; // To prevent FMR: Free memory read
clearerr( m_fp );
if( m_lock->isLocked() ) {
m_lock->release();
}
return ULOG_NO_EVENT;
}
dprintf( D_FULLDEBUG, "ReadUserLog: error (not EOF) reading "
"event number\n" );
}
// allocate event object; check if allocated successfully
event = instantiateEvent ((ULogEventNumber) eventnumber);
if (!event) {
dprintf( D_FULLDEBUG, "ReadUserLog: unable to instantiate event\n" );
if ( m_lock->isLocked()) {
m_lock->release();
}
return ULOG_UNK_ERROR;
}
// read event from file; check for result
retval2 = event->getEvent (m_fp);
// check if error in reading event
if (!retval1 || !retval2)
{
dprintf( D_FULLDEBUG,
"ReadUserLog: error reading event; re-trying\n" );
// we could end up here if file locking did not work for
// whatever reason (usual NFS bugs, whatever). so here
// try to wait a second until the current partially-written
// event has benn completely written. the algorithm is
// wait a second, rewind to our initial position (in case a
// buggy getEvent() slurped up more than one event), then
// again try to synchronize the log
//
// NOTE: this code is important, so don't remove or "fix"
// it unless you *really* know what you're doing and test it
// extermely well
if( m_lock->isLocked() ) {
m_lock->release();
}
sleep( 1 );
if( m_lock->isUnlocked() ) {
m_lock->obtain( WRITE_LOCK );
}
if( fseek( m_fp, filepos, SEEK_SET)) {
dprintf( D_ALWAYS, "fseek() failed in %s:%d", __FILE__, __LINE__ );
if ( m_lock->isLocked() ) {
m_lock->release();
}
return ULOG_UNK_ERROR;
}
if( synchronize() )
{
// if synchronization was successful, reset file position and ...
if (fseek (m_fp, filepos, SEEK_SET))
{
dprintf(D_ALWAYS, "fseek() failed in ReadUserLog::readEvent");
if ( m_lock->isLocked() ) {
m_lock->release();
}
return ULOG_UNK_ERROR;
}
// ... attempt to read the event again
clearerr (m_fp);
int oldeventnumber = eventnumber;
eventnumber = -1;
retval1 = fscanf (m_fp, "%d", &eventnumber);
if( retval1 == 1 ) {
if( eventnumber != oldeventnumber ) {
if( event ) {
delete event;
}
// allocate event object; check if allocated
// successfully
event = instantiateEvent( (ULogEventNumber)eventnumber );
if( !event ) {
dprintf( D_FULLDEBUG, "ReadUserLog: unable to "
"instantiate event\n" );
if( m_lock->isLocked() ) {
m_lock->release();
}
return ULOG_UNK_ERROR;
}
}
retval2 = event->getEvent( m_fp );
}
// if failed again, we have a parse error
if (retval1 != 1 || !retval2)
{
dprintf( D_FULLDEBUG, "ReadUserLog: error reading event "
"on second try\n");
delete event;
event = NULL; // To prevent FMR: Free memory read
synchronize ();
if (m_lock->isLocked()) {
m_lock->release();
}
return ULOG_RD_ERROR;
}
else
{
// finally got the event successfully --
// synchronize the log
if( synchronize() ) {
if( m_lock->isLocked() ) {
m_lock->release();
}
return ULOG_OK;
}
else
{
// got the event, but could not synchronize!!
// treat as incomplete event
dprintf( D_FULLDEBUG,
"ReadUserLog: got event on second try "
"but synchronize() failed\n");
delete event;
event = NULL; // To prevent FMR: Free memory read
clearerr( m_fp );
if( m_lock->isLocked() ) {
m_lock->release();
}
return ULOG_NO_EVENT;
}
}
}
else
{
// if we could not synchronize the log, we don't have the full
// event in the stream yet; restore file position and return
dprintf( D_FULLDEBUG, "ReadUserLog: syncronize() failed\n");
if (fseek (m_fp, filepos, SEEK_SET))
{
dprintf(D_ALWAYS, "fseek() failed in ReadUserLog::readEvent");
if (m_lock->isLocked()) {
m_lock->release();
}
return ULOG_UNK_ERROR;
}
clearerr (m_fp);
delete event;
event = NULL; // To prevent FMR: Free memory read
if (m_lock->isLocked()) {
m_lock->release();
}
return ULOG_NO_EVENT;
}
}
else
{
// got the event successfully -- synchronize the log
if (synchronize ())
{
if (m_lock->isLocked()) {
m_lock->release();
}
return ULOG_OK;
}
else
{
// got the event, but could not synchronize!! treat as incomplete
// event
dprintf( D_FULLDEBUG, "ReadUserLog: got event on first try "
"but synchronize() failed\n");
delete event;
event = NULL; // To prevent FMR: Free memory read
clearerr (m_fp);
if (m_lock->isLocked() ) {
m_lock->release();
}
return ULOG_NO_EVENT;
}
}
// will not reach here
if (m_lock->isLocked()) {
m_lock->release();
}
dprintf( D_ALWAYS, "Error: got to the end of "
"ReadUserLog::readEventOld()\n");
return ULOG_UNK_ERROR;
}
// Static method for initializing a file state
bool
ReadUserLog::InitFileState( ReadUserLog::FileState &state )
{
return ReadUserLogState::InitState( state );
}
// Static method for un-initializing a file state
bool
ReadUserLog::UninitFileState( ReadUserLog::FileState &state )
{
return ReadUserLogState::UninitState( state );
}
bool
ReadUserLog::GetFileState( ReadUserLog::FileState &state ) const
{
if ( !m_initialized ) {
Error( LOG_ERROR_NOT_INITIALIZED, __LINE__ );
return false;
}
return m_state->GetState( state );
}
bool
ReadUserLog::SetFileState( const ReadUserLog::FileState &state )
{
if ( !m_initialized ) {
Error( LOG_ERROR_NOT_INITIALIZED, __LINE__ );
return false;
}
return m_state->SetState( state );
}
void
ReadUserLog::Lock( bool verify_init )
{
if( verify_init ) {
ASSERT ( m_initialized );
}
if ( m_lock->isUnlocked() ) {
m_lock->obtain( WRITE_LOCK );
}
ASSERT( m_lock->isLocked() );
}
void
ReadUserLog::Unlock( bool verify_init )
{
if( verify_init ) {
ASSERT ( m_initialized );
}
if ( m_lock->isLocked( ) ) {
m_lock->release( );
}
ASSERT( m_lock->isUnlocked() );
}
bool
ReadUserLog::synchronize ( void )
{
if ( !m_initialized ) {
Error( LOG_ERROR_NOT_INITIALIZED, __LINE__ );
return false;
}
const int bufSize = 512;
char buffer[bufSize];
while( fgets( buffer, bufSize, m_fp ) != NULL ) {
if( strcmp( buffer, SynchDelimiter) == 0 ) {
return true;
}
}
return false;
}
void
ReadUserLog::outputFilePos( const char *pszWhereAmI )
{
ASSERT ( m_initialized );
dprintf(D_ALWAYS, "Filepos: %ld, context: %s\n", ftell(m_fp), pszWhereAmI);
}
void
ReadUserLog::setIsXMLLog( bool is_xml )
{
if( is_xml ) {
m_state->LogType( ReadUserLogState::LOG_TYPE_XML );
} else {
m_state->LogType( ReadUserLogState::LOG_TYPE_OLD );
}
}
bool
ReadUserLog::getIsXMLLog( void ) const
{
return ( m_state->IsLogType( ReadUserLogState::LOG_TYPE_XML ) );
}
void
ReadUserLog::setIsOldLog( bool is_old )
{
if( is_old ) {
m_state->LogType( ReadUserLogState::LOG_TYPE_OLD );
} else {
m_state->LogType( ReadUserLogState::LOG_TYPE_UNKNOWN );
}
}
bool
ReadUserLog::getIsOldLog( void ) const
{
return ( m_state->IsLogType( ReadUserLogState::LOG_TYPE_OLD ) );
}
void
ReadUserLog::clear( void )
{
m_initialized = false;
m_missed_event = false;
m_state = NULL;
m_match = NULL;
m_fd = -1;
m_fp = NULL;
m_lock = NULL;
m_lock_rot = -1;
m_close_file = false;
m_read_only = false;
m_enable_close = true;
m_handle_rot = false;
m_lock_enable = false;
m_max_rotations = 0;
m_read_header = false;
m_error = LOG_ERROR_NONE;
m_line_num = 0;
}
void
ReadUserLog::releaseResources( void )
{
if ( m_match ) {
delete m_match;
m_match = NULL;
}
if ( m_state ) {
delete m_state;
m_state = NULL;
}
CloseLogFile( true );
delete m_lock;
m_lock = NULL;
}
void
ReadUserLog:: getErrorInfo( ErrorType &error,
const char *& error_str,
unsigned &line_num ) const
{
const char *strings[] = {
"None",
"Reader not initialized",
"Attempt to re-initialize reader",
"File not found",
"Other file error",
"Invalid state buffer",
};
error = m_error;
line_num = m_line_num;
unsigned eint = (unsigned) m_error;
unsigned num = ( sizeof(strings) / sizeof(const char *) );
if ( eint >= num ) {
error_str = "Unknown";
}
else {
error_str = strings[eint];
}
};
// **********************************
// ReadUserLogMatch methods
// **********************************
// Compare a file by rotation # to the cached info
ReadUserLogMatch::MatchResult
ReadUserLogMatch::Match(
int rot,
int match_thresh,
int *score_ptr ) const
{
// Get the initial score from the state
int local_score;
if ( NULL == score_ptr ) {
score_ptr = &local_score;
}
*score_ptr = m_state->ScoreFile( rot );
// Generate the final score using the internal logic
return MatchInternal( rot, NULL, match_thresh, score_ptr );
}
// Compare the "current" file to the cached info
ReadUserLogMatch::MatchResult
ReadUserLogMatch::Match(
const char *path,
int rot,
int match_thresh,
int *score_ptr ) const
{
// Get the initial score from the state
int local_score;
if ( NULL == score_ptr ) {
score_ptr = &local_score;
}
*score_ptr = m_state->ScoreFile( path, rot );
// Generate the final score using the internal logic
return MatchInternal( rot, path, match_thresh, score_ptr );
}
// Compare the stat info passed in to the cached info
ReadUserLogMatch::MatchResult
ReadUserLogMatch::Match(
StatStructType &statbuf,
int rot,
int match_thresh,
int *score_ptr ) const
{
// Get the initial score from the state
int local_score;
if ( NULL == score_ptr ) {
score_ptr = &local_score;
}
*score_ptr = m_state->ScoreFile( statbuf, rot );
// Generate the final score using the internal logic
return MatchInternal( rot, NULL, match_thresh, score_ptr );
}
// Score analysis
ReadUserLogMatch::MatchResult
ReadUserLogMatch::MatchInternal(
int rot,
const char *path,
int match_thresh,
int *score_ptr ) const
{
int score = *score_ptr;
// If no path provided, generate one
MyString path_str;
if ( NULL == path ) {
m_state->GeneratePath( rot, path_str );
} else {
path_str = path;
}
dprintf( D_FULLDEBUG, "Match: score of '%s' = %d\n",
path_str.Value(), score );
// Quick look at the score passed in from the state comparison
// We can return immediately in some cases
MatchResult result = EvalScore( match_thresh, score );
if ( UNKNOWN != result ) {
return result;
}
// Here, we have an indeterminate result
// Read the file's header info
// We'll instantiate a new log reader to do this for us
// Note: we disable rotation for this one, so we won't recurse infinitely
ReadUserLog log_reader;
dprintf( D_FULLDEBUG, "Match: reading file %s\n", path_str.Value() );
// Initialize the reader
if ( !log_reader.initialize( path_str.Value(), false, false ) ) {
return MATCH_ERROR;
}
// Read the file's header info
ReadUserLogHeader header_reader;
int status = header_reader.Read( log_reader );
if ( ULOG_OK == status ) {
// Do nothing
}
else if ( ULOG_NO_EVENT == status ) {
return EvalScore( match_thresh, score );
}
else {
return MATCH_ERROR;
}
// Finally, extract the ID & store it
int id_result = m_state->CompareUniqId( header_reader.getId() );
const char *result_str = "unknown";
if ( id_result > 0 ) {
score += SCORE_FACTOR_UNIQ_MATCH;
result_str = "match";
}
else if ( id_result < 0 ) {
score = 0;
result_str = "no match";
}
dprintf( D_FULLDEBUG, "Read ID from '%s' as '%s': %d (%s)\n",
path_str.Value(), header_reader.getId().Value(),
id_result, result_str );
// And, last but not least, re-evaluate the score
dprintf( D_FULLDEBUG, "Match: Final score is %d\n", score );
return EvalScore( match_thresh, score );
}
ReadUserLogMatch::MatchResult
ReadUserLogMatch::EvalScore(
int match_thresh,
int score ) const
{
// < 0 is an error
if ( score < 0 ) {
return MATCH_ERROR;
}
// Less than the min threshold - give up, declare "no match"
else if ( score < SCORE_MIN_MATCH ) {
return NOMATCH;
}
// Or, if it's above the min match threshold,
else if ( score >= match_thresh ) {
return MATCH;
}
else {
return UNKNOWN;
}
}
const char *
ReadUserLogMatch::MatchStr( ReadUserLogMatch::MatchResult value ) const
{
switch( value ) {
case MATCH_ERROR:
return "ERROR";
case MATCH:
return "MATCH";
case UNKNOWN:
return "UNKNOWN";
case NOMATCH:
return "NOMATCH";
default:
return "<invalid>";
};
}
/*
### Local Variables: ***
### mode:c++ ***
### tab-width:4 ***
### End: ***
*/
| bbockelm/htcondor | src/condor_utils/read_user_log.cpp | C++ | apache-2.0 | 41,821 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: post
title: All Roads Lead to Shenzhen (for Electronics)
excerpt: "An account of my first visit to Shenzhen, China - the modern day Mecca of electronics manufacturing."
tags: [electronics, Shenzhen, China]
categories: [Electronics]
comments: true
modified: 2015-01-17
thumbnail: images/2016/01/shenzhen-bldg.jpg
images: images/2016/01/shenzhen-bldg.jpg
image:
feature: header.jpg
---
*This is a brief account of my four day visit in January 2016 to Shenzhen,
China. Due to my unfamiliarity with the language and brevity of
the trip, this is only a superficial perspective.*

## Why Shenzhen?
If you are doing anything related to electronics today, you will come
to know about Shenzhen soon enough. In my case, [snapVCC][1], a
product that I succesfully crowd-funded recently, brought me
here. Although it was not a requirement for me to be present here for
production, I decided to make the trip to get a feel for the place -
especially considering future projects.
## Getting There
Here's a brief overview of the formalities involved in getting to
Shenzhen - from an Indian point of view.
### Chinese Visa
I applied for a visa through a travel agent in Bangalore, since the
Chinese consulate is in Mumbai. The visa fee was INR 8000 (plus the
travel agent charged a small fee). I applied for a *business* visa,
and the only supporting docunent I needed was an invitation letter
from Seeed Studio, the company that's manufacturing my product in
Shenzhen. I got the visa in hand in about a week - a single entry
visa valid for three months.
### Tickets
When I asked around, I was advised to fly to Hong Kong and take ground
transportation rather than fly directly to Shenzhen. Ticket prices from
Bangalore to Shenzhen ranged from around INR 25000 to 35000,
depending on airlines, dates and stop-overs. I opted for a direct
flight - a five hour journey. I think you can do it on the cheap if
you don't mind breaking your journey and are flexible with dates.
### Currency
The currency in China is Chinese Yuan (CNY), but it's more commonly
referred to with its older name RMB. A quick approximate conversion
to INR is to just multiply CNY by 10. I took USD from India and
converted it in Hong Kong. The conversion rate of Hong Kong Dollar to
INR is about 7.5 at the moment.
### Crossing from Hong Kong
Immigration at Hong Kong was straightforward. I just needed to fill a
form, and there was no visa as such for short visits from India. I
then collected my luggage and followed the "transport to mainland"
signs. I opted for a "limo service" which is actually a shared taxi. I
had my Shenzhen hotel address printed in Chinese characters (using
google Translate), so all I had to is point to it, and pay 200 HKD at
the counter. They slapped a sticker on to my jacket (which probably said
"illiterate man") and I was handed over to an attendant who shooed me
towards the taxi gates. From then on, I was in "point and sign" mode.

The "limo" was actually a van which takes a driver plus seven
passengers. I was wedged between two passengers in the middle
row. After my initial bewildrement, I had a nice conversation (in
English) with the fellow to my left - an Engineer from Taiwan who
worked for Foxconn. The driver provided us with yellow immigration
forms to fill, and in less than hour, we were at the border. We first
passed through the Hong Kong gates, and then the Chinese gates. In
both cases, we did not need to get out of the car. The officers just
inspected out passports and peered into the car which had the
interiors lighst on and the doors open. The taxis all had their trunks
open, but in our case atleast, there was no inspection. Once we
crossed the Chinese border, the taxi went into a mall where passengers
were switched to other cars based on their Shenzhen destinations. In
another 20 minutes, I was dropped off at my hotel.
### Hotel
I wanted to stay close to the electronics markets, and I (mostly by
accident) ended up choosing the Shenzhen Shanghai Hotel, which was at
a walking distance to the Huaqiangbei markets. The cost of the room
was about 500 RMB per night, which did not include a meal plan. My room was
nice and cozy and the service in general was good. The buffet breakfast was
atrociously bad, though. Definitely not worth the 75 RMB charge.
## Shenzhen
Shenzhen is one of China's first Special Economic Zones set up in the
1980s and has grown to become the world's destination for electronics
manufacturing. Shenzhen is a huge city, and I visited only
parts of Futian, Nanshan, and Luohu districts during my stay.
### Getting Around

You can get around Shenzhen in a taxi, but using the metro or bus is much
cheaper. I used the metro, and found it to be very convenient. You can
buy subway tokens at all stations, and the main menu has an English
option which you can use. The machines I saw accepted only 5 Yuan
notes or coins. A better option (which I plan to try next time) is to
buy a *Shenzhen Tong Card* - a prepaid card that be used for both the
bus and the metro. If you do take a taxi, ask for a *fa-piao* - a "tax
receipt" - this apparently reduces the chance that you will be
overcharged for the trip.
### Food
Being a vegetarian (not vegan) my expectation was that I was screwed
in China as far food goes. But this was actually not the case.

As long as I was with someone who
could speak Mandarin, I got excellent vegetarian food. Left to myself,
I exercised my pathetic point and mime skills, and usually ended up
with weird stuff like tentacles on noodles. But even then I was always
able to drown my (temporary) sorrow in a bottle of Tsingtao and some
fried Tofu. I had learned the phrases *wo chi su* (I eat vegetables.)
and *wo bu chi roe* (I don't eat meat.) - but Chinese language is
*tonal* which meant that most of the time people just stared at my
(apparent) gibberish, and I beat a hasty retreat to sign language.
### Language
As I was preparing for the trip, one of my friends who had travelled
in China remarked - "you will get to experience what illiteracy
means". It's not just that I was in a place where I didn't know the
local language - I had travelled in Thailand, Cambodia and
Indonesia. But those were tourist friendly destinations where it was
easy to find someone who spoke English. But in Shezhen, the isolation
was complete. I had no idea what I was looking at - almost all shop
signs were in Chinese, and hardly anyone spoke English.
Technology can help, *Pleco* is an app I found to be useful - it
provides an off-line translation from English to Chinese, including
pronunciation. But this app can be confusing as well. A given English
word can have multiple translations and most may make no sense for
your particular situation.You can also use google to translate the
Chinese characters. I am sure there's plenty of other software you
could use to do similar things.
One useful thing to learn (thanks Charles, for teaching me) is Chinese
hand gestures for numbers:

*(Image credit: https://pdsworldservice.files.wordpress.com/2013/06/e69caae6a087e9a298-1.jpg)*
By the way, Shenzhen is pronounced more like *shen-jen* rather than
*shen-zen*.
### Safety
During my trip, I found the Chinese people to be friendly and Shenzhen
streets to be safe. I routinely walked a couple of kilometers back to
the hotel late at night, and I faced no problems whatsoever. Every few
blocks, I saw Police kiosks and a uniformed officer. The streets were
so brightly lit at some places that it felt like daylight at 11:30 PM.
### Internet
As you might have heard, a lot of the internet that you take for
granted (Facebook, Twitter, Google services, etc.) are blocked in
China. But almost everyone I met used VPN software, so it's important to
set one up before making the trip. Another idea is to get a SIM from
Hong Kong for your phone, have in on roaming, and you have unfiltered
internet on your phone in Shenzhen for the duration of your trip.
### Visit to Seeed Studio
The primary purpose of my trip was to be at Seeed Studio in time
for the production of snapVCC.

Seeed is in Xili, which was a 40 minute ride by taxi from my hotel,
and cost about 80 RMB. I won't go into details of my Seeed visit
here, except to say that they are a great bunch of people, and that I
was very happy to be present to see the first pieces of snapVCC come
out of production.
### Haquiangbei Electronics Market
One of the big attractions of Shenzhen is the Haquiangbei (HQB)
electronics market. For folks from Bangalore, think of it as
$$(S.P.Road)^N$$ where $$N$$ is a very large number. A good guide to
this area is the *Shenzhen Map for Makers* created by Seeed Studio,
the PDF for which is available free online. When I was in town they also
gave me a printed copy, which was very handy.

You can think of HQB as a big spread of multi-storied malls densely
packed with shops selling all kinds of electronics - right from
discrete components to fully assembled computers. There are zones for
specific components - power supplies or motors, for instance. The most
impressive sight in that area is the 70+ storied SEG building, the
first 8 floors of which consist of electronics markets, and the rest
filled with restaurants, offices and such. It was so tall that I could used
the building as a marker to orient myself as I walked around it that
area.

One interesting sight outside HQB malls is stalls selling remote
controlled drones. These can be as cheap as 100 RMB. It's great fun to
watch the sellers fly these things - they can make them shoot up to
the sky and do all kinds of crazy maneuvers. Added to this is their
sales pitch. My seller stood on top of a drone to demonstrate its
crash recoverability. So of course I bought one.
Looking at HQB, you understand why so many companies from the west
have operations here. Need a reel of MOSFETs for your assembly line? No
problem - just walk to HQB and get one. It's like buying vegetables in
a supermarket.
### Ian & HQB Hackers
I was in touch with Ian (of *Dangerous Prototypes* fame) who has his
base in Shenzhen now. He was kind enough to connect me with his
HQB hacker group on *WeChat*. Every evening we hung out in the HQB area
and I great fun speaking to folks from US, Germany, Australia and
other places who were using the Shenzhen infrastructure to work on
their projects.

If you are in the HQB area, I'd be happy to put you in touch with Ian's group.
### Sightseeing
Although most folks come to Shenzhen for electronics, the place offers
plenty of sightseeing opportunites as well. One place I visited is the
Dafen oil painting village, where I purchased a couple of paintings by
local artists.

I wanted to visit the Fairly Lake botanical gardens, but didn't have
time. It's supposed to be one of the most beautful parks in China. Do
check the wikitravel guide to Shenzhen for other suggestions.
## Conclusion
Although my trip was short, a visit to Shenzhen gave me a much clearer
picture of its electronics manufacturing infrastructure. I hope to leverage
my knowledge and contacts for future projects. Looking forward to my
next visit!
## References
1. [Wikitravel guide to Shenzhen][2]
[1]: https://www.crowdsupply.com/electronut-labs/snapvcc
[2]: http://wikitravel.org/en/Shenzhen | electronut/electronut.github.io | _posts/2016-01-17-all-roads-shenzhen.md | Markdown | mit | 11,762 | [
30522,
1011,
1011,
1011,
9621,
1024,
2695,
2516,
1024,
2035,
4925,
2599,
2000,
26555,
1006,
2005,
8139,
1007,
28142,
1024,
1000,
2019,
4070,
1997,
2026,
2034,
3942,
2000,
26555,
1010,
2859,
1011,
1996,
2715,
2154,
21340,
1997,
8139,
5814,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Session.setDefault('isLoggingIn', false);
Template.account.helpers({
signedUp: function() {
return Package["brettle:accounts-login-state"].LoginState.signedUp()
}
});
Template.account.events({
'click .logout': function(evt) {
Meteor.logout();
evt.preventDefault();
},
'click .login': function(evt) {
Session.set('isLoggingIn', true);
evt.preventDefault();
}
});
| jcantara/resume-tube | client/account.js | JavaScript | mit | 398 | [
30522,
5219,
1012,
2275,
3207,
7011,
11314,
1006,
1005,
2003,
21197,
4726,
2378,
1005,
1010,
6270,
1007,
1025,
23561,
1012,
4070,
1012,
2393,
2545,
1006,
1063,
2772,
6279,
1024,
3853,
1006,
1007,
1063,
2709,
7427,
1031,
1000,
12049,
2571,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package nl.mpi.oai.harvester.harvesting;
import java.util.logging.Level;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import com.ctc.wstx.exc.WstxUnexpectedCharException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import nl.mpi.oai.harvester.utils.DocumentSource;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.codehaus.stax2.XMLInputFactory2;
import org.codehaus.stax2.XMLStreamReader2;
import org.codehaus.stax2.evt.XMLEvent2;
/**
* <br> Helper implementing operations on documents transported by OAI
*
* @author Kees Jan van de Looij (Max Planck Institute for Psycholinguistics)
*/
public class OAIHelper {
private static Logger logger = LogManager.getLogger(OAIHelper.class);
// only keep one XPath object for querying
static public XPath xpath = null;
/**
* <br> Get the metadata prefixes referenced in a document <br><br>
*
* Note: since the metadata itself might not contain a reference to the
* prefix, the document needs to be an OAI envelope.
*
* @param document the document
* @return the metadata prefix
*/
static public String getPrefix (DocumentSource document){
// metadata prefix
String prefix = null;
if (document.hasDocument()) {
// node in the document
Node node = null;
if (xpath == null){
// set up XPath querying
XPathFactory xpf = XPathFactory.newInstance();
xpath = xpf.newXPath();
}
// look for the prefix in the request node
try {
node = (Node) xpath.evaluate(
"//*[local-name()='request']",
document.getDocument(), XPathConstants.NODE);
} catch (XPathExpressionException e) {
e.printStackTrace();
}
if (node == null){
// no request node, no metadata prefix
prefix = null;
} else {
// found the request node, get the prefix attribute value
if (node.getAttributes().getNamedItem("metadataPrefix") == null){
prefix = null; // no metadata prefix
} else {
prefix = node.getAttributes().getNamedItem("metadataPrefix").getNodeValue();
}
}
} else {
int state = 1; // 1:START 0:STOP -1:ERROR
try {
XMLInputFactory2 xmlif = (XMLInputFactory2) XMLInputFactory2.newInstance();
xmlif.configureForConvenience();
XMLStreamReader2 xmlr = (XMLStreamReader2) xmlif.createXMLStreamReader(document.getStream());
while (state > 0) {
int eventType = xmlr.getEventType();
switch (state) {
case 1://START
switch (eventType) {
case XMLEvent2.START_ELEMENT:
QName qn = xmlr.getName();
if (qn.getLocalPart().equals("request")) {
prefix = xmlr.getAttributeValue(null,"metadataPrefix");
if (prefix != null)
state = 0;//STOP
}
break;
}
break;
}
outer:
if (xmlr.hasNext())
try {
xmlr.next();
} catch (WstxUnexpectedCharException ex) {
logger.info("Invalid char found in XML, skipping the current one and look for next one");
}
else
state = state == 1? 0: -1;// if START then STOP else ERROR
}
} catch (XMLStreamException ex) {
logger.error("problem finding prefix in the XML stream!",ex);
state = -1;//ERROR
}
if (state < 0 || prefix == null)
logger.debug("couldn't find prefix in the XML stream!");
else
logger.debug("found prefix["+prefix+"] in the XML stream!");
}
return prefix;
}
}
| clarin-eric/oai-harvest-manager | src/main/java/nl/mpi/oai/harvester/harvesting/OAIHelper.java | Java | gpl-3.0 | 4,649 | [
30522,
7427,
17953,
1012,
6131,
2072,
1012,
1051,
4886,
1012,
11203,
2121,
1012,
21534,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
15899,
1012,
2504,
1025,
12324,
9262,
2595,
1012,
20950,
1012,
3415,
15327,
1012,
1053,
18442,
1025,
12324,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef _ALLOCA_H
#define _ALLOCA_H
#ifdef __cplusplus
extern "C" {
#endif
#define __NEED_size_t
#include <bits/alltypes.h>
void *alloca(size_t);
#ifdef __GNUC__
#define alloca __builtin_alloca
#endif
#ifdef __cplusplus
}
#endif
#endif
| zichiban/UnixHubLinux | tools/include/alloca.h | C | mit | 242 | [
30522,
1001,
2065,
30524,
1001,
9375,
1035,
1035,
2342,
1035,
2946,
1035,
1056,
1001,
2421,
1026,
9017,
1013,
2035,
13874,
2015,
1012,
1044,
1028,
11675,
1008,
2035,
24755,
1006,
2946,
1035,
1056,
1007,
1025,
1001,
2065,
3207,
2546,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright (C) 2012 by INdT
*
* This program 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; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @author Rodrigo Goncalves de Oliveira <rodrigo.goncalves@openbossa.org>
* @author Roger Felipe Zanoni da Silva <roger.zanoni@openbossa.org>
*/
#ifndef _SPRITESHEET_H_
#define _SPRITESHEET_H_
#include "quasipainteditem.h"
#include <QtCore/QtGlobal>
class QPixmap;
class SpriteSheet : public QuasiPaintedItem
{
Q_OBJECT
Q_PROPERTY(int frame READ frame WRITE setFrame NOTIFY frameChanged)
public:
SpriteSheet(QuasiDeclarativeItem *parent = 0);
QString source() const;
void setSource(const QString &source);
int frames() const;
void setFrames(const int &frames);
int frame() const;
void setFrame(const int &frame);
int initialFrame() const;
void setInitialFrame(const int &initialFrame);
bool verticalMirror() const;
void setVerticalMirror(const bool &verticalMirror);
bool horizontalMirror() const;
void setHorizontalMirror(const bool &horizontalMirror);
void paint(QPainter *painter);
signals:
void sourceChanged();
void framesChanged();
void frameChanged();
void initialFrameChanged();
private:
void updateSizeInfo();
private:
QPixmap *m_pixMap;
QString m_source;
int m_frames;
int m_frame;
int m_initialFrame;
int m_frameWidth;
int m_vertical;
int m_horizontal;
bool m_mirror;
};
#endif /* _SPRITESHEET_H_ */
| INdT/Quasi-Engine | src/spritesheet.h | C | gpl-3.0 | 2,124 | [
30522,
1013,
1008,
1008,
1008,
9385,
1006,
1039,
1007,
2262,
2011,
27427,
2102,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
1008,
19933,
2009,
2104,
1996,
3408,
1997,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright (c) 2010-2019 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.powermax.internal;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.smarthome.core.thing.ThingTypeUID;
/**
* The {@link PowermaxBinding} class defines common constants, which are
* used across the whole binding.
*
* @author Laurent Garnier - Initial contribution
*/
public class PowermaxBindingConstants {
public static final String BINDING_ID = "powermax";
// List of all Thing Type UIDs
public static final ThingTypeUID BRIDGE_TYPE_SERIAL = new ThingTypeUID(BINDING_ID, "serial");
public static final ThingTypeUID BRIDGE_TYPE_IP = new ThingTypeUID(BINDING_ID, "ip");
public static final ThingTypeUID THING_TYPE_ZONE = new ThingTypeUID(BINDING_ID, "zone");
public static final ThingTypeUID THING_TYPE_X10 = new ThingTypeUID(BINDING_ID, "x10");
// All supported Bridge types
public static final Set<ThingTypeUID> SUPPORTED_BRIDGE_TYPES_UIDS = Collections
.unmodifiableSet(Stream.of(BRIDGE_TYPE_SERIAL, BRIDGE_TYPE_IP).collect(Collectors.toSet()));
// All supported Thing types
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections
.unmodifiableSet(Stream.of(THING_TYPE_ZONE, THING_TYPE_X10).collect(Collectors.toSet()));
// List of all Channel ids
public static final String MODE = "mode";
public static final String TROUBLE = "trouble";
public static final String ALERT_IN_MEMORY = "alert_in_memory";
public static final String SYSTEM_STATUS = "system_status";
public static final String READY = "ready";
public static final String WITH_ZONES_BYPASSED = "with_zones_bypassed";
public static final String ALARM_ACTIVE = "alarm_active";
public static final String SYSTEM_ARMED = "system_armed";
public static final String ARM_MODE = "arm_mode";
public static final String TRIPPED = "tripped";
public static final String LAST_TRIP = "last_trip";
public static final String BYPASSED = "bypassed";
public static final String ARMED = "armed";
public static final String LOW_BATTERY = "low_battery";
public static final String PGM_STATUS = "pgm_status";
public static final String X10_STATUS = "x10_status";
public static final String EVENT_LOG = "event_log_%s";
public static final String UPDATE_EVENT_LOGS = "update_event_logs";
public static final String DOWNLOAD_SETUP = "download_setup";
}
| theoweiss/openhab2 | bundles/org.openhab.binding.powermax/src/main/java/org/openhab/binding/powermax/internal/PowermaxBindingConstants.java | Java | epl-1.0 | 2,871 | [
30522,
1013,
1008,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
1011,
10476,
16884,
2000,
1996,
2330,
25459,
2622,
1008,
1008,
2156,
1996,
5060,
5371,
1006,
1055,
1007,
5500,
2007,
2023,
2147,
2005,
3176,
1008,
2592,
1012,
1008,
1008,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
*
* * Licensed to the Apache Software Foundation (ASF) under one or more
* * contributor license agreements. See the NOTICE file distributed with
* * this work for additional information regarding copyright ownership.
* * The ASF licenses this file to You under the Apache License, Version 2.0
* * (the "License"); you may not use this file except in compliance with
* * the License. You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/
package org.apache.eagle.security.auditlog;
import backtype.storm.spout.SchemeAsMultiScheme;
import com.typesafe.config.Config;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.eagle.common.config.EagleConfigConstants;
import org.apache.eagle.dataproc.impl.storm.kafka.KafkaSourcedSpoutProvider;
import org.apache.eagle.dataproc.impl.storm.kafka.KafkaSourcedSpoutScheme;
import org.apache.eagle.datastream.ExecutionEnvironments;
import org.apache.eagle.datastream.core.StreamProducer;
import org.apache.eagle.datastream.storm.StormExecutionEnvironment;
import org.apache.eagle.partition.DataDistributionDao;
import org.apache.eagle.partition.PartitionAlgorithm;
import org.apache.eagle.partition.PartitionStrategy;
import org.apache.eagle.partition.PartitionStrategyImpl;
import org.apache.eagle.security.partition.DataDistributionDaoImpl;
import org.apache.eagle.security.partition.GreedyPartitionAlgorithm;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class MapRFSAuditLogProcessorMain {
public static PartitionStrategy createStrategy(Config config) {
// TODO: Refactor configuration structure to avoid repeated config processing configure ~ hao
String host = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.HOST);
Integer port = config.getInt(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PORT);
String username = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.USERNAME);
String password = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PASSWORD);
String topic = config.getString("dataSourceConfig.topic");
DataDistributionDao dao = new DataDistributionDaoImpl(host, port, username, password, topic);
PartitionAlgorithm algorithm = new GreedyPartitionAlgorithm();
String key1 = EagleConfigConstants.EAGLE_PROPS + ".partitionRefreshIntervalInMin";
Integer partitionRefreshIntervalInMin = config.hasPath(key1) ? config.getInt(key1) : 60;
String key2 = EagleConfigConstants.EAGLE_PROPS + ".kafkaStatisticRangeInMin";
Integer kafkaStatisticRangeInMin = config.hasPath(key2) ? config.getInt(key2) : 60;
PartitionStrategy strategy = new PartitionStrategyImpl(dao, algorithm, partitionRefreshIntervalInMin * DateUtils.MILLIS_PER_MINUTE, kafkaStatisticRangeInMin * DateUtils.MILLIS_PER_MINUTE);
return strategy;
}
public static KafkaSourcedSpoutProvider createProvider(Config config) {
String deserClsName = config.getString("dataSourceConfig.deserializerClass");
final KafkaSourcedSpoutScheme scheme = new KafkaSourcedSpoutScheme(deserClsName, config) {
@Override
public List<Object> deserialize(byte[] ser) {
Object tmp = deserializer.deserialize(ser);
Map<String, Object> map = (Map<String, Object>)tmp;
if(tmp == null) return null;
return Arrays.asList(map.get("user"), tmp);
}
};
KafkaSourcedSpoutProvider provider = new KafkaSourcedSpoutProvider() {
@Override
public SchemeAsMultiScheme getStreamScheme(String deserClsName, Config context) {
return new SchemeAsMultiScheme(scheme);
}
};
return provider;
}
@SuppressWarnings("unchecked")
public static void execWithDefaultPartition(StormExecutionEnvironment env, KafkaSourcedSpoutProvider provider) {
StreamProducer source = env.fromSpout(provider).withOutputFields(2).nameAs("kafkaMsgConsumer").groupBy(Arrays.asList(0));
//StreamProducer reassembler = source.flatMap(new HdfsUserCommandReassembler()).groupBy(Arrays.asList(0));
//source.streamUnion(reassembler)
source.flatMap(new FileSensitivityDataJoinExecutor()).groupBy(Arrays.asList(0))
.flatMap(new IPZoneDataJoinExecutor())
.alertWithConsumer("maprFSAuditLogEventStream", "maprFSAuditLogAlertExecutor");
env.execute();
}
@SuppressWarnings("unchecked")
public static void execWithBalancedPartition(StormExecutionEnvironment env, KafkaSourcedSpoutProvider provider) {
PartitionStrategy strategy = createStrategy(env.getConfig());
StreamProducer source = env.fromSpout(provider).withOutputFields(2).nameAs("kafkaMsgConsumer").groupBy(strategy);
//StreamProducer reassembler = source.flatMap(new HdfsUserCommandReassembler()).groupBy(Arrays.asList(0));
//source.streamUnion(reassembler)
source.flatMap(new FileSensitivityDataJoinExecutor()).groupBy(Arrays.asList(0))
.flatMap(new IPZoneDataJoinExecutor())
.alertWithConsumer("maprFSAuditLogEventStream", "maprFSAuditLogAlertExecutor");
env.execute();
}
public static void main(String[] args) throws Exception{
StormExecutionEnvironment env = ExecutionEnvironments.getStorm(args);
Config config = env.getConfig();
KafkaSourcedSpoutProvider provider = createProvider(env.getConfig());
Boolean balancePartition = config.hasPath("eagleProps.balancePartitionEnabled") && config.getBoolean("eagleProps.balancePartitionEnabled");
if (balancePartition) {
execWithBalancedPartition(env, provider);
} else {
execWithDefaultPartition(env, provider);
}
}
} | rlugojr/incubator-eagle | eagle-security/eagle-security-maprfs-auditlog/src/main/java/org/apache/eagle/security/auditlog/MapRFSAuditLogProcessorMain.java | Java | apache-2.0 | 6,554 | [
30522,
1013,
1008,
1008,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
1008,
2023,
2147,
2005,
3176,
2592,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* dzl-shortcut-theme.c
*
* Copyright (C) 2016 Christian Hergert <chergert@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define G_LOG_DOMAIN "dzl-shortcut-theme"
#include "config.h"
#include <string.h>
#include "dzl-debug.h"
#include "shortcuts/dzl-shortcut-private.h"
#include "shortcuts/dzl-shortcut-chord.h"
#include "shortcuts/dzl-shortcut-theme.h"
typedef struct
{
gchar *name;
gchar *title;
gchar *subtitle;
/*
* The parent_name property can be used to inherit from another
* shortcut theme when dispatching operations. The controllers
* will use this to locate the parent theme/context pair and
* try after the active theme fails to dispatch.
*/
gchar *parent_name;
/*
* A hashtable of context names to the context pointer. The hashtable
* owns the reference to the context.
*/
GHashTable *contexts;
/*
* A list of additional CSS resources that should be ingreated with this
* theme so that everything is applied together. You might use this if
* some of your keytheme needs to use CSS keybinding resources.
*/
GHashTable *resource_providers;
/*
* Commands and actions can be mapped from a context or directly from the
* theme for convenience (to avoid having to define them from every context).
*/
DzlShortcutChordTable *actions_table;
DzlShortcutChordTable *commands_table;
/*
* Weak back-pointer to the DzlShorcutMangaer that owns this theme. A theme
* can only be in one manager at a time. This will be cleared when the theme
* is removed from the manager.
*/
DzlShortcutManager *manager;
/*
* The theme also maintains a list of chains overridden by the theme. These
* are indexed by the interned string pointer (for direct pointer copmarison)
* of the command_id or action_id.
*/
GHashTable *chains;
} DzlShortcutThemePrivate;
enum {
PROP_0,
PROP_NAME,
PROP_PARENT_NAME,
PROP_SUBTITLE,
PROP_TITLE,
N_PROPS
};
G_DEFINE_TYPE_WITH_PRIVATE (DzlShortcutTheme, dzl_shortcut_theme, G_TYPE_OBJECT)
static GParamSpec *properties [N_PROPS];
static void
dzl_shortcut_theme_finalize (GObject *object)
{
DzlShortcutTheme *self = (DzlShortcutTheme *)object;
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_clear_pointer (&priv->name, g_free);
g_clear_pointer (&priv->parent_name, g_free);
g_clear_pointer (&priv->title, g_free);
g_clear_pointer (&priv->subtitle, g_free);
g_clear_pointer (&priv->contexts, g_hash_table_unref);
g_clear_pointer (&priv->chains, g_hash_table_unref);
g_clear_pointer (&priv->actions_table, dzl_shortcut_chord_table_free);
g_clear_pointer (&priv->commands_table, dzl_shortcut_chord_table_free);
G_OBJECT_CLASS (dzl_shortcut_theme_parent_class)->finalize (object);
}
static void
dzl_shortcut_theme_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
DzlShortcutTheme *self = (DzlShortcutTheme *)object;
switch (prop_id)
{
case PROP_NAME:
g_value_set_string (value, dzl_shortcut_theme_get_name (self));
break;
case PROP_PARENT_NAME:
g_value_set_string (value, dzl_shortcut_theme_get_parent_name (self));
break;
case PROP_TITLE:
g_value_set_string (value, dzl_shortcut_theme_get_title (self));
break;
case PROP_SUBTITLE:
g_value_set_string (value, dzl_shortcut_theme_get_subtitle (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
dzl_shortcut_theme_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
DzlShortcutTheme *self = (DzlShortcutTheme *)object;
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
switch (prop_id)
{
case PROP_NAME:
priv->name = g_value_dup_string (value);
break;
case PROP_PARENT_NAME:
dzl_shortcut_theme_set_parent_name (self, g_value_get_string (value));
break;
case PROP_TITLE:
g_free (priv->title);
priv->title = g_value_dup_string (value);
break;
case PROP_SUBTITLE:
g_free (priv->subtitle);
priv->subtitle = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
dzl_shortcut_theme_class_init (DzlShortcutThemeClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = dzl_shortcut_theme_finalize;
object_class->get_property = dzl_shortcut_theme_get_property;
object_class->set_property = dzl_shortcut_theme_set_property;
properties [PROP_NAME] =
g_param_spec_string ("name",
"Name",
"The name of the theme",
NULL,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
properties [PROP_PARENT_NAME] =
g_param_spec_string ("parent-name",
"Parent Name",
"The name of the parent shortcut theme",
NULL,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_TITLE] =
g_param_spec_string ("title",
"Title",
"The title of the theme as used for UI elements",
NULL,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
properties [PROP_SUBTITLE] =
g_param_spec_string ("subtitle",
"Subtitle",
"The subtitle of the theme as used for UI elements",
NULL,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
dzl_shortcut_theme_init (DzlShortcutTheme *self)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
priv->commands_table = dzl_shortcut_chord_table_new ();
priv->actions_table = dzl_shortcut_chord_table_new ();
priv->contexts = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
priv->chains = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify)dzl_shortcut_closure_chain_free);
}
const gchar *
dzl_shortcut_theme_get_name (DzlShortcutTheme *self)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
return priv->name;
}
/**
* dzl_shortcut_theme_find_context_by_name:
* @self: An #DzlShortcutContext
* @name: The name of the context
*
* Gets the context named @name. If the context does not exist, it will
* be created.
*
* Returns: (not nullable) (transfer none): An #DzlShortcutContext
*/
DzlShortcutContext *
dzl_shortcut_theme_find_context_by_name (DzlShortcutTheme *self,
const gchar *name)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
DzlShortcutContext *ret;
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
g_return_val_if_fail (name != NULL, NULL);
name = g_intern_string (name);
if (NULL == (ret = g_hash_table_lookup (priv->contexts, name)))
{
ret = dzl_shortcut_context_new (name);
g_hash_table_insert (priv->contexts, (gchar *)name, ret);
}
return ret;
}
/**
* _dzl_shortcut_theme_try_find_context_by_name:
* @self: a #DzlShortcutTheme
*
* This function is like dzl_shortcut_theme_find_context_by_name() but will
* not create the context if it does not exist.
*
* Returns: (transfer none) (nullable): A #DzlShortcutContext or %NULL.
*/
DzlShortcutContext *
_dzl_shortcut_theme_try_find_context_by_name (DzlShortcutTheme *self,
const gchar *name)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
GQuark qname;
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
g_return_val_if_fail (name != NULL, NULL);
/* Names are interned (which are quarks) */
if (0 != (qname = g_quark_try_string (name)))
return g_hash_table_lookup (priv->contexts, g_quark_to_string (qname));
return NULL;
}
static DzlShortcutContext *
dzl_shortcut_theme_find_default_context_by_type (DzlShortcutTheme *self,
GType type)
{
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
g_return_val_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET), NULL);
return dzl_shortcut_theme_find_context_by_name (self, g_type_name (type));
}
/**
* dzl_shortcut_theme_find_default_context:
*
* Finds the default context in the theme for @widget.
*
* Returns: (nullable) (transfer none): An #DzlShortcutContext or %NULL.
*/
DzlShortcutContext *
dzl_shortcut_theme_find_default_context (DzlShortcutTheme *self,
GtkWidget *widget)
{
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
return dzl_shortcut_theme_find_default_context_by_type (self, G_OBJECT_TYPE (widget));
}
DzlShortcutContext *
_dzl_shortcut_theme_find_default_context_with_phase (DzlShortcutTheme *self,
GtkWidget *widget,
DzlShortcutPhase phase)
{
g_autofree gchar *free_me = NULL;
const gchar *name;
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
name = G_OBJECT_TYPE_NAME (widget);
if ((phase & DZL_SHORTCUT_PHASE_BUBBLE) != 0)
name = free_me = g_strdup_printf ("%s:bubble", name);
else if ((phase & DZL_SHORTCUT_PHASE_CAPTURE) != 0)
name = free_me = g_strdup_printf ("%s:capture", name);
return dzl_shortcut_theme_find_context_by_name (self, name);
}
void
dzl_shortcut_theme_add_context (DzlShortcutTheme *self,
DzlShortcutContext *context)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
const gchar *name;
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
g_return_if_fail (DZL_IS_SHORTCUT_CONTEXT (context));
name = dzl_shortcut_context_get_name (context);
g_return_if_fail (name != NULL);
g_hash_table_insert (priv->contexts, (gchar *)g_intern_string (name), g_object_ref (context));
}
DzlShortcutTheme *
dzl_shortcut_theme_new (const gchar *name)
{
return g_object_new (DZL_TYPE_SHORTCUT_THEME,
"name", name,
NULL);
}
const gchar *
dzl_shortcut_theme_get_title (DzlShortcutTheme *self)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
return priv->title;
}
const gchar *
dzl_shortcut_theme_get_subtitle (DzlShortcutTheme *self)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
return priv->subtitle;
}
GHashTable *
_dzl_shortcut_theme_get_contexts (DzlShortcutTheme *self)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
return priv->contexts;
}
void
_dzl_shortcut_theme_set_name (DzlShortcutTheme *self,
const gchar *name)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
if (g_strcmp0 (name, priv->name) != 0)
{
g_free (priv->name);
priv->name = g_strdup (name);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_NAME]);
}
}
/**
* dzl_shortcut_theme_get_parent_name:
* @self: a #DzlShortcutTheme
*
* Gets the name of the parent shortcut theme.
*
* This is used to resolve shortcuts from the parent theme without having to
* copy them directly into this shortcut theme. It allows for some level of
* copy-on-write (CoW).
*
* Returns: (nullable): The name of the parent theme, or %NULL if none is set.
*/
const gchar *
dzl_shortcut_theme_get_parent_name (DzlShortcutTheme *self)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
return priv->parent_name;
}
void
dzl_shortcut_theme_set_parent_name (DzlShortcutTheme *self,
const gchar *parent_name)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
if (g_strcmp0 (parent_name, priv->parent_name) != 0)
{
g_free (priv->parent_name);
priv->parent_name = g_strdup (parent_name);
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_PARENT_NAME]);
}
}
const gchar *
_dzl_shortcut_theme_lookup_action (DzlShortcutTheme *self,
const DzlShortcutChord *chord)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
g_return_val_if_fail (chord != NULL, NULL);
if (priv->actions_table != NULL)
{
const gchar *action = NULL;
DzlShortcutMatch match;
match = dzl_shortcut_chord_table_lookup (priv->actions_table, chord, (gpointer *)&action);
if (match == DZL_SHORTCUT_MATCH_EQUAL)
return action;
}
return NULL;
}
void
dzl_shortcut_theme_set_chord_for_action (DzlShortcutTheme *self,
const gchar *detailed_action_name,
const DzlShortcutChord *chord,
DzlShortcutPhase phase)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
if (detailed_action_name == NULL)
{
dzl_shortcut_chord_table_remove (priv->actions_table, chord);
return;
}
detailed_action_name = g_intern_string (detailed_action_name);
dzl_shortcut_chord_table_remove_data (priv->actions_table,
(gpointer)detailed_action_name);
if (chord != NULL)
dzl_shortcut_chord_table_add (priv->actions_table, chord,
(gpointer)detailed_action_name);
if (phase == DZL_SHORTCUT_PHASE_DISPATCH)
phase = DZL_SHORTCUT_PHASE_BUBBLE | DZL_SHORTCUT_PHASE_GLOBAL;
if (!g_hash_table_contains (priv->chains, detailed_action_name))
{
DzlShortcutClosureChain *chain;
chain = dzl_shortcut_closure_chain_append_action_string (NULL, detailed_action_name);
if (chain != NULL)
{
chain->phase = phase;
g_hash_table_insert (priv->chains, (gchar *)detailed_action_name, chain);
}
}
}
const DzlShortcutChord *
dzl_shortcut_theme_get_chord_for_action (DzlShortcutTheme *self,
const gchar *detailed_action_name)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
const DzlShortcutChord *ret;
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
if (priv->actions_table == NULL)
return NULL;
ret = dzl_shortcut_chord_table_lookup_data (priv->actions_table,
(gpointer)g_intern_string (detailed_action_name));
if (ret == NULL)
{
DzlShortcutTheme *parent = dzl_shortcut_theme_get_parent (self);
if (parent != NULL)
ret = dzl_shortcut_theme_get_chord_for_action (parent, detailed_action_name);
}
return ret;
}
void
dzl_shortcut_theme_set_accel_for_action (DzlShortcutTheme *self,
const gchar *detailed_action_name,
const gchar *accel,
DzlShortcutPhase phase)
{
g_autoptr(DzlShortcutChord) chord = NULL;
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
if (accel != NULL)
chord = dzl_shortcut_chord_new_from_string (accel);
dzl_shortcut_theme_set_chord_for_action (self, detailed_action_name, chord, phase);
}
/**
* dzl_shortcut_theme_set_chord_for_command:
* @self: a #DzlShortcutTheme
* @chord: (nullable): the chord for the command
* @command: (nullable): the command to be executed
* @phase: the phase to activate within, or 0 for the default
*
* This will set the command to execute when @chord is pressed. If command is
* %NULL, the accelerator will be cleared. If @chord is %NULL, all
* accelerators for @command will be cleared.
*/
void
dzl_shortcut_theme_set_chord_for_command (DzlShortcutTheme *self,
const gchar *command,
const DzlShortcutChord *chord,
DzlShortcutPhase phase)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
if (command == NULL)
{
dzl_shortcut_chord_table_remove (priv->commands_table, chord);
return;
}
command = g_intern_string (command);
dzl_shortcut_chord_table_remove_data (priv->commands_table, (gpointer)command);
if (chord != NULL)
dzl_shortcut_chord_table_add (priv->commands_table, chord, (gpointer)command);
if (phase == DZL_SHORTCUT_PHASE_DISPATCH)
phase = DZL_SHORTCUT_PHASE_BUBBLE | DZL_SHORTCUT_PHASE_GLOBAL;
if (!g_hash_table_contains (priv->chains, command))
{
DzlShortcutClosureChain *chain;
chain = dzl_shortcut_closure_chain_append_command (NULL, command);
chain->phase = phase;
g_hash_table_insert (priv->chains, (gchar *)command, chain);
}
}
const DzlShortcutChord *
dzl_shortcut_theme_get_chord_for_command (DzlShortcutTheme *self,
const gchar *command)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
const DzlShortcutChord *ret;
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), NULL);
if (priv->commands_table == NULL)
return NULL;
ret = dzl_shortcut_chord_table_lookup_data (priv->commands_table,
(gpointer)g_intern_string (command));
if (ret == NULL)
{
DzlShortcutTheme *parent = dzl_shortcut_theme_get_parent (self);
if (parent != NULL)
ret = dzl_shortcut_theme_get_chord_for_command (parent, command);
}
return ret;
}
/**
* dzl_shortcut_theme_set_accel_for_command:
* @self: a #DzlShortcutTheme
* @command: (nullable): the command to be executed
* @accel: (nullable): the shortcut accelerator
* @phase: the phase to activate within, or 0 for the default
*
* This will set the command to execute when @accel is pressed. If command is
* %NULL, the accelerator will be cleared. If accelerator is %NULL, all
* accelerators for @command will be cleared.
*/
void
dzl_shortcut_theme_set_accel_for_command (DzlShortcutTheme *self,
const gchar *command,
const gchar *accel,
DzlShortcutPhase phase)
{
g_autoptr(DzlShortcutChord) chord = NULL;
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
if (accel != NULL)
chord = dzl_shortcut_chord_new_from_string (accel);
dzl_shortcut_theme_set_chord_for_command (self, command, chord, phase);
}
/**
* dzl_shortcut_theme_get_parent:
* @self: a #DzlShortcutTheme
*
* If the #DzlShortcutTheme:parent-name property has been set, this will fetch
* the parent #DzlShortcutTheme.
*
* Returns: (transfer none) (nullable): A #DzlShortcutTheme or %NULL.
*/
DzlShortcutTheme *
dzl_shortcut_theme_get_parent (DzlShortcutTheme *self)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_assert (DZL_IS_SHORTCUT_THEME (self));
if (g_strcmp0 (priv->name, "internal") == 0)
return NULL;
if (priv->manager == NULL)
return NULL;
if (priv->parent_name == NULL)
return _dzl_shortcut_manager_get_internal_theme (priv->manager);
return dzl_shortcut_manager_get_theme_by_name (priv->manager, priv->parent_name);
}
DzlShortcutMatch
_dzl_shortcut_theme_match (DzlShortcutTheme *self,
DzlShortcutPhase phase,
const DzlShortcutChord *chord,
DzlShortcutClosureChain **chain)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
DzlShortcutTheme *parent;
DzlShortcutMatch match1;
DzlShortcutMatch match2;
DzlShortcutMatch match3 = DZL_SHORTCUT_MATCH_NONE;
const gchar *action_id = NULL;
const gchar *command_id = NULL;
g_return_val_if_fail (DZL_IS_SHORTCUT_THEME (self), FALSE);
g_return_val_if_fail (chord != NULL, FALSE);
g_return_val_if_fail (chain != NULL, FALSE);
match1 = dzl_shortcut_chord_table_lookup (priv->actions_table, chord, (gpointer *)&action_id);
if (match1 == DZL_SHORTCUT_MATCH_EQUAL)
{
*chain = g_hash_table_lookup (priv->chains, action_id);
if ((*chain)->phase == phase)
return match1;
match1 = DZL_SHORTCUT_MATCH_NONE;
}
match2 = dzl_shortcut_chord_table_lookup (priv->commands_table, chord, (gpointer *)&command_id);
if (match2 == DZL_SHORTCUT_MATCH_EQUAL)
{
*chain = g_hash_table_lookup (priv->chains, command_id);
if ((*chain)->phase == phase)
return match2;
match2 = DZL_SHORTCUT_MATCH_NONE;
}
/*
* We didn't find anything in this theme, try our parent theme.
*/
parent = dzl_shortcut_theme_get_parent (self);
if (parent != NULL)
{
match3 = _dzl_shortcut_theme_match (parent, phase, chord, chain);
if (match3 == DZL_SHORTCUT_MATCH_EQUAL)
return match3;
}
/*
* Nothing found, let the caller know if we found a partial match
* and ensure we zero out chain just to be safe.
*/
*chain = NULL;
return (match1 || match2 || match3) ? DZL_SHORTCUT_MATCH_PARTIAL : DZL_SHORTCUT_MATCH_NONE;
}
void
_dzl_shortcut_theme_set_manager (DzlShortcutTheme *self,
DzlShortcutManager *manager)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
g_return_if_fail (!manager || DZL_IS_SHORTCUT_MANAGER (manager));
g_return_if_fail (priv->manager == NULL || manager == NULL);
priv->manager = manager;
}
static void
copy_chord_to_table (const DzlShortcutChord *chord,
gpointer data,
gpointer user_data)
{
DzlShortcutChordTable *dest = user_data;
const gchar *interned_string = data;
g_assert (chord != NULL);
g_assert (data != NULL);
g_assert (dest != NULL);
dzl_shortcut_chord_table_add (dest, chord, (gpointer)interned_string);
}
void
_dzl_shortcut_theme_merge (DzlShortcutTheme *self,
DzlShortcutTheme *layer)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
DzlShortcutThemePrivate *layer_priv = dzl_shortcut_theme_get_instance_private (layer);
GHashTableIter hiter;
gpointer key;
gpointer value;
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
g_return_if_fail (DZL_IS_SHORTCUT_THEME (layer));
g_return_if_fail (self != layer);
g_return_if_fail (DZL_IS_SHORTCUT_MANAGER (priv->manager));
g_return_if_fail (DZL_IS_SHORTCUT_MANAGER (layer_priv->manager));
g_return_if_fail (priv->manager == layer_priv->manager);
/*
* This function will take the values in @layer and apply them to @self.
* Doing so will allow us to discard @layer afterwards. What this does for us
* is allow the base application and plugins all define aspects of a theme
* but have them merged into one.
*
* This function is destructive to @layer which is why it is private API and
* should only be used by the DzlShortcutManager.
*/
if (priv->name == NULL && layer_priv->name != NULL)
priv->name = g_steal_pointer (&layer_priv->name);
if (priv->title == NULL && layer_priv->title != NULL)
priv->title = g_steal_pointer (&layer_priv->title);
if (priv->subtitle == NULL && layer_priv->subtitle != NULL)
priv->subtitle = g_steal_pointer (&layer_priv->subtitle);
if (priv->parent_name == NULL && layer_priv->parent_name != NULL)
priv->parent_name = g_steal_pointer (&layer_priv->parent_name);
/*
* Steal all of the closure chains from @layer and apply them to our
* overriden closure chains.
*/
g_hash_table_iter_init (&hiter, layer_priv->chains);
while (g_hash_table_iter_next (&hiter, &key, &value))
{
DzlShortcutClosureChain *chain = value;
const gchar *interned_key = key;
g_hash_table_insert (priv->chains, (gpointer)interned_key, chain);
g_hash_table_iter_steal (&hiter);
}
/*
* Merge all of the contexts found in the upper layer and apply them
* to our contexts. Since there could be additions/removals to the
* context, we can't just steal them, but have to merge their contents.
*/
g_hash_table_iter_init (&hiter, layer_priv->contexts);
while (g_hash_table_iter_next (&hiter, &key, &value))
{
DzlShortcutContext *context = value;
DzlShortcutContext *base_context;
const gchar *interned_key = key;
base_context = g_hash_table_lookup (priv->contexts, interned_key);
/*
* If we do not contain this context yet, we can cheat and just steal the
* whole context rather than merge them.
*/
if (base_context == NULL)
{
g_hash_table_insert (priv->contexts, (gpointer)interned_key, value);
g_hash_table_iter_steal (&hiter);
continue;
}
/*
* Okay, both layers have the context, so we need to merge them.
*/
_dzl_shortcut_context_merge (base_context, context);
}
/* Merge any associated resources. */
if (layer_priv->resource_providers != NULL)
{
GHashTableIter iter;
if (priv->resource_providers == NULL)
priv->resource_providers = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
g_hash_table_iter_init (&iter, layer_priv->resource_providers);
while (g_hash_table_iter_next (&iter, &key, &value))
{
g_hash_table_iter_steal (&iter);
g_hash_table_insert (priv->resource_providers, key, value);
}
}
/*
* Copy our action and commands chords over. These are all const data, so no
* need to be tricky about stealing data or what data we are safe to
* copy/steal/ref/etc.
*/
dzl_shortcut_chord_table_foreach (layer_priv->actions_table, copy_chord_to_table, priv->actions_table);
dzl_shortcut_chord_table_foreach (layer_priv->commands_table, copy_chord_to_table, priv->commands_table);
}
void
dzl_shortcut_theme_add_css_resource (DzlShortcutTheme *self,
const gchar *path)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_autoptr(GtkCssProvider) provider = NULL;
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
g_return_if_fail (path != NULL);
g_return_if_fail (*path == '/' || g_str_has_prefix (path, "resource://"));
if (priv->resource_providers == NULL)
priv->resource_providers = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
path = g_intern_string (path);
provider = gtk_css_provider_new ();
if (g_str_has_prefix (path, "resource://"))
{
const gchar *adjpath = path + strlen ("resource://");
gtk_css_provider_load_from_resource (provider, adjpath);
g_hash_table_insert (priv->resource_providers, (gpointer)path, g_steal_pointer (&provider));
}
else
{
g_autoptr(GError) error = NULL;
if (!gtk_css_provider_load_from_path (provider, path, &error))
g_warning ("%s", error->message);
else
g_hash_table_insert (priv->resource_providers, (gpointer)path, g_steal_pointer (&provider));
}
}
void
dzl_shortcut_theme_remove_css_resource (DzlShortcutTheme *self,
const gchar *path)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
g_return_if_fail (path != NULL);
if (priv->resource_providers != NULL)
g_hash_table_remove (priv->resource_providers, g_intern_string (path));
}
void
_dzl_shortcut_theme_attach (DzlShortcutTheme *self)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
if (priv->resource_providers != NULL)
{
GdkScreen *screen = gdk_screen_get_default ();
GtkStyleProvider *provider;
GHashTableIter iter;
g_hash_table_iter_init (&iter, priv->resource_providers);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&provider))
{
DZL_TRACE_MSG ("adding CSS provider %p", provider);
gtk_style_context_add_provider_for_screen (screen,
provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
}
}
void
_dzl_shortcut_theme_detach (DzlShortcutTheme *self)
{
DzlShortcutThemePrivate *priv = dzl_shortcut_theme_get_instance_private (self);
DZL_ENTRY;
g_return_if_fail (DZL_IS_SHORTCUT_THEME (self));
if (priv->resource_providers != NULL)
{
GdkScreen *screen = gdk_screen_get_default ();
GtkStyleProvider *provider;
GHashTableIter iter;
g_hash_table_iter_init (&iter, priv->resource_providers);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&provider))
{
DZL_TRACE_MSG ("removing CSS provider %p", provider);
gtk_style_context_remove_provider_for_screen (screen, provider);
}
}
DZL_EXIT;
}
| chergert/libdazzle | src/shortcuts/dzl-shortcut-theme.c | C | gpl-3.0 | 31,155 | [
30522,
1013,
1008,
1040,
2480,
2140,
1011,
2460,
12690,
1011,
4323,
1012,
1039,
1008,
1008,
9385,
1006,
1039,
1007,
2355,
3017,
2014,
4590,
2102,
1026,
24188,
4590,
2102,
1030,
2417,
12707,
1012,
4012,
1028,
1008,
1008,
2023,
2565,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace SJBR\StaticInfoTables\Domain\Model;
/***************************************************************
* Copyright notice
*
* (c) 2011-2012 Armin Rüdiger Vieweg <info@professorweb.de>
* (c) 2013 Stanislas Rolland <typo3(arobas)sjbr.ca>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script 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 General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* The Country model
*
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class Country extends AbstractEntity {
/**
* The German short name
* @var string
*/
protected $shortNameDe = '';
/**
* Sets the German short name.
*
* @param string $shortNameDe
*
* @return void
*/
public function setShortNameDe($shortNameDe) {
$this->shortNameDe = $shortNameDe;
}
/**
* Gets the German short name.
*
* @return string
*/
public function getShortNameDe() {
return $this->shortNameDe;
}
}
?> | Loopshape/Portfolio | hostweb/typo3conf/ext/static_info_tables_de/Classes/Domain/Model/Country.php | PHP | gpl-2.0 | 1,688 | [
30522,
1026,
1029,
25718,
3415,
15327,
1055,
3501,
19892,
1032,
10763,
2378,
14876,
10880,
2015,
1032,
5884,
1032,
2944,
1025,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{% extends "profile_base.html" %}
{% load static %}
{% block content %}
<div class="panel panel-default" id="account-details">
<div class="panel-heading">
Account Details
<a href="{% url 'profile_edit'%}" id="edit-account">
<span class="glyphicon glyphicon-pencil">
</span>
</a>
</div>
<div class="panel-body" id="account-body">
<p>Username: {{ user.username }}</p>
<p>First name: {{ user.first_name }}</p>
<p>Last name: {{ user.last_name }}</p>
<p>Email: {{ user.email }}</p>
</div>
<div class="panel-body" id="account-edit">
</div>
</div> <!-- end panel -->
<div class="panel panel-default">
<div class="panel-heading">
Description
<a href="{% url 'profile_edit_description'%}" id="edit-account">
<span class="glyphicon glyphicon-pencil">
</span>
</a>
</div>
<div class="panel-body">
{{ profile.description }}
</div>
</div> <!-- end panel -->
<div class="panel panel-default">
<div class="panel-heading">
Contact Information
<a href="{% url 'profile_edit_contact'%}" id="edit-account">
<span class="glyphicon glyphicon-pencil">
</span>
</a>
</div>
<div class="panel-body">
<p>Mobile Number: {{ profile.mobile_number }}</p>
<p>Contact details:</p>
<p>{{ profile.contact_info|linebreaks }}</p>
</div>
</div> <!-- end panel -->
{% endblock %}
| raytung/Slice | UserProfile/templates/profile_index.html | HTML | mit | 1,394 | [
30522,
1063,
1003,
8908,
1000,
6337,
1035,
2918,
1012,
16129,
1000,
1003,
1065,
1063,
1003,
7170,
10763,
1003,
1065,
1063,
1003,
3796,
4180,
1003,
1065,
1026,
4487,
2615,
2465,
1027,
1000,
5997,
5997,
1011,
12398,
1000,
8909,
1027,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"45825520","logradouro":"Rua Jequitinhonha","bairro":"Minas Gerais","cidade":"Eun\u00e1polis","uf":"BA","estado":"Bahia"});
| lfreneda/cepdb | api/v1/45825520.jsonp.js | JavaScript | cc0-1.0 | 137 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
3429,
2620,
17788,
25746,
2692,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
15333,
15549,
7629,
8747,
3270,
1000,
1010,
1000,
21790,
1893... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
published: true
title: Plaza Garibaldi
layout: post
---
Para informações gerais e história consulte o [Site Oficial](http://www.plazagaribaldi.com.mx)
# Onde fica?
A Praça Garibaldi fica a cerca de 1.5km do Zócalo (Praça principal do centro histórico).
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3762.3457390439908!2d-99.14110084971966!3d19.440654845396715!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x85d1f92ec7757c1f%3A0xe4295c2ada8f4af7!2sPlaza+Garibaldi!5e0!3m2!1spt-BR!2sbr!4v1455835451018" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
# Como chegar?
A melhor forma é de [Metrô](/2016/02/18/transporte.html#metr).
Dependendo da linha é possível descer direto na estação Garibaldi e caminhar menos de 1 minuto até a praça.
Outra opção é caminhar 15min a partir do Zócalo.
# O que fazer?
Na praça está localizado o [Museu da Tequila e Mezcal](http://www.mutemgaribaldi.mx/museo.html) onde é contada a história e o processo de produção destas bebidas, são expostas centenas de rótulos das mais diversas variedades e incluso no valor da entrada está uma degustação de tequila ou mezcal.

O Museu ainda tem uma breve história dos Mariachis, símbolos da cultura Mexicana e presentes em toda parte.

O Museu abre todos os dias, e de quinta a domingo fica até as 02:30! Uma boa opção pra fazer um esquenta hahaha.
Na praça também está localizada a [Escola de Mariachis](http://www.cultura.df.gob.mx/index.php/de-mariachi-ollin-yoliztli-garibaldi), e todas as noites dezenas de grupos se apresentam por lá. Normalmente eles oferecem "serenatas" para as pessoas e cobram por música!

<iframe width="420" height="315" src="https://www.youtube.com/embed/VCb9_0U1U1Y" frameborder="0" allowfullscreen></iframe>
Além disso, ao redor da praça existem diversos bares e restaurantes competindo por público. Todos eles tem pessoas na frente convidando (as vezes insistentemente) para entrar.
Nós fomos apenas a um desses restaurantes, o [Salón Tenampa](http://www.salontenampa.com). Um lugar bem agradável com comida muito boa e um preço justo.

| MikhailKoslowski/MikhailKoslowski.github.io | _posts/2016-02-18-plaza-garibaldi.markdown | Markdown | mit | 2,679 | [
30522,
1011,
1011,
1011,
2405,
1024,
2995,
2516,
1024,
8232,
11721,
3089,
28807,
9621,
1024,
2695,
1011,
1011,
1011,
11498,
12367,
22684,
2229,
29220,
1041,
19891,
23363,
2063,
1051,
1031,
2609,
1997,
24108,
2140,
1033,
1006,
8299,
1024,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.properties.provider;
import com.intellij.lang.properties.psi.Property;
import com.intellij.lang.properties.psi.PropertyKeyIndex;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.properties.provider.PropertiesProvider;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
public class PropertiesProviderImpl implements PropertiesProvider {
@Override
public @Nullable String getPropertyValue(@NotNull String propertyKey, @NotNull GlobalSearchScope scope) {
Project project = scope.getProject();
if (project == null) return null;
Collection<Property> property =
PropertyKeyIndex.getInstance().get(propertyKey, project, scope);
if (property == null) return null;
Property item = ContainerUtil.getFirstItem(property);
return item != null ? item.getValue() : null;
}
}
| jwren/intellij-community | plugins/properties/properties-psi-api/src/com/intellij/lang/properties/provider/PropertiesProviderImpl.java | Java | apache-2.0 | 1,127 | [
30522,
1013,
1013,
9385,
2456,
1011,
16798,
2475,
6892,
10024,
7076,
1055,
1012,
1054,
1012,
1051,
1012,
1998,
16884,
1012,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1996,
15895,
1016,
1012,
1014,
6105,
1012,
7427,
4012,
1012,
13420,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
@extends('site.layouts.default')
{{-- Web site Title --}}
@section('title')
Login
@parent
@stop
{{-- Content --}}
@section('content')
<div class="page-header">
<h1>Ingresar al administrador</h1>
</div>
<?php
echo Form::open(array('url' => '/login', 'class' => 'form-horizontal')); ?>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<fieldset>
<div class="form-group">
<label class="col-md-2 control-label" for="email">Usuario</label>
<div class="col-md-10">
<input class="form-control" tabindex="1" placeholder="usuario" type="text" name="username" id="email">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="password">
Clave
</label>
<div class="col-md-10">
<input class="form-control" tabindex="2" placeholder="clave" type="password" name="password" id="password">
</div>
</div>
@if ( Session::get('error') )
<div class="alert alert-danger">{{ Session::get('error') }}</div>
@endif
@if ( Session::get('notice') )
<div class="alert">{{ Session::get('notice') }}</div>
@endif
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button tabindex="3" type="submit" class="btn btn-primary">Ingresar</button>
</div>
</div>
</fieldset>
</form>
@stop
| palamago/shared-links-ranking | app/views/site/user/login.blade.php | PHP | gpl-2.0 | 1,634 | [
30522,
1030,
8908,
1006,
1005,
2609,
1012,
9621,
2015,
1012,
12398,
1005,
1007,
1063,
1063,
1011,
1011,
4773,
2609,
2516,
1011,
1011,
1065,
1065,
1030,
2930,
1006,
1005,
2516,
1005,
1007,
8833,
2378,
1030,
6687,
1030,
2644,
1063,
1063,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace User\UserBundle\Controller;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Reservable\ActivityBundle\Entity\Activity;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use User\UserBundle\Entity\Users;
class ConsultController extends Controller
{
public function viewUsersAction()
{
if(!$this->get('security.context')->isGranted('ROLE_USER')) {
throw new AccessDeniedException();
}
$allUsers = array();
$users = $this->getDoctrine()
->getRepository('UserUserBundle:Users')
->findAllUsers();
foreach($users as $oneUser){
//ldd($oneUser);
$aux['userID'] = ucwords($oneUser->getID());
$aux['email'] = $oneUser->getEmail();
$aux['name'] = ucwords($oneUser->getName());
$aux['surname'] = ucwords($oneUser->getSurname());
$aux['phone'] = $oneUser->getPhoneNumber();
$aux['mobile'] = $oneUser->getMobileNumber();
$aux['lastLogin'] = $oneUser->getLastLogin();
$aux['active'] = $oneUser->isEnabled();
$role = $oneUser->getRole();
$aux['role'] = $role[0];
$aux['properties'] = array();
switch($role[0]){
case 'ROLE_USER':
break;
case 'ROLE_ADMIN':
$aux['properties'] = $this->getUserProperties($oneUser->getID());
break;
case 'ROLE_SUPER_ADMIN':
break;
}
$allUsers[] = $aux;
$auxEmail['ownerID'] = $oneUser->getID();
$auxEmail['email'] = $oneUser->getEmail();
$allEmails[] = $auxEmail;
}
return $this->render('UserUserBundle:Consult:viewUsers.html.twig',
array('allUsers' => $allUsers, 'allEmails' => $allEmails));
}
public function viewUsersModifAction($userId){
if(!$this->get('security.context')->isGranted('ROLE_USER')) {
throw new AccessDeniedException();
}
$thisUser = $this->getDoctrine()
->getRepository('UserUserBundle:Users')
->getUserByUserID($userId);
$thisUserData = array();
$thisUserData['name'] = $thisUser->getName();
$thisUserData['email'] = $thisUser->getEmail();
$thisUserData['id'] = $thisUser->getId();
$thisUserData['role'] = $thisUser->getRole();
$thisUserData['surname'] = $thisUser->getSurname();
$thisUserData['activeUser'] = ( $thisUser->isEnabled() ) ? 1 : 0 ;
switch($thisUserData['role'][0]){
case 'ROLE_USER':
break;
case 'ROLE_ADMIN':
$thisUserData['properties'] = $this->getUserProperties($thisUserData['id']);
break;
case 'ROLE_SUPER_ADMIN':
break;
}
//ldd($thisUserData);
return $this->render('UserUserBundle:Consult:viewUsersModif.html.twig',
array('oneUser' => $thisUserData));
}
public function deleteUserAction($userId){
if(!$this->get('security.context')->isGranted('ROLE_USER')) {
throw new AccessDeniedException();
}
// Eliminar usuario
$adminId = $this->get('security.context')->getToken()->getUser()->getId();
$changeOwner = $this->getDoctrine()
->getManager()
->createQuery("UPDATE ReservableActivityBundle:Activity a
SET a.ownerID = " . $adminId . ", a.active = 0
WHERE a.ownerID = " . $userId)
->getResult();
$deleteOwner = $this->getDoctrine()->getManager()
->createQuery("DELETE FROM UserUserBundle:Users u WHERE u.id = " . $userId)
->getResult();
return $this->redirect($this->generateUrl('view_users', array(), 'prod'));
}
public function activeUserAction($userId){
if(!$this->get('security.context')->isGranted('ROLE_USER')) {
throw new AccessDeniedException();
}
// Activar usuario
$activeOwner = $this->getDoctrine()->getManager()
->createQuery("UPDATE UserUserBundle:Users u SET u.enabled = 1 WHERE u.id = " . $userId)
->getResult();
$request = $this->getRequest();
$env = ($this->get('kernel')->getEnvironment() == 'dev')? 'app_dev.php' : 'app.php' ;
$url = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath() . '/' . $env . '/' . $request->getLocale() . '/view-users';
return $this->redirect($url);
}
public function deactiveUserAction($userId){
if(!$this->get('security.context')->isGranted('ROLE_USER')) {
throw new AccessDeniedException();
}
// Activar usuario
$deactiveOwner = $this->getDoctrine()->getManager()
->createQuery("UPDATE UserUserBundle:Users u SET u.enabled = 0 WHERE u.id = " . $userId)
->getResult();
$request = $this->getRequest();
$env = ($this->get('kernel')->getEnvironment() == 'dev')? 'app_dev.php' : 'app.php' ;
$url = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath() . '/' . $env . '/' . $request->getLocale() . '/view-users';
return $this->redirect($url);
}
public function checkUserAction(){
$request = $this->getRequest();
$email = $request->request->get('email');
$google_id = $request->request->get('id');
$result = false;
$user = $this->getDoctrine()
->getRepository('UserUserBundle:Users')
->findByEmail($email);
if(!empty($user)){
$encoder_service = $this->get('security.encoder_factory');
$encoder = $encoder_service->getEncoder($user);
$encoded_pass = $encoder->encodePassword($google_id, $user->getSalt());
if($encoded_pass == $user->getPassword()){
$result = true;
}
else{
$resultUpdatePassword = $this->getDoctrine()
->getManager()
->createQuery('UPDATE UserUserBundle:Users u
SET u.password = \'' . $encoded_pass . '\'
WHERE u.email = \'' . $email . '\'')
->getResult();
$result = $resultUpdatePassword;
}
}
else{
// Guardamos el usuario y logueamos
$user = new Users();
$salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);
$encoder_service = $this->get('security.encoder_factory');
$encoder = $encoder_service->getEncoder($user);
$username = substr($email, 0, strpos($email, '@'));
$user->setName($request->request->get('given_name'));
$user->setSurname($request->request->get('family_name'));
$user->setUsername($username);
$user->setUsernameCanonical($username);
$user->setEmail($email);
$user->setEmailCanonical($email);
$user->setSalt($salt);
$user->setPassword($encoder->encodePassword($google_id, $salt));
$user->setRole('a:1:{i:0;s:9:"ROLE_USER";}');
$user->setEnabled(1);
// extra
$gplink = $request->request->get('link');
$picture = $request->request->get('picture');
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();
$result = true;
}
return new JsonResponse(array('response'=>$result));
}
public function getUserProperties($userID){
$properties = $this->getDoctrine()
->getManager()
->createQuery('SELECT a
FROM ReservableActivityBundle:Activity a
WHERE a.ownerID = ' . $userID)
->getResult();
$result = array();
if(!empty($properties)){
foreach($properties as $oneProperty){
$aux['id'] = $oneProperty->getId();
$aux['name'] = $oneProperty->getName();
$aux['numBookings'] = $this->getNumBookings($oneProperty->getId());
$result[] = $aux;
}
}
return $result;
}
public function getNumBookings($activityID){
$bookings = $this->getDoctrine()
->getManager()
->createQuery('SELECT count(b)
FROM BookingsBookingBundle:Booking b
WHERE b.activityID = ' . $activityID)
->getResult();
$num = 0;
if(!empty($bookings)){
$num = $bookings[0][1];
}
return $num;
}
} | silver819/alm-cristina | src/User/UserBundle/Controller/ConsultController.php | PHP | mit | 8,653 | [
30522,
1026,
1029,
25718,
3415,
15327,
5310,
1032,
5310,
27265,
2571,
1032,
11486,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
3036,
1032,
4563,
1032,
6453,
1032,
3229,
4181,
6340,
10288,
24422,
1025,
2224,
25353,
2213,
14876,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2012 The ChromiumOS Authors. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program 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 General Public License for more details.
*/
#include <console/console.h>
#include <cpu/x86/smm.h>
#include <elog.h>
#define GSMI_RET_SUCCESS 0x00
#define GSMI_RET_INVALID_PARAMETER 0x82
#define GSMI_RET_UNSUPPORTED 0x83
#define GSMI_CMD_SET_EVENT_LOG 0x08
#define GSMI_CMD_CLEAR_EVENT_LOG 0x09
#define GSMI_CMD_LOG_S0IX_SUSPEND 0x0a
#define GSMI_CMD_LOG_S0IX_RESUME 0x0b
#define GSMI_CMD_HANDSHAKE_TYPE 0xc1
#define GSMI_HANDSHAKE_NONE 0x7f
#define GSMI_LOG_ENTRY_TYPE_KERNEL 0xDEAD
struct gsmi_set_eventlog_param {
u32 data_ptr;
u32 data_len;
u32 type;
} __packed;
struct gsmi_set_eventlog_type1 {
u16 type;
u32 instance;
} __packed;
struct gsmi_clear_eventlog_param {
u32 percentage;
u32 data_type;
} __packed;
void __weak elog_gsmi_cb_platform_log_wake_source(void)
{
/* Default weak implementation, does nothing. */
}
void __weak elog_gsmi_cb_mainboard_log_wake_source(void)
{
/* Default weak implementation, does nothing. */
}
/* Param is usually EBX, ret in EAX */
u32 gsmi_exec(u8 command, u32 *param)
{
struct gsmi_set_eventlog_param *sel;
struct gsmi_set_eventlog_type1 *type1;
struct gsmi_clear_eventlog_param *cel;
u32 ret = GSMI_RET_UNSUPPORTED;
switch (command) {
case GSMI_CMD_HANDSHAKE_TYPE:
/* Used by kernel to verify basic SMI functionality */
printk(BIOS_DEBUG, "GSMI Handshake\n");
ret = GSMI_HANDSHAKE_NONE;
break;
case GSMI_CMD_SET_EVENT_LOG:
/* Look for a type1 event */
sel = (struct gsmi_set_eventlog_param *)(*param);
if (!sel)
break;
/* Make sure the input is usable */
if (sel->type != 1 && sel->data_ptr != 0 &&
sel->data_len != sizeof(struct gsmi_set_eventlog_type1))
break;
/* Event structure within the data buffer */
type1 = (struct gsmi_set_eventlog_type1 *)(sel->data_ptr);
if (!type1)
break;
printk(BIOS_DEBUG, "GSMI Set Event Log "
"(type=0x%x instance=0x%x)\n",
type1->type, type1->instance);
if (type1->type == GSMI_LOG_ENTRY_TYPE_KERNEL) {
/* Special case for linux kernel shutdown reason */
elog_add_event_dword(ELOG_TYPE_OS_EVENT,
type1->instance);
} else {
/* Add other events that may be used for testing */
elog_add_event_dword(type1->type, type1->instance);
}
ret = GSMI_RET_SUCCESS;
break;
case GSMI_CMD_CLEAR_EVENT_LOG:
/* Get parameter buffer even though we don't use it */
cel = (struct gsmi_clear_eventlog_param *)(*param);
if (!cel)
break;
printk(BIOS_DEBUG, "GSMI Clear Event Log (%u%% type=%u)\n",
cel->percentage, cel->data_type);
if (elog_clear() == 0)
ret = GSMI_RET_SUCCESS;
break;
case GSMI_CMD_LOG_S0IX_SUSPEND:
case GSMI_CMD_LOG_S0IX_RESUME:
ret = GSMI_RET_SUCCESS;
if (command == GSMI_CMD_LOG_S0IX_SUSPEND)
elog_add_event(ELOG_TYPE_S0IX_ENTER);
else {
elog_add_event(ELOG_TYPE_S0IX_EXIT);
elog_gsmi_cb_platform_log_wake_source();
elog_gsmi_cb_mainboard_log_wake_source();
}
break;
default:
printk(BIOS_DEBUG, "GSMI Unknown: 0x%02x\n", command);
break;
}
return ret;
}
| wolflee/coreboot | src/drivers/elog/gsmi.c | C | gpl-2.0 | 3,559 | [
30522,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
4563,
27927,
2622,
1012,
1008,
1008,
9385,
1006,
1039,
1007,
2262,
1996,
10381,
21716,
5007,
2891,
6048,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#myGallery, #myGallerySet, #flickrGallery
{
width: 520px;
height: 300px;
z-index:5;
margin-bottom: 20px;
}
.jdGallery a
{
outline:0;
}
#flickrGallery
{
width: 500px;
height: 334px;
}
#myGallery img.thumbnail, #myGallerySet img.thumbnail
{
display: none;
}
.jdGallery
{
overflow: hidden;
position: relative;
}
.jdGallery img
{
border: 0;
margin: 0;
}
.jdGallery .slideElement
{
width: 100%;
height: 100%;
background-color: #000;
background-repeat: no-repeat;
background-position: center center;
background-image: url('img/loading-bar-black.gif');
}
.jdGallery .loadingElement
{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
background-color: #000;
background-repeat: no-repeat;
background-position: center center;
background-image: url('img/loading-bar-black.gif');
}
.jdGallery .slideInfoZone
{
position: absolute;
z-index: 10;
width: 100%;
margin: 0px;
left: 0;
bottom: 0;
height: 120px;
background: #181818;
color: #fff;
text-indent: 0;
overflow: hidden;
}
* html .jdGallery .slideInfoZone
{
bottom: -1px;
}
.jdGallery .slideInfoZone h2
{
padding: 0;
font-size: 14px;
margin: 0;
margin: 2px 5px;
font-weight: bold;
color: #fff !important;
}
.jdGallery .slideInfoZone p
{
padding: 0;
font-size: 12px;
margin: 2px 5px;
color: #eee;
}
.jdGallery div.carouselContainer
{
position: absolute;
height: 135px;
width: 100%;
z-index: 10;
margin: 0px;
left: 0;
top: 0;
}
.jdGallery a.carouselBtn
{
position: absolute;
bottom: 0;
right: 30px;
height: 20px;
/*width: 100px; background: url('img/carousel_btn.gif') no-repeat;*/
text-align: center;
padding: 0 10px;
font-size: 13px;
background: #333;
color: #fff;
cursor: pointer;
}
.jdGallery .carousel
{
position: absolute;
width: 100%;
margin: 0px;
left: 0;
top: 0;
height: 115px;
background: #333;
color: #fff;
text-indent: 0;
overflow: hidden;
}
.jdExtCarousel
{
overflow: hidden;
position: relative;
}
.jdGallery .carousel .carouselWrapper, .jdExtCarousel .carouselWrapper
{
position: absolute;
width: 100%;
height: 78px;
top: 10px;
left: 0;
overflow: hidden;
}
.jdGallery .carousel .carouselInner, .jdExtCarousel .carouselInner
{
position: relative;
}
.jdGallery .carousel .carouselInner .thumbnail, .jdExtCarousel .carouselInner .thumbnail
{
cursor: pointer;
background: #000;
background-position: center center;
float: left;
border: solid 1px #fff;
}
.jdGallery .wall .thumbnail, .jdExtCarousel .wall .thumbnail
{
margin-bottom: 10px;
}
.jdGallery .carousel .label, .jdExtCarousel .label
{
font-size: 13px;
position: absolute;
bottom: 5px;
left: 10px;
padding: 0;
margin: 0;
}
.jdGallery .carousel .wallButton, .jdExtCarousel .wallButton
{
font-size: 10px;
position: absolute;
bottom: 5px;
right: 10px;
padding: 1px 2px;
margin: 0;
background: #222;
border: 1px solid #888;
cursor: pointer;
}
.jdGallery .carousel .label .number, .jdExtCarousel .label .number
{
color: #b5b5b5;
}
.jdGallery a
{
font-size: 100%;
text-decoration: none;
color: #fff;
}
.jdGallery a.right, .jdGallery a.left
{
position: absolute;
height: 99%;
width: 25%;
cursor: pointer;
z-index:10;
filter:alpha(opacity=20);
-moz-opacity:0.2;
-khtml-opacity: 0.2;
opacity: 0.2;
}
* html .jdGallery a.right, * html .jdGallery a.left
{
filter:alpha(opacity=50);
}
.jdGallery a.right:hover, .jdGallery a.left:hover
{
filter:alpha(opacity=80);
-moz-opacity:0.8;
-khtml-opacity: 0.8;
opacity: 0.8;
}
.jdGallery a.left
{
left: 0;
top: 0;
background: url('img/fleche1.png') no-repeat center left;
}
* html .jdGallery a.left { background: url('img/fleche1.gif') no-repeat center left; }
.jdGallery a.right
{
right: 0;
top: 0;
background: url('img/fleche2.png') no-repeat center right;
}
* html .jdGallery a.right { background: url('img/fleche2.gif') no-repeat center right; }
.jdGallery a.open
{
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.withArrows a.open
{
position: absolute;
top: 0;
left: 25%;
height: 99%;
width: 50%;
cursor: pointer;
z-index: 10;
background: none;
-moz-opacity:0.8;
-khtml-opacity: 0.8;
opacity: 0.8;
}
.withArrows a.open:hover { background: url('img/open.png') no-repeat center center; }
* html .withArrows a.open:hover { background: url('img/open.gif') no-repeat center center;
filter:alpha(opacity=80); }
/* Gallery Sets */
.jdGallery a.gallerySelectorBtn
{
z-index: 15;
position: absolute;
top: 0;
left: 30px;
height: 20px;
/*width: 100px; background: url('img/carousel_btn.gif') no-repeat;*/
text-align: center;
padding: 0 10px;
font-size: 13px;
background: #333;
color: #fff;
cursor: pointer;
opacity: .4;
-moz-opacity: .4;
-khtml-opacity: 0.4;
filter:alpha(opacity=40);
}
.jdGallery .gallerySelector
{
z-index: 20;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: #000;
}
.jdGallery .gallerySelector h2
{
margin: 0;
padding: 10px 20px 10px 20px;
font-size: 20px;
line-height: 30px;
color: #fff !important;
}
.jdGallery .gallerySelector .gallerySelectorWrapper
{
overflow: hidden;
}
.jdGallery .gallerySelector .gallerySelectorInner div.galleryButton
{
margin-left: 10px;
margin-top: 10px;
border: 1px solid #888;
padding: 5px;
height: 40px;
color: #fff;
cursor: pointer;
float: left;
}
.jdGallery .gallerySelector .gallerySelectorInner div.hover
{
background: #333;
}
.jdGallery .gallerySelector .gallerySelectorInner div.galleryButton div.preview
{
background: #000;
background-position: center center;
float: left;
border: none;
width: 40px;
height: 40px;
margin-right: 5px;
}
.jdGallery .gallerySelector .gallerySelectorInner div.galleryButton h3
{
margin: 0;
padding: 0;
font-size: 12px;
font-weight: normal;
color: #fff;
}
.jdGallery .gallerySelector .gallerySelectorInner div.galleryButton p.info
{
margin: 0;
padding: 0;
font-size: 12px;
font-weight: normal;
color: #fff !important;
} | Quartermain/viettrungtravel_wordpress | wp-content/themes/Innox/jdgallery/jd.gallery.css | CSS | gpl-2.0 | 6,296 | [
30522,
1001,
2026,
22263,
7301,
1010,
1001,
2026,
22263,
7301,
13462,
1010,
1001,
17312,
28921,
10820,
2100,
1063,
9381,
1024,
19611,
2361,
2595,
1025,
4578,
1024,
3998,
2361,
2595,
1025,
1062,
1011,
5950,
1024,
1019,
1025,
7785,
1011,
3953... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "pdns/namespaces.hh"
#include <pdns/dns.hh>
#include <pdns/dnsbackend.hh>
#include <pdns/dnspacket.hh>
#include <pdns/ueberbackend.hh>
#include <pdns/ahuexception.hh>
#include <pdns/logger.hh>
#include <pdns/arguments.hh>
#include <boost/lexical_cast.hpp>
#include <rapidjson/rapidjson.h>
#include <rapidjson/document.h>
#include "pdns/json.hh"
#include "pdns/statbag.hh"
#include "pdns/packetcache.hh"
StatBag S;
PacketCache PC;
ArgvMap &arg()
{
static ArgvMap arg;
return arg;
};
class RemoteLoader
{
public:
RemoteLoader();
};
DNSBackend *be;
#ifdef REMOTEBACKEND_HTTP
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#define BOOST_TEST_MODULE unit
#include <boost/test/unit_test.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
struct RemotebackendSetup {
RemotebackendSetup() {
be = 0;
try {
// setup minimum arguments
::arg().set("module-dir")="";
new RemoteLoader();
BackendMakers().launch("remote");
// then get us a instance of it
::arg().set("remote-connection-string")="http:url=http://localhost:62434/dns,post=1";
::arg().set("remote-dnssec")="yes";
be = BackendMakers().all()[0];
} catch (AhuException &ex) {
BOOST_TEST_MESSAGE("Cannot start remotebackend: " << ex.reason );
};
}
~RemotebackendSetup() { }
};
BOOST_GLOBAL_FIXTURE( RemotebackendSetup );
#else
#include <iostream>
int main(void) {
std::cout << "No HTTP support in remotebackend - skipping test" << std::endl;
return 0;
}
#endif
| zeha/debian-pdns | modules/remotebackend/test-remotebackend-post.cc | C++ | gpl-2.0 | 1,610 | [
30522,
1001,
2421,
1000,
22851,
3619,
1013,
3415,
15327,
2015,
1012,
1044,
2232,
1000,
1001,
2421,
1026,
22851,
3619,
1013,
1040,
3619,
1012,
1044,
2232,
1028,
1001,
2421,
1026,
22851,
3619,
1013,
1040,
3619,
5963,
10497,
1012,
1044,
2232,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Myapp\CroisiereBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* PrixCroisiereRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PrixCroisiereRepository extends EntityRepository
{
}
| meznisabri/Meznisabri | src/Myapp/CroisiereBundle/Entity/PrixCroisiereRepository.php | PHP | mit | 279 | [
30522,
1026,
1029,
25718,
3415,
15327,
2026,
29098,
1032,
13675,
10054,
21253,
27265,
2571,
1032,
9178,
1025,
2224,
8998,
1032,
2030,
2213,
1032,
9178,
2890,
6873,
28307,
2100,
1025,
1013,
1008,
1008,
1008,
5431,
26775,
10054,
21253,
2890,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.application.options.colors;
import com.intellij.application.options.EditorFontsConstants;
import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeTooltipManager;
import com.intellij.openapi.application.ApplicationBundle;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.colors.FontPreferences;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.*;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.util.EventDispatcher;
import com.intellij.util.ui.JBUI;
import net.miginfocom.swing.MigLayout;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
public class FontOptions extends JPanel implements OptionsPanel{
private static final FontInfoRenderer RENDERER = new FontInfoRenderer() {
@Override
protected boolean isEditorFont() {
return true;
}
};
private final EventDispatcher<ColorAndFontSettingsListener> myDispatcher = EventDispatcher.create(ColorAndFontSettingsListener.class);
@NotNull private final ColorAndFontOptions myOptions;
@NotNull private final JTextField myEditorFontSizeField = new JTextField(4);
@NotNull private final JTextField myLineSpacingField = new JTextField(4);
private final FontComboBox myPrimaryCombo = new FontComboBox();
private final JCheckBox myUseSecondaryFontCheckbox = new JCheckBox(ApplicationBundle.message("secondary.font"));
private final JCheckBox myEnableLigaturesCheckbox = new JCheckBox(ApplicationBundle.message("use.ligatures"));
private final FontComboBox mySecondaryCombo = new FontComboBox(false, false);
@NotNull private final JBCheckBox myOnlyMonospacedCheckBox =
new JBCheckBox(ApplicationBundle.message("checkbox.show.only.monospaced.fonts"));
private boolean myIsInSchemeChange;
public FontOptions(@NotNull ColorAndFontOptions options) {
setLayout(new MigLayout("ins 0, gap 5, flowx"));
myOptions = options;
add(myOnlyMonospacedCheckBox, "newline 10, sgx b, sx 2");
add(new JLabel(ApplicationBundle.message("primary.font")), "newline, ax right");
add(myPrimaryCombo, "sgx b");
add(new JLabel(ApplicationBundle.message("editbox.font.size")), "gapleft 20");
add(myEditorFontSizeField);
add(new JLabel(ApplicationBundle.message("editbox.line.spacing")), "gapleft 20");
add(myLineSpacingField);
add(new JLabel(ApplicationBundle.message("label.fallback.fonts.list.description"),
MessageType.INFO.getDefaultIcon(),
SwingConstants.LEFT), "newline, sx 5");
add(myUseSecondaryFontCheckbox, "newline, ax right");
add(mySecondaryCombo, "sgx b");
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
myEnableLigaturesCheckbox.setBorder(null);
panel.add(myEnableLigaturesCheckbox);
JLabel warningIcon = new JLabel(AllIcons.General.BalloonWarning);
IdeTooltipManager.getInstance().setCustomTooltip(
warningIcon,
new TooltipWithClickableLinks.ForBrowser(warningIcon,
ApplicationBundle.message("ligatures.jre.warning",
ApplicationNamesInfo.getInstance().getFullProductName())));
warningIcon.setBorder(JBUI.Borders.emptyLeft(5));
updateWarningIconVisibility(warningIcon);
panel.add(warningIcon);
add(panel, "newline, sx 2");
myOnlyMonospacedCheckBox.setBorder(null);
myUseSecondaryFontCheckbox.setBorder(null);
mySecondaryCombo.setEnabled(false);
myOnlyMonospacedCheckBox.setSelected(EditorColorsManager.getInstance().isUseOnlyMonospacedFonts());
myOnlyMonospacedCheckBox.addActionListener(e -> {
EditorColorsManager.getInstance().setUseOnlyMonospacedFonts(myOnlyMonospacedCheckBox.isSelected());
myPrimaryCombo.setMonospacedOnly(myOnlyMonospacedCheckBox.isSelected());
mySecondaryCombo.setMonospacedOnly(myOnlyMonospacedCheckBox.isSelected());
});
myPrimaryCombo.setMonospacedOnly(myOnlyMonospacedCheckBox.isSelected());
myPrimaryCombo.setRenderer(RENDERER);
mySecondaryCombo.setMonospacedOnly(myOnlyMonospacedCheckBox.isSelected());
mySecondaryCombo.setRenderer(RENDERER);
myUseSecondaryFontCheckbox.addActionListener(e -> {
mySecondaryCombo.setEnabled(myUseSecondaryFontCheckbox.isSelected());
syncFontFamilies();
});
ItemListener itemListener = this::syncFontFamilies;
myPrimaryCombo.addItemListener(itemListener);
mySecondaryCombo.addItemListener(itemListener);
ActionListener actionListener = this::syncFontFamilies;
myPrimaryCombo.addActionListener(actionListener);
mySecondaryCombo.addActionListener(actionListener);
myEditorFontSizeField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
public void textChanged(DocumentEvent event) {
if (myIsInSchemeChange || !SwingUtilities.isEventDispatchThread()) return;
String selectedFont = myPrimaryCombo.getFontName();
if (selectedFont != null) {
setFontSize(getFontSizeFromField());
}
updateDescription(true);
}
});
myEditorFontSizeField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() != KeyEvent.VK_UP && e.getKeyCode() != KeyEvent.VK_DOWN) return;
boolean up = e.getKeyCode() == KeyEvent.VK_UP;
try {
int value = Integer.parseInt(myEditorFontSizeField.getText());
value += (up ? 1 : -1);
value = Math.min(EditorFontsConstants.getMaxEditorFontSize(), Math.max(EditorFontsConstants.getMinEditorFontSize(), value));
myEditorFontSizeField.setText(String.valueOf(value));
}
catch (NumberFormatException ignored) {
}
}
});
myLineSpacingField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
public void textChanged(DocumentEvent event) {
if (myIsInSchemeChange) return;
float lineSpacing = getLineSpacingFromField();
if (getLineSpacing() != lineSpacing) {
setCurrentLineSpacing(lineSpacing);
}
updateDescription(true);
}
});
myLineSpacingField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() != KeyEvent.VK_UP && e.getKeyCode() != KeyEvent.VK_DOWN) return;
boolean up = e.getKeyCode() == KeyEvent.VK_UP;
try {
float value = Float.parseFloat(myLineSpacingField.getText());
value += (up ? 1 : -1) * .1F;
value = Math.min(EditorFontsConstants.getMaxEditorLineSpacing(), Math.max(EditorFontsConstants.getMinEditorLineSpacing(), value));
myLineSpacingField.setText(String.format(Locale.ENGLISH, "%.1f", value));
}
catch (NumberFormatException ignored) {
}
}
});
myEnableLigaturesCheckbox.addActionListener(e -> {
getFontPreferences().setUseLigatures(myEnableLigaturesCheckbox.isSelected());
updateWarningIconVisibility(warningIcon);
updateDescription(true);
});
}
private void updateWarningIconVisibility(JLabel warningIcon) {
warningIcon.setVisible(!SystemInfo.isJetbrainsJvm && getFontPreferences().useLigatures());
}
private int getFontSizeFromField() {
try {
return Math.min(EditorFontsConstants.getMaxEditorFontSize(),
Math.max(EditorFontsConstants.getMinEditorFontSize(), Integer.parseInt(myEditorFontSizeField.getText())));
}
catch (NumberFormatException e) {
return EditorFontsConstants.getDefaultEditorFontSize();
}
}
private float getLineSpacingFromField() {
try {
return Math.min(EditorFontsConstants.getMaxEditorLineSpacing(), Math.max(EditorFontsConstants.getMinEditorLineSpacing(), Float.parseFloat(myLineSpacingField.getText())));
} catch (NumberFormatException e){
return EditorFontsConstants.getDefaultEditorLineSpacing();
}
}
/**
* Processes an event from {@code FontComboBox}
* if it is enabled and its item is selected.
*
* @param event the event to process
*/
private void syncFontFamilies(AWTEvent event) {
Object source = event.getSource();
if (source instanceof FontComboBox) {
FontComboBox combo = (FontComboBox)source;
if (combo.isEnabled() && combo.isShowing() && combo.getSelectedItem() != null) {
syncFontFamilies();
}
}
}
private void syncFontFamilies() {
if (myIsInSchemeChange) {
return;
}
FontPreferences fontPreferences = getFontPreferences();
fontPreferences.clearFonts();
String primaryFontFamily = myPrimaryCombo.getFontName();
String secondaryFontFamily = mySecondaryCombo.isEnabled() ? mySecondaryCombo.getFontName() : null;
int fontSize = getFontSizeFromField();
if (primaryFontFamily != null ) {
if (!FontPreferences.DEFAULT_FONT_NAME.equals(primaryFontFamily)) {
fontPreferences.addFontFamily(primaryFontFamily);
}
fontPreferences.register(primaryFontFamily, fontSize);
}
if (secondaryFontFamily != null) {
if (!FontPreferences.DEFAULT_FONT_NAME.equals(secondaryFontFamily)){
fontPreferences.addFontFamily(secondaryFontFamily);
}
fontPreferences.register(secondaryFontFamily, fontSize);
}
updateDescription(true);
}
@Override
public void updateOptionsList() {
myIsInSchemeChange = true;
myLineSpacingField.setText(Float.toString(getLineSpacing()));
FontPreferences fontPreferences = getFontPreferences();
List<String> fontFamilies = fontPreferences.getEffectiveFontFamilies();
myPrimaryCombo.setFontName(fontPreferences.getFontFamily());
boolean isThereSecondaryFont = fontFamilies.size() > 1;
myUseSecondaryFontCheckbox.setSelected(isThereSecondaryFont);
mySecondaryCombo.setFontName(isThereSecondaryFont ? fontFamilies.get(1) : null);
myEditorFontSizeField.setText(String.valueOf(fontPreferences.getSize(fontPreferences.getFontFamily())));
boolean readOnly = ColorAndFontOptions.isReadOnly(myOptions.getSelectedScheme());
myPrimaryCombo.setEnabled(!readOnly);
mySecondaryCombo.setEnabled(isThereSecondaryFont && !readOnly);
myOnlyMonospacedCheckBox.setEnabled(!readOnly);
myLineSpacingField.setEnabled(!readOnly);
myEditorFontSizeField.setEnabled(!readOnly);
myUseSecondaryFontCheckbox.setEnabled(!readOnly);
myEnableLigaturesCheckbox.setEnabled(!readOnly);
myEnableLigaturesCheckbox.setSelected(fontPreferences.useLigatures());
myIsInSchemeChange = false;
}
@NotNull
protected FontPreferences getFontPreferences() {
return getCurrentScheme().getFontPreferences();
}
protected void setFontSize(int fontSize) {
getCurrentScheme().setEditorFontSize(fontSize);
}
protected float getLineSpacing() {
return getCurrentScheme().getLineSpacing();
}
protected void setCurrentLineSpacing(float lineSpacing) {
getCurrentScheme().setLineSpacing(lineSpacing);
}
@Override
@Nullable
public Runnable showOption(final String option) {
return null;
}
@Override
public void applyChangesToScheme() {
}
@Override
public void selectOption(final String typeToSelect) {
}
protected EditorColorsScheme getCurrentScheme() {
return myOptions.getSelectedScheme();
}
public boolean updateDescription(boolean modified) {
EditorColorsScheme scheme = myOptions.getSelectedScheme();
if (modified && ColorAndFontOptions.isReadOnly(scheme)) {
return false;
}
myDispatcher.getMulticaster().fontChanged();
return true;
}
@Override
public void addListener(ColorAndFontSettingsListener listener) {
myDispatcher.addListener(listener);
}
@Override
public JPanel getPanel() {
return this;
}
@Override
public Set<String> processListOptions() {
return new HashSet<>();
}
}
| youdonghai/intellij-community | platform/lang-impl/src/com/intellij/application/options/colors/FontOptions.java | Java | apache-2.0 | 13,068 | [
30522,
1013,
1008,
1008,
9385,
2456,
1011,
2355,
6892,
10024,
7076,
1055,
1012,
1054,
1012,
1051,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace SKE\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
class CacheClearCommand extends ContainerAwareCommand
{
protected $cachePath;
protected $finder;
protected $filesystem;
/**
* @param $cachePath
*/
public function setCachePath($cachePath)
{
$this->cachePath = $cachePath;
}
/**
* @return mixed
*/
public function getCachePath()
{
return $this->cachePath;
}
/**
* @param Filesystem $filesystem
*/
public function setFilesystem(Filesystem $filesystem)
{
$this->filesystem = $filesystem;
}
/**
* @return Filesystem
*/
public function getFilesystem()
{
if(null === $this->filesystem) {
$this->setFilesystem(
new Filesystem()
);
}
return $this->filesystem;
}
/**
* @param Finder $finder
*/
public function setFinder(Finder $finder)
{
$this->finder = $finder;
}
/**
* @return Finder
*/
public function getFinder()
{
if(null === $this->finder) {
$this->setFinder(
Finder::create()
);
}
return $this->finder;
}
/**
* Configures the command
*/
protected function configure()
{
$this->setName('cache:clear')
->setDescription('Clears the cache');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$finder = $this->getFinder();
$finder->in($this->getCachePath());
$finder->ignoreDotFiles(true);
$filesystem = $this->getFilesystem();
$filesystem->remove($finder);
$output->writeln(sprintf("%s <info>success</info>", 'cache:clear'));
}
}
| ooXei1sh/silex-ske-sandbox | src/SKE/Command/CacheClearCommand.php | PHP | unlicense | 2,254 | [
30522,
1026,
1029,
25718,
3415,
15327,
15315,
2063,
1032,
3094,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
14012,
1032,
7705,
27265,
2571,
1032,
3094,
1032,
11661,
10830,
2890,
9006,
2386,
2094,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<HTML>
<!-- Created by HTTrack Website Copier/3.49-2 [XR&CO'2014] -->
<!-- Mirrored from www.webstandards.org/?p=962 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 18 Aug 2017 17:59:11 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8"><META HTTP-EQUIV="Refresh" CONTENT="0; URL=2007/01/30/youre-looking-swell-molly/index.html"><TITLE>Page has moved</TITLE>
</HEAD>
<BODY>
<A HREF="2007/01/30/youre-looking-swell-molly/index.html"><h3>Click here...</h3></A>
</BODY>
<!-- Created by HTTrack Website Copier/3.49-2 [XR&CO'2014] -->
<!-- Mirrored from www.webstandards.org/?p=962 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 18 Aug 2017 17:59:11 GMT -->
</HTML>
| WebStandardsSherpa/webstandards.org | indexd7e6.html | HTML | mit | 831 | [
30522,
1026,
16129,
1028,
1026,
999,
1011,
1011,
2580,
2011,
1044,
4779,
22648,
2243,
4037,
8872,
3771,
1013,
1017,
1012,
4749,
1011,
1016,
1031,
1060,
2099,
1004,
2522,
1005,
2297,
1033,
1011,
1011,
1028,
1026,
999,
1011,
1011,
22243,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
if( $this->network->id && $this->user->is_logged ) {
$this->redirect('dashboard');
}
$this->load_langfile('outside/global.php');
$this->load_langfile('outside/signin.php');
$D->page_title = $this->lang('signin_page_title', array('#SITE_TITLE#'=>$C->SITE_TITLE));
$D->allow_fb_connect = FALSE;
if( isset($C->FACEBOOK_API_KEY) && !empty($C->FACEBOOK_API_KEY) ) {
$D->allow_fb_connect = TRUE;
}
if( isset($C->TWITTER_CONSUMER_KEY,$C->TWITTER_CONSUMER_SECRET) && !empty($C->TWITTER_CONSUMER_KEY) && !empty($C->TWITTER_CONSUMER_SECRET) ) {
$D->allow_fb_connect = TRUE;
}
if( $D->allow_fb_connect ) {
if( $this->param('js') == 'fbconnect' ) {
$fbinfo = new stdClass;
if( isset($_GET['fb']) && is_array($_GET['fb']) ) {
foreach($_GET['fb'] as $k=>$v) { $fbinfo->$k = urldecode($v); }
}
$fbinfo->uid = isset($_GET['fb_uid']) ? preg_replace('/[^0-9]/i', '', $_GET['fb_uid']) : '';
$fbinfo->uid = trim($fbinfo->uid);
$tmpkey = md5(time()*rand(0,99999));
$_SESSION[$tmpkey] = $fbinfo;
if( ! empty($fbinfo->uid) ) {
$db2->query('SELECT email, password FROM users WHERE facebook_uid<>"" AND facebook_uid="'.$db2->e($fbinfo->uid).'" LIMIT 1');
if($tmp = $db2->fetch_object()) {
if( $this->user->login(stripslashes($tmp->email), stripslashes($tmp->password)) ) {
$this->redirect($C->SITE_URL.'dashboard');
}
}
}
$this->redirect($C->SITE_URL.'signup/fbinfo:'.$tmpkey);
exit;
}
if( $this->param('fbinfo') ) {
$this->params->fbinfo = trim($this->param('fbinfo'));
$D->allow_fb_connect = FALSE;
if( !empty($this->params->fbinfo) && isset($_SESSION[$this->params->fbinfo]) ) {
$fbinfo = $_SESSION[$this->params->fbinfo];
$db2->query('SELECT email FROM users WHERE facebook_uid<>"" AND facebook_uid="'.$db2->e($fbinfo->uid).'" LIMIT 1');
if( $u = $db2->fetch_object() ) {
$D->email = stripslashes($u->email);
}
}
}
if( $this->param('get')=='twitter' ) {
if( isset($_SESSION['TWITTER_CONNECTED']) && $_SESSION['TWITTER_CONNECTED'] && $_SESSION['TWITTER_CONNECTED']->id ) {
$uid = intval($_SESSION['TWITTER_CONNECTED']->id);
$db2->query('SELECT email, password FROM users WHERE twitter_uid<>"" AND twitter_uid="'.$uid.'" LIMIT 1');
if($tmp = $db2->fetch_object()) {
if( $this->user->login(stripslashes($tmp->email), stripslashes($tmp->password)) ) {
$this->redirect($C->SITE_URL.'dashboard');
}
}
$this->redirect($C->SITE_URL.'signup/get:twitter');
exit;
}
}
}
$D->submit = FALSE;
$D->error = FALSE;
$D->errmsg = '';
$D->email = '';
$D->password = '';
$D->rememberme = FALSE;
if( isset($_POST['email'], $_POST['password']) ) {
$D->submit = TRUE;
$D->email = trim($_POST['email']);
$D->password = trim($_POST['password']);
$D->rememberme = isset($_POST['rememberme']) && $_POST['rememberme']==1;
if( empty($D->email) || empty($D->password) ) {
$D->error = TRUE;
$D->errmsg = 'signin_form_errmsg';
}
else {
if( $this->user->is_logged ) {
$this->user->logout();
}
// HASHFAIL
$res = $this->user->login($D->email, md5($D->password), $D->rememberme);
if( ! $res ) {
$D->error = TRUE;
if( $this->network->id ) {
// HASHFAIL
$db2->query('SELECT id FROM users WHERE (email="'.$db2->e($D->email).'" OR username="'.$db2->e($D->email).'") AND password="'.$db2->e(md5($D->password)).'" AND active=0 LIMIT 1');
if( $db2->num_rows() > 0 ) {
$D->errmsg = 'signin_form_errmsgsusp';
}
}
if( empty($D->errmsg) ) {
$D->errmsg = 'signin_form_errmsg';
}
}
else {
if( $this->param('fbinfo') && isset($_SESSION[$this->param('fbinfo')]) ) {
$fbinfo = $_SESSION[$this->param('fbinfo')];
$db2->query('UPDATE users SET facebook_uid="'.$db2->e($fbinfo->uid).'" WHERE id="'.intval($this->user->id).'" LIMIT 1');
unset($_SESSION[$this->param('fbinfo')]);
}
if( isset($_SESSION['TWITTER_CONNECTED']) && $_SESSION['TWITTER_CONNECTED'] && $_SESSION['TWITTER_CONNECTED']->id ) {
$uid = intval($_SESSION['TWITTER_CONNECTED']->id);
if( $uid != 0 ) {
$db2->query('UPDATE users SET twitter_uid="'.$uid.'" WHERE id="'.intval($this->user->id).'" LIMIT 1');
}
}
$this->redirect($C->SITE_URL.'dashboard');
}
}
}
$D->num_members = 0;
$D->num_posts = 0;
if( $this->network->id ) {
$D->num_members = intval($db2->fetch_field('SELECT COUNT(id) FROM users WHERE active=1'));
$D->num_posts = intval($db2->fetch_field('SELECT COUNT(id) FROM posts WHERE user_id<>0 AND api_id<>2'));
}
$this->load_template('signin.php');
?> | Opentronix/Opentronix | upload/system/controllers/signin.php | PHP | agpl-3.0 | 4,619 | [
30522,
1026,
1029,
25718,
2065,
1006,
1002,
2023,
1011,
1028,
2897,
1011,
1028,
8909,
1004,
1004,
1002,
2023,
1011,
1028,
5310,
1011,
1028,
2003,
1035,
26618,
1007,
1063,
1002,
2023,
1011,
1028,
2417,
7442,
6593,
1006,
1005,
24923,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="css/work.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/jquery.jscrollpane.css" />
<script type="text/javascript" src="js/libs/jquery-1.7.2.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script src="js/libs/jquery.zoom.js"></script>
<script type="text/javascript" src="js/libs/jquery.mousewheel.js"></script>
<script type="text/javascript" src="js/libs/jquery.jscrollpane.js"></script>
<script type="text/javascript" src="js/libs/jquery.galleriffic.js"></script>
<script>
$(document).ready(function(){
$('#ex1').zoom();
$('#ex2').zoom({ grab: true,
});
$('#ex3').zoom();
});
$("#gallery #thumbs img").hover(function(){
$('#main-img').attr('src',$(this).attr('src'));
});
</script>
</head>
<body>
<div class="works" id="section-scroll">
<h1>Assignment <strong>Tracker</strong></h1>
<div id="gallery">
<p align="center"><img src="images/large/9a.jpg" alt="Assignment Tracker" id="main-img"></p>
<p align="center" id="thumbs">
<img src="images/large/9a.jpg" alt="Assignment Tracker" width="10%">
<img src="images/large/9b.jpg" alt="Assignment Tracker" width="10%">
<img src="images/large/9c.jpg" alt="Assignment Tracker" width="10%">
<img src="images/large/9d.jpg" alt="Assignment Tracker" width="10%">
</p>
</div>
<br />
<header>
:: Adobe Photoshop ::<br />
</header>
<p>
Ever wished for an <strong>Asssignment Tracker</strong>? Well, just continue wishing as nobody would ever wants to develop. Maybe someday I will, after learning iPhone's <strong>Objective C</strong> and <strong>Java</strong> languages! But for now, I created a <strong>concept</strong> prototype for one of my module, Human Computer Interaction. <br />
Looks neat, huh?<br />
</p>
</div>
</body>
</html>
| kaie-n/kaie-n.github.io | old-portfolio/09.html | HTML | apache-2.0 | 2,117 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package au.gov.amsa.util;
public class Pair<T, S> {
private final T a;
private final S b;
public Pair(T a, S b) {
this.a = a;
this.b = b;
}
public static <T, S> Pair<T, S> create(T t, S s) {
return new Pair<T, S>(t, s);
}
public T a() {
return a;
}
public S b() {
return b;
}
public T left() {
return a;
}
public S right() {
return b;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Pair [left=");
builder.append(a);
builder.append(", right=");
builder.append(b);
builder.append("]");
return builder.toString();
}
}
| amsa-code/risky | risky-util/src/main/java/au/gov/amsa/util/Pair.java | Java | apache-2.0 | 757 | [
30522,
7427,
8740,
1012,
18079,
1012,
2572,
3736,
1012,
21183,
4014,
1025,
2270,
2465,
3940,
1026,
1056,
1010,
1055,
1028,
1063,
2797,
2345,
1056,
1037,
1025,
2797,
2345,
1055,
1038,
1025,
2270,
3940,
1006,
1056,
1037,
1010,
1055,
1038,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.shield.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* A summary of information about the attack.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/shield-2016-06-02/SummarizedAttackVector" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SummarizedAttackVector implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The attack type, for example, SNMP reflection or SYN flood.
* </p>
*/
private String vectorType;
/**
* <p>
* The list of counters that describe the details of the attack.
* </p>
*/
private java.util.List<SummarizedCounter> vectorCounters;
/**
* <p>
* The attack type, for example, SNMP reflection or SYN flood.
* </p>
*
* @param vectorType
* The attack type, for example, SNMP reflection or SYN flood.
*/
public void setVectorType(String vectorType) {
this.vectorType = vectorType;
}
/**
* <p>
* The attack type, for example, SNMP reflection or SYN flood.
* </p>
*
* @return The attack type, for example, SNMP reflection or SYN flood.
*/
public String getVectorType() {
return this.vectorType;
}
/**
* <p>
* The attack type, for example, SNMP reflection or SYN flood.
* </p>
*
* @param vectorType
* The attack type, for example, SNMP reflection or SYN flood.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SummarizedAttackVector withVectorType(String vectorType) {
setVectorType(vectorType);
return this;
}
/**
* <p>
* The list of counters that describe the details of the attack.
* </p>
*
* @return The list of counters that describe the details of the attack.
*/
public java.util.List<SummarizedCounter> getVectorCounters() {
return vectorCounters;
}
/**
* <p>
* The list of counters that describe the details of the attack.
* </p>
*
* @param vectorCounters
* The list of counters that describe the details of the attack.
*/
public void setVectorCounters(java.util.Collection<SummarizedCounter> vectorCounters) {
if (vectorCounters == null) {
this.vectorCounters = null;
return;
}
this.vectorCounters = new java.util.ArrayList<SummarizedCounter>(vectorCounters);
}
/**
* <p>
* The list of counters that describe the details of the attack.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setVectorCounters(java.util.Collection)} or {@link #withVectorCounters(java.util.Collection)} if you want
* to override the existing values.
* </p>
*
* @param vectorCounters
* The list of counters that describe the details of the attack.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SummarizedAttackVector withVectorCounters(SummarizedCounter... vectorCounters) {
if (this.vectorCounters == null) {
setVectorCounters(new java.util.ArrayList<SummarizedCounter>(vectorCounters.length));
}
for (SummarizedCounter ele : vectorCounters) {
this.vectorCounters.add(ele);
}
return this;
}
/**
* <p>
* The list of counters that describe the details of the attack.
* </p>
*
* @param vectorCounters
* The list of counters that describe the details of the attack.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SummarizedAttackVector withVectorCounters(java.util.Collection<SummarizedCounter> vectorCounters) {
setVectorCounters(vectorCounters);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getVectorType() != null)
sb.append("VectorType: ").append(getVectorType()).append(",");
if (getVectorCounters() != null)
sb.append("VectorCounters: ").append(getVectorCounters());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof SummarizedAttackVector == false)
return false;
SummarizedAttackVector other = (SummarizedAttackVector) obj;
if (other.getVectorType() == null ^ this.getVectorType() == null)
return false;
if (other.getVectorType() != null && other.getVectorType().equals(this.getVectorType()) == false)
return false;
if (other.getVectorCounters() == null ^ this.getVectorCounters() == null)
return false;
if (other.getVectorCounters() != null && other.getVectorCounters().equals(this.getVectorCounters()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getVectorType() == null) ? 0 : getVectorType().hashCode());
hashCode = prime * hashCode + ((getVectorCounters() == null) ? 0 : getVectorCounters().hashCode());
return hashCode;
}
@Override
public SummarizedAttackVector clone() {
try {
return (SummarizedAttackVector) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.shield.model.transform.SummarizedAttackVectorMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| aws/aws-sdk-java | aws-java-sdk-shield/src/main/java/com/amazonaws/services/shield/model/SummarizedAttackVector.java | Java | apache-2.0 | 7,238 | [
30522,
1013,
1008,
1008,
9385,
2418,
1011,
16798,
2475,
9733,
1012,
4012,
1010,
4297,
1012,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
title: பாபிலோனின் விழுகை
date: 06/02/2020
---
`கேள்வி: கடைசிக்கால பாபிலோனின் விழுகைக்கு அடையாளமாக இருக்கும் பெல்ஷாத் சாருடைய பாபிலோனின் விழுகைபற்றி நாம் என்ன கற்றுக்கொள்ள முடிகிறது? தானி 5:29-31; வெளி 14:8; 16:19; 18:2.`
எவ்வளவுதான் குறைகள் இருந்தாலும் பெல்ஷாத்சார் வாக்குத் தவறவில்லை. தானியேல் சொன்ன விளக்கம் கெட்ட செய்தியாக இருந் தாலும்கூட விளக்கத்தை ஏற்றுக்கொண்டான். தான் உறுதியளித்தபடி தீர்க்கதரிசிக்கு பரிசுகளை வழங்குகிறான். தானியேலுடைய செய்தி உண்மை என்பதைஅவன் உணர்ந்த செயலானது, தானியேலுடைய தேவன் உண்மையானவரென அவன் உணர்ந்ததை எடுத்துக்காட்டியது. முன்பு பரிசுகளை மறுத்த தானியேலும்கூட இப்போது ஏற்றுக்கொள் கிறான். விளக்கம்சொல்வதற்கு இனி அவை தடையாக இருக்காது என்பதும் காரணமாக இருக்கலாம். ஆனால் அந்தச் சூழ்நிலையில் அந்தப் பரிசுகளால் பயனில்லை; சாம்ராஜ்யம் விழ இருந்தது. அப்படி யிருந்தாலும் ஒரு மனிதாபிமானத்திற்காக, தீர்க்கதரிசி அந்தப் பரிசை ஏற்றுக்கொள்கிறான்; ஒரு சில மணி நேரங்களே ராஜ்யத்திற்கு தான் மூன்றாம் அதிபதியாக இருக்கப்போவதையும் அறிந்திருந்தான்.
தீர்க்கதரிசி சொன்னபடி பாபிலோன் விழுகிறது. ராஜாவும் அவ னுடைய அரசவையினரும் குடித்து வெறித்திருந்த நிலையில், சண்டை யில்லாமல் சடிதியில் பாபிலோன் விழுகிறது. பெர்சியர்கள் கால்வாய் ஒன்றை வெட்டி, ஐபிராத்தைத் திருப்பிவிட்டு, அந்த ஆற்றுப்படுகை வழியாக நகரத்திற்குள் அணிவகுத்துச் சென்றதாக ஹெரோடாடஸ் எனும் வரலாற்றாசிரியர் எழுதுகிறார். அன்று இராத்திரியில் பெல்ஷாத் சார் கொல்லப்பட்டான். அவனுடைய அப்பா நபோனிடஸ் ஏற்கனவே நகரத்தை விட்டு ஓடியிருந்தான்; பின்னர் புதிய ஆட்சியாளர்களிடம் சரணடைந்தான். எனவே வரலாற்றிலேயே மிகப்பெரிதான சாம் ராஜ்யம் விழுந்தது.; பொன்னான தலையாகிய பாபிலோன் முடிந்தது.
‘தேவனை அறிந்து, அவருடைய சித்தப்படி செய்ய பெல்ஷாத் சாருக்கு பல வாய்ப்புகள் கொடுக்கப்பட்டன. தன்னுடைய தாத்தா நேபு காத்நேச்சார் மனிதர்களிடமிருந்து தள்ளப்பட்டதைக் கண்டிருந்தான். அரசன் அகந்தையோடு தன் அறிவை குறித்து பெருமைபாராட்டியபோது அதைக் கொடுத்தவர் அதை எடுத்ததையும் பார்த்திருந்தான். ராஜா ராஜ் யத்திலிருந்து துரத்தப்பட்டு, வெளியின் மிருகங்களோடு சஞ்சரிக்க விடப்பட்டதையும் கண்டிருந்தான். அந்தப் பாடங்களை அவன் மறந் திருக்கக் கூடாது; ஆனால் கேளிக்கையும் சுயமகிமையும் மறக்கச்செய் தன. நேபுகாத்நேச்சார்மேல் நியாயத்தீர்ப்பைக் கொண்டுவந்த அதே பாவங்களைச் செய்தான். கிருபையாகக் கொடுக்கப்பட்ட தருணங் களை வீணாக்கினான்; சத்தியத்தை அறியும்படி கொடுக்கப்பட்ட வாய்பப்புகளைப் புறக்கணித்தான்.’ - BE, Apr 25, 1898.
`‘சத்தியத்தை அறிந்துகொள்ள’ என்னென்ன வாய்ப்புகள் கொடுக்கப்பட்டுள்ளன? அறிந்து கொள்ளவேண்டிய அனைத்து சத்தியங்களையும் அறிந்ததாக எப்போது சொல்லமுடியும்?` | PrJared/sabbath-school-lessons | src/ta/2020-01/06/06.md | Markdown | mit | 6,399 | [
30522,
1011,
1011,
1011,
2516,
1024,
1388,
29931,
29924,
29932,
29928,
30524,
29927,
29933,
29920,
29935,
29926,
1388,
29931,
29924,
29932,
29928,
29934,
29931,
29923,
29932,
29923,
100,
1386,
29931,
29925,
100,
100,
100,
1029,
1385,
29931,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php if (!defined('APPLICATION')) exit();
$Alt = FALSE;
$Session = Gdn::Session();
$EditUser = $Session->CheckPermission('Garden.Users.Edit');
$DeleteUser = $Session->CheckPermission('Garden.Users.Delete');
foreach ($this->UserData->Result() as $User) {
$Alt = $Alt ? FALSE : TRUE;
?>
<tr id="<?php echo "UserID_{$User->UserID}"; ?>"<?php echo $Alt ? ' class="Alt"' : ''; ?>>
<!-- <td class="CheckboxCell"><input type="checkbox" name="LogID[]" value="<?php echo $User->UserID; ?>" /></td>-->
<td><strong><?php echo UserAnchor($User); ?></strong></td>
<td class="Alt"><?php echo Gdn_Format::Email($User->Email); ?></td>
<td style="max-width: 200px;">
<?php
$Roles = GetValue('Roles', $User, array());
$RolesString = '';
if ($User->Banned && !in_array('Banned', $Roles)) {
$RolesString = T('Banned');
}
if ($User->Admin > 1) {
$RolesString = ConcatSep(', ', $RolesString, T('System'));
}
foreach ($Roles as $RoleID => $RoleName) {
$Query = http_build_query(array('Keywords' => $RoleName));
$RolesString = ConcatSep(', ', $RolesString, '<a href="'.Url('/user/browse?'.$Query).'">'.htmlspecialchars($RoleName).'</a>');
}
echo $RolesString;
?>
</td>
<td class="Alt"><?php echo Gdn_Format::Date($User->DateFirstVisit, 'html'); ?></td>
<td><?php echo Gdn_Format::Date($User->DateLastActive, 'html'); ?></td>
<td><?php echo htmlspecialchars($User->LastIPAddress); ?></td>
<?php
$this->EventArgs['User'] = $User;
$this->FireEvent('UserCell');
?>
<?php if ($EditUser || $DeleteUser) { ?>
<td><?php
if ($EditUser)
echo Anchor(T('Edit'), '/user/edit/'.$User->UserID, 'Popup SmallButton');
if ($DeleteUser && $User->UserID != $Session->User->UserID)
echo Anchor(T('Delete'), '/user/delete/'.$User->UserID, 'SmallButton');
$this->EventArguments['User'] = $User;
$this->FireEvent('UserListOptions');
?></td>
<?php } ?>
</tr>
<?php
} | ppazos/cabolabs-web-old | forum/applications/dashboard/views/user/users.php | PHP | apache-2.0 | 2,182 | [
30522,
1026,
1029,
25718,
2065,
1006,
999,
4225,
1006,
1005,
4646,
1005,
1007,
1007,
6164,
1006,
1007,
1025,
1002,
12456,
1027,
6270,
1025,
1002,
5219,
1027,
1043,
2094,
2078,
1024,
1024,
5219,
1006,
1007,
1025,
1002,
10086,
20330,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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("DAI.Exception")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DAI.Exception")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[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("0576f278-ef21-469a-a598-06c15ae518ad")]
// 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")]
| uQr/FrameworkWithDesingPatterns | DAI.Exception/Properties/AssemblyInfo.cs | C# | gpl-2.0 | 1,402 | [
30522,
2478,
2291,
1012,
9185,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
21624,
8043,
7903,
2229,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
6970,
11923,
2121,
7903,
2229,
1025,
1013,
1013,
2236,
2592,
2055,
2019,
3320,
2003,
4758,
2083,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>template test</title>
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/highcharts.js"></script>
<script src="../dist/template-native.js"></script>
<script src="js/tmpl.js"></script>
<script src="js/doT.js"></script>
<script src="js/juicer.js"></script>
<script src="js/kissy.js"></script>
<script src="js/template.js"></script>
<script src="js/mustache.js"></script>
<script src="js/handlebars.js"></script>
<script src="js/baiduTemplate.js"></script>
<script src="js/jquery.tmpl.js"></script>
<script src="js/easytemplate.js"></script>
<script src="js/underscore.js"></script>
<script src="js/etpl.js"></script>
<script>
// 数据量
var length = 100;
// 渲染次数
var number = 10000;
var data = {
list: []
};
for (var i = 0; i < length; i ++) {
data.list.push({
index: i,
user: '<strong style="color:red">糖饼</strong>',
site: 'http://www.planeart.cn',
weibo: 'http://weibo.com/planeart',
QQweibo: 'http://t.qq.com/tangbin'
});
};
// 待测试的引擎列表
var testList = [
{
name: 'artTemplate',
tester: function () {
//template.config('escape', false);
var source = document.getElementById('template').innerHTML;
var fn = template.compile(source);
for (var i = 0; i < number; i ++) {
fn(data);
}
}
},
{
name: 'juicer',
tester: function () {
var config = {cache:true};
var source = document.getElementById('juicer').innerHTML;
for (var i = 0; i < number; i ++) {
juicer.to_html(source, data, config);
}
}
},
{
name: 'doT',
tester: function () {
var source = document.getElementById('doT').innerHTML;
var doTtmpl = doT.template(source);
for (var i = 0; i < number; i ++) {
doTtmpl(data);
}
}
},
{
name: 'Handlebars',
tester: function () {
var source = document.getElementById('Handlebars').innerHTML;
var fn = Handlebars.compile(source);
for (var i = 0; i < number; i ++) {
fn(data);
}
}
},
{
name: 'etpl',
tester: function () {
// dont escape html
etpl.config({
defaultFilter: ''
});
var source = document.getElementById('etpl').innerHTML;
var fn = etpl.compile(source);
for (var i = 0; i < number; i ++) {
fn(data);
}
}
},
{
name: 'tmpl',
tester: function () {
var source = document.getElementById('tmpl').innerHTML;
var fn = tmpl(source);
for (var i = 0; i < number; i ++) {
fn(data);
}
}
},
{
name: 'easyTemplate',
tester: function () {
var source = document.getElementById('easyTemplate').innerHTML;
var fn = easyTemplate(source);
for (var i = 0; i < number; i ++) {
// easyTemplate 渲染方法被重写到 toString(), 需要取值操作才会运行
fn(data) + '';
}
}
},
{
name: 'underscoreTemplate',
tester: function () {
var source = document.getElementById('underscoreTemplate').innerHTML;
var fn = _.template(source);
for (var i = 0; i < number; i ++) {
fn(data);
}
}
},
{
name: 'baiduTemplate',
tester: function () {
var bt=baidu.template;
bt.ESCAPE = false;
for (var i = 0; i < number; i ++) {
bt('baidu-template', data);
}
}
},
// jqueryTmpl 太慢,可能导致浏览器停止响应
/*{
name: 'jqueryTmpl',
tester: function () {
var source = document.getElementById("jqueryTmpl").innerHTML;
for (var i = 0; i < number; i ++) {
$.tmpl(source, data);
}
}
},*/
{
name: 'Mustache',
tester: function () {
var source = document.getElementById('Mustache').innerHTML;
for (var i = 0; i < number; i ++) {
Mustache.to_html(source, data);
}
}
}
];
KISSY.use('template',function(S,T) {
testList.push({
name: 'kissyTemplate',
tester: function () {
var source= document.getElementById('kissy').innerHTML;
for (var i = 0; i < number; i ++) {
T(source).render(data);
}
}
});
});
var startTest = function () {
var Timer = function (){
this.startTime = + new Date;
};
Timer.prototype.stop = function(){
return + new Date - this.startTime;
};
var colors = Highcharts.getOptions().colors;
var categories = [];
for (var i = 0; i < testList.length; i ++) {
categories.push(testList[i].name);
}
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
height: categories.length * 40,
type: 'bar'
},
title: {
text: 'JavaScript 模板引擎负荷测试'
},
subtitle: {
text: length + ' 条数据 × ' + number + ' 次渲染'
},
xAxis: {
categories: categories,
labels: {
align: 'right',
style: {
fontSize: '12px',
fontFamily: 'Verdana, sans-serif'
}
}
},
yAxis: {
min: 0,
title: {
text: '耗时(毫秒)'
}
},
legend: {
enabled: false
},
tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br/>'+
this.y + '毫秒';
}
},
credits: {
enabled: false
},
plotOptions: {
bar: {
dataLabels: {
enabled: true,
formatter: function () {
return this.y + 'ms';
}
}
}
},
series: [{
data : []
}]
});
var log = function (message) {
document.getElementById('log').innerHTML = message;
};
var tester = function (target) {
var time = new Timer;
target.tester();
var endTime = time.stop();
chart.series[0].addPoint({
color: colors.shift(),
y: endTime
});
if (!testList.length) {
log('测试已完成,请不要迷恋速度');
return;
}
target = testList.shift();
log('正在测试: ' + target.name + '..');
setTimeout(function () {
tester(target);
}, 500);
};
var target = testList.shift();
log('正在测试: ' + target.name + '..');
tester(target);
};
</script>
<!-- artTemplate 的模板 -->
<script id="template" type="text/tmpl">
<ul>
<% for (i = 0, l = list.length; i < l; i ++) { %>
<li>用户: <%=#list[i].user%>/ 网站:<%=#list[i].site%></li>
<% } %>
</ul>
</script>
<!-- baidu-template 的模板 -->
<script id="baidu-template" type="text/tmpl">
<ul>
<% for (var val, i = 0, l = list.length; i < l; i ++) { %>
<% val = list[i]; %>
<li>用户: <%:=val.user%>/ 网站:<%:=val.site%></li>
<% } %>
</ul>
</script>
<!-- easyTemplate 的模板 -->
<script id="easyTemplate" type="text/tmpl">
<ul>
<#list data.list as item>
<li>用户: ${item.user}/ 网站:${item.site}</li>
</#list>
</ul>
</script>
<!-- tmpl 的模板 -->
<script id="tmpl" type="text/tmpl">
<ul>
<% for (var val, i = 0, l = list.length; i < l; i ++) { %>
<% val = list[i]; %>
<li>用户: <%=val.user%>/ 网站:<%=val.site%></li>
<% } %>
</ul>
</script>
<!-- jqueryTmpl 的模板 -->
<script id="jqueryTmpl" type="text/tmpl">
<ul>
{{each list}}
<li>用户: ${$value.user}/ 网站:${$value.site}</li>
{{/each}}
</ul>
</script>
<!--juicer 的模板 -->
<script id="juicer" type="text/tmpl">
<ul>
{@each list as val}
<li>用户: $${val.user}/ 网站:$${val.site}</li>
{@/each}
</ul>
</script>
<!--etpl 的模板 -->
<script id="etpl" type="text/tmpl">
<ul>
<!--for: ${list} as ${val} -->
<li>用户: ${val.user}/ 网站:${val.site}</li>
<!--/for-->
</ul>
</script>
<!-- doT 的模板 -->
<script id="doT" type="text/tmpl">
<ul>
{{ for (var val, i = 0, l = it.list.length; i < l; i ++) { }}
{{ val = it.list; }}
<li>用户: {{=val[i].user}}/ 网站:{{=val[i].site}}</li>
{{ } }}
</ul>
</script>
<!--Mustache 的模板 -->
<script id="Mustache" type="text/tmpl">
<ul>
{{#list}}
<li>用户: {{{user}}}/ 网站:{{{site}}}</li>
{{/list}}
</ul>
</script>
<!--Handlebars 的模板 -->
<script id="Handlebars" type="text/tmpl">
<ul>
{{#list}}
<li>用户: {{{user}}}/ 网站:{{{site}}}</li>
{{/list}}
</ul>
</script>
<!--kissy 的模板 -->
<script id="kissy" type="text/tmpl">
<ul>
{{#each list as val}}
<li>用户: {{val.user}}/ 网站:{{val.site}}</li>
{{/each}}
</ul>
</script>
<!-- ejs 的模板 -->
<script id="ejs" type="text/tmpl">
<ul>
<& for (var val, i = 0, l = @list.length; i < l; i ++) { &>
<& val = @list[i]; &>
<li>用户: <&= val.user &>; 网站:<&= val.site &></li>
<& } &>
</ul>
</script>
<!-- underscore 的模板 -->
<script id="underscoreTemplate" type="text/tmpl">
<ul>
<% for (var i = 0, l = list.length; i < l; i ++) { %>
<li>用户: <%=list[i].user%>/ 网站:<%=list[i].site%></li>
<% } %>
</ul>
</script>
</head>
<body>
<h1>引擎渲染速度测试</h1>
<p><strong><script>document.write(length)</script></strong> 条数据 × <strong><script>document.write(number)</script></strong> 次渲染测试 [escape:false, cache:true]</p>
<p><em>建议在拥有 v8 javascript 引擎的 chrome 浏览器上进行测试,避免浏览器停止响应</em></p>
<p><button id="button-test" onclick="this.disabled=true;startTest()" style="padding: 5px;">开始测试»</button> <span id="log" style="font-size:12px"><script>for (var i = 0; i < testList.length; i ++) {document.write(testList[i].name + '; ')}</script></span></p>
<div id="container" style="min-width: 400px; margin: 0 auto"></div>
</body>
</html> | WTXGBG/loltpc | tp5/public/assets/libs/art-template/test/test-speed.html | HTML | apache-2.0 | 11,011 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
21183,
2546,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div class="section">
<h2>JavaScript Xmpp Client</h2>
<form id="ojsxc">
<div class="form-group">
<label class="text-left form-no-padding">
<input type="radio" name="serverType" required="required" value="internal" <?php if($_['serverType'] === 'internal')echo 'checked'; ?> />
Internal (Experimental)
</label>
<em>Limited functionality only: No clients besides JSXC in ownCloud, no multi-user chat, no server-to-server federations.</em>
</div>
<div class="form-group">
<label class="text-left form-no-padding">
<input type="radio" name="serverType" class="required" required="required" value="external" <?php if($_['serverType'] === 'external')echo 'checked'; ?> />
External
</label>
<em>Choose this option to use your own XMPP server.</em>
</div>
<fieldset>
<h3>Basic</h3>
<div class="ojsxc-internal hidden">
</div>
<div class="ojsxc-external hidden">
<div class="form-group">
<label for="xmppDomain">* XMPP domain</label>
<div class="form-col">
<input type="text" name="xmppDomain" id="xmppDomain" class="required" required="required" value="<?php p($_['xmppDomain']); ?>" />
</div>
</div>
<div class="form-group">
<label for="xmppPreferMail">Prefer mail address to loginName@xmppDomain</label>
<input type="checkbox" name="xmppPreferMail" id="xmppPreferMail" value="true" <?php if($_[ 'xmppPreferMail']==='true' || $_[ 'xmppPreferMail']===true) echo "checked"; ?> />
</div>
<div class="form-group">
<label for="boshUrl">* BOSH url</label>
<div class="form-col">
<input type="text" name="boshUrl" id="boshUrl" class="required" required="required" value="<?php p($_['boshUrl']); ?>" />
<div class="boshUrl-msg"></div>
</div>
</div>
<div class="form-group">
<label for="xmppResource">XMPP resource</label>
<div class="form-col">
<input type="text" name="xmppResource" id="xmppResource" value="<?php p($_['xmppResource']); ?>" />
</div>
</div>
<div class="form-group">
<label for="xmppOverwrite">Allow user to overwrite XMPP settings</label>
<div class="form-col">
<input type="checkbox" name="xmppOverwrite" id="xmppOverwrite" value="true" <?php if($_[ 'xmppOverwrite']==='true' || $_[ 'xmppOverwrite']===true) echo "checked"; ?> />
</div>
</div>
</div>
<div class="form-group">
<label for="xmppStartMinimized">Hide roster after first login</label>
<div class="form-col">
<input type="checkbox" name="xmppStartMinimized" id="xmppStartMinimized" value="true" <?php if($_[ 'xmppStartMinimized']==='true' || $_[ 'xmppStartMinimized']===true) echo "checked"; ?> />
</div>
</div>
</fieldset>
<fieldset>
<h3>ICE server <small>(WebRTC)</small></h3>
<div class="form-group">
<label for="iceUrl">Url</label>
<div class="form-col">
<input type="text" name="iceUrl" id="iceUrl" value="<?php p($_['iceUrl']); ?>" placeholder="stun:stun.stunprotocol.org" pattern="^(stun|turn):.+" />
</div>
</div>
<div class="form-group">
<label for="iceUsername">TURN Username</label>
<div class="form-col">
<input type="text" name="iceUsername" id="iceUsername" value="<?php p($_['iceUsername']); ?>" />
<em>If no username is set, TURN-REST-API credentials are used.</em>
</div>
</div>
<div class="form-group">
<label for="iceCredential">TURN Credential</label>
<div class="form-col">
<input type="text" name="iceCredential" id="iceCredential" value="<?php p($_['iceCredential']); ?>" />
<em>If no password is set, TURN-REST-API credentials are used.</em>
</div>
</div>
<div class="form-group">
<label for="iceSecret">TURN Secret</label>
<div class="form-col">
<input type="text" name="iceSecret" id="iceSecret" value="<?php p($_['iceSecret']); ?>" />
<em>Secret for TURN-REST-API credentials as described <a href="http://tools.ietf.org/html/draft-uberti-behave-turn-rest-00" target="_blank">here</a>.</em>
</div>
</div>
<div class="form-group">
<label for="iceTtl">TURN TTL</label>
<div class="form-col">
<input type="number" name="iceTtl" id="iceTtl" value="<?php p($_['iceTtl']); ?>" />
<em>Lifetime for TURN-REST-API credentials in seconds.</em>
</div>
</div>
</fieldset>
<fieldset>
<h3>Screen sharing</h3>
<div class="form-group">
<label for="firefoxExtension">Firefox Extension Url</label>
<div class="form-col">
<input type="url" name="firefoxExtension" id="firefoxExtension" value="<?php p($_['firefoxExtension']); ?>" />
<em>Firefox needs an extension in order to support screen sharing. <a href="https://github.com/jsxc/jsxc/wiki/Screen-sharing">More details.</a></em>
</div>
</div>
<div class="form-group">
<label for="chromeExtension">Chrome Extension Url</label>
<div class="form-col">
<input type="url" name="chromeExtension" id="chromeExtension" value="<?php p($_['chromeExtension']); ?>" />
<em>Chrome needs an extension in order to support screen sharing. <a href="https://github.com/jsxc/jsxc/wiki/Screen-sharing">More details.</a></em>
</div>
</div>
</fieldset>
<fieldset>
<h3>CSP <small>Content-Security-Policy</small></h3>
<div class="form-group">
<label for="fileUpload">External services</label>
<div class="form-col">
<?php foreach($_['externalServices'] as $external): ?>
<input type="text" name="externalServices[]" value="<?php p($external); ?>" pattern="^(https://)?([\w\d*][\w\d-]*)(\.[\w\d-]+)+(:[\d]+)?$" />
<?php endforeach;?>
<button class="add-input">+</button>
<em>All domains of external services which JSXC should reach. E.g. http file upload service. <a href="#" id="insert-upload-service">Insert upload services automatically</a>.</em>
</div>
</div>
</fieldset>
<div class="form-col-offset">
<div class="msg"></div>
<input type="submit" value="Save settings" />
</div>
</form>
</div>
| owncloud/jsxc.chat | templates/settings.php | PHP | mit | 5,995 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
2930,
1000,
1028,
1026,
1044,
2475,
1028,
9262,
22483,
1060,
8737,
2361,
7396,
1026,
1013,
1044,
2475,
1028,
1026,
2433,
8909,
1027,
1000,
1051,
22578,
2595,
2278,
1000,
1028,
1026,
4487,
2615,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/perl -w
use strict;
use warnings;
use Carp;
use feature ':5.10';
use File::Basename;
use Getopt::Long;
BEGIN {
my $script_name = basename $0;
if (-f $script_name && -d "../etc") {
# we're in the scripts directory - go up
chdir "..";
}
};
use lib qw(lib);
use Canto::Config;
use Canto::TrackDB;
use Canto::Track;
use Canto::Track::LoadUtil;
use Canto::Meta::Util;
my $remove_person = undef;
my $remove_lab = undef;
my $remove_curs = undef;
my $remove_all_sessions = undef;
my $remove_pub = undef;
my $do_help = 0;
if (!@ARGV) {
usage();
}
my $result = GetOptions ("person=s" => \$remove_person,
"lab=s" => \$remove_lab,
"curs" => \$remove_curs,
"all-canto-sessions!" => \$remove_all_sessions,
"pub" => \$remove_pub,
"help|h" => \$do_help);
sub usage
{
my $message = shift;
if (defined $message) {
$message .= "\n";
} else {
$message = '';
}
die qq|${message}usage:
$0 --person <email_address>
OR
$0 --lab <lab_name>
OR
$0 --curs <session_key> [<session_key> [<session_key>] ...]
OR
$0 --pub <pubmed_id> [<pubmed_id> [<pubmed_id>]...]
OR
$0 --all-canto-sessions
Options:
--person - remove the person with the given email address, and unassign any
publications and sessions assigned to this user
--lab - remove the lab with the given name.
--curs - remove a curation session (curs) and the curs database
--pub - remove a publication from the database, unless it has a session
--all-canto-sessions - remove ALL sessions
Example:
$0 --pub PMID:9161420 PMID:8937892
|;
}
if ($do_help) {
usage();
}
my $app_name = Canto::Config::get_application_name();
$ENV{CANTO_CONFIG_LOCAL_SUFFIX} ||= 'deploy';
my $suffix = $ENV{CANTO_CONFIG_LOCAL_SUFFIX};
if (!Canto::Meta::Util::app_initialised($app_name, $suffix)) {
die "The application is not yet initialised, try running the canto_start " .
"script\n";
}
my $config = Canto::Config::get_config();
my $schema = Canto::TrackDB->new(config => $config);
my $load_util = Canto::Track::LoadUtil->new(schema => $schema);
my $exit_flag = 1;
my $proc = sub {
if (defined $remove_person) {
my $person = $schema->resultset('Person')->find({ email_address => $remove_person });
if (defined $person) {
my @labs = $person->labs();
if (@labs) {
my $lab_string = join ', ', map { $_->name() } @labs;
my $person_name = $person->name();
warn "Can't delete $person_name who is lab head of: $lab_string
Delete the lab first with:
$0 --lab '", $labs[0]->name(), "'\n";
} else {
my @curs_curators = $person->curs_curators();
map {
$_->delete();
} @curs_curators;
my @assigned_publications = $person->pubs();
map {
$_->corresponding_author(undef);
$_->update();
} @assigned_publications;
$person->delete();
$exit_flag = 0;
}
} else {
warn "No person found for email address: $remove_person\n";
}
}
if (defined $remove_lab) {
my $lab = $schema->resultset('Lab')->find({ name => $remove_lab });
if (defined $lab) {
map { $_->lab(undef); $_->update(); } $lab->people();
$lab->delete();
$exit_flag = 0;
} else {
warn "No lab found named: $remove_lab\n";
}
}
if (defined $remove_curs) {
for my $curs_key (@ARGV) {
warn "removing: $curs_key\n";
Canto::Track::delete_curs($config, $schema, $curs_key);
}
$exit_flag = 0;
}
if (defined $remove_pub) {
for my $pub_uniquename (@ARGV) {
if (Canto::Track::delete_pub($config, $schema, $pub_uniquename)) {
print "successfully removed $pub_uniquename\n";
}
}
$exit_flag = 0;
}
if (defined $remove_all_sessions) {
my @keys = Canto::Track::all_curs_keys($schema);
for my $curs_key (sort @keys) {
warn "removing: $curs_key\n";
Canto::Track::delete_curs($config, $schema, $curs_key);
}
$exit_flag = 0;
}
};
$schema->txn_do($proc);
exit($exit_flag);
| kimrutherford/canto | script/canto_delete.pl | Perl | gpl-3.0 | 4,142 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
2566,
2140,
1011,
1059,
2224,
9384,
1025,
2224,
16234,
1025,
2224,
29267,
1025,
2224,
3444,
1005,
1024,
1019,
1012,
2184,
1005,
1025,
2224,
5371,
1024,
1024,
2918,
18442,
1025,
2224,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from django.core.management.base import BaseCommand, CommandError
from ship_data.models import GpggaGpsFix
import datetime
from main import utils
import csv
import os
from django.db.models import Q
import glob
from main.management.commands import findgpsgaps
gps_bridge_working_intervals = None
# This file is part of https://github.com/cpina/science-cruise-data-management
#
# This project was programmed in a hurry without any prior Django experience,
# while circumnavigating the Antarctic on the ACE expedition, without proper
# Internet access, with 150 scientists using the system and doing at the same
# cruise other data management and system administration tasks.
#
# Sadly there aren't unit tests and we didn't have time to refactor the code
# during the cruise, which is really needed.
#
# Carles Pina (carles@pina.cat) and Jen Thomas (jenny_t152@yahoo.co.uk), 2016-2017.
class Command(BaseCommand):
help = 'Outputs the track in CSV format.'
def add_arguments(self, parser):
parser.add_argument('output_directory', type=str, help="Will delete existing files that started on the same start date")
parser.add_argument('start', type=str, help="Start of the GPS data. Format: YYYYMMDD")
parser.add_argument('end', type=str, help="End of the GPS data. Format: YYYYMMDD or 'yesterday'")
def handle(self, *args, **options):
generate_all_tracks(options['output_directory'], options['start'], options['end'])
def generate_all_tracks(output_directory, start, end):
global gps_bridge_working_intervals
gps_gaps = findgpsgaps.FindDataGapsGps("GPS Bridge1", start, end)
gps_bridge_working_intervals = gps_gaps.find_gps_missings()
generate_fast(output_directory, 3600, "1hour", start, end)
generate_fast(output_directory, 300, "5min", start, end)
generate_fast(output_directory, 60, "1min", start, end)
generate_fast(output_directory, 1, "1second", start, end)
def generate_fast(output_directory, seconds, file_suffix, start, end):
"""
This method uses Mysql datetime 'ends with' instead of doing individual queries
for each 'seconds'. It's faster but harder to find gaps in the data.
"""
first_date = datetime.datetime.strptime(start, "%Y%m%d")
first_date = utils.set_utc(first_date)
if end == "yesterday":
last_date = utils.last_midnight()
else:
last_date = datetime.datetime.strptime(end, "%Y%m%d")
last_date = utils.set_utc(last_date)
starts_file_format = first_date.strftime("%Y%m%d")
ends_file_format = last_date.strftime("%Y%m%d")
filename = "track_{}_{}_{}.csv".format(starts_file_format, ends_file_format, file_suffix)
files_to_delete = glob.glob(os.path.join(output_directory, "track_{}_*_{}.csv".format(starts_file_format,
file_suffix)))
print("Will start processing:", filename)
file_path = os.path.join(output_directory, filename)
if file_path in files_to_delete:
files_to_delete.remove(file_path) # In case that this script is re-generating the file
file = open(file_path + ".tmp", "w")
csv_writer = csv.writer(file)
csv_writer.writerow(["date_time", "latitude", "longitude"])
one_day = datetime.timedelta(days=1)
current_day = first_date
while current_day <= last_date:
process_day(current_day, seconds, csv_writer)
current_day += one_day
delete_files(files_to_delete)
file.close()
os.rename(file_path + ".tmp", file_path)
def process_day(date_time_process, seconds, csv_writer):
date_time_process_tomorrow = date_time_process + datetime.timedelta(days=1)
today_filter = Q(date_time__gte=date_time_process) & Q(date_time__lt=date_time_process_tomorrow)
if seconds == 1:
query_set = GpggaGpsFix.objects.filter(today_filter).order_by('date_time')
elif seconds == 60:
query_set = GpggaGpsFix.objects.filter(today_filter).filter(date_time__contains=':01.').order_by('date_time')
elif seconds == 300:
query_set = GpggaGpsFix.objects.filter(today_filter).filter(Q(date_time__contains=':00:01.') |
Q(date_time__contains=':05:01.') |
Q(date_time__contains=':10:01.') |
Q(date_time__contains=':15:01.') |
Q(date_time__contains=':20:01.') |
Q(date_time__contains=':25:01.') |
Q(date_time__contains=':30:01.') |
Q(date_time__contains=':35:01.') |
Q(date_time__contains=':40:01.') |
Q(date_time__contains=':45:01.') |
Q(date_time__contains=':50:01.') |
Q(date_time__contains=':55:01.')).order_by('date_time')
elif seconds == 3600:
query_set = GpggaGpsFix.objects.filter(today_filter).filter(date_time__contains=':00:01').order_by('date_time')
else:
assert False # need to add a if case for this
# 64: GPS Bridge
# 63: GPS Trimble
query_set = query_set.filter(utils.filter_out_bad_values())
previous_date_time_string = ""
for gps_info in query_set.iterator():
date_time_string = gps_info.date_time.strftime("%Y-%m-%d %H:%M:%S")
if date_time_string == previous_date_time_string:
continue
if which_gps(date_time_string) == "GPS Bridge1":
if gps_info.device_id == 64:
l = [gps_info.date_time.strftime("%Y-%m-%d %H:%M:%S"),
"{:.4f}".format(gps_info.latitude),
"{:.4f}".format(gps_info.longitude)]
# print(l)
csv_writer.writerow(l)
previous_date_time_string = date_time_string
else:
if gps_info.device_id == 63:
l = [gps_info.date_time.strftime("%Y-%m-%d %H:%M:%S"),
"{:.4f}".format(gps_info.latitude),
"{:.4f}".format(gps_info.longitude)]
# print(l)
csv_writer.writerow(l)
previous_date_time_string = date_time_string
def delete_files(files):
for file in files:
print("Deleting file:", file)
os.remove(file)
def generate_method_1(output_directory, seconds, file_suffix):
"""
This method does a query every 'seconds'. Very slow, could be used to find gaps easily on the data.
As it is now it is difficult to decide which GPS the get comes from.
"""
time_delta = datetime.timedelta(seconds=seconds)
first_date = GpggaGpsFix.objects.earliest().date_time
last_date = GpggaGpsFix.objects.latest().date_time
filename = "track_{}_{}_{}.csv".format(first_date.strftime("%Y%m%d"), last_date.strftime("%Y%m%d"), file_suffix)
print("Will start processing:", filename)
file_path = os.path.join(output_directory, filename)
file = open(file_path, "w")
csv_writer = csv.writer(file)
csv_writer.writerow(["date_time", "latitude", "longitude"])
current_date = first_date
previous_date = current_date
while current_date < last_date:
location = utils.ship_location(current_date)
if location.date_time != previous_date:
if location.date_time is not None and location.latitude is not None and location.longitude is not None:
csv_writer.writerow([location.date_time.strftime("%Y-%m-%d %H:%M:%S"), "{:.4f}".format(location.latitude), "{:.4f}".format(location.longitude)])
if location.date_time is None:
print("No data for:", current_date)
if previous_date.day != current_date.day:
print("Generating CSV GPS info:", current_date)
previous_date = current_date
current_date = current_date + time_delta
def which_gps(date_time_str):
for interval in gps_bridge_working_intervals:
if interval['starts'] < date_time_str <= interval['stops']:
# if date_time_str > interval['starts'] and date_time_str <= interval['stops']:
return "GPS Bridge1"
return "Trimble GPS"
| cpina/science-cruise-data-management | ScienceCruiseDataManagement/main/management/commands/exportgpstracks.py | Python | mit | 8,461 | [
30522,
2013,
6520,
23422,
1012,
4563,
1012,
2968,
1012,
2918,
12324,
2918,
9006,
2386,
2094,
1010,
3474,
29165,
2013,
2911,
1035,
2951,
1012,
4275,
12324,
14246,
23033,
21600,
22747,
7646,
12324,
3058,
7292,
2013,
2364,
12324,
21183,
12146,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* arch/arm/include/asm/cacheflush.h
*
* Copyright (C) 1999-2002 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _ASMARM_CACHEFLUSH_H
#define _ASMARM_CACHEFLUSH_H
#include <linux/mm.h>
#include <asm/glue-cache.h>
#include <asm/shmparam.h>
#include <asm/cachetype.h>
#include <asm/outercache.h>
#include <asm/rodata.h>
#define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT)
/*
* This flag is used to indicate that the page pointed to by a pte is clean
* and does not require cleaning before returning it to the user.
*/
#define PG_dcache_clean PG_arch_1
/*
* MM Cache Management
* ===================
*
* The arch/arm/mm/cache-*.S and arch/arm/mm/proc-*.S files
* implement these methods.
*
* Start addresses are inclusive and end addresses are exclusive;
* start addresses should be rounded down, end addresses up.
*
* See Documentation/cachetlb.txt for more information.
* Please note that the implementation of these, and the required
* effects are cache-type (VIVT/VIPT/PIPT) specific.
*
* flush_icache_all()
*
* Unconditionally clean and invalidate the entire icache.
* Currently only needed for cache-v6.S and cache-v7.S, see
* __flush_icache_all for the generic implementation.
*
* flush_kern_all()
*
* Unconditionally clean and invalidate the entire cache.
*
* flush_user_all()
*
* Clean and invalidate all user space cache entries
* before a change of page tables.
*
* flush_user_range(start, end, flags)
*
* Clean and invalidate a range of cache entries in the
* specified address space before a change of page tables.
* - start - user start address (inclusive, page aligned)
* - end - user end address (exclusive, page aligned)
* - flags - vma->vm_flags field
*
* coherent_kern_range(start, end)
*
* Ensure coherency between the Icache and the Dcache in the
* region described by start, end. If you have non-snooping
* Harvard caches, you need to implement this function.
* - start - virtual start address
* - end - virtual end address
*
* coherent_user_range(start, end)
*
* Ensure coherency between the Icache and the Dcache in the
* region described by start, end. If you have non-snooping
* Harvard caches, you need to implement this function.
* - start - virtual start address
* - end - virtual end address
*
* flush_kern_dcache_area(kaddr, size)
*
* Ensure that the data held in page is written back.
* - kaddr - page address
* - size - region size
*
* DMA Cache Coherency
* ===================
*
* dma_flush_range(start, end)
*
* Clean and invalidate the specified virtual address range.
* - start - virtual start address
* - end - virtual end address
*/
struct cpu_cache_fns {
void (*flush_icache_all)(void);
void (*flush_kern_all)(void);
void (*flush_user_all)(void);
void (*flush_user_range)(unsigned long, unsigned long, unsigned int);
void (*coherent_kern_range)(unsigned long, unsigned long);
void (*coherent_user_range)(unsigned long, unsigned long);
void (*flush_kern_dcache_area)(void *, size_t);
void (*dma_map_area)(const void *, size_t, int);
void (*dma_unmap_area)(const void *, size_t, int);
void (*dma_flush_range)(const void *, const void *);
};
/*
* Select the calling method
*/
#ifdef MULTI_CACHE
extern struct cpu_cache_fns cpu_cache;
#define __cpuc_flush_icache_all cpu_cache.flush_icache_all
#define __cpuc_flush_kern_all cpu_cache.flush_kern_all
#define __cpuc_flush_user_all cpu_cache.flush_user_all
#define __cpuc_flush_user_range cpu_cache.flush_user_range
#define __cpuc_coherent_kern_range cpu_cache.coherent_kern_range
#define __cpuc_coherent_user_range cpu_cache.coherent_user_range
#define __cpuc_flush_dcache_area cpu_cache.flush_kern_dcache_area
/*
* These are private to the dma-mapping API. Do not use directly.
* Their sole purpose is to ensure that data held in the cache
* is visible to DMA, or data written by DMA to system memory is
* visible to the CPU.
*/
#define dmac_map_area cpu_cache.dma_map_area
#define dmac_unmap_area cpu_cache.dma_unmap_area
#define dmac_flush_range cpu_cache.dma_flush_range
#else
extern void __cpuc_flush_icache_all(void);
extern void __cpuc_flush_kern_all(void);
extern void __cpuc_flush_user_all(void);
extern void __cpuc_flush_user_range(unsigned long, unsigned long, unsigned int);
extern void __cpuc_coherent_kern_range(unsigned long, unsigned long);
extern void __cpuc_coherent_user_range(unsigned long, unsigned long);
extern void __cpuc_flush_dcache_area(void *, size_t);
/*
* These are private to the dma-mapping API. Do not use directly.
* Their sole purpose is to ensure that data held in the cache
* is visible to DMA, or data written by DMA to system memory is
* visible to the CPU.
*/
extern void dmac_map_area(const void *, size_t, int);
extern void dmac_unmap_area(const void *, size_t, int);
extern void dmac_flush_range(const void *, const void *);
#endif
/*
* Copy user data from/to a page which is mapped into a different
* processes address space. Really, we want to allow our "user
* space" model to handle this.
*/
extern void copy_to_user_page(struct vm_area_struct *, struct page *,
unsigned long, void *, const void *, unsigned long);
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
do { \
memcpy(dst, src, len); \
} while (0)
/*
* Convert calls to our calling convention.
*/
/* Invalidate I-cache */
#define __flush_icache_all_generic() \
asm("mcr p15, 0, %0, c7, c5, 0" \
: : "r" (0));
/* Invalidate I-cache inner shareable */
#define __flush_icache_all_v7_smp() \
asm("mcr p15, 0, %0, c7, c1, 0" \
: : "r" (0));
/*
* Optimized __flush_icache_all for the common cases. Note that UP ARMv7
* will fall through to use __flush_icache_all_generic.
*/
#if (defined(CONFIG_CPU_V7) && \
(defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K))) || \
defined(CONFIG_SMP_ON_UP)
#define __flush_icache_preferred __cpuc_flush_icache_all
#elif __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP)
#define __flush_icache_preferred __flush_icache_all_v7_smp
#elif __LINUX_ARM_ARCH__ == 6 && defined(CONFIG_ARM_ERRATA_411920)
#define __flush_icache_preferred __cpuc_flush_icache_all
#else
#define __flush_icache_preferred __flush_icache_all_generic
#endif
static inline void __flush_icache_all(void)
{
__flush_icache_preferred();
}
#define flush_cache_all() __cpuc_flush_kern_all()
#ifndef CONFIG_SMP
#define flush_all_cpu_caches() flush_cache_all()
#else
extern void flush_all_cpu_caches(void);
#endif
static inline void vivt_flush_cache_mm(struct mm_struct *mm)
{
if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm)))
__cpuc_flush_user_all();
}
static inline void
vivt_flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
{
struct mm_struct *mm = vma->vm_mm;
if (!mm || cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm)))
__cpuc_flush_user_range(start & PAGE_MASK, PAGE_ALIGN(end),
vma->vm_flags);
}
static inline void
vivt_flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn)
{
struct mm_struct *mm = vma->vm_mm;
if (!mm || cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm))) {
unsigned long addr = user_addr & PAGE_MASK;
__cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
}
}
#ifndef CONFIG_CPU_CACHE_VIPT
#define flush_cache_mm(mm) \
vivt_flush_cache_mm(mm)
#define flush_cache_range(vma,start,end) \
vivt_flush_cache_range(vma,start,end)
#define flush_cache_page(vma,addr,pfn) \
vivt_flush_cache_page(vma,addr,pfn)
#else
extern void flush_cache_mm(struct mm_struct *mm);
extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn);
#endif
#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
/*
* flush_cache_user_range is used when we want to ensure that the
* Harvard caches are synchronised for the user space address range.
* This is used for the ARM private sys_cacheflush system call.
*/
#define flush_cache_user_range(start,end) \
__cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
/*
* Perform necessary cache operations to ensure that data previously
* stored within this range of addresses can be executed by the CPU.
*/
#define flush_icache_range(s,e) __cpuc_coherent_kern_range(s,e)
/*
* Perform necessary cache operations to ensure that the TLB will
* see data written in the specified area.
*/
#define clean_dcache_area(start,size) cpu_dcache_clean_area(start, size)
/*
* flush_dcache_page is used when the kernel has written to the page
* cache page at virtual address page->virtual.
*
* If this page isn't mapped (ie, page_mapping == NULL), or it might
* have userspace mappings, then we _must_ always clean + invalidate
* the dcache entries associated with the kernel mapping.
*
* Otherwise we can defer the operation, and clean the cache when we are
* about to change to user space. This is the same method as used on SPARC64.
* See update_mmu_cache for the user space part.
*/
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
extern void flush_dcache_page(struct page *);
static inline void flush_kernel_vmap_range(void *addr, int size)
{
if ((cache_is_vivt() || cache_is_vipt_aliasing()))
__cpuc_flush_dcache_area(addr, (size_t)size);
}
static inline void invalidate_kernel_vmap_range(void *addr, int size)
{
if ((cache_is_vivt() || cache_is_vipt_aliasing()))
__cpuc_flush_dcache_area(addr, (size_t)size);
}
#define ARCH_HAS_FLUSH_ANON_PAGE
static inline void flush_anon_page(struct vm_area_struct *vma,
struct page *page, unsigned long vmaddr)
{
extern void __flush_anon_page(struct vm_area_struct *vma,
struct page *, unsigned long);
if (PageAnon(page))
__flush_anon_page(vma, page, vmaddr);
}
#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
static inline void flush_kernel_dcache_page(struct page *page)
{
}
#define flush_dcache_mmap_lock(mapping) \
spin_lock_irq(&(mapping)->tree_lock)
#define flush_dcache_mmap_unlock(mapping) \
spin_unlock_irq(&(mapping)->tree_lock)
#define flush_icache_user_range(vma,page,addr,len) \
flush_dcache_page(page)
/*
* We don't appear to need to do anything here. In fact, if we did, we'd
* duplicate cache flushing elsewhere performed by flush_dcache_page().
*/
#define flush_icache_page(vma,page) do { } while (0)
/*
* flush_cache_vmap() is used when creating mappings (eg, via vmap,
* vmalloc, ioremap etc) in kernel space for pages. On non-VIPT
* caches, since the direct-mappings of these pages may contain cached
* data, we need to do a full cache flush to ensure that writebacks
* don't corrupt data placed into these pages via the new mappings.
*/
static inline void flush_cache_vmap(unsigned long start, unsigned long end)
{
if (!cache_is_vipt_nonaliasing())
flush_cache_all();
else
/*
* set_pte_at() called from vmap_pte_range() does not
* have a DSB after cleaning the cache line.
*/
dsb();
}
static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
{
if (!cache_is_vipt_nonaliasing())
flush_cache_all();
}
#endif
| mlachwani/Android-4.4.2-Manta-Kernel | arch/arm/include/asm/cacheflush.h | C | gpl-2.0 | 11,383 | [
30522,
1013,
1008,
1008,
7905,
1013,
2849,
1013,
2421,
1013,
2004,
2213,
1013,
17053,
10258,
20668,
1012,
1044,
1008,
1008,
9385,
1006,
1039,
1007,
2639,
1011,
2526,
5735,
2332,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright © 2013-2018 camunda services GmbH and various authors (info@camunda.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.camunda.bpm.container.impl.jboss.deployment.marker;
import java.util.List;
import org.camunda.bpm.application.AbstractProcessApplication;
import org.camunda.bpm.application.impl.metadata.spi.ProcessesXml;
import org.camunda.bpm.container.impl.jboss.util.ProcessesXmlWrapper;
import org.jboss.as.ee.component.ComponentDescription;
import org.jboss.as.server.deployment.AttachmentKey;
import org.jboss.as.server.deployment.AttachmentList;
import org.jboss.as.server.deployment.DeploymentUnit;
import org.jboss.jandex.AnnotationInstance;
/**
*
* @author Daniel Meyer
*
*/
public class ProcessApplicationAttachments {
private static final AttachmentKey<Boolean> MARKER = AttachmentKey.create(Boolean.class);
private static final AttachmentKey<Boolean> PART_OF_MARKER = AttachmentKey.create(Boolean.class);
private static final AttachmentKey<AttachmentList<ProcessesXmlWrapper>> PROCESSES_XML_LIST = AttachmentKey.createList(ProcessesXmlWrapper.class);
private static final AttachmentKey<ComponentDescription> PA_COMPONENT = AttachmentKey.create(ComponentDescription.class);
private static final AttachmentKey<AnnotationInstance> POST_DEPLOY_METHOD = AttachmentKey.create(AnnotationInstance.class);
private static final AttachmentKey<AnnotationInstance> PRE_UNDEPLOY_METHOD = AttachmentKey.create(AnnotationInstance.class);
/**
* Attach the parsed ProcessesXml file to a deployment unit.
*
*/
public static void addProcessesXml(DeploymentUnit unit, ProcessesXmlWrapper processesXmlWrapper) {
unit.addToAttachmentList(PROCESSES_XML_LIST, processesXmlWrapper);
}
/**
* Returns the attached {@link ProcessesXml} marker or null;
*
*/
public static List<ProcessesXmlWrapper> getProcessesXmls(DeploymentUnit deploymentUnit) {
return deploymentUnit.getAttachmentList(PROCESSES_XML_LIST);
}
/**
* marks a a {@link DeploymentUnit} as a process application
*/
public static void mark(DeploymentUnit unit) {
unit.putAttachment(MARKER, Boolean.TRUE);
}
/**
* marks a a {@link DeploymentUnit} as part of a process application
*/
public static void markPartOfProcessApplication(DeploymentUnit unit) {
if(unit.getParent() != null && unit.getParent() != unit) {
unit.getParent().putAttachment(PART_OF_MARKER, Boolean.TRUE);
}
}
/**
* return true if the deployment unit is either itself a process
* application or part of a process application.
*/
public static boolean isPartOfProcessApplication(DeploymentUnit unit) {
if(isProcessApplication(unit)) {
return true;
}
if(unit.getParent() != null && unit.getParent() != unit) {
return unit.getParent().hasAttachment(PART_OF_MARKER);
}
return false;
}
/**
* Returns true if the {@link DeploymentUnit} itself is a process application (carries a processes.xml)
*
*/
public static boolean isProcessApplication(DeploymentUnit deploymentUnit) {
return deploymentUnit.hasAttachment(MARKER);
}
/**
* Returns the {@link ComponentDescription} for the {@link AbstractProcessApplication} component
*/
public static ComponentDescription getProcessApplicationComponent(DeploymentUnit deploymentUnit) {
return deploymentUnit.getAttachment(PA_COMPONENT);
}
/**
* Attach the {@link ComponentDescription} for the {@link AbstractProcessApplication} component
*/
public static void attachProcessApplicationComponent(DeploymentUnit deploymentUnit, ComponentDescription componentDescription){
deploymentUnit.putAttachment(PA_COMPONENT, componentDescription);
}
/**
* Attach the {@link AnnotationInstance}s for the PostDeploy methods
*/
public static void attachPostDeployDescription(DeploymentUnit deploymentUnit, AnnotationInstance annotation){
deploymentUnit.putAttachment(POST_DEPLOY_METHOD, annotation);
}
/**
* Attach the {@link AnnotationInstance}s for the PreUndeploy methods
*/
public static void attachPreUndeployDescription(DeploymentUnit deploymentUnit, AnnotationInstance annotation){
deploymentUnit.putAttachment(PRE_UNDEPLOY_METHOD, annotation);
}
/**
* @return the description of the PostDeploy method
*/
public static AnnotationInstance getPostDeployDescription(DeploymentUnit deploymentUnit) {
return deploymentUnit.getAttachment(POST_DEPLOY_METHOD);
}
/**
* @return the description of the PreUndeploy method
*/
public static AnnotationInstance getPreUndeployDescription(DeploymentUnit deploymentUnit) {
return deploymentUnit.getAttachment(PRE_UNDEPLOY_METHOD);
}
private ProcessApplicationAttachments() {
}
}
| xasx/camunda-bpm-platform | distro/wildfly8/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/deployment/marker/ProcessApplicationAttachments.java | Java | apache-2.0 | 5,340 | [
30522,
1013,
1008,
1008,
9385,
1075,
2286,
1011,
2760,
11503,
18426,
2578,
18289,
1998,
2536,
6048,
1006,
18558,
1030,
11503,
18426,
1012,
4012,
1007,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
export interface ControlPoint {
faction: string;
id: string;
size: string;
x: number;
y: number;
};
class ControlGame {
arthurianScore: number;
controlPoints: ControlPoint[];
gameState: number;
timeLeft: number;
tuathaDeDanannScore: number;
vikingScore: number;
constructor(controlGame = <ControlGame>{}) {
// Game State
this.gameState = controlGame.gameState || 0;
// Game Score
this.arthurianScore = controlGame.arthurianScore || 0;
this.tuathaDeDanannScore = controlGame.tuathaDeDanannScore || 0;
this.vikingScore = controlGame.vikingScore || 0;
// Time remaining
this.timeLeft = controlGame.timeLeft || 0;
// Control Points (if included)
this.controlPoints = controlGame.controlPoints || <ControlPoint[]>[];
}
static create() {
let a = new ControlGame();
return a;
}
}
export default ControlGame;
| saddieeiddas/cu-core | src/ts/classes/ControlGame.ts | TypeScript | mpl-2.0 | 1,100 | [
30522,
1013,
1008,
1008,
1008,
2023,
3120,
3642,
2433,
2003,
3395,
2000,
1996,
3408,
1997,
1996,
9587,
5831,
4571,
2270,
1008,
6105,
1010,
1058,
1012,
1016,
1012,
1014,
1012,
2065,
1037,
6100,
1997,
1996,
6131,
2140,
2001,
2025,
5500,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var Connection = require("./db/db-connection").Connection;
var Tables = require("./db/tables");
const R = require("ramda");
var QUERY_MATCHES = {
$or: [
{percent_name: {$gt: 0.9}},
{
distance: {$lt: 1}
},
{
percent_name: {$gt: 0.8},
distance: {$lt: 30}
},
{
percent_name: {$gt: 0.8},
percent_address_phonetic: 1,
distance: {$lt: 50}
}
]
};
var connection = new Connection();
connection.connect()
.then(connection.collection.bind(connection, Tables.FUZZY_MATCHES_FB))
.then(coll=> {
return coll.find(QUERY_MATCHES).toArray()
})
.then(matches=> {
var promises = matches.map(match=> {
return Promise.resolve(R.filter(item=>(item.id_p1 == match.id_p1 || item.id_p2 == match.id_p1), matches)).then(response=> {
return {
id: match.id_p1.toString(),
name: match.name_p1,
response: R.compose(
R.sortBy(R.identity),
R.uniq,
R.flatten,
R.map(place=> {
return [place.id_p1.toString(), place.id_p2.toString()]
})
)(response)
}
})
});
return Promise.all(promises);
})
.then(matches=> {
matches = R.groupBy(item=>item.id, matches);
matches = Object.keys(matches).map((key)=> {
var get_ids = R.compose(
R.reduce((prev, id)=> {
prev.id_facebook.push(id);
return prev;
}, {id_facebook: [], id_google: [], id_opendata: [], id_imprese: []}),
R.sortBy(R.identity),
R.uniq,
R.flatten
, R.map(R.prop("response"))
);
var ids = get_ids(matches[key]);
return Object.assign({
name: matches[key][0].name
}, ids)
});
var uniq_matches = [];
for (var i = 0; i < matches.length; i++) {
var match = matches[i];
var found = R.find(nm=> {
var has_fb = match.id_facebook.filter(id=>nm.id_facebook.includes(id)).length;
return has_fb;
})(uniq_matches);
if (!found) {
uniq_matches.push(match);
}else {
found.id_facebook=R.uniq(found.id_facebook.concat(match.id_facebook));
}
}
var fuzzyMatchColl = connection.db.collection(Tables.FUZZY_MATCHES_FB_ONE_TO_MANY);
return fuzzyMatchColl.drop().then(_=>{
return fuzzyMatchColl.insertMany(uniq_matches);
})
})
.then(_=> {
connection.db.close();
console.log("DONE");
process.exit(0);
})
.catch(_=> {
console.log(_);
connection.db.close();
process.exit(1);
}); | marcog83/cesena-online-demo | dati-jobs/fuzzy-match-fb-places-step_2.js | JavaScript | gpl-3.0 | 3,057 | [
30522,
13075,
4434,
1027,
5478,
1006,
1000,
1012,
1013,
16962,
1013,
16962,
1011,
4434,
1000,
1007,
1012,
4434,
1025,
13075,
7251,
1027,
5478,
1006,
1000,
1012,
1013,
16962,
1013,
7251,
1000,
1007,
1025,
9530,
3367,
1054,
1027,
5478,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
# Copyright© 2016 ICTSTUDIO <http://www.ictstudio.eu>
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': "MIS Builder Cost Center Filter",
'version': '8.0.1.0.0',
'category': 'Reporting',
'summary': """
Add Cost Center filters to MIS Reports
""",
'author':
'ICTSTUDIO,'
'ACSONE SA/NV,'
'Odoo Community Association (OCA)',
'website': "http://www.ictstudio.eu",
'license': 'AGPL-3',
'depends': [
'mis_builder',
'account_cost_center'
],
'data': [
'views/mis_report_view.xml',
'views/mis_builder_cost_center.xml',
],
'qweb': [
'static/src/xml/mis_widget.xml'
],
}
| ICTSTUDIO/accounting-addons | mis_builder_cost_center_filter/__openerp__.py | Python | agpl-3.0 | 793 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
9385,
29652,
2355,
25891,
3367,
21041,
2080,
1026,
8299,
1024,
1013,
1013,
7479,
1012,
25891,
3367,
21041,
2080,
1012,
7327,
1028,
1001,
9385,
2355... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// EPOS Memory Segment Abstraction Declarations
#ifndef __segment_h
#define __segment_h
#include <mmu.h>
__BEGIN_SYS
class Segment: public MMU::Chunk
{
private:
typedef MMU::Chunk Chunk;
public:
typedef CPU::Phy_Addr Phy_Addr;
typedef MMU::Flags Flags;
public:
Segment(unsigned int bytes, const Color & color = Color::WHITE, const Flags & flags = Flags::APP);
Segment(const Phy_Addr & phy_addr, unsigned int bytes, const Flags & flags);
~Segment();
unsigned int size() const;
Phy_Addr phy_address() const;
int resize(int amount);
};
__END_SYS
#endif
| fmreina/20162-INE5424-Agrupamento2-Tema1.1-ComponentesDeControleEAutomacao-17 | ine5424/include/segment.h | C | gpl-3.0 | 595 | [
30522,
1013,
1013,
4958,
2891,
3638,
6903,
24504,
8170,
2015,
1001,
2065,
13629,
2546,
1035,
1035,
6903,
1035,
1044,
1001,
9375,
1035,
1035,
6903,
1035,
1044,
1001,
2421,
1026,
3461,
2226,
1012,
1044,
1028,
1035,
1035,
4088,
1035,
25353,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>小王子第二章</title>
<style>
p {text-indent:2em;}
</style>
</head>
<body>
<div class="articleContent"><p>
我就这样孤独地生活着,没有一个能真正谈得来的人,一直到六年前在撒哈 拉沙漠上发生了那次故障。我的发动机里有个东西损坏了。当时由于我既没有带 机械师也没有带旅客,我就试图独自完成这个困难的维修工作。这对我来说是个 生与死的问题。我随身带的水只够饮用一星期。</p>
<p>
第一天晚上我就睡在这远离人间烟火的大沙漠上。我比大海中伏在小木排上 的遇难者还要孤独得多。而在第二天拂晓,当一个奇怪的小声音叫醒我的时候, 你们可以想见我当时是多么吃惊。这小小的声音说道:</p>
<p>
“请你给我画一只羊,好吗?”</p>
<p>
“啊!”</p>
<p>
“给我画一只羊……”</p>
<p>
我象是受到惊雷轰击一般,一下子就站立起来。我使劲地揉了揉眼睛,仔细 地看了看。我看见一个十分奇怪的小家伙严肃地朝我凝眸望着。这是后来我给他 画出来的最好的一副画像。可是,我的画当然要比他本人的模样逊色得多。这不 是我的过错。六岁时,大人们使我对我的画家生涯失去了勇气,除了画过开着肚 皮和闭着肚皮的蟒蛇,后来再没有学过画。</p>
<p>
<img alt="童话故事小王子连载第二章" height="348" src="155S61162-0.jpg" width="300" /></p>
<p>
我惊奇地睁大着眼睛看着这突然出现的小家伙。你们不要忘记,我当时处在 远离人烟千里之外的地方。而这个小家伙给我的印象是,他既不象迷了路的样子, 也没有半点疲乏、饥渴、惧怕的神情。他丝毫不象是一个迷失在旷无人烟的大沙 漠中的孩子。当我在惊讶之中终于又能说出话来的时候,对他说道:</p>
<p>
“唉,你在这儿干什么?”</p>
<p>
可是他却不慌不忙地好象有一件重要的事一般,对我重复地说道:</p>
<p>
“请……给我画一只羊……”</p>
<p>
当一种神秘的东西把你镇住的时候,你是不敢不听从它的支配的,在这旷无 人烟的沙漠上,面临死亡的危险的情况下,尽管这样的举动使我感到十分荒诞, 我还是掏出了一张纸和一支钢笔。这时我却又记起,我只学过地理、历史、算术 和语法,就有点不大高兴地对小家伙说我不会画画。他回答我说:</p>
<p>
“没有关系,给我画一只羊吧!”</p>
<p>
因为我从来没有画过羊,我就给他重画我所仅仅会画的两副画中的那副闭着 肚皮的巨蟒。</p>
<p>
“不,不!我不要蟒蛇,它肚子里还有一头象。”</p>
<p>
我听了他的话,简直目瞪口呆。他接着说:“巨蟒这东西太危险,大象又太 占地方。我住的地方非常小,我需要一只羊。给我画一只羊吧。”</p>
<p>
我就给他画了。</p>
<p>
<img alt="童话故事小王子连载第二章" height="165" src="155S61326-1.jpg" width="200" /></p>
<p>
他专心地看着,随后又说:</p>
<p>
“我不要,这只羊已经病得很重了。给我重新画一只。”</p>
<p>
我又画了起来。</p>
<p>
<img alt="童话故事小王子连载第二章" height="176" src="155SB923-2.jpg" width="200" /></p>
<p>
我的这位朋友天真可爱地笑了,并且客气地拒绝道:“你看,你画的不是小羊,是头公羊,还有犄角呢。”</p>
<p>
于是我又重新画了一张。</p>
<p>
<img alt="童话故事小王子连载第二章" height="193" src="155SAT6-3.jpg" width="200" /></p>
<p>
这副画同前几副一样又被拒绝了。</p>
<p>
“这一只太老了。我想要一只能活得长的羊。”</p>
<p>
我不耐烦了。因为我急于要检修发动机,于是就草草画了这张画,并且匆匆 地对他说道:</p>
<p>
<img alt="童话故事小王子连载第二章" height="85" src="155SC263-4.jpg" width="200" /></p>
<p>
“这是一只箱子,你要的羊就在里面。”</p>
<p>
这时我十分惊奇地看到我的这位小评判员喜笑颜开。他说:</p>
<p>
“这正是我想要的,……你说这只羊需要很多草吗?”</p>
<p>
“为什么问这个呢?”</p>
<p>
“因为我那里地方非常小……”</p>
<p>
“我给你画的是一只很小的小羊,地方小也够喂养它的。”</p>
<p>
他把脑袋靠近这张画。</p>
<p>
“并不象你说的那么小……瞧!它睡着了……”</p>
<p>
就这样,我认识了小王子。</p>
</div>
</body>
</html>
| 22377832/ccyswift | ThtLittlePrince/ThtLittlePrince/chapter2/chapter2.html | HTML | mit | 5,052 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
2516,
1028,
1829,
1909,
1816,
100,
1752,
1932,
1026,
1013,
2516,
1028,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
!(function(root) {
function Grapnel(opts) {
"use strict";
var self = this; // Scope reference
this.events = {}; // Event Listeners
this.state = null; // Router state object
this.options = opts || {}; // Options
this.options.env = this.options.env || (!!(Object.keys(root).length === 0 && process && process.browser !== true) ? 'server' : 'client');
this.options.mode = this.options.mode || (!!(this.options.env !== 'server' && this.options.pushState && root.history && root.history.pushState) ? 'pushState' : 'hashchange');
this.version = '0.6.4'; // Version
if ('function' === typeof root.addEventListener) {
root.addEventListener('hashchange', function() {
self.trigger('hashchange');
});
root.addEventListener('popstate', function(e) {
// Make sure popstate doesn't run on init -- this is a common issue with Safari and old versions of Chrome
if (self.state && self.state.previousState === null) return false;
self.trigger('navigate');
});
}
return this;
};
/**
* Create a RegExp Route from a string
* This is the heart of the router and I've made it as small as possible!
*
* @param {String} Path of route
* @param {Array} Array of keys to fill
* @param {Bool} Case sensitive comparison
* @param {Bool} Strict mode
*/
Grapnel.regexRoute = function(path, keys, sensitive, strict) {
if (path instanceof RegExp) return path;
if (path instanceof Array) path = '(' + path.join('|') + ')';
// Build route RegExp
path = path.concat(strict ? '' : '/?')
.replace(/\/\(/g, '(?:/')
.replace(/\+/g, '__plus__')
.replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g, function(_, slash, format, key, capture, optional) {
keys.push({
name: key,
optional: !!optional
});
slash = slash || '';
return '' + (optional ? '' : slash) + '(?:' + (optional ? slash : '') + (format || '') + (capture || (format && '([^/.]+?)' || '([^/]+?)')) + ')' + (optional || '');
})
.replace(/([\/.])/g, '\\$1')
.replace(/__plus__/g, '(.+)')
.replace(/\*/g, '(.*)');
return new RegExp('^' + path + '$', sensitive ? '' : 'i');
};
/**
* ForEach workaround utility
*
* @param {Array} to iterate
* @param {Function} callback
*/
Grapnel._forEach = function(a, callback) {
if (typeof Array.prototype.forEach === 'function') return Array.prototype.forEach.call(a, callback);
// Replicate forEach()
return function(c, next) {
for (var i = 0, n = this.length; i < n; ++i) {
c.call(next, this[i], i, this);
}
}.call(a, callback);
};
/**
* Add an route and handler
*
* @param {String|RegExp} route name
* @return {self} Router
*/
Grapnel.prototype.get = Grapnel.prototype.add = function(route) {
var self = this,
middleware = Array.prototype.slice.call(arguments, 1, -1),
handler = Array.prototype.slice.call(arguments, -1)[0],
request = new Request(route);
var invoke = function RouteHandler() {
// Build request parameters
var req = request.parse(self.path());
// Check if matches are found
if (req.match) {
// Match found
var extra = {
route: route,
params: req.params,
req: req,
regex: req.match
};
// Create call stack -- add middleware first, then handler
var stack = new CallStack(self, extra).enqueue(middleware.concat(handler));
// Trigger main event
self.trigger('match', stack, req);
// Continue?
if (!stack.runCallback) return self;
// Previous state becomes current state
stack.previousState = self.state;
// Save new state
self.state = stack;
// Prevent this handler from being called if parent handler in stack has instructed not to propagate any more events
if (stack.parent() && stack.parent().propagateEvent === false) {
stack.propagateEvent = false;
return self;
}
// Call handler
stack.callback();
}
// Returns self
return self;
};
// Event name
var eventName = (self.options.mode !== 'pushState' && self.options.env !== 'server') ? 'hashchange' : 'navigate';
// Invoke when route is defined, and once again when app navigates
return invoke().on(eventName, invoke);
};
/**
* Fire an event listener
*
* @param {String} event name
* @param {Mixed} [attributes] Parameters that will be applied to event handler
* @return {self} Router
*/
Grapnel.prototype.trigger = function(event) {
var self = this,
params = Array.prototype.slice.call(arguments, 1);
// Call matching events
if (this.events[event]) {
Grapnel._forEach(this.events[event], function(fn) {
fn.apply(self, params);
});
}
return this;
};
/**
* Add an event listener
*
* @param {String} event name (multiple events can be called when separated by a space " ")
* @param {Function} callback
* @return {self} Router
*/
Grapnel.prototype.on = Grapnel.prototype.bind = function(event, handler) {
var self = this,
events = event.split(' ');
Grapnel._forEach(events, function(event) {
if (self.events[event]) {
self.events[event].push(handler);
} else {
self.events[event] = [handler];
}
});
return this;
};
/**
* Allow event to be called only once
*
* @param {String} event name(s)
* @param {Function} callback
* @return {self} Router
*/
Grapnel.prototype.once = function(event, handler) {
var ran = false;
return this.on(event, function() {
if (ran) return false;
ran = true;
handler.apply(this, arguments);
handler = null;
return true;
});
};
/**
* @param {String} Route context (without trailing slash)
* @param {[Function]} Middleware (optional)
* @return {Function} Adds route to context
*/
Grapnel.prototype.context = function(context) {
var self = this,
middleware = Array.prototype.slice.call(arguments, 1);
return function() {
var value = arguments[0],
submiddleware = (arguments.length > 2) ? Array.prototype.slice.call(arguments, 1, -1) : [],
handler = Array.prototype.slice.call(arguments, -1)[0],
prefix = (context.slice(-1) !== '/' && value !== '/' && value !== '') ? context + '/' : context,
path = (value.substr(0, 1) !== '/') ? value : value.substr(1),
pattern = prefix + path;
return self.add.apply(self, [pattern].concat(middleware).concat(submiddleware).concat([handler]));
}
};
/**
* Navigate through history API
*
* @param {String} Pathname
* @return {self} Router
*/
Grapnel.prototype.navigate = function(path) {
return this.path(path).trigger('navigate');
};
Grapnel.prototype.path = function(pathname) {
var self = this,
frag;
if ('string' === typeof pathname) {
// Set path
if (self.options.mode === 'pushState') {
frag = (self.options.root) ? (self.options.root + pathname) : pathname;
root.history.pushState({}, null, frag);
} else if (root.location) {
root.location.hash = (self.options.hashBang ? '!' : '') + pathname;
} else {
root._pathname = pathname || '';
}
return this;
} else if ('undefined' === typeof pathname) {
// Get path
if (self.options.mode === 'pushState') {
frag = root.location.pathname.replace(self.options.root, '');
} else if (self.options.mode !== 'pushState' && root.location) {
frag = (root.location.hash) ? root.location.hash.split((self.options.hashBang ? '#!' : '#'))[1] : '';
} else {
frag = root._pathname || '';
}
return frag;
} else if (pathname === false) {
// Clear path
if (self.options.mode === 'pushState') {
root.history.pushState({}, null, self.options.root || '/');
} else if (root.location) {
root.location.hash = (self.options.hashBang) ? '!' : '';
}
return self;
}
};
/**
* Create routes based on an object
*
* @param {Object} [Options, Routes]
* @param {Object Routes}
* @return {self} Router
*/
Grapnel.listen = function() {
var opts, routes;
if (arguments[0] && arguments[1]) {
opts = arguments[0];
routes = arguments[1];
} else {
routes = arguments[0];
}
// Return a new Grapnel instance
return (function() {
// TODO: Accept multi-level routes
for (var key in routes) {
this.add.call(this, key, routes[key]);
}
return this;
}).call(new Grapnel(opts || {}));
};
/**
* Create a call stack that can be enqueued by handlers and middleware
*
* @param {Object} Router
* @param {Object} Extend
* @return {self} CallStack
*/
function CallStack(router, extendObj) {
this.stack = CallStack.global.slice(0);
this.router = router;
this.runCallback = true;
this.callbackRan = false;
this.propagateEvent = true;
this.value = router.path();
for (var key in extendObj) {
this[key] = extendObj[key];
}
return this;
};
/**
* Build request parameters and allow them to be checked against a string (usually the current path)
*
* @param {String} Route
* @return {self} Request
*/
function Request(route) {
this.route = route;
this.keys = [];
this.regex = Grapnel.regexRoute(route, this.keys);
};
// This allows global middleware
CallStack.global = [];
/**
* Prevent a callback from being called
*
* @return {self} CallStack
*/
CallStack.prototype.preventDefault = function() {
this.runCallback = false;
};
/**
* Prevent any future callbacks from being called
*
* @return {self} CallStack
*/
CallStack.prototype.stopPropagation = function() {
this.propagateEvent = false;
};
/**
* Get parent state
*
* @return {Object} Previous state
*/
CallStack.prototype.parent = function() {
var hasParentEvents = !!(this.previousState && this.previousState.value && this.previousState.value == this.value);
return (hasParentEvents) ? this.previousState : false;
};
/**
* Run a callback (calls to next)
*
* @return {self} CallStack
*/
CallStack.prototype.callback = function() {
this.callbackRan = true;
this.timeStamp = Date.now();
this.next();
};
/**
* Add handler or middleware to the stack
*
* @param {Function|Array} Handler or a array of handlers
* @param {Int} Index to start inserting
* @return {self} CallStack
*/
CallStack.prototype.enqueue = function(handler, atIndex) {
var handlers = (!Array.isArray(handler)) ? [handler] : ((atIndex < handler.length) ? handler.reverse() : handler);
while (handlers.length) {
this.stack.splice(atIndex || this.stack.length + 1, 0, handlers.shift());
}
return this;
};
/**
* Call to next item in stack -- this adds the `req`, `event`, and `next()` arguments to all middleware
*
* @return {self} CallStack
*/
CallStack.prototype.next = function() {
var self = this;
return this.stack.shift().call(this.router, this.req, this, function next() {
self.next.call(self);
});
};
/**
* Match a path string -- returns a request object if there is a match -- returns false otherwise
*
* @return {Object} req
*/
Request.prototype.parse = function(path) {
var match = path.match(this.regex),
self = this;
var req = {
params: {},
keys: this.keys,
matches: (match || []).slice(1),
match: match
};
// Build parameters
Grapnel._forEach(req.matches, function(value, i) {
var key = (self.keys[i] && self.keys[i].name) ? self.keys[i].name : i;
// Parameter key will be its key or the iteration index. This is useful if a wildcard (*) is matched
req.params[key] = (value) ? decodeURIComponent(value) : undefined;
});
return req;
};
// Append utility constructors to Grapnel
Grapnel.CallStack = CallStack;
Grapnel.Request = Request;
if ('function' === typeof root.define && !root.define.amd.grapnel) {
root.define(function(require, exports, module) {
root.define.amd.grapnel = true;
return Grapnel;
});
} else if ('object' === typeof module && 'object' === typeof module.exports) {
module.exports = exports = Grapnel;
} else {
root.Grapnel = Grapnel;
}
}).call({}, ('object' === typeof window) ? window : this);
/*
var router = new Grapnel({ pushState : true, hashBang : true });
router.get('/products/:category/:id?', function(req){
var id = req.params.id,
category = req.params.category
console.log(category, id);
});
router.get('/tiempo', function(req){
console.log("tiempo!");
$("#matikbirdpath").load("views/rooms.html", function(res){
console.log(res);
console.log("hola");
});
});
router.get('/', function(req){
console.log(req.user);
console.log("hola!");
$("#matikbirdpath").load("views/rooms.html", function(res){
console.log(res);
console.log("hola");
});
});
router.navigate('/');
*/
NProgress.start();
var routes = {
'/' : function(req, e){
$("#matikbirdpath").load("views/main.html", function(res){
console.log(res);
NProgress.done();
});
},
'/dashboard' : function(req, e){
$("#matikbirdpath").load("views/dashboard.html", function(res){
console.log(res);
NProgress.done();
});
},
'/calendario' : function(req, e){
$("#matikbirdpath").load("views/calendario.html", function(res){
console.log(res);
console.log("hola");
});
},
'/now' : function(req, e){
$("#matikbirdpath").load("views/clase_ahora.html", function(res){
console.log(res);
console.log("hola");
});
},
'/category/:id' : function(req, e){
// Handle route
},
'/*' : function(req, e){
if(!e.parent()){
$("#matikbirdpath").load("views/main.html", function(res){
console.log(res);
NProgress.done();
});
}
}
}
var router = Grapnel.listen({ pushState : true, hashBang: true }, routes); | matikbird/matikbird.github.io | portfolio/copylee/assets/mtk-route.js | JavaScript | mit | 16,205 | [
30522,
999,
1006,
3853,
1006,
7117,
1007,
1063,
3853,
24665,
9331,
11877,
1006,
23569,
2015,
1007,
1063,
1000,
2224,
9384,
1000,
1025,
13075,
2969,
1027,
2023,
1025,
1013,
1013,
9531,
4431,
2023,
1012,
2824,
1027,
1063,
1065,
1025,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Zenrin Admin - Daily Report</title>
<!-- Bootstrap Core CSS -->
<link href="../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- MetisMenu CSS -->
<link href="../vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="../dist/css/sb-admin-2.css" rel="stylesheet">
<!-- Morris Charts CSS -->
<link href="../vendor/morrisjs/morris.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="../vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- 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>
<div id="wrapper">
<!-- Navigation -->
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="index.html">SB Admin v2.0</a>
</div>
<!-- /.navbar-header -->
<ul class="nav navbar-top-links navbar-right">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-envelope fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-messages">
<li>
<a href="#">
<div>
<strong>John Smith</strong>
<span class="pull-right text-muted">
<em>Yesterday</em>
</span>
</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<strong>John Smith</strong>
<span class="pull-right text-muted">
<em>Yesterday</em>
</span>
</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<strong>John Smith</strong>
<span class="pull-right text-muted">
<em>Yesterday</em>
</span>
</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
</a>
</li>
<li class="divider"></li>
<li>
<a class="text-center" href="#">
<strong>Read All Messages</strong>
<i class="fa fa-angle-right"></i>
</a>
</li>
</ul>
<!-- /.dropdown-messages -->
</li>
<!-- /.dropdown -->
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-tasks fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-tasks">
<li>
<a href="#">
<div>
<p>
<strong>Task 1</strong>
<span class="pull-right text-muted">40% Complete</span>
</p>
<div class="progress progress-striped active">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 40%">
<span class="sr-only">40% Complete (success)</span>
</div>
</div>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<p>
<strong>Task 2</strong>
<span class="pull-right text-muted">20% Complete</span>
</p>
<div class="progress progress-striped active">
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
<span class="sr-only">20% Complete</span>
</div>
</div>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<p>
<strong>Task 3</strong>
<span class="pull-right text-muted">60% Complete</span>
</p>
<div class="progress progress-striped active">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%">
<span class="sr-only">60% Complete (warning)</span>
</div>
</div>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<p>
<strong>Task 4</strong>
<span class="pull-right text-muted">80% Complete</span>
</p>
<div class="progress progress-striped active">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 80%">
<span class="sr-only">80% Complete (danger)</span>
</div>
</div>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a class="text-center" href="#">
<strong>See All Tasks</strong>
<i class="fa fa-angle-right"></i>
</a>
</li>
</ul>
<!-- /.dropdown-tasks -->
</li>
<!-- /.dropdown -->
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-alerts">
<li>
<a href="#">
<div>
<i class="fa fa-comment fa-fw"></i> New Comment
<span class="pull-right text-muted small">4 minutes ago</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<i class="fa fa-twitter fa-fw"></i> 3 New Followers
<span class="pull-right text-muted small">12 minutes ago</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<i class="fa fa-envelope fa-fw"></i> Message Sent
<span class="pull-right text-muted small">4 minutes ago</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<i class="fa fa-tasks fa-fw"></i> New Task
<span class="pull-right text-muted small">4 minutes ago</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<i class="fa fa-upload fa-fw"></i> Server Rebooted
<span class="pull-right text-muted small">4 minutes ago</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a class="text-center" href="#">
<strong>See All Alerts</strong>
<i class="fa fa-angle-right"></i>
</a>
</li>
</ul>
<!-- /.dropdown-alerts -->
</li>
<!-- /.dropdown -->
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#"><i class="fa fa-user fa-fw"></i> User Profile</a>
</li>
<li><a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a>
</li>
<li class="divider"></li>
<li><a href="login.html"><i class="fa fa-sign-out fa-fw"></i> Logout</a>
</li>
</ul>
<!-- /.dropdown-user -->
</li>
<!-- /.dropdown -->
</ul>
<!-- /.navbar-top-links -->
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
<!-- /input-group -->
</li>
<li>
<a href="index.html"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
</li>
<li>
<a href="#"><i class="fa fa-bar-chart-o fa-fw"></i> Charts<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
<a href="flot.html">Flot Charts</a>
</li>
<li>
<a href="morris.html">Morris.js Charts</a>
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
<a href="tables.html"><i class="fa fa-table fa-fw"></i> Tables</a>
</li>
<li>
<a href="forms.html"><i class="fa fa-edit fa-fw"></i> Forms</a>
</li>
<li>
<a href="#"><i class="fa fa-wrench fa-fw"></i> UI Elements<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
<a href="panels-wells.html">Panels and Wells</a>
</li>
<li>
<a href="buttons.html">Buttons</a>
</li>
<li>
<a href="notifications.html">Notifications</a>
</li>
<li>
<a href="typography.html">Typography</a>
</li>
<li>
<a href="icons.html"> Icons</a>
</li>
<li>
<a href="grid.html">Grid</a>
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
<a href="#"><i class="fa fa-sitemap fa-fw"></i> Multi-Level Dropdown<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
<a href="#">Second Level Item</a>
</li>
<li>
<a href="#">Second Level Item</a>
</li>
<li>
<a href="#">Third Level <span class="fa arrow"></span></a>
<ul class="nav nav-third-level">
<li>
<a href="#">Third Level Item</a>
</li>
<li>
<a href="#">Third Level Item</a>
</li>
<li>
<a href="#">Third Level Item</a>
</li>
<li>
<a href="#">Third Level Item</a>
</li>
</ul>
<!-- /.nav-third-level -->
</li>
</ul>
<!-- /.nav-second-level -->
</li>
<li>
<a href="#"><i class="fa fa-files-o fa-fw"></i> Sample Pages<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li>
<a href="blank.html">Blank Page</a>
</li>
<li>
<a href="login.html">Login Page</a>
</li>
</ul>
<!-- /.nav-second-level -->
</li>
</ul>
</div>
<!-- /.sidebar-collapse -->
</div>
<!-- /.navbar-static-side -->
</nav>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Flot</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
Line Chart Example
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="flot-chart">
<div class="flot-chart-content" id="flot-line-chart"></div>
</div>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-12 -->
<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
Pie Chart Example
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="flot-chart">
<div class="flot-chart-content" id="flot-pie-chart"></div>
</div>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-6 -->
<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
Multiple Axes Line Chart Example
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="flot-chart">
<div class="flot-chart-content" id="flot-line-chart-multi"></div>
</div>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-6 -->
<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
Moving Line Chart Example
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="flot-chart">
<div class="flot-chart-content" id="flot-line-chart-moving"></div>
</div>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-6 -->
<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
Bar Chart Example
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="flot-chart">
<div class="flot-chart-content" id="flot-bar-chart"></div>
</div>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-6 -->
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
Flot Charts Usage
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<p>Flot is a pure JavaScript plotting library for jQuery, with a focus on simple usage, attractive looks, and interactive features. In SB Admin, we are using the most recent version of Flot along with a few plugins to enhance the user experience. The Flot plugins being used are the tooltip plugin for hoverable tooltips, and the resize plugin for fully responsive charts. The documentation for Flot Charts is available on their website, <a target="_blank" href="http://www.flotcharts.org/">http://www.flotcharts.org/</a>.</p>
<a target="_blank" class="btn btn-default btn-lg btn-block" href="http://www.flotcharts.org/">View Flot Charts Documentation</a>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-6 -->
</div>
<!-- /.row -->
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="../vendor/jquery/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="../vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="../vendor/metisMenu/metisMenu.min.js"></script>
<!-- Flot Charts JavaScript -->
<script src="../vendor/flot/excanvas.min.js"></script>
<script src="../vendor/flot/jquery.flot.js"></script>
<script src="../vendor/flot/jquery.flot.pie.js"></script>
<script src="../vendor/flot/jquery.flot.resize.js"></script>
<script src="../vendor/flot/jquery.flot.time.js"></script>
<script src="../vendor/flot-tooltip/jquery.flot.tooltip.min.js"></script>
<script src="../data/flot-data.js"></script>
<!-- Custom Theme JavaScript -->
<script src="../dist/js/sb-admin-2.js"></script>
</body>
</html>
| phamminhtien305/demodailyreport.io | pages/flot.html | HTML | mit | 24,567 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>MediaQueryListEventInit | picturepark-sdk-v1-fetch API</title>
<meta name="description" content="Documentation for picturepark-sdk-v1-fetch API">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">picturepark-sdk-v1-fetch API</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="mediaquerylisteventinit.html">MediaQueryListEventInit</a>
</li>
</ul>
<h1>Interface MediaQueryListEventInit</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<a href="eventinit.html" class="tsd-signature-type">EventInit</a>
<ul class="tsd-hierarchy">
<li>
<span class="target">MediaQueryListEventInit</span>
</li>
</ul>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section tsd-is-external">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-external"><a href="mediaquerylisteventinit.html#bubbles" class="tsd-kind-icon">bubbles</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-external"><a href="mediaquerylisteventinit.html#cancelable" class="tsd-kind-icon">cancelable</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-external"><a href="mediaquerylisteventinit.html#composed" class="tsd-kind-icon">composed</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface tsd-is-external"><a href="mediaquerylisteventinit.html#matches" class="tsd-kind-icon">matches</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface tsd-is-external"><a href="mediaquerylisteventinit.html#media" class="tsd-kind-icon">media</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-external">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-external">
<a name="bubbles" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> bubbles</h3>
<div class="tsd-signature tsd-kind-icon">bubbles<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<p>Inherited from <a href="animationeventinit.html">AnimationEventInit</a>.<a href="animationeventinit.html#bubbles">bubbles</a></p>
<ul>
<li>Defined in node_modules/typescript/lib/lib.dom.d.ts:476</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-external">
<a name="cancelable" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> cancelable</h3>
<div class="tsd-signature tsd-kind-icon">cancelable<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<p>Inherited from <a href="animationeventinit.html">AnimationEventInit</a>.<a href="animationeventinit.html#cancelable">cancelable</a></p>
<ul>
<li>Defined in node_modules/typescript/lib/lib.dom.d.ts:477</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-external">
<a name="composed" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> composed</h3>
<div class="tsd-signature tsd-kind-icon">composed<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<p>Inherited from <a href="animationeventinit.html">AnimationEventInit</a>.<a href="animationeventinit.html#composed">composed</a></p>
<ul>
<li>Defined in node_modules/typescript/lib/lib.dom.d.ts:478</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface tsd-is-external">
<a name="matches" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> matches</h3>
<div class="tsd-signature tsd-kind-icon">matches<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in node_modules/typescript/lib/lib.dom.d.ts:722</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface tsd-is-external">
<a name="media" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> media</h3>
<div class="tsd-signature tsd-kind-icon">media<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in node_modules/typescript/lib/lib.dom.d.ts:723</li>
</ul>
</aside>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-interface tsd-is-external">
<a href="mediaquerylisteventinit.html" class="tsd-kind-icon">Media<wbr>Query<wbr>List<wbr>Event<wbr>Init</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-external">
<a href="mediaquerylisteventinit.html#bubbles" class="tsd-kind-icon">bubbles</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-external">
<a href="mediaquerylisteventinit.html#cancelable" class="tsd-kind-icon">cancelable</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-external">
<a href="mediaquerylisteventinit.html#composed" class="tsd-kind-icon">composed</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface tsd-is-external">
<a href="mediaquerylisteventinit.html#matches" class="tsd-kind-icon">matches</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface tsd-is-external">
<a href="mediaquerylisteventinit.html#media" class="tsd-kind-icon">media</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html> | Picturepark/Picturepark.SDK.TypeScript | docs/picturepark-sdk-v1-fetch/api/interfaces/mediaquerylisteventinit.html | HTML | mit | 9,754 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
2465,
1027,
1000,
12398,
2053,
1011,
1046,
2015,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
8299,
1011,
104... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Pipedrive.FiltersApi
All URIs are relative to *https://api.pipedrive.com/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**addFilter**](FiltersApi.md#addFilter) | **POST** /filters | Add a new filter
[**deleteFilter**](FiltersApi.md#deleteFilter) | **DELETE** /filters/{id} | Delete a filter
[**deleteFilters**](FiltersApi.md#deleteFilters) | **DELETE** /filters | Delete multiple filters in bulk
[**getFilter**](FiltersApi.md#getFilter) | **GET** /filters/{id} | Get one filter
[**getFilterHelpers**](FiltersApi.md#getFilterHelpers) | **GET** /filters/helpers | Get all filter helpers
[**getFilters**](FiltersApi.md#getFilters) | **GET** /filters | Get all filters
[**updateFilter**](FiltersApi.md#updateFilter) | **PUT** /filters/{id} | Update filter
## addFilter
> FiltersPostResponse addFilter(opts)
Add a new filter
Adds a new filter, returns the ID upon success. Note that in the conditions JSON object only one first-level condition group is supported, and it must be glued with 'AND', and only two second level condition groups are supported of which one must be glued with 'AND' and the second with 'OR'. Other combinations do not work (yet) but the syntax supports introducing them in future. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/adding-a-filter\" target=\"_blank\" rel=\"noopener noreferrer\">adding a filter</a>.
### Example
```javascript
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';
let apiInstance = new Pipedrive.FiltersApi();
let opts = Pipedrive.AddFilterRequest.constructFromObject({
// Properties that you want to update
});
apiInstance.addFilter(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**addFilterRequest** | [**AddFilterRequest**](AddFilterRequest.md)| | [optional]
### Return type
[**FiltersPostResponse**](FiltersPostResponse.md)
### Authorization
[api_key](../README.md#api_key), [oauth2](../README.md#oauth2)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## deleteFilter
> FiltersDeleteResponse deleteFilter(id)
Delete a filter
Marks a filter as deleted.
### Example
```javascript
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';
let apiInstance = new Pipedrive.FiltersApi();
let id = 56; // Number | The ID of the filter
apiInstance.deleteFilter(id).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Number**| The ID of the filter |
### Return type
[**FiltersDeleteResponse**](FiltersDeleteResponse.md)
### Authorization
[api_key](../README.md#api_key), [oauth2](../README.md#oauth2)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## deleteFilters
> FiltersBulkDeleteResponse deleteFilters(ids)
Delete multiple filters in bulk
Marks multiple filters as deleted.
### Example
```javascript
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';
let apiInstance = new Pipedrive.FiltersApi();
let ids = "ids_example"; // String | The comma-separated filter IDs to delete
apiInstance.deleteFilters(ids).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ids** | **String**| The comma-separated filter IDs to delete |
### Return type
[**FiltersBulkDeleteResponse**](FiltersBulkDeleteResponse.md)
### Authorization
[api_key](../README.md#api_key), [oauth2](../README.md#oauth2)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## getFilter
> FiltersGetResponse getFilter(id)
Get one filter
Returns data about a specific filter. Note that this also returns the condition lines of the filter.
### Example
```javascript
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';
let apiInstance = new Pipedrive.FiltersApi();
let id = 56; // Number | The ID of the filter
apiInstance.getFilter(id).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Number**| The ID of the filter |
### Return type
[**FiltersGetResponse**](FiltersGetResponse.md)
### Authorization
[api_key](../README.md#api_key), [oauth2](../README.md#oauth2)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## getFilterHelpers
> Object getFilterHelpers()
Get all filter helpers
Returns all supported filter helpers. It helps to know what conditions and helpers are available when you want to <a href=\"/docs/api/v1/Filters#addFilter\">add</a> or <a href=\"/docs/api/v1/Filters#updateFilter\">update</a> filters. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/adding-a-filter\" target=\"_blank\" rel=\"noopener noreferrer\">adding a filter</a>.
### Example
```javascript
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
let apiInstance = new Pipedrive.FiltersApi();
apiInstance.getFilterHelpers().then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
This endpoint does not need any parameter.
### Return type
**Object**
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## getFilters
> FiltersBulkGetResponse getFilters(opts)
Get all filters
Returns data about all filters.
### Example
```javascript
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';
let apiInstance = new Pipedrive.FiltersApi();
let opts = {
'type': new Pipedrive.FilterType() // FilterType | The types of filters to fetch
};
apiInstance.getFilters(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**type** | [**FilterType**](.md)| The types of filters to fetch | [optional]
### Return type
[**FiltersBulkGetResponse**](FiltersBulkGetResponse.md)
### Authorization
[api_key](../README.md#api_key), [oauth2](../README.md#oauth2)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## updateFilter
> FiltersPostResponse updateFilter(id, opts)
Update filter
Updates an existing filter.
### Example
```javascript
import Pipedrive from 'pipedrive';
let defaultClient = Pipedrive.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix = 'Token';
// Configure OAuth2 access token for authorization: oauth2
let oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';
let apiInstance = new Pipedrive.FiltersApi();
let id = 56; // Number | The ID of the filter
let opts = Pipedrive.UpdateFilterRequest.constructFromObject({
// Properties that you want to update
});
apiInstance.updateFilter(id, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Number**| The ID of the filter |
**updateFilterRequest** | [**UpdateFilterRequest**](UpdateFilterRequest.md)| | [optional]
### Return type
[**FiltersPostResponse**](FiltersPostResponse.md)
### Authorization
[api_key](../README.md#api_key), [oauth2](../README.md#oauth2)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
| pipedrive/client-nodejs | docs/FiltersApi.md | Markdown | mit | 11,139 | [
30522,
1001,
8667,
23663,
1012,
17736,
9331,
2072,
2035,
24471,
2483,
2024,
5816,
2000,
1008,
16770,
1024,
1013,
1013,
17928,
1012,
8667,
23663,
1012,
4012,
1013,
1058,
2487,
1008,
4118,
1064,
8299,
5227,
1064,
6412,
1011,
1011,
1011,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// HLO shardings describe how an HLO instruction is split across multiple
// computations.
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_HLO_SHARDING_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_HLO_SHARDING_H_
#include <map>
#include <string>
#include <vector>
#include "absl/types/span.h"
#include "tensorflow/compiler/xla/array.h"
#include "tensorflow/compiler/xla/literal.h"
#include "tensorflow/compiler/xla/protobuf_util.h"
#include "tensorflow/compiler/xla/shape_tree.h"
#include "tensorflow/compiler/xla/xla_data.pb.h"
#include "tensorflow/core/lib/hash/hash.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/types.h"
namespace xla {
// HLO shardings describe how an HLO instruction is split across multiple
// computations.
class HloSharding {
public:
// Creates a trivial sharding that replicates a maximal tile across all
// devices.
static HloSharding Replicate() { return HloSharding(); }
// Creates a sharding that emulates device placement; a tile shape equal to
// the input shape (one tile) assigned to a single device.
static HloSharding AssignDevice(int64 device_id);
// Creates a new sharding which splits a shape into tiles amongst the devices
// specified by `tile_assignment`.
static HloSharding Tile(const Array<int64>& tile_assignment) {
return HloSharding(tile_assignment);
}
// Creates a new sharding which splits a one-dimensional input shape into
// `num_tiles` tiles.
static HloSharding Tile1D(const Shape& input_shape, int64 num_tiles);
// Creates a new sharding for a tuple type. The given ShapeTree must have
// elements for every leaf shape contained in the tuple.
static HloSharding Tuple(const ShapeTree<HloSharding>& sub_shardings);
// Creates a new sharding for a tuple type. The number of elements in
// shardings must match the number of leaf nodes in tuple_shape. For
// empty tuples, the shardings array must have one element.
static HloSharding Tuple(const Shape& tuple_shape,
absl::Span<const HloSharding> shardings);
// Creates a new sharding for a tuple type, with a single input sharding
// repeated on each leaf.
static HloSharding SingleTuple(const Shape& tuple_shape,
const HloSharding& sharding);
// If shape is an array, returns sharding, otherwise returns the tuple shaped
// sharding with all the leaf nodes having the same input sharding.
static HloSharding Single(const Shape& shape, const HloSharding& sharding);
// Create a new sharding from a protobuf OpSharding.
static StatusOr<HloSharding> FromProto(const OpSharding& proto);
// Checks whether device is a reserved device number. A reserved device number
// has usually a special meaning, with dedicated handling logic.
static bool IsReservedDevice(int64 device) { return device < 0; }
OpSharding ToProto() const;
// Note that this string canonically has outer curly braces, e.g.
// "{replicated}".
string ToString() const;
// Validate that this sharding can be applied to a tensor with shape `shape`.
Status Validate(const Shape& shape, int64 num_devices) const;
// Returns true if the sharding has tuple type.
bool IsTuple() const { return tuple_; }
// Returns true if the sharding is trivial: replicate on all devices.
bool IsReplicated() const {
if (!IsTuple()) {
return replicated_;
}
return absl::c_all_of(
tuple_elements_, [](const HloSharding& s) { return s.IsReplicated(); });
}
// Returns true if the tile size is the same as the input size.
bool IsTileMaximal() const {
if (!IsTuple()) {
return maximal_;
}
return absl::c_all_of(tuple_elements_, [](const HloSharding& s) {
return s.IsTileMaximal();
});
}
// Returns true if the sharding defines an operation on the given device.
bool UsesDevice(int64 device) const;
// Retrieves a histogram of the devices used by the sharding. The returned
// map has the device number as key, and the occurrence count as value.
// If a sharding does not have a device, it will not be included in the
// histogram. The count argument, if not nullptr, will receive the total
// number of elements this sharding is made of (one for array, N leaves for
// tuples).
std::map<int64, int64> UsedDevices(int64* count) const;
// Returns the tile that should be executed on the given device.
// REQUIRES: !IsTuple()
std::vector<int64> TileIndexForDevice(int64 device) const;
// Returns the device that should execute the given tile.
// It is an error to call this if is_replicated() is true.
// REQUIRES: !IsTuple()
int64 DeviceForTileIndex(absl::Span<const int64> index) const;
// Given a device ID, returns the offset within the specified shape of the
// tile that should be executed on the given core. This returns the lower
// extent of the tile in the input space.
// REQUIRES: !IsTuple()
std::vector<int64> TileOffsetForDevice(const Shape& shape,
int64 device) const;
// Given a device ID, returns the limit within the specified shape of the
// tile that should be executed on the given core. This returns the upper
// extent of the tile in the input space.
// REQUIRES: !IsTuple()
std::vector<int64> TileLimitForDevice(const Shape& shape, int64 device) const;
// Returns the single device this op operates on. If the sharding does not
// span a single device, the return value will be empty.
// In order for a sharding to span a single device, every leaf sharding must
// be maximal and not replicated, and the used device must match.
absl::optional<int64> UniqueDevice() const;
// Retrieves the unique device or fails with a CHECK.
int64 GetUniqueDevice() const;
// Returns true if this op only uses a single device.
bool HasUniqueDevice() const { return UniqueDevice().has_value(); }
// Returns the ShapeTree containing the shardings for each element of this
// tuple, if IsTuple, or a ShapeTree with a single element containing this
// sharding. Only the leaf elements are populated. This creates a new
// ShapeTree object so is not cheap.
StatusOr<ShapeTree<HloSharding>> AsShapeTree(const Shape& shape) const;
ShapeTree<HloSharding> GetAsShapeTree(const Shape& shape) const {
return AsShapeTree(shape).ValueOrDie();
}
// Retrieves the sub sharding at a given index, out of a tuple sharding.
// REQUIRES: IsTuple()
HloSharding GetSubSharding(const Shape& shape, const ShapeIndex& index) const;
// If the current sharding is a tuple sharding, return itself as result.
// Otherwise returns a tuple sharding for the input shape, with all the leaves
// having this object sharding.
StatusOr<HloSharding> GetTupleSharding(const Shape& shape) const;
// Extracts the sharding that is common within the current sharding.
// If the current sharding is not a tuple sharding, the current sharding will
// be returned. If it is a tuple, and all the tuple elements are common, the
// common element will be returned. Otherwise the optional will contain no
// value.
absl::optional<HloSharding> ExtractSingleSharding() const;
bool operator==(const HloSharding& other) const {
return replicated_ == other.replicated_ && maximal_ == other.maximal_ &&
tile_assignment_ == other.tile_assignment_ &&
tuple_elements_ == other.tuple_elements_;
}
bool operator!=(const HloSharding& other) const { return !(*this == other); }
size_t Hash() const;
struct Hasher {
size_t operator()(const HloSharding& sharding) const {
return sharding.Hash();
}
};
// Gets the tile assignment tensor.
// REQUIRES: !IsReplicated() && !IsTuple()
const Array<int64>& tile_assignment() const { return tile_assignment_; }
// Returns the flattened list of all the leaf shardings in a tuple shape, by
// pre-order walk (ShapeTree iterator order).
// REQUIRES: IsTuple().
std::vector<HloSharding>& tuple_elements() { return tuple_elements_; }
const std::vector<HloSharding>& tuple_elements() const {
return tuple_elements_;
}
// Gets the tile shape.
// REQUIRES: !IsTuple()
Shape TileShape(const Shape& shape) const;
private:
HloSharding()
: replicated_(true),
maximal_(true),
tuple_(false),
tile_assignment_({0}) {}
// device_id values:
// -2: magic number to mean unassigned device, used by spatial partitioning
// -1: the id of the host
// 0 or positive: the id of a device
// NOTE(dimvar): -1 is needed for outside compilation. It can be removed once
// we have fully switched to the side-effect tokens.
explicit HloSharding(int64 device_id)
: replicated_(false),
maximal_(true),
tuple_(false),
tile_assignment_({1}, device_id) {}
explicit HloSharding(const Array<int64>& tile_assignment)
: replicated_(false),
maximal_(false),
tuple_(false),
tile_assignment_(tile_assignment) {}
explicit HloSharding(const std::vector<HloSharding>& tuple_shardings)
: replicated_(false),
maximal_(false),
tuple_(true),
tile_assignment_({0}),
tuple_elements_(tuple_shardings) {}
// Checks that the number of elements in tuple_elements_ is consistent with
// the tuple shape passes as argument.
Status CheckLeafCount(const Shape& shape) const;
// Internal helper to validate a tuple sharding.
Status ValidateTuple(const Shape& shape, int64 num_devices) const;
// Internal helper to validate a non-tuple (leaf) sharding.
Status ValidateNonTuple(const Shape& shape, int64 num_devices) const;
// Returns the number of tuple_elements_ entries to fit the shape.
static int64 RequiredLeaves(const Shape& shape);
bool replicated_;
bool maximal_;
bool tuple_;
// This field is only used if replicated_ is false. If maximal_ is true, then
// the field contains a rank 1 array with a single element, which is the
// device the HLO is assigned to. If maximal_ is false, the field contains an
// array with the same rank as the corresponding HLO. The dimension sizes of
// the array describe the number of ways the HLO is partitioned along each
// dimension. The values of the array specify which device each tile of
// the HLO is assigned to. The index of each value determines which tile it
// takes.
// For example, {{{2, 3}}, {{5, 7}}} (whose ToString representation is
// "{devices=[2,1,2]2,3,5,7}"), means that dimension 1 is split two way and
// dimension 3 is split 2 way. Core 5, whose index is [2,1,1] will take the
// tile that contains the 2nd half of dimension 1 and the 1st half of
// dimension 3.
Array<int64> tile_assignment_;
// Only non-empty when tuple_ is true. If a tuple is empty then one entry is
// present for the root. This is a flattened list of all the leaf shardings in
// a tuple shape, by pre-order walk (ShapeTree iterator order).
std::vector<HloSharding> tuple_elements_;
};
std::ostream& operator<<(std::ostream& out, const HloSharding& sharding);
} // namespace xla
#endif // TENSORFLOW_COMPILER_XLA_SERVICE_HLO_SHARDING_H_
| xzturn/tensorflow | tensorflow/compiler/xla/service/hlo_sharding.h | C | apache-2.0 | 11,888 | [
30522,
1013,
1008,
9385,
2418,
1996,
23435,
12314,
6048,
1012,
2035,
2916,
9235,
1012,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package br.edu.ufcg.computacao.si1.model.anuncio;
import javax.persistence.*;
import br.edu.ufcg.computacao.si1.model.usuario.Usuario;
import java.util.Date;
/**
* Classe abstrata para objetos do tipo Anuncio, onde serão contidos valores e métodos para o mesmo.
*
* @author Thaynan Andrey
* @author Giuseppe Mongiovi
*/
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Anuncio {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = "anuncio_id", nullable = false, unique = true)
private Long _id;
@Column(name = "titulo", nullable = false)
private String titulo;
@Column(name = "quantia", nullable = false)
private double quantia;
@Column(name = "data_criacao", nullable = false)
private Long dataDeCriacao;
private int diasDeVidaUtil;
@ManyToOne
@JoinColumn(name="usuario_id")
private Usuario dono;
/**
* Construtor default
*/
public Anuncio() {
titulo = "";
dataDeCriacao = new Date().getTime();
quantia = 0;
}
/**
* Construtor do objeto
*/
public Anuncio(String titulo, double quantia, Usuario dono, Long dataDeCriacao, int diasDeVidaUtil) {
this.titulo = titulo;
this.quantia = quantia;
this.dataDeCriacao = dataDeCriacao;
this.dono = dono;
this.diasDeVidaUtil = diasDeVidaUtil;
}
/**
* Metodo para retorno da quantidade de dias de vida útil do anúncio
* @return int - Quantidade de dias de vida útil do anúncio.
*/
public int getDiasDeVidaUtil() {
return diasDeVidaUtil;
}
/**
* Metodo para alteracao da quantidade de dias de vida útil do anúncio
* @param int diasDeVidaUtil - Quantidade de dias de vida útil do anúncio.
*/
public void setDiasDeVidaUtil(int diasDeVidaUtil) {
this.diasDeVidaUtil = diasDeVidaUtil;
}
/**
* Metodo abstrato para retorno do tipo do anúncio que deve ser implementado nas subclasses.
* @return String - Tipo do anuncio.
*/
public abstract String getTipo();
/**
* Metodo para alteracao do dono do anúncio
* @param Usuario dono = dono do anuncio.
*/
public void setDono(Usuario dono) {
this.dono = dono;
}
public Usuario pegueDono() {
return this.dono;
}
/**
* Metodo para retorno do id do anúncio
* @return Long id - o id do anuncio
*/
public Long get_id() {
return _id;
}
/**
* Metodo para alteracao do id do anúncio
* @param long _id - id a ser colocado no anuncio
*/public void set_id(Long _id) {
this._id = _id;
}
/**
* Metodo para retorno do titulo do anúncio
* @return String - Titulo do anuncio.
*/
public String getTitulo() {
return titulo;
}
/**
* Metodo para alteracao do titulo do anúncio
* @param String titulo - Titulo do anuncio.
*/
public void setTitulo(String titulo) {
this.titulo = titulo;
}
/**
* Metodo para retorno da data de criação do anúncio
* @return String - Data de criacao do anuncio.
*/
public Long getDataDeCriacao() {
return dataDeCriacao;
}
/**
* Metodo para alteracao da data de criação do anúncio
* @param String dataDeCriacao - Data de criacao do anuncio.
*/
public void setDataDeCriacao(Long dataDeCriacao) {
this.dataDeCriacao = dataDeCriacao;
}
/**
* Metodo para retorno do preço do anúncio
* @return Double - Valor ou salario referente ao anuncio.
*/
public double getQuantia() {
return quantia;
}
/**
* Metodo para alteracao do preço do anúncio
* @param Double quantia - Valor ou salario referente ao anuncio.
*/
public void setQuantia(double quantia) {
this.quantia = quantia;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Anuncio)) return false;
Anuncio anuncio = (Anuncio) o;
if (Double.compare(anuncio.getQuantia(), getQuantia()) != 0) return false;
if (!get_id().equals(anuncio.get_id())) return false;
if (!getTitulo().equals(anuncio.getTitulo())) return false;
if (!getDataDeCriacao().equals(anuncio.getDataDeCriacao())) return false;
return getTipo().equals(anuncio.getTipo());
}
@Override
public int hashCode() {
int result;
long temp;
result = get_id().hashCode();
result = 31 * result + getTitulo().hashCode();
result = 31 * result + getDataDeCriacao().hashCode();
temp = Double.doubleToLongBits(getQuantia());
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + getTipo().hashCode();
return result;
}
@Override
public String toString() {
return "Anuncio{" +
"_id=" + _id +
", titulo='" + titulo + '\'' +
", dataDeCriacao=" + getDataDeCriacao() +
", quantia=" + quantia +
'}';
}
}
| ThaynanAndrey/Projeto-SI1 | src/main/java/br/edu/ufcg/computacao/si1/model/anuncio/Anuncio.java | Java | mit | 5,164 | [
30522,
7427,
7987,
1012,
3968,
2226,
1012,
11966,
2290,
1012,
4012,
18780,
19629,
2080,
1012,
9033,
2487,
1012,
2944,
1012,
2019,
4609,
9793,
1025,
12324,
9262,
2595,
1012,
28297,
1012,
1008,
1025,
12324,
7987,
1012,
3968,
2226,
1012,
11966... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = PowerOutagePredictor
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | rkastilani/PowerOutagePredictor | Docs/Makefile | Makefile | mit | 617 | [
30522,
1001,
10124,
2191,
8873,
2571,
2005,
27311,
12653,
1001,
1001,
2017,
2064,
2275,
2122,
10857,
2013,
1996,
3094,
2240,
1012,
27311,
7361,
3215,
1027,
27311,
8569,
4014,
2094,
1027,
27311,
1011,
3857,
27311,
21572,
3501,
1027,
2373,
58... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Brasa\RecursoHumanoBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
class RhuAcreditacionTipoType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('codigo', TextType::class, array('required' => true))
->add('nombre', TextType::class, array('required' => true))
->add('cargo', TextType::class, array('required' => true))
->add('cargoCodigo', TextType::class, array('required' => true))
->add('guardar', SubmitType::class, array('label' => 'Guardar'));
}
public function getBlockPrefix()
{
return 'form';
}
}
| wariox3/brasa | src/Brasa/RecursoHumanoBundle/Form/Type/RhuAcreditacionTipoType.php | PHP | mit | 959 | [
30522,
1026,
1029,
25718,
3415,
15327,
11655,
3736,
1032,
28667,
9236,
11631,
19042,
16429,
8630,
2571,
1032,
2433,
1032,
2828,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
2433,
1032,
10061,
13874,
1025,
2224,
25353,
2213,
14876,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
redirect_from: /docs/1.0.22/modules/directives.html
---
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>directives | @uirouter/angularjs</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
<link rel="stylesheet" href="../assets/css/uirouter.css">
<script src="../assets/js/modernizr.js"></script>
<script src="../assets/js/reset.js"></script>
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">@uirouter/angularjs</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<!--
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
-->
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Internal UI-Router API</label>
<!--
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
-->
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../index.html">@uirouter/angularjs</a>
</li>
<li>
<a href="directives.html">directives</a>
</li>
</ul>
<h1>Module directives</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<div class="lead">
<h1 id="angular-1-directives">Angular 1 Directives</h1>
</div>
<p>These are the directives included in UI-Router for Angular 1.
These directives are used in templates to create viewports and link/navigate to states.</p>
</div>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Variables</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"><a href="directives.html#uisrefactivedirective" class="tsd-kind-icon">ui<wbr>Sref<wbr>Active<wbr>Directive</a></li>
<li class="tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"><a href="directives.html#uisrefdirective" class="tsd-kind-icon">ui<wbr>Sref<wbr>Directive</a></li>
<li class="tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"><a href="directives.html#uistatedirective" class="tsd-kind-icon">ui<wbr>State<wbr>Directive</a></li>
<li class="tsd-kind-variable tsd-parent-kind-external-module"><a href="directives.html#uiview" class="tsd-kind-icon">ui<wbr>View</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Variables</h2>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a name="uisrefactivedirective" class="tsd-anchor"></a>
<!--
<h3><span class="tsd-flag ts-flagLet">Let</span> ui<wbr>Sref<wbr>Active<wbr>Directive</h3>
-->
<div class="tsd-signature tsd-kind-icon">ui<wbr>Sref<wbr>Active<wbr>Directive<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ng1_directive</span> <div class="tsd-header">
<p> <code>ui-sref-active</code> and <code>ui-sref-active-eq</code>: A directive that adds a CSS class when a <code>ui-sref</code> is active </p>
</div>
</div>
<div class="tsd-declaration">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p><code>ui-sref-active</code> and <code>ui-sref-active-eq</code>: A directive that adds a CSS class when a <code>ui-sref</code> is active</p>
</div>
<p>A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the
related directive's state is active (and remove them when it is inactive).</p>
<p>The primary use-case is to highlight the active link in navigation menus,
distinguishing it from the inactive menu items.</p>
<h3 id="linking-to-a-ui-sref-or-ui-state">Linking to a <code>ui-sref</code> or <code>ui-state</code></h3>
<p><code>ui-sref-active</code> can live on the same element as <code>ui-sref</code>/<code>ui-state</code>, or it can be on a parent element.
If a <code>ui-sref-active</code> is a parent to more than one <code>ui-sref</code>/<code>ui-state</code>, it will apply the CSS class when <strong>any of the links are active</strong>.</p>
<h3 id="matching">Matching</h3>
<p>The <code>ui-sref-active</code> directive applies the CSS class when the <code>ui-sref</code>/<code>ui-state</code>'s target state <strong>or any child state is active</strong>.
This is a "fuzzy match" which uses <a href="../classes/state.stateservice.html#includes">StateService.includes</a>.</p>
<p>The <code>ui-sref-active-eq</code> directive applies the CSS class when the <code>ui-sref</code>/<code>ui-state</code>'s target state is directly active (not when child states are active).
This is an "exact match" which uses <a href="../classes/state.stateservice.html#is">StateService.is</a>.</p>
<h3 id="parameter-values">Parameter values</h3>
<p>If the <code>ui-sref</code>/<code>ui-state</code> includes parameter values, the current parameter values must match the link's values for the link to be highlighted.
This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted.</p>
<h4 id="example-">Example:</h4>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">ng-repeat</span>=<span class="hljs-string">"user in users"</span> <span class="hljs-attr">ui-sref-active</span>=<span class="hljs-string">"active"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"user.details({ userId: user.id })"</span>></span>{{ user.lastName }}<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">li</span>></span></code></pre>
<h3 id="examples">Examples</h3>
<p>Given the following template:</p>
<h4 id="example-">Example:</h4>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">ul</span>></span>
<span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">ui-sref-active</span>=<span class="hljs-string">"active"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"item"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"app.user({user: 'bilbobaggins'})"</span>></span>@bilbobaggins<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">li</span>></span>
<span class="hljs-tag"></<span class="hljs-name">ul</span>></span></code></pre>
<p>When the app state is <code>app.user</code> (or any child state),
and contains the state parameter "user" with value "bilbobaggins",
the resulting HTML will appear as (note the 'active' class):</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">ul</span>></span>
<span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">ui-sref-active</span>=<span class="hljs-string">"active"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"item active"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"app.user({user: 'bilbobaggins'})"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/users/bilbobaggins"</span>></span>@bilbobaggins<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">li</span>></span>
<span class="hljs-tag"></<span class="hljs-name">ul</span>></span></code></pre>
<h3 id="glob-mode">Glob mode</h3>
<p>It is possible to pass <code>ui-sref-active</code> an expression that evaluates to an object.
The objects keys represent active class names and values represent the respective state names/globs.
<code>ui-sref-active</code> will match if the current active state <strong>includes</strong> any of
the specified state names/globs, even the abstract ones.</p>
<h4 id="example-">Example:</h4>
<p>Given the following template, with "admin" being an abstract state:</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">ui-sref-active</span>=<span class="hljs-string">"{'active': 'admin.**'}"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref-active</span>=<span class="hljs-string">"active"</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"admin.roles"</span>></span>Roles<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">div</span>></span></code></pre>
<p>Arrays are also supported as values in the <code>ngClass</code>-like interface.
This allows multiple states to add <code>active</code> class.</p>
<h4 id="example-">Example:</h4>
<p>Given the following template, with "admin.roles" being the current state, the class will be added too:</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">ui-sref-active</span>=<span class="hljs-string">"{'active': ['owner.**', 'admin.**']}"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref-active</span>=<span class="hljs-string">"active"</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"admin.roles"</span>></span>Roles<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">div</span>></span></code></pre>
<p>When the current state is "admin.roles" the "active" class will be applied to both the <code><div></code> and <code><a></code> elements.
It is important to note that the state names/globs passed to <code>ui-sref-active</code> override any state provided by a linked <code>ui-sref</code>.</p>
<h3 id="notes-">Notes:</h3>
<ul>
<li><p>The class name is interpolated <strong>once</strong> during the directives link time (any further changes to the
interpolated value are ignored).</p>
</li>
<li><p>Multiple classes may be specified in a space-separated format: <code>ui-sref-active='class1 class2 class3'</code></p>
</li>
</ul>
</div>
</div>
<aside class="tsd-sources">
<ul>
<li>Defined in ui-router-angularjs/src/directives/stateDirectives.ts:572</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a name="uisrefdirective" class="tsd-anchor"></a>
<!--
<h3><span class="tsd-flag ts-flagLet">Let</span> ui<wbr>Sref<wbr>Directive</h3>
-->
<div class="tsd-signature tsd-kind-icon">ui<wbr>Sref<wbr>Directive<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ng1_directive</span> <div class="tsd-header">
<p> <code>ui-sref</code>: A directive for linking to a state </p>
</div>
</div>
<div class="tsd-declaration">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p><code>ui-sref</code>: A directive for linking to a state</p>
</div>
<p>A directive which links to a state (and optionally, parameters).
When clicked, this directive activates the linked state with the supplied parameter values.</p>
<h3 id="linked-state">Linked State</h3>
<p>The attribute value of the <code>ui-sref</code> is the name of the state to link to.</p>
<h4 id="example-">Example:</h4>
<p>This will activate the <code>home</code> state when the link is clicked.</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"home"</span>></span>Home<span class="hljs-tag"></<span class="hljs-name">a</span>></span></code></pre>
<h3 id="relative-links">Relative Links</h3>
<p>You can also use relative state paths within <code>ui-sref</code>, just like a relative path passed to <code>$state.go()</code> (<a href="../classes/state.stateservice.html#go">StateService.go</a>).
You just need to be aware that the path is relative to the state that <em>created</em> the link.
This allows a state to create a relative <code>ui-sref</code> which always targets the same destination.</p>
<h4 id="example-">Example:</h4>
<p>Both these links are relative to the parent state, even when a child state is currently active.</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">".child1"</span>></span>child 1 state<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">".child2"</span>></span>child 2 state<span class="hljs-tag"></<span class="hljs-name">a</span>></span></code></pre>
<p>This link activates the parent state.</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"^"</span>></span>Return<span class="hljs-tag"></<span class="hljs-name">a</span>></span></code></pre>
<h3 id="hrefs">hrefs</h3>
<p>If the linked state has a URL, the directive will automatically generate and
update the <code>href</code> attribute (using the <a href="../classes/state.stateservice.html#href">StateService.href</a> method).</p>
<h4 id="example-">Example:</h4>
<p>Assuming the <code>users</code> state has a url of <code>/users/</code></p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"users"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/users/"</span>></span>Users<span class="hljs-tag"></<span class="hljs-name">a</span>></span></code></pre>
<h3 id="parameter-values">Parameter Values</h3>
<p>In addition to the state name, a <code>ui-sref</code> can include parameter values which are applied when activating the state.
Param values can be provided in the <code>ui-sref</code> value after the state name, enclosed by parentheses.
The content inside the parentheses is an expression, evaluated to the parameter values.</p>
<h4 id="example-">Example:</h4>
<p>This example renders a list of links to users.
The state's <code>userId</code> parameter value comes from each user's <code>user.id</code> property.</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">ng-repeat</span>=<span class="hljs-string">"user in users"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"users.detail({ userId: user.id })"</span>></span>{{ user.displayName }}<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">li</span>></span></code></pre>
<p>Note:
The parameter values expression is <code>$watch</code>ed for updates.</p>
<h3 id="transition-options">Transition Options</h3>
<p>You can specify <a href="../interfaces/transition.transitionoptions.html">TransitionOptions</a> to pass to <a href="../classes/state.stateservice.html#go">StateService.go</a> by using the <code>ui-sref-opts</code> attribute.
Options are restricted to <code>location</code>, <code>inherit</code>, and <code>reload</code>.</p>
<h4 id="example-">Example:</h4>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"home"</span> <span class="hljs-attr">ui-sref-opts</span>=<span class="hljs-string">"{ reload: true }"</span>></span>Home<span class="hljs-tag"></<span class="hljs-name">a</span>></span></code></pre>
<h3 id="other-dom-events">Other DOM Events</h3>
<p>You can also customize which DOM events to respond to (instead of <code>click</code>) by
providing an <code>events</code> array in the <code>ui-sref-opts</code> attribute.</p>
<h4 id="example-">Example:</h4>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"contacts"</span> <span class="hljs-attr">ui-sref-opts</span>=<span class="hljs-string">"{ events: ['change', 'blur'] }"</span>></span></code></pre>
<h3 id="highlighting-the-active-link">Highlighting the active link</h3>
<p>This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.</p>
<h3 id="examples">Examples</h3>
<p>If you have the following template:</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"home"</span>></span>Home<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"about"</span>></span>About<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"{page: 2}"</span>></span>Next page<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"><<span class="hljs-name">ul</span>></span>
<span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">ng-repeat</span>=<span class="hljs-string">"contact in contacts"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"contacts.detail({ id: contact.id })"</span>></span>{{ contact.name }}<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">li</span>></span>
<span class="hljs-tag"></<span class="hljs-name">ul</span>></span></code></pre>
<p>Then (assuming the current state is <code>contacts</code>) the rendered html including hrefs would be:</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#/home"</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"home"</span>></span>Home<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#/about"</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"about"</span>></span>About<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#/contacts?page=2"</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"{page: 2}"</span>></span>Next page<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"><<span class="hljs-name">ul</span>></span>
<span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">ng-repeat</span>=<span class="hljs-string">"contact in contacts"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#/contacts/1"</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"contacts.detail({ id: contact.id })"</span>></span>Joe<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">li</span>></span>
<span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">ng-repeat</span>=<span class="hljs-string">"contact in contacts"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#/contacts/2"</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"contacts.detail({ id: contact.id })"</span>></span>Alice<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">li</span>></span>
<span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">ng-repeat</span>=<span class="hljs-string">"contact in contacts"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#/contacts/3"</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"contacts.detail({ id: contact.id })"</span>></span>Bob<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">li</span>></span>
<span class="hljs-tag"></<span class="hljs-name">ul</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#/home"</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"home"</span> <span class="hljs-attr">ui-sref-opts</span>=<span class="hljs-string">"{reload: true}"</span>></span>Home<span class="hljs-tag"></<span class="hljs-name">a</span>></span></code></pre>
<h3 id="notes">Notes</h3>
<ul>
<li>You can use <code>ui-sref</code> to change <strong>only the parameter values</strong> by omitting the state name and parentheses.<h4 id="example-">Example:</h4>
Sets the <code>lang</code> parameter to <code>en</code> and remains on the same state.</li>
</ul>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-sref</span>=<span class="hljs-string">"{ lang: 'en' }"</span>></span>English<span class="hljs-tag"></<span class="hljs-name">a</span>></span></code></pre>
<ul>
<li><p>A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.</p>
</li>
<li><p>Unlike the parameter values expression, the state name is not <code>$watch</code>ed (for performance reasons).
If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.</p>
</li>
</ul>
</div>
</div>
<aside class="tsd-sources">
<ul>
<li>Defined in ui-router-angularjs/src/directives/stateDirectives.ts:283</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a name="uistatedirective" class="tsd-anchor"></a>
<!--
<h3><span class="tsd-flag ts-flagLet">Let</span> ui<wbr>State<wbr>Directive</h3>
-->
<div class="tsd-signature tsd-kind-icon">ui<wbr>State<wbr>Directive<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ng1_directive</span> <div class="tsd-header">
<p> <code>ui-state</code>: A fully dynamic directive for linking to a state </p>
</div>
</div>
<div class="tsd-declaration">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p><code>ui-state</code>: A fully dynamic directive for linking to a state</p>
</div>
<p>A directive which links to a state (and optionally, parameters).
When clicked, this directive activates the linked state with the supplied parameter values.</p>
<p><strong>This directive is very similar to [[uiSref]], but it <code>$observe</code>s and <code>$watch</code>es/evaluates all its inputs.</strong></p>
<p>A directive which links to a state (and optionally, parameters).
When clicked, this directive activates the linked state with the supplied parameter values.</p>
<h3 id="linked-state">Linked State</h3>
<p>The attribute value of <code>ui-state</code> is an expression which is <code>$watch</code>ed and evaluated as the state to link to.
<strong>This is in contrast with <code>ui-sref</code>, which takes a state name as a string literal.</strong></p>
<h4 id="example-">Example:</h4>
<p>Create a list of links.</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">ng-repeat</span>=<span class="hljs-string">"link in navlinks"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-state</span>=<span class="hljs-string">"link.state"</span>></span>{{ link.displayName }}<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">li</span>></span></code></pre>
<h3 id="relative-links">Relative Links</h3>
<p>If the expression evaluates to a relative path, it is processed like [[uiSref]].
You just need to be aware that the path is relative to the state that <em>created</em> the link.
This allows a state to create relative <code>ui-state</code> which always targets the same destination.</p>
<h3 id="hrefs">hrefs</h3>
<p>If the linked state has a URL, the directive will automatically generate and
update the <code>href</code> attribute (using the <a href="../classes/state.stateservice.html#href">StateService.href</a> method).</p>
<h3 id="parameter-values">Parameter Values</h3>
<p>In addition to the state name expression, a <code>ui-state</code> can include parameter values which are applied when activating the state.
Param values should be provided using the <code>ui-state-params</code> attribute.
The <code>ui-state-params</code> attribute value is <code>$watch</code>ed and evaluated as an expression.</p>
<h4 id="example-">Example:</h4>
<p>This example renders a list of links with param values.
The state's <code>userId</code> parameter value comes from each user's <code>user.id</code> property.</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">li</span> <span class="hljs-attr">ng-repeat</span>=<span class="hljs-string">"link in navlinks"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-state</span>=<span class="hljs-string">"link.state"</span> <span class="hljs-attr">ui-state-params</span>=<span class="hljs-string">"link.params"</span>></span>{{ link.displayName }}<span class="hljs-tag"></<span class="hljs-name">a</span>></span>
<span class="hljs-tag"></<span class="hljs-name">li</span>></span></code></pre>
<h3 id="transition-options">Transition Options</h3>
<p>You can specify <a href="../interfaces/transition.transitionoptions.html">TransitionOptions</a> to pass to <a href="../classes/state.stateservice.html#go">StateService.go</a> by using the <code>ui-state-opts</code> attribute.
Options are restricted to <code>location</code>, <code>inherit</code>, and <code>reload</code>.
The value of the <code>ui-state-opts</code> is <code>$watch</code>ed and evaluated as an expression.</p>
<h4 id="example-">Example:</h4>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-state</span>=<span class="hljs-string">"returnto.state"</span> <span class="hljs-attr">ui-state-opts</span>=<span class="hljs-string">"{ reload: true }"</span>></span>Home<span class="hljs-tag"></<span class="hljs-name">a</span>></span></code></pre>
<h3 id="other-dom-events">Other DOM Events</h3>
<p>You can also customize which DOM events to respond to (instead of <code>click</code>) by
providing an <code>events</code> array in the <code>ui-state-opts</code> attribute.</p>
<h4 id="example-">Example:</h4>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">ui-state</span>=<span class="hljs-string">"contacts"</span> <span class="hljs-attr">ui-state-opts</span>=<span class="hljs-string">"{ events: ['change', 'blur'] }"</span>></span></code></pre>
<h3 id="highlighting-the-active-link">Highlighting the active link</h3>
<p>This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.</p>
<h3 id="notes">Notes</h3>
<ul>
<li>You can use <code>ui-params</code> to change <strong>only the parameter values</strong> by omitting the state name and supplying only <code>ui-state-params</code>.
However, it might be simpler to use [[uiSref]] parameter-only links.</li>
</ul>
<h4 id="example-">Example:</h4>
<p>Sets the <code>lang</code> parameter to <code>en</code> and remains on the same state.</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">a</span> <span class="hljs-attr">ui-state</span>=<span class="hljs-string">""</span> <span class="hljs-attr">ui-state-params</span>=<span class="hljs-string">"{ lang: 'en' }"</span>></span>English<span class="hljs-tag"></<span class="hljs-name">a</span>></span></code></pre>
<ul>
<li>A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.
<code>`</code></li>
</ul>
</div>
</div>
<aside class="tsd-sources">
<ul>
<li>Defined in ui-router-angularjs/src/directives/stateDirectives.ts:422</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-external-module">
<a name="uiview" class="tsd-anchor"></a>
<!--
<h3><span class="tsd-flag ts-flagLet">Let</span> ui<wbr>View</h3>
-->
<div class="tsd-signature tsd-kind-icon">ui<wbr>View<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ng1_directive</span> <div class="tsd-header">
<p> <code>ui-view</code>: A viewport directive which is filled in by a view from the active state. </p>
</div>
</div>
<div class="tsd-declaration">
<div class="tsd-comment tsd-typography">
<div class="lead">
<p><code>ui-view</code>: A viewport directive which is filled in by a view from the active state.</p>
</div>
<h3 id="attributes">Attributes</h3>
<ul>
<li><p><code>name</code>: (Optional) A view name.
The name should be unique amongst the other views in the same state.
You can have views of the same name that live in different states.
The ui-view can be targeted in a View using the name (<a href="../interfaces/ng1.ng1statedeclaration.html#views">Ng1StateDeclaration.views</a>).</p>
</li>
<li><p><code>autoscroll</code>: an expression. When it evaluates to true, the <code>ui-view</code> will be scrolled into view when it is activated.
Uses <a href="injectables.html#_uiviewscroll">$uiViewScroll</a> to do the scrolling.</p>
</li>
<li><p><code>onload</code>: Expression to evaluate whenever the view updates.</p>
</li>
</ul>
<h4 id="example-">Example:</h4>
<p>A view can be unnamed or named.</p>
<pre><code class="language-html"><span class="hljs-comment"><!-- Unnamed --></span>
<span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">ui-view</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span>
<span class="hljs-comment"><!-- Named --></span>
<span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">ui-view</span>=<span class="hljs-string">"viewName"</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span>
<span class="hljs-comment"><!-- Named (different style) --></span>
<span class="hljs-tag"><<span class="hljs-name">ui-view</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewName"</span>></span><span class="hljs-tag"></<span class="hljs-name">ui-view</span>></span></code></pre>
<p>You can only have one unnamed view within any template (or root html). If you are only using a
single view and it is unnamed then you can populate it like so:</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">ui-view</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span>
$stateProvider.state("home", {
template: "<span class="hljs-tag"><<span class="hljs-name">h1</span>></span>HELLO!<span class="hljs-tag"></<span class="hljs-name">h1</span>></span>"
})</code></pre>
<p>The above is a convenient shortcut equivalent to specifying your view explicitly with the
<a href="../interfaces/ng1.ng1statedeclaration.html#views">Ng1StateDeclaration.views</a> config property, by name, in this case an empty name:</p>
<pre><code class="language-js">$stateProvider.state(<span class="hljs-string">"home"</span>, {
<span class="hljs-attr">views</span>: {
<span class="hljs-string">""</span>: {
<span class="hljs-attr">template</span>: <span class="hljs-string">"<h1>HELLO!</h1>"</span>
}
}
})</code></pre>
<p>But typically you'll only use the views property if you name your view or have more than one view
in the same template. There's not really a compelling reason to name a view if its the only one,
but you could if you wanted, like so:</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">ui-view</span>=<span class="hljs-string">"main"</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span></code></pre>
<pre><code class="language-js">$stateProvider.state(<span class="hljs-string">"home"</span>, {
<span class="hljs-attr">views</span>: {
<span class="hljs-string">"main"</span>: {
<span class="hljs-attr">template</span>: <span class="hljs-string">"<h1>HELLO!</h1>"</span>
}
}
})</code></pre>
<p>Really though, you'll use views to set up multiple views:</p>
<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">ui-view</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span>
<span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">ui-view</span>=<span class="hljs-string">"chart"</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span>
<span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">ui-view</span>=<span class="hljs-string">"data"</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span></code></pre>
<pre><code class="language-js">$stateProvider.state(<span class="hljs-string">"home"</span>, {
<span class="hljs-attr">views</span>: {
<span class="hljs-string">""</span>: {
<span class="hljs-attr">template</span>: <span class="hljs-string">"<h1>HELLO!</h1>"</span>
},
<span class="hljs-string">"chart"</span>: {
<span class="hljs-attr">template</span>: <span class="hljs-string">"<chart_thing/>"</span>
},
<span class="hljs-string">"data"</span>: {
<span class="hljs-attr">template</span>: <span class="hljs-string">"<data_thing/>"</span>
}
}
})</code></pre>
<h4 id="examples-for-autoscroll-">Examples for <code>autoscroll</code>:</h4>
<pre><code class="language-html"><span class="hljs-comment"><!-- If autoscroll present with no expression,
then scroll ui-view into view --></span>
<span class="hljs-tag"><<span class="hljs-name">ui-view</span> <span class="hljs-attr">autoscroll</span>/></span>
<span class="hljs-comment"><!-- If autoscroll present with valid expression,
then scroll ui-view into view if expression evaluates to true --></span>
<span class="hljs-tag"><<span class="hljs-name">ui-view</span> <span class="hljs-attr">autoscroll</span>=<span class="hljs-string">'true'</span>/></span>
<span class="hljs-tag"><<span class="hljs-name">ui-view</span> <span class="hljs-attr">autoscroll</span>=<span class="hljs-string">'false'</span>/></span>
<span class="hljs-tag"><<span class="hljs-name">ui-view</span> <span class="hljs-attr">autoscroll</span>=<span class="hljs-string">'scopeVariable'</span>/></span></code></pre>
<p>Resolve data:</p>
<p>The resolved data from the state's <code>resolve</code> block is placed on the scope as <code>$resolve</code> (this
can be customized using <a href="../interfaces/ng1.ng1viewdeclaration.html#resolveas">Ng1ViewDeclaration.resolveAs</a>). This can be then accessed from the template.</p>
<p>Note that when <code>controllerAs</code> is being used, <code>$resolve</code> is set on the controller instance <em>after</em> the
controller is instantiated. The <code>$onInit()</code> hook can be used to perform initialization code which
depends on <code>$resolve</code> data.</p>
<h4 id="example-">Example:</h4>
<pre><code class="language-js">$stateProvider.state(<span class="hljs-string">'home'</span>, {
<span class="hljs-attr">template</span>: <span class="hljs-string">'<my-component user="$resolve.user"></my-component>'</span>,
<span class="hljs-attr">resolve</span>: {
<span class="hljs-attr">user</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">UserService</span>) </span>{ <span class="hljs-keyword">return</span> UserService.fetchUser(); }
}
});</code></pre>
</div>
</div>
<aside class="tsd-sources">
<ul>
<li>Defined in ui-router-angularjs/src/directives/viewDirective.ts:172</li>
</ul>
</aside>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../index.html"><em>@uirouter/angularjs</em></a>
</li>
<li class="label tsd-is-external">
<span>Public API</span>
</li>
<li class=" tsd-kind-external-module">
<a href="common.html">common</a>
</li>
<li class=" tsd-kind-external-module">
<a href="core.html">core</a>
</li>
<li class="current tsd-kind-external-module">
<a href="directives.html">directives</a>
</li>
<li class=" tsd-kind-external-module">
<a href="injectables.html">injectables</a>
</li>
<li class=" tsd-kind-external-module">
<a href="ng1.html">ng1</a>
</li>
<li class=" tsd-kind-external-module">
<a href="ng1_state_events.html">ng1_<wbr>state_<wbr>events</a>
</li>
<li class=" tsd-kind-external-module">
<a href="params.html">params</a>
</li>
<li class=" tsd-kind-external-module">
<a href="resolve.html">resolve</a>
</li>
<li class=" tsd-kind-external-module">
<a href="state.html">state</a>
</li>
<li class=" tsd-kind-external-module">
<a href="transition.html">transition</a>
</li>
<li class=" tsd-kind-external-module">
<a href="url.html">url</a>
</li>
<li class=" tsd-kind-external-module">
<a href="view.html">view</a>
</li>
<li class="label tsd-is-external">
<span>Internal UI-<wbr><wbr>Router API</span>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="common_hof.html">common_<wbr>hof</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="common_predicates.html">common_<wbr>predicates</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="common_strings.html">common_<wbr>strings</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="hooks.html">hooks</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="path.html">path</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="trace.html">trace</a>
</li>
<li class=" tsd-kind-external-module tsd-is-external">
<a href="vanilla.html">vanilla</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="directives.html#uisrefactivedirective" class="tsd-kind-icon">ui<wbr>Sref<wbr>Active<wbr>Directive</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="directives.html#uisrefdirective" class="tsd-kind-icon">ui<wbr>Sref<wbr>Directive</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
<a href="directives.html#uistatedirective" class="tsd-kind-icon">ui<wbr>State<wbr>Directive</a>
</li>
<li class=" tsd-kind-variable tsd-parent-kind-external-module">
<a href="directives.html#uiview" class="tsd-kind-icon">ui<wbr>View</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="http://typedoc.io" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html> | ui-router/ui-router.github.io | _ng1_docs/1.0.22/modules/directives.html | HTML | mit | 49,924 | [
30522,
1011,
1011,
1011,
2417,
30524,
1046,
2015,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
1060,
1011,
25423,
1011,
118... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2012-2019 MarkLogic Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.marklogic.hub.web.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class AppController {
/**
* Assumes that the root URL should use a template named "index", which presumably will setup the Angular app.
*/
@RequestMapping(value = {"/", "/login", "/home", "/settings", "/jobs", "/traces/**", "/404"}, method = RequestMethod.GET)
public String index() {
return "index";
}
}
| marklogic/data-hub-in-a-box | web/src/main/java/com/marklogic/hub/web/web/AppController.java | Java | apache-2.0 | 1,192 | [
30522,
1013,
1008,
1008,
9385,
2262,
1011,
10476,
2928,
27179,
3840,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
30524,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
1008,
2017,
2089,
6855,
1037,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// NB: This issue affected only debug-mode.
// { dg-options "-std=gnu++11" }
// { dg-do compile }
// Copyright (C) 2007-2015 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// 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 General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <unordered_map>
//PR libstdc++/35922
int main()
{
std::unordered_map<int, int> m;
}
| hemantjain95/gcc | libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug_mode.cc | C++ | gpl-2.0 | 961 | [
30522,
1013,
1013,
1050,
2497,
1024,
2023,
3277,
5360,
2069,
2139,
8569,
2290,
1011,
5549,
1012,
1013,
1013,
1063,
1040,
2290,
1011,
7047,
1000,
1011,
2358,
2094,
1027,
27004,
1009,
1009,
2340,
1000,
1065,
1013,
1013,
1063,
1040,
2290,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:2.1.0.0
// SpecFlow Generator Version:2.0.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
#pragma warning disable
namespace Tests
{
using TechTalk.SpecFlow;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "2.1.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("XMLConverter")]
public partial class XMLConverterFeature
{
private TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "XMLConverter.feature"
#line hidden
[NUnit.Framework.TestFixtureSetUpAttribute()]
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "XMLConverter", null, ProgrammingLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
[NUnit.Framework.TestFixtureTearDownAttribute()]
public virtual void FeatureTearDown()
{
testRunner.OnFeatureEnd();
testRunner = null;
}
[NUnit.Framework.SetUpAttribute()]
public virtual void TestInitialize()
{
}
[NUnit.Framework.TearDownAttribute()]
public virtual void ScenarioTearDown()
{
testRunner.OnScenarioEnd();
}
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
{
testRunner.OnScenarioStart(scenarioInfo);
}
public virtual void ScenarioCleanup()
{
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("convert CSV to XML")]
[NUnit.Framework.CategoryAttribute("mytag")]
public virtual void ConvertCSVToXML()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("convert CSV to XML", new string[] {
"mytag"});
#line 4
this.ScenarioSetup(scenarioInfo);
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"nombre",
"apellido",
"edad"});
table1.AddRow(new string[] {
"nexer",
"rodriguez",
"21"});
table1.AddRow(new string[] {
"kevin",
"estevez",
"21"});
table1.AddRow(new string[] {
"tonio",
"mejia",
"20"});
table1.AddRow(new string[] {
"josue",
"barahona",
"21"});
#line 5
testRunner.Given("the next table of csv representation file", ((string)(null)), table1, "Given ");
#line 11
testRunner.When("I press convert to XML", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 12
testRunner.Then(@"the final result should be '<Rows><Row><nombre>""nexer""</nombre><apellido>""rodriguez""</apellido><edad>21</edad></Row><Row><nombre>""kevin""</nombre><apellido>""estevez""</apellido><edad>21</edad></Row><Row><nombre>""tonio""</nombre><apellido>""mejia""</apellido><edad>20</edad></Row><Row><nombre>""josue""</nombre><apellido>""barahona""</apellido><edad>21</edad></Row></Rows>'", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
}
}
#pragma warning restore
#endregion
| rNexeR/IngSoft-ExaII | Tests/XMLConverter.feature.cs | C# | mit | 4,255 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import java.util.Iterator;
import java.util.NoSuchElementException;
@SuppressWarnings("unchecked")
public class RandomizedQueue<Item> implements Iterable<Item> {
private Item[] _arr;
private int _length = 0;
private void resize(int newLength) {
if (newLength > _arr.length) newLength = 2 * _arr.length;
else if (newLength < _arr.length / 4) newLength = _arr.length / 2;
else return;
Item[] newArr = (Item[])(new Object[newLength]);
for (int i = 0; i < _length; ++i) {
newArr[i] = _arr[i];
}
_arr = newArr;
}
public RandomizedQueue() {
_arr = (Item[])(new Object[1]);
}
public boolean isEmpty() {
return _length == 0;
}
public int size() {
return _length;
}
public void enqueue(Item item) {
if (item == null) throw new NullPointerException();
resize(_length + 1);
_arr[_length] = item;
++_length;
}
public Item dequeue() {
if (_length == 0) throw new NoSuchElementException();
int idx = StdRandom.uniform(_length);
Item ret = _arr[idx];
_arr[idx] = _arr[_length - 1];
_arr[_length - 1] = null;
--_length;
resize(_length);
return ret;
}
public Item sample() {
if (_length == 0) throw new NoSuchElementException();
return _arr[StdRandom.uniform(_length)];
}
private class RandomizedQueueIterator implements Iterator<Item> {
Item[] _state;
int _current = 0;
public RandomizedQueueIterator() {
_state = (Item[])(new Object[_length]);
for (int i = 0; i < _length; ++i) {
_state[i] = _arr[i];
}
StdRandom.shuffle(_state);
}
public boolean hasNext() {
return _current != _state.length;
}
public Item next() {
if (!hasNext()) throw new NoSuchElementException();
return _state[_current++];
}
public void remove() {
throw new UnsupportedOperationException();
}
}
public Iterator<Item> iterator() {
return new RandomizedQueueIterator();
}
public static void main(String[] args) {
RandomizedQueue<Integer> queue = new RandomizedQueue<Integer>();
for (int i = 0; i < 10; ++i) {
queue.enqueue(i);
}
for (int e: queue) {
StdOut.println(e);
}
}
}
| hghwng/mooc-algs1 | 2/RandomizedQueue.java | Java | mit | 2,505 | [
30522,
12324,
9262,
1012,
21183,
4014,
1012,
2009,
6906,
4263,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
16839,
19140,
16930,
15781,
2595,
24422,
1025,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
30524,
13512,
2232,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.restsql.core;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
public class RequestUtilTest {
@Test
public void testConvertToStandardInternetMediaType() {
assertEquals("application/json", RequestUtil.convertToStandardInternetMediaType("application/json"));
assertEquals("application/json", RequestUtil.convertToStandardInternetMediaType("json"));
assertEquals("application/json", RequestUtil.convertToStandardInternetMediaType("JSON"));
assertEquals("application/xml", RequestUtil.convertToStandardInternetMediaType("application/xml"));
assertEquals("application/xml", RequestUtil.convertToStandardInternetMediaType("xml"));
assertEquals("application/xml", RequestUtil.convertToStandardInternetMediaType("XML"));
}
@Test
public void testGetRequestMediaType() {
assertEquals(null, RequestUtil.getRequestMediaType(null));
assertEquals(null, RequestUtil.getRequestMediaType(""));
assertEquals("unknown", RequestUtil.getRequestMediaType("unknown"));
assertEquals("application/unknown", RequestUtil.getRequestMediaType("application/unknown"));
assertEquals("application/json", RequestUtil.getRequestMediaType("application/json"));
assertEquals("application/json", RequestUtil.getRequestMediaType("application/json; charset=UTF-8"));
assertEquals("application/xml", RequestUtil.getRequestMediaType("application/xml"));
assertEquals("application/xml", RequestUtil.getRequestMediaType("application/xml; charset=UTF-8"));
assertEquals("application/x-www-form-urlencoded", RequestUtil.getRequestMediaType("application/x-www-form-urlencoded"));
assertEquals("application/x-www-form-urlencoded", RequestUtil.getRequestMediaType("application/x-www-form-urlencoded; charset=UTF-8"));
assertEquals("application/json", RequestUtil.getRequestMediaType("application/json;q=0.9,application/xml;q=0.8"));
assertEquals("application/xml", RequestUtil.getRequestMediaType("application/json;q=0.9,application/xml"));
}
@Test
public void testGetResponseMediaType_WithParamsAndRequestMediaType() {
List<RequestValue> params = new ArrayList<RequestValue>();
String mediaType = RequestUtil.getResponseMediaType(params, null, null);
assertEquals(HttpRequestAttributes.DEFAULT_MEDIA_TYPE, mediaType);
assertEquals(0, params.size());
RequestValue param1 = new RequestValue("test", "123");
params.add(param1);
mediaType = RequestUtil.getResponseMediaType(params, null, null);
assertEquals(HttpRequestAttributes.DEFAULT_MEDIA_TYPE, mediaType);
assertEquals(1, params.size());
RequestValue param2 = new RequestValue("test2", "12345");
params.add(param2);
mediaType = RequestUtil.getResponseMediaType(params, "application/json", null);
assertEquals("application/json", mediaType);
assertEquals(2, params.size());
mediaType = RequestUtil.getResponseMediaType(params, "application/x-www-form-urlencoded", null);
assertEquals("application/xml", mediaType);
assertEquals(2, params.size());
params.add(new RequestValue(Request.PARAM_NAME_OUTPUT, "application/json"));
mediaType = RequestUtil.getResponseMediaType(params, null, null);
assertEquals("application/json", mediaType);
assertEquals(2, params.size());
assertEquals(param1, params.get(0));
assertEquals(param2, params.get(1));
params.add(new RequestValue(Request.PARAM_NAME_OUTPUT, "application/xml"));
mediaType = RequestUtil.getResponseMediaType(params, "application/json", null);
assertEquals("application/xml", mediaType);
assertEquals(2, params.size());
assertEquals(param1, params.get(0));
assertEquals(param2, params.get(1));
params.add(new RequestValue(Request.PARAM_NAME_OUTPUT, "application/xml"));
mediaType = RequestUtil.getResponseMediaType(params, "application/x-www-form-urlencoded", null);
assertEquals("application/xml", mediaType);
assertEquals(2, params.size());
assertEquals(param1, params.get(0));
assertEquals(param2, params.get(1));
}
@Test
public void testGetResponseMediaType_WithParamsAndResponseMediaType() {
List<RequestValue> params = new ArrayList<RequestValue>();
RequestValue param1 = new RequestValue("test", "123");
params.add(param1);
String mediaType = RequestUtil.getResponseMediaType(params, null, "application/json");
assertEquals("application/json", mediaType);
assertEquals(1, params.size());
RequestValue param2 = new RequestValue("test2", "12345");
params.add(param2);
mediaType = RequestUtil.getResponseMediaType(params, "application/json", "application/json");
assertEquals("application/json", mediaType);
assertEquals(2, params.size());
mediaType = RequestUtil.getResponseMediaType(params, "application/xml", "application/json");
assertEquals("application/json", mediaType);
assertEquals(2, params.size());
mediaType = RequestUtil.getResponseMediaType(params, "application/x-www-form-urlencoded", "application/json");
assertEquals("application/json", mediaType);
assertEquals(2, params.size());
// Parameter overrides accept media type
params.add(new RequestValue(Request.PARAM_NAME_OUTPUT, "application/xml"));
mediaType = RequestUtil.getResponseMediaType(params, "application/x-www-form-urlencoded", "application/json");
assertEquals("application/xml", mediaType);
assertEquals(2, params.size());
assertEquals(param1, params.get(0));
assertEquals(param2, params.get(1));
// Parameter overrides accept media type
params.add(new RequestValue(Request.PARAM_NAME_OUTPUT, "application/xml"));
mediaType = RequestUtil.getResponseMediaType(params, "application/json", "application/json");
assertEquals("application/xml", mediaType);
assertEquals(2, params.size());
assertEquals(param1, params.get(0));
assertEquals(param2, params.get(1));
}
@Test
public void testGetResponseMediaType_WithComplexAcceptHeader() {
List<RequestValue> params = new ArrayList<RequestValue>();
RequestValue param1 = new RequestValue("test", "123");
params.add(param1);
String acceptMediaType = "application/xml";
assertEquals("application/xml", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
acceptMediaType = "application/xml; charset=UTF-8";
assertEquals("application/xml", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
acceptMediaType = "application/json";
assertEquals("application/json", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
acceptMediaType = "application/json; charset=UTF-8";
assertEquals("application/json", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
acceptMediaType = "*/*";
assertEquals("application/xml", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
acceptMediaType = "application/*";
assertEquals("application/xml", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
acceptMediaType = "application/json;q=0.9,application/xml;q=0.8";
assertEquals("application/json", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
acceptMediaType = "application/json;q=0.9,application/xml";
assertEquals("application/xml", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
// Chrome
acceptMediaType = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
assertEquals("application/xml", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
// Firefox
acceptMediaType = "text/xml, application/xml, application/xhtml+xml, text/html;q=0.9, text/plain;q=0.8, image/png,*/*;q=0.5";
assertEquals("application/xml", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
//IE
acceptMediaType = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*";
assertEquals("application/xml", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
}
@Test
public void testGetResponseMediaType_WithInvalidAcceptHeader() {
List<RequestValue> params = new ArrayList<RequestValue>();
RequestValue param1 = new RequestValue("test", "123");
params.add(param1);
String acceptMediaType = null;
assertEquals("application/xml", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
acceptMediaType = "";
assertEquals("application/xml", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
acceptMediaType = "application/unknown";
assertEquals("application/unknown", RequestUtil.getResponseMediaType(params, null, acceptMediaType));
}
}
| restsql/restsql-test | src/org/restsql/core/RequestUtilTest.java | Java | mit | 8,694 | [
30522,
7427,
8917,
1012,
16626,
4160,
2140,
1012,
4563,
1025,
12324,
10763,
8917,
1012,
12022,
4183,
1012,
20865,
1012,
20865,
2063,
26426,
2015,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
9262,
1012,
21183,
4014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.