text
stringlengths 2
1.04M
| meta
dict |
---|---|
<?php
class AddressController extends Controller
{
private $filter_input;
private $employee_id;
public function main()
{
}
/**
* EmployeeController constructor.
*/
public function __construct($db)
{
parent::__construct($db);
$this->filter_input = new FilterInput();
}
public function viewEmployeeAddress()
{
$this->filter_input->saveFromTagsGet();
if (isset($_GET['employee_id'])) {
$model = new AddressesModel($this->db);
$data = $model->readEmployeeAddress($_GET['employee_id']);
$this->loadView('common/header.php');
$this->loadView('employees/employee_data.php', $data);
$this->loadView('common/footer.php');
}
}
public function editEmployeeData()
{
$this->filter_input->saveFromTagsGet();
if (isset($_GET['employee_id'])) {
$this->submitEditEmployee($_GET['employee_id']);
$this->loadView('common/header.php');
$this->loadView('employees/edit_employee_data.php');
$this->loadView('common/footer.php');
}
}
private function submitEditEmployee($employee_id)
{
$this->filter_input->saveFromTagsPost();
if (isset($_POST['save'])) {
if ($this->validateEditEmployee()) {
$first_name = $_POST['first_name'];
$middle_name = $_POST['middle_name'];
$last_name = $_POST['last_name'];
$town_name = $_POST['town_name'];
$address_text = $_POST['address_text'];
$model = new AddressesModel($this->db);
$model->editEmployeeData($employee_id, $first_name, $middle_name, $last_name, $town_name, $address_text);
}
}
if (isset($_POST['cancel'])) {
header('Location: ?controller=EmployeeController');
}
}
private function validateEditEmployee()
{
if ($_POST['first_name'] == '' ) {
echo 'The first name can not be empty!';
return false;
} elseif ($_POST['middle_name'] == '') {
echo 'The middle name can not be empty!';
return false;
} elseif ($_POST['last_name'] == '') {
echo 'The last name can not be empty!';
return false;
} elseif ($_POST['town_name'] == '') {
echo 'Enter a town!';
return false;
} elseif ($_POST['address_text'] == '') {
echo 'Enter un address!';
return false;
}
return true;
}
} | {
"content_hash": "625c174a413d5ee674649a27b069dd90",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 121,
"avg_line_length": 29.863636363636363,
"alnum_prop": 0.5144596651445966,
"repo_name": "stoyantodorovbg/PHP-Web-Development-Basics",
"id": "9ff0aae2e902fa3b408a5df1ce72198f1134b326",
"size": "2628",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Homework Working with Forms in PHP/employee2/controller/AddressController.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8312"
},
{
"name": "HTML",
"bytes": "5671"
},
{
"name": "PHP",
"bytes": "426690"
},
{
"name": "PLpgSQL",
"bytes": "1589"
}
],
"symlink_target": ""
} |
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("CloudFoundryOwinSelfHost")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CloudFoundryOwinSelfHost")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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("0c37c878-111b-4507-a51f-4a8c92de65b9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "5eee14c33b99277c9d3eaf597f2cfefd",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.333333333333336,
"alnum_prop": 0.7521186440677966,
"repo_name": "SteelToeOSS/Samples",
"id": "3dfed382a8389eef9d8fbd0a2a42d937a974c6a7",
"size": "1419",
"binary": false,
"copies": "1",
"ref": "refs/heads/2.x",
"path": "Management/src/AspDotNet4/CloudFoundryOwinSelfHost/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "210"
},
{
"name": "Batchfile",
"bytes": "2137"
},
{
"name": "C#",
"bytes": "546165"
},
{
"name": "CSS",
"bytes": "8760"
},
{
"name": "HTML",
"bytes": "107853"
},
{
"name": "JavaScript",
"bytes": "72677"
},
{
"name": "Shell",
"bytes": "2091"
}
],
"symlink_target": ""
} |
#include <assert.h>
#include <errno.h>
#include <libintl.h>
#include <netdb.h>
#include <nss.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/mman.h>
#include "dbg_log.h"
#include "nscd.h"
#ifdef HAVE_SENDFILE
# include <kernel-features.h>
#endif
typedef enum nss_status (*nss_gethostbyname4_r)
(const char *name, struct gaih_addrtuple **pat,
char *buffer, size_t buflen, int *errnop,
int *h_errnop, int32_t *ttlp);
typedef enum nss_status (*nss_gethostbyname3_r)
(const char *name, int af, struct hostent *host,
char *buffer, size_t buflen, int *errnop,
int *h_errnop, int32_t *, char **);
typedef enum nss_status (*nss_getcanonname_r)
(const char *name, char *buffer, size_t buflen, char **result,
int *errnop, int *h_errnop);
static const ai_response_header notfound =
{
.version = NSCD_VERSION,
.found = 0,
.naddrs = 0,
.addrslen = 0,
.canonlen = 0,
.error = 0
};
static time_t
addhstaiX (struct database_dyn *db, int fd, request_header *req,
void *key, uid_t uid, struct hashentry *const he,
struct datahead *dh)
{
/* Search for the entry matching the key. Please note that we don't
look again in the table whether the dataset is now available. We
simply insert it. It does not matter if it is in there twice. The
pruning function only will look at the timestamp. */
/* We allocate all data in one memory block: the iov vector,
the response header and the dataset itself. */
struct dataset
{
struct datahead head;
ai_response_header resp;
char strdata[0];
} *dataset = NULL;
if (__builtin_expect (debug_level > 0, 0))
{
if (he == NULL)
dbg_log (_("Haven't found \"%s\" in hosts cache!"), (char *) key);
else
dbg_log (_("Reloading \"%s\" in hosts cache!"), (char *) key);
}
static service_user *hosts_database;
service_user *nip = NULL;
int no_more;
int rc6 = 0;
int rc4 = 0;
int herrno = 0;
if (hosts_database != NULL)
{
nip = hosts_database;
no_more = 0;
}
else
no_more = __nss_database_lookup ("hosts", NULL,
"dns [!UNAVAIL=return] files", &nip);
if (__res_maybe_init (&_res, 0) == -1)
no_more = 1;
/* If we are looking for both IPv4 and IPv6 address we don't want
the lookup functions to automatically promote IPv4 addresses to
IPv6 addresses. Currently this is decided by setting the
RES_USE_INET6 bit in _res.options. */
int old_res_options = _res.options;
_res.options &= ~RES_USE_INET6;
size_t tmpbuf6len = 1024;
char *tmpbuf6 = alloca (tmpbuf6len);
size_t tmpbuf4len = 0;
char *tmpbuf4 = NULL;
int32_t ttl = INT32_MAX;
ssize_t total = 0;
char *key_copy = NULL;
bool alloca_used = false;
time_t timeout = MAX_TIMEOUT_VALUE;
while (!no_more)
{
void *cp;
int status[2] = { NSS_STATUS_UNAVAIL, NSS_STATUS_UNAVAIL };
int naddrs = 0;
size_t addrslen = 0;
char *canon = NULL;
size_t canonlen;
nss_gethostbyname4_r fct4 = __nss_lookup_function (nip,
"gethostbyname4_r");
if (fct4 != NULL)
{
struct gaih_addrtuple atmem;
struct gaih_addrtuple *at;
while (1)
{
at = &atmem;
rc6 = 0;
herrno = 0;
status[1] = DL_CALL_FCT (fct4, (key, &at, tmpbuf6, tmpbuf6len,
&rc6, &herrno, &ttl));
if (rc6 != ERANGE || (herrno != NETDB_INTERNAL
&& herrno != TRY_AGAIN))
break;
tmpbuf6 = extend_alloca (tmpbuf6, tmpbuf6len, 2 * tmpbuf6len);
}
if (rc6 != 0 && herrno == NETDB_INTERNAL)
goto out;
if (status[1] != NSS_STATUS_SUCCESS)
goto next_nip;
/* We found the data. Count the addresses and the size. */
for (const struct gaih_addrtuple *at2 = at = &atmem; at2 != NULL;
at2 = at2->next)
{
++naddrs;
/* We do not handle anything other than IPv4 and IPv6
addresses. The getaddrinfo implementation does not
either so it is not worth trying to do more. */
if (at2->family == AF_INET)
addrslen += INADDRSZ;
else if (at2->family == AF_INET6)
addrslen += IN6ADDRSZ;
}
canon = at->name;
canonlen = strlen (canon) + 1;
total = sizeof (*dataset) + naddrs + addrslen + canonlen;
/* Now we can allocate the data structure. If the TTL of the
entry is reported as zero do not cache the entry at all. */
if (ttl != 0 && he == NULL)
dataset = (struct dataset *) mempool_alloc (db, total
+ req->key_len, 1);
if (dataset == NULL)
{
/* We cannot permanently add the result in the moment. But
we can provide the result as is. Store the data in some
temporary memory. */
dataset = (struct dataset *) alloca (total + req->key_len);
/* We cannot add this record to the permanent database. */
alloca_used = true;
}
/* Fill in the address and address families. */
char *addrs = dataset->strdata;
uint8_t *family = (uint8_t *) (addrs + addrslen);
for (const struct gaih_addrtuple *at2 = at; at2 != NULL;
at2 = at2->next)
{
*family++ = at2->family;
if (at2->family == AF_INET)
addrs = mempcpy (addrs, at2->addr, INADDRSZ);
else if (at2->family == AF_INET6)
addrs = mempcpy (addrs, at2->addr, IN6ADDRSZ);
}
cp = family;
}
else
{
/* Prefer the function which also returns the TTL and
canonical name. */
nss_gethostbyname3_r fct = __nss_lookup_function (nip,
"gethostbyname3_r");
if (fct == NULL)
fct = __nss_lookup_function (nip, "gethostbyname2_r");
if (fct == NULL)
goto next_nip;
struct hostent th[2];
/* Collect IPv6 information first. */
while (1)
{
rc6 = 0;
status[0] = DL_CALL_FCT (fct, (key, AF_INET6, &th[0], tmpbuf6,
tmpbuf6len, &rc6, &herrno, &ttl,
&canon));
if (rc6 != ERANGE || herrno != NETDB_INTERNAL)
break;
tmpbuf6 = extend_alloca (tmpbuf6, tmpbuf6len, 2 * tmpbuf6len);
}
if (rc6 != 0 && herrno == NETDB_INTERNAL)
goto out;
/* If the IPv6 lookup has been successful do not use the
buffer used in that lookup, use a new one. */
if (status[0] == NSS_STATUS_SUCCESS && rc6 == 0)
{
tmpbuf4len = 512;
tmpbuf4 = alloca (tmpbuf4len);
}
else
{
tmpbuf4len = tmpbuf6len;
tmpbuf4 = tmpbuf6;
}
/* Next collect IPv4 information. */
while (1)
{
rc4 = 0;
status[1] = DL_CALL_FCT (fct, (key, AF_INET, &th[1], tmpbuf4,
tmpbuf4len, &rc4, &herrno,
ttl == INT32_MAX ? &ttl : NULL,
canon == NULL ? &canon : NULL));
if (rc4 != ERANGE || herrno != NETDB_INTERNAL)
break;
tmpbuf4 = extend_alloca (tmpbuf4, tmpbuf4len, 2 * tmpbuf4len);
}
if (rc4 != 0 && herrno == NETDB_INTERNAL)
goto out;
if (status[0] != NSS_STATUS_SUCCESS
&& status[1] != NSS_STATUS_SUCCESS)
goto next_nip;
/* We found the data. Count the addresses and the size. */
for (int j = 0; j < 2; ++j)
if (status[j] == NSS_STATUS_SUCCESS)
for (int i = 0; th[j].h_addr_list[i] != NULL; ++i)
{
++naddrs;
addrslen += th[j].h_length;
}
if (canon == NULL)
{
/* Determine the canonical name. */
nss_getcanonname_r cfct;
cfct = __nss_lookup_function (nip, "getcanonname_r");
if (cfct != NULL)
{
const size_t max_fqdn_len = 256;
char *buf = alloca (max_fqdn_len);
char *s;
int rc;
if (DL_CALL_FCT (cfct, (key, buf, max_fqdn_len, &s,
&rc, &herrno))
== NSS_STATUS_SUCCESS)
canon = s;
else
/* Set to name now to avoid using gethostbyaddr. */
canon = key;
}
else
{
struct hostent *hstent = NULL;
int herrno;
struct hostent hstent_mem;
void *addr;
size_t addrlen;
int addrfamily;
if (status[1] == NSS_STATUS_SUCCESS)
{
addr = th[1].h_addr_list[0];
addrlen = sizeof (struct in_addr);
addrfamily = AF_INET;
}
else
{
addr = th[0].h_addr_list[0];
addrlen = sizeof (struct in6_addr);
addrfamily = AF_INET6;
}
size_t tmpbuflen = 512;
char *tmpbuf = alloca (tmpbuflen);
int rc;
while (1)
{
rc = __gethostbyaddr2_r (addr, addrlen, addrfamily,
&hstent_mem, tmpbuf, tmpbuflen,
&hstent, &herrno, NULL);
if (rc != ERANGE || herrno != NETDB_INTERNAL)
break;
tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
tmpbuflen * 2);
}
if (rc == 0)
{
if (hstent != NULL)
canon = hstent->h_name;
else
canon = key;
}
}
}
canonlen = canon == NULL ? 0 : (strlen (canon) + 1);
total = sizeof (*dataset) + naddrs + addrslen + canonlen;
/* Now we can allocate the data structure. If the TTL of the
entry is reported as zero do not cache the entry at all. */
if (ttl != 0 && he == NULL)
dataset = (struct dataset *) mempool_alloc (db, total
+ req->key_len, 1);
if (dataset == NULL)
{
/* We cannot permanently add the result in the moment. But
we can provide the result as is. Store the data in some
temporary memory. */
dataset = (struct dataset *) alloca (total + req->key_len);
/* We cannot add this record to the permanent database. */
alloca_used = true;
}
/* Fill in the address and address families. */
char *addrs = dataset->strdata;
uint8_t *family = (uint8_t *) (addrs + addrslen);
for (int j = 0; j < 2; ++j)
if (status[j] == NSS_STATUS_SUCCESS)
for (int i = 0; th[j].h_addr_list[i] != NULL; ++i)
{
addrs = mempcpy (addrs, th[j].h_addr_list[i],
th[j].h_length);
*family++ = th[j].h_addrtype;
}
cp = family;
}
/* Fill in the rest of the dataset. */
dataset->head.allocsize = total + req->key_len;
dataset->head.recsize = total - offsetof (struct dataset, resp);
dataset->head.notfound = false;
dataset->head.nreloads = he == NULL ? 0 : (dh->nreloads + 1);
dataset->head.usable = true;
/* Compute the timeout time. */
dataset->head.ttl = ttl == INT32_MAX ? db->postimeout : ttl;
timeout = dataset->head.timeout = time (NULL) + dataset->head.ttl;
dataset->resp.version = NSCD_VERSION;
dataset->resp.found = 1;
dataset->resp.naddrs = naddrs;
dataset->resp.addrslen = addrslen;
dataset->resp.canonlen = canonlen;
dataset->resp.error = NETDB_SUCCESS;
if (canon != NULL)
cp = mempcpy (cp, canon, canonlen);
key_copy = memcpy (cp, key, req->key_len);
assert (cp == (char *) dataset + total);
/* Now we can determine whether on refill we have to create a
new record or not. */
if (he != NULL)
{
assert (fd == -1);
if (total + req->key_len == dh->allocsize
&& total - offsetof (struct dataset, resp) == dh->recsize
&& memcmp (&dataset->resp, dh->data,
dh->allocsize - offsetof (struct dataset,
resp)) == 0)
{
/* The data has not changed. We will just bump the
timeout value. Note that the new record has been
allocated on the stack and need not be freed. */
dh->timeout = dataset->head.timeout;
dh->ttl = dataset->head.ttl;
++dh->nreloads;
}
else
{
/* We have to create a new record. Just allocate
appropriate memory and copy it. */
struct dataset *newp
= (struct dataset *) mempool_alloc (db, total + req->key_len,
1);
if (__builtin_expect (newp != NULL, 1))
{
/* Adjust pointer into the memory block. */
key_copy = (char *) newp + (key_copy - (char *) dataset);
dataset = memcpy (newp, dataset, total + req->key_len);
alloca_used = false;
}
/* Mark the old record as obsolete. */
dh->usable = false;
}
}
else
{
/* We write the dataset before inserting it to the database
since while inserting this thread might block and so
would unnecessarily let the receiver wait. */
assert (fd != -1);
#ifdef HAVE_SENDFILE
if (__builtin_expect (db->mmap_used, 1) && !alloca_used)
{
assert (db->wr_fd != -1);
assert ((char *) &dataset->resp > (char *) db->data);
assert ((char *) dataset - (char *) db->head + total
<= (sizeof (struct database_pers_head)
+ db->head->module * sizeof (ref_t)
+ db->head->data_size));
# ifndef __ASSUME_SENDFILE
ssize_t written;
written =
# endif
sendfileall (fd, db->wr_fd, (char *) &dataset->resp
- (char *) db->head, dataset->head.recsize);
# ifndef __ASSUME_SENDFILE
if (written == -1 && errno == ENOSYS)
goto use_write;
# endif
}
else
# ifndef __ASSUME_SENDFILE
use_write:
# endif
#endif
writeall (fd, &dataset->resp, dataset->head.recsize);
}
goto out;
next_nip:
if (nss_next_action (nip, status[1]) == NSS_ACTION_RETURN)
break;
if (nip->next == NULL)
no_more = -1;
else
nip = nip->next;
}
/* No result found. Create a negative result record. */
if (he != NULL && rc4 == EAGAIN)
{
/* If we have an old record available but cannot find one now
because the service is not available we keep the old record
and make sure it does not get removed. */
if (reload_count != UINT_MAX && dh->nreloads == reload_count)
/* Do not reset the value if we never not reload the record. */
dh->nreloads = reload_count - 1;
/* Reload with the same time-to-live value. */
timeout = dh->timeout = time (NULL) + dh->ttl;
}
else
{
/* We have no data. This means we send the standard reply for
this case. */
total = sizeof (notfound);
if (fd != -1)
TEMP_FAILURE_RETRY (send (fd, ¬found, total, MSG_NOSIGNAL));
/* If we cannot permanently store the result, so be it. */
if (__builtin_expect (db->negtimeout == 0, 0))
{
/* Mark the old entry as obsolete. */
if (dh != NULL)
dh->usable = false;
dataset = NULL;
}
else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
+ req->key_len), 1)) != NULL)
{
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
dataset->head.recsize = total;
dataset->head.notfound = true;
dataset->head.nreloads = 0;
dataset->head.usable = true;
/* Compute the timeout time. */
timeout = dataset->head.timeout = time (NULL) + db->negtimeout;
dataset->head.ttl = db->negtimeout;
/* This is the reply. */
memcpy (&dataset->resp, ¬found, total);
/* Copy the key data. */
key_copy = memcpy (dataset->strdata, key, req->key_len);
}
}
out:
_res.options |= old_res_options & RES_USE_INET6;
if (dataset != NULL && !alloca_used)
{
/* If necessary, we also propagate the data to disk. */
if (db->persistent)
{
// XXX async OK?
uintptr_t pval = (uintptr_t) dataset & ~pagesize_m1;
msync ((void *) pval,
((uintptr_t) dataset & pagesize_m1) + total + req->key_len,
MS_ASYNC);
}
(void) cache_add (req->type, key_copy, req->key_len, &dataset->head,
true, db, uid, he == NULL);
pthread_rwlock_unlock (&db->lock);
/* Mark the old entry as obsolete. */
if (dh != NULL)
dh->usable = false;
}
return timeout;
}
void
addhstai (struct database_dyn *db, int fd, request_header *req, void *key,
uid_t uid)
{
addhstaiX (db, fd, req, key, uid, NULL, NULL);
}
time_t
readdhstai (struct database_dyn *db, struct hashentry *he, struct datahead *dh)
{
request_header req =
{
.type = GETAI,
.key_len = he->len
};
return addhstaiX (db, -1, &req, db->data + he->key, he->owner, he, dh);
}
| {
"content_hash": "070831d7e7b59e56d66326f3812fccdc",
"timestamp": "",
"source": "github",
"line_count": 576,
"max_line_length": 79,
"avg_line_length": 27.39236111111111,
"alnum_prop": 0.5807453416149069,
"repo_name": "endplay/omniplay",
"id": "aaaf80df9db41190f7ce24e1249d2a3ee6ef82a3",
"size": "16700",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "eglibc-2.15/nscd/aicache.c",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "ASP",
"bytes": "4528"
},
{
"name": "Assembly",
"bytes": "17491433"
},
{
"name": "Awk",
"bytes": "79791"
},
{
"name": "Batchfile",
"bytes": "903"
},
{
"name": "C",
"bytes": "444772157"
},
{
"name": "C++",
"bytes": "10631343"
},
{
"name": "GDB",
"bytes": "17950"
},
{
"name": "HTML",
"bytes": "47935"
},
{
"name": "Java",
"bytes": "2193"
},
{
"name": "Lex",
"bytes": "44513"
},
{
"name": "M4",
"bytes": "9029"
},
{
"name": "Makefile",
"bytes": "1758605"
},
{
"name": "Objective-C",
"bytes": "5278898"
},
{
"name": "Perl",
"bytes": "649746"
},
{
"name": "Perl 6",
"bytes": "1101"
},
{
"name": "Python",
"bytes": "585875"
},
{
"name": "RPC",
"bytes": "97869"
},
{
"name": "Roff",
"bytes": "2522798"
},
{
"name": "Scilab",
"bytes": "21433"
},
{
"name": "Shell",
"bytes": "426172"
},
{
"name": "TeX",
"bytes": "283872"
},
{
"name": "UnrealScript",
"bytes": "6143"
},
{
"name": "XS",
"bytes": "1240"
},
{
"name": "Yacc",
"bytes": "93190"
},
{
"name": "sed",
"bytes": "9202"
}
],
"symlink_target": ""
} |
package com.flj.latte.ec.main.sort.content;
import android.support.v7.widget.AppCompatImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.flj.latte.ec.R;
import java.util.List;
/**
* Created by Administrator on 2017/9/19 0019.
*/
public class SectionAdapter extends BaseSectionQuickAdapter<SectionBean,BaseViewHolder> {
private static final RequestOptions OPTIONS = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.dontAnimate();
public SectionAdapter(int layoutResId, int sectionHeadResId, List<SectionBean> data) {
super(layoutResId, sectionHeadResId, data);
}
@Override
protected void convertHead(BaseViewHolder helper, SectionBean item) {
helper.setText(R.id.header,item.header);
helper.setVisible(R.id.more,item.ismIsMore());
helper.addOnClickListener(R.id.more);
}
@Override
protected void convert(BaseViewHolder helper, SectionBean item) {
//item.t返回SectionBean类型
final String thumb = item.t.getmGoodsThumb();
final String name = item.t.getmGoodsName();
final int goodsId = item.t.getmGoodsId();
final SectionContentItemEntity entity = item.t;
helper.setText(R.id.tv,name);
final AppCompatImageView goodsImageView = helper.getView(R.id.iv);
Glide.with(mContext)
.load(thumb)
.into(goodsImageView);
}
}
| {
"content_hash": "ae7b6ff03eb1d46a1824437059e038e1",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 90,
"avg_line_length": 31.76923076923077,
"alnum_prop": 0.7100484261501211,
"repo_name": "xiao125/LatteDamo",
"id": "4ec898b0e4e6a1d9a87c153f0728e46346b89b19",
"size": "1660",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "latte-ec/src/main/java/com/flj/latte/ec/main/sort/content/SectionAdapter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "2828"
},
{
"name": "Java",
"bytes": "452938"
},
{
"name": "JavaScript",
"bytes": "59268"
}
],
"symlink_target": ""
} |
(function() {
var app = angular.module('nyt', []);
app.controller('NytController', ['$http', '$scope', function($http, $scope) {
var nyt = this;
nyt.homeStories = {};
nyt.healthStories = {};
nyt.expanded = false;
$scope.homeExpanded = false;
$scope.healthExpanded = false;
nyt.expand = function() {
this.expanded = !this.expanded;
}
$scope.expandHome = function() {
$scope.homeExpanded = !$scope.homeExpanded;
}
$scope.expandHealth = function() {
$scope.healthExpanded = !$scope.healthExpanded;
}
$scope.homeFetched = false;
$scope.healthFetched = false;
$scope.getHome = function() {
if ($scope.homeFetched) {
return false;
} else {
$http.get('/nyt/home').then(function(res) {
$scope.homeFetched = true;
var stories = res.data.stories.results;
nyt.homeStories = stories;
});
}
}
$scope.getHealth = function() {
if ($scope.healthFetched) {
return false;
} else {
$http.get('/nyt/health').then(function(res) {
$scope.healthFetched = true;
var stories = res.data.stories.results;
nyt.healthStories = stories;
});
}
}
}]);
})();
| {
"content_hash": "56ef3367de27e2eb92ee6ddfd45a95b5",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 24.5,
"alnum_prop": 0.554945054945055,
"repo_name": "nhashmi/top-of-the-morning",
"id": "5b1117758843245f572e00e7bfc2629db5b6102b",
"size": "1274",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/components/nyt/nyt.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1740"
},
{
"name": "HTML",
"bytes": "4312"
},
{
"name": "JavaScript",
"bytes": "9530"
}
],
"symlink_target": ""
} |
namespace blitz {
template<template <typename> class TensorType, typename DType>
DType CrossEntropyMulti<TensorType, DType>::Apply(
const shared_ptr<TensorType<DType> > output,
const shared_ptr<TensorType<DType> > target) {
return Backend<TensorType, DType>::CrossEntropyMultiApplyFunc(
output.get(), target.get());
}
template<template <typename> class TensorType, typename DType>
void CrossEntropyMulti<TensorType, DType>::Derivative(
const shared_ptr<TensorType<DType> > output,
const shared_ptr<TensorType<DType> > target,
shared_ptr<TensorType<DType> > result) {
Backend<TensorType, DType>::CrossEntropyMultiDerivativeFunc(
output.get(), target.get(), result.get());
}
INSTANTIATE_CLASS_CPU(CrossEntropyMulti);
#ifdef BLITZ_USE_GPU
INSTANTIATE_CLASS_GPU(CrossEntropyMulti);
#endif
} // namespace blitz
| {
"content_hash": "f6a71dcf70f77edc1e7dd17045e4c87b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 64,
"avg_line_length": 33.4,
"alnum_prop": 0.7604790419161677,
"repo_name": "PAA-NCIC/blitz",
"id": "95379cdee39cd392f16c5c9b800bfbdf8d00ee4f",
"size": "900",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/transforms/cross_entropy_multi.cc",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "10051"
},
{
"name": "C++",
"bytes": "258894"
},
{
"name": "Cuda",
"bytes": "34635"
},
{
"name": "Makefile",
"bytes": "5251"
},
{
"name": "Objective-C",
"bytes": "2696"
},
{
"name": "Python",
"bytes": "8891"
},
{
"name": "Shell",
"bytes": "31441"
}
],
"symlink_target": ""
} |
/**
* Module dependencies.
*/
var express = require('express');
var http = require('http');
var path = require('path');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var mongoose = require('mongoose/');
var session = require('express-session');
var bcrypt = require('bcrypt');
var latestPosts = [];
var secretconfig = require('./secretconfig.json');
mongoose.connect('mongodb://localhost/cdj-adv');
var app = express();
app.use(session({
secret: secretconfig.secret,
resave: true,
saveUninitialized: true
}))
// all environments
app.set('port', process.env.PORT || 3001);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.methodOverride());
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
// development only
if ('development' == app.get('env')) {
app.use(express.errorHandler());
}
var Schema = mongoose.Schema;
//var UserDetail = new Schema({
// username: String,
// password: String
//}, {collection: 'userInfo'});
var userSchema = mongoose.Schema({
username: {type: String, required:true, trim: true},
password: {type: String, required:true},
name: String,
details: {
lineOfCode: String,
programmingLanguage: String,
programmingProject: String
}
}, {collection: 'userInfo'});
var postSchema = mongoose.Schema({
date: { type: Date, default: Date.now },
user: {type: String, required:true},
title: {type: String, required:true},
message: String
}, {collection: 'posts'});
postSchema.pre('save', function(next) {
getPosts();
next();
});
var UserDetails = mongoose.model('userInfo',userSchema);
var Posts = mongoose.model('posts',postSchema);
function getPosts(){
Posts.find({}).sort('-date').limit(100).exec(function(err, posts){
latestPosts = posts;
console.log("Posts updated");
});
}
getPosts();
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(user, done) {
done(null, user);
});
passport.use(new LocalStrategy(
function(username, password, done) {
process.nextTick(function () {
UserDetails.findOne({'username':username},
function(err, user) {
if (err) { return done(err); }
if (!user) { return done(null, false); }
if (!user.username) { return done(null, false); }
if (!user.password) { return done(null, false); }
var passwordsMatch = bcrypt.compareSync(password,user.password);
return done(null, passwordsMatch ? user : false);
});
});
}
));
app.get('/' , function(req, res, next){
if(req.session.username){
var uname = req.session.username;
res.render('index_loggedin', { title: secretconfig.title, uname: uname, posts: latestPosts });
}else{
res.render('index', { title: secretconfig.title});
}
});
app.get('/logout' , function(req, res, next){
req.session.loggedIn = false;
req.session.username = null;
res.redirect("/#loggedOut");
});
app.get('/login' , function(req, res, next){
res.render('login');
});
app.get('/auth', function(req, res, next) {
res.sendfile('views/login.html');
});
app.get('/loginFailure' , function(req, res, next){
res.send('Failure to authenticate');
});
app.get('/loginSuccess' , function(req, res, next){
res.send('Successfully authenticated');
});
app.post('/login',
passport.authenticate('local', {
failureRedirect: '/login#loginFailure'
}),function(req,res){
req.session.loggedIn = true;
req.session.username = req.user.username;
res.redirect("/#loginSuccess");
}
);
app.get('/signup', function(req,res){
res.render('signup.jade');
});
app.get('/dashboard', function(req,res){
if(req.session.username){
res.render('dashboard.jade', { title: secretconfig.title, uname: req.session.username });
}else{
res.redirect("/login");
}
});
// IMPORTANT: rubixmc.no-ip.org:25567
app.post('/post', function(req, res){
if(req.session.username){
if(req.body.title){
if(req.body.title.length > 2 && req.body.title.length < 50){
if(req.body.message){
if(req.body.message.length < 1000){
var testPost = new Posts({user:req.session.username,title:req.body.title, message: req.body.message});
testPost.save(function(err,data) {console.log("saved");});
}
}else{
var testPost = new Posts({user:req.session.username,title:req.body.title});
testPost.save(function(err,data) {console.log("saved");});
}
res.redirect("/");
}else{
res.redirect("/");
}
}else{
res.redirect("/");
}
}else{
res.redirect("/login");
}
});
app.post('/signup', function(req,res){
if(req.body.id != secretconfig.id){res.redirect("/signup#idIncorrect");return;}
if(req.body.password != req.body.passConf){res.redirect("/signup#confirmPassword");return;}
var usernameTest = /^[a-zA-Z0-9]+([._]?[a-zA-Z0-9]+)*$/;
if(req.body.username.length > 12 || req.body.username.length < 3){res.redirect("/signup#usernameRules");return;}
if(req.body.password.length >= 6){res.redirect("/signup#passwordRules");return;}
if(!usernameTest.test(req.body.username)){res.redirect("/signup#usernameRules");return;}
if(!usernameTest.test(req.body.password)){res.redirect("/signup#passwordRules");return;}
UserDetails.findOne({'username':req.body.username},
function(err, user) {
if(err || !user){
bcrypt.hash(req.body.password, 8, function(err, hash) {
if(err){res.redirect("/error#500");console.log(err);}
var registerUser = new UserDetails({username: req.body.username, password: hash});
console.log(registerUser);
// save registerUser Mongo
registerUser.save(function(err,data) {
if(err) {
console.log(err);
res.redirect("/error#500");
} else {
console.log('registerUser: ' + data.username + " saved.");
res.redirect("/login#signupSuccessful");
}
});
});
}else{
res.redirect("/signup#userExistant");
}
}
);
});
app.post("/comments/:id", function(req,res){
res.redirect("/");
});
app.get("/api/comments/:id", function(req,res){
res.send(
JSON.stringify({
id:req.params.id,
comments:[
{
user:"me",
time:Date.now(),
text: "Hi there",
subcomments:[]
}
]
})
);
});
app.get("/comments/:id", function(req,res){
res.render("comments", {title: secretconfig.title, uname: req.session.username,id: req.params.id});
});
app.use(express.static(path.join(__dirname, 'public')));
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
| {
"content_hash": "ab0905eef499ddc66690c1c504bae11c",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 114,
"avg_line_length": 26.28301886792453,
"alnum_prop": 0.6288585786073223,
"repo_name": "pfgithub/cdj-adv",
"id": "4ea6d2e133f0261186bdc1dba197155e44fcd803",
"size": "6965",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4609"
},
{
"name": "HTML",
"bytes": "3942"
},
{
"name": "JavaScript",
"bytes": "17030"
}
],
"symlink_target": ""
} |
package net.gcdc.geonetworking;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.threeten.bp.Instant;
public class BasicGeobroadcastTest {
@Test(timeout=3000)
public void test() throws IOException, InterruptedException {
final Position slottsberget = new Position(57.702878, 11.927723);
final Position damen = new Position(57.703864, 11.945876);
final Position sannegordshamn = new Position(57.708769, 11.927088);
final Position semcon = new Position(57.709526, 11.943996);
final Position teater = new Position(57.705714, 11.934608);
final Position jarntorget = new Position(57.699786, 11.953191);
final Position kuggen = new Position(57.706700, 11.938955);
DuplicatorLinkLayer d = new DuplicatorLinkLayer();
LinkLayer l1 = d.get();
LinkLayer l2 = d.get();
LinkLayer l3 = d.get();
LinkLayer l4 = d.get();
StationConfig config1 = new StationConfig();
config1.itsGnBeaconServiceRetransmitTimer = 500;
config1.itsGnBeaconServiceMaxJitter = 500;
StationConfig config2 = new StationConfig();
config2.itsGnBeaconServiceRetransmitTimer = 500;
config2.itsGnBeaconServiceMaxJitter = 500;
config2.itsGnGeoBroadcastCbfMaxTime = 5;
StationConfig config3 = new StationConfig();
config3.itsGnBeaconServiceRetransmitTimer = 500;
config3.itsGnBeaconServiceMaxJitter = 500;
config3.itsGnGeoBroadcastCbfMinTime = 99;
StationConfig config4 = new StationConfig();
final Optional<Address> emptyAddress = Optional.empty();
PositionProvider posSlottsberget = new PositionProvider() {
@Override public LongPositionVector getLatestPosition() {
return new LongPositionVector(emptyAddress, Instant.now(),
slottsberget, false, 0, 0);
}
};
PositionProvider posKuggen = new PositionProvider() {
@Override public LongPositionVector getLatestPosition() {
return new LongPositionVector(emptyAddress, Instant.now(),
kuggen, false, 0, 0);
}
};
PositionProvider posSemcon = new PositionProvider() {
@Override public LongPositionVector getLatestPosition() {
return new LongPositionVector(emptyAddress, Instant.now(),
semcon, false, 0, 0);
}
};
PositionProvider posJarntorget = new PositionProvider() {
@Override public LongPositionVector getLatestPosition() {
return new LongPositionVector(emptyAddress, Instant.now(),
jarntorget, false, 0, 0);
}
};
final BtpSocket socketAtSlottsberget = BtpSocket.on(config1, l1, posSlottsberget);
final BtpSocket socketAtKuggen = BtpSocket.on(config2, l2, posKuggen);
final BtpSocket socketAtSemcon = BtpSocket.on(config3, l3, posSemcon);
final BtpSocket socketAtJarntorget = BtpSocket.on(config4, l4, posJarntorget);
final byte[] payload = new byte[] {10, 20, 30};
final short destinationPort = 4001;
// Kuggen and Semcon inside, Jarntorget outside.
final Destination destinationKuggen = Destination.geobroadcast(
Area.rectangle(kuggen, 1.2 * kuggen.distanceInMetersTo(semcon),
0.5 * kuggen.distanceInMetersTo(semcon), 50));
// Send.
final BtpPacket packet = BtpPacket.customDestination(payload, destinationPort, destinationKuggen);
socketAtSlottsberget.send(packet);
// Receive without timeout.
final BtpPacket packet2 = socketAtKuggen.receive();
assertArrayEquals(packet.payload(), packet2.payload());
// // Receive without timeout.
// BtpPacket packet3 = socketAtSemcon.receive();
// assertArrayEquals(packet.payload(), packet3.payload());
// Receive with timeout.
final List<Throwable> exceptionsSemcon = Collections.synchronizedList(new ArrayList<Throwable>());
Thread receiverSemcon = new Thread(new Runnable() {
@Override public void run() {
try {
BtpPacket packet3 = socketAtSemcon.receive();
assertArrayEquals(packet.payload(), packet3.payload());
} catch (final Throwable e) {
exceptionsSemcon.add(e);
}
}
});
receiverSemcon.start();
Thread.sleep(10); // In Milliseconds.
receiverSemcon.interrupt();
receiverSemcon.join();
assertTrue(exceptionsSemcon.isEmpty());
// Receive with timeout. Too far -- should never receive.
final List<Throwable> exceptionsJarntorget = Collections.synchronizedList(new ArrayList<Throwable>());
Thread receiverJarntorget = new Thread(new Runnable() {
@Override public void run() {
try {
@SuppressWarnings("unused") // We should never receive it.
BtpPacket packet4 = socketAtJarntorget.receive();
org.junit.Assert.fail("should have never received");
} catch (final Throwable e) {
exceptionsJarntorget.add(e);
}
}
});
receiverJarntorget.start();
Thread.sleep(10); // In Milliseconds.
receiverJarntorget.interrupt();
receiverJarntorget.join();
assertEquals(exceptionsJarntorget.size(), 1);
assertEquals(exceptionsJarntorget.get(0).getClass(), InterruptedException.class);
}
}
| {
"content_hash": "35ee05080232a374f03b0a1b2c5454b2",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 110,
"avg_line_length": 41.15172413793103,
"alnum_prop": 0.6276185687950394,
"repo_name": "Heuvendw/geonetworking",
"id": "97d32c299fb8fa6d97b282db5d28dbe3a72f0753",
"size": "5967",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "geonetworking/src/test/java/net/gcdc/geonetworking/BasicGeobroadcastTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1543"
},
{
"name": "HTML",
"bytes": "26504"
},
{
"name": "Java",
"bytes": "700070"
},
{
"name": "Scala",
"bytes": "1442"
},
{
"name": "Shell",
"bytes": "1445"
}
],
"symlink_target": ""
} |
// Copyright 2022 Google LLC
//
// 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
//
// https://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 file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **
'use strict';
function main(name) {
// [START cloudtasks_v2beta2_generated_CloudTasks_GetTask_async]
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The task name. For example:
* `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
*/
// const name = 'abc123'
/**
* The response_view specifies which subset of the Task google.cloud.tasks.v2beta2.Task will be
* returned.
* By default response_view is BASIC google.cloud.tasks.v2beta2.Task.View.BASIC; not all
* information is retrieved by default because some data, such as
* payloads, might be desirable to return only when needed because
* of its large size or because of the sensitivity of data that it
* contains.
* Authorization for FULL google.cloud.tasks.v2beta2.Task.View.FULL requires
* `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/)
* permission on the Task google.cloud.tasks.v2beta2.Task resource.
*/
// const responseView = {}
// Imports the Tasks library
const {CloudTasksClient} = require('@google-cloud/tasks').v2beta2;
// Instantiates a client
const tasksClient = new CloudTasksClient();
async function callGetTask() {
// Construct request
const request = {
name,
};
// Run request
const response = await tasksClient.getTask(request);
console.log(response);
}
callGetTask();
// [END cloudtasks_v2beta2_generated_CloudTasks_GetTask_async]
}
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
| {
"content_hash": "0e201a66139a201944537869bc7ba45e",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 99,
"avg_line_length": 35.53333333333333,
"alnum_prop": 0.7125703564727955,
"repo_name": "googleapis/google-cloud-node",
"id": "774f7a39913fc1422eb649321b802c779331671d",
"size": "2665",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "packages/google-cloud-tasks/samples/generated/v2beta2/cloud_tasks.get_task.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "2789"
},
{
"name": "JavaScript",
"bytes": "10920867"
},
{
"name": "Python",
"bytes": "19983"
},
{
"name": "Shell",
"bytes": "58046"
},
{
"name": "TypeScript",
"bytes": "77312562"
}
],
"symlink_target": ""
} |
{% from qiita_core.qiita_settings import qiita_config %}
{% if prep_info %}
<h3>Data Types</h3>
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
{% for dt in prep_info %}
{% set cleaned_dt = dt.replace(' ', '_') %}
<div class="panel-heading" role="tab" id="heading{{cleaned_dt}}">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse{{cleaned_dt}}" aria-expanded="true" aria-controls="collapse{{cleaned_dt}}">{{dt}}</a>
</h4>
</div>
<div id="collapse{{cleaned_dt}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading{{cleaned_dt}}">
<div class="panel-body">
{% for prep in prep_info[dt] %}
<a href="#" style="display:block;color:black;" onclick="populate_main_div('{% raw qiita_config.portal_dir %}/study/description/prep_template/', { prep_id: {{prep['id']}}, study_id: {{study_id}} });">
<span id="prep-header-{{prep['id']}}">{{prep['name']}} - ID {{prep['id']}} - {{prep['status']}}</span><br/>
{{prep['start_artifact']}} - ID {{prep['start_artifact_id']}}<br/>
{{prep['youngest_artifact']}}
</a>
<hr>
{% end %}
</div>
</div>
{% end %}
</div>
</div>
{% else %}
<h4>No preparation information has been added yet</h4>
{% end %}
| {
"content_hash": "365b7c750feb2d80c66644161edf7ac2",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 213,
"avg_line_length": 50.1,
"alnum_prop": 0.5429141716566867,
"repo_name": "squirrelo/qiita",
"id": "431d7c469301ed77e2d0cd8543cb154a3ff02c3b",
"size": "1503",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "qiita_pet/templates/study_ajax/data_type_menu.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "1692"
},
{
"name": "HTML",
"bytes": "449930"
},
{
"name": "JavaScript",
"bytes": "5876"
},
{
"name": "Makefile",
"bytes": "6838"
},
{
"name": "PLSQL",
"bytes": "2359"
},
{
"name": "PLpgSQL",
"bytes": "45311"
},
{
"name": "Python",
"bytes": "1696427"
},
{
"name": "SQLPL",
"bytes": "6192"
},
{
"name": "Shell",
"bytes": "3062"
}
],
"symlink_target": ""
} |
namespace chrome_pdf {
namespace {
void RunAndDeleteResultCallback(void* user_data, int32_t result) {
std::unique_ptr<ResultCallback> callback(
static_cast<ResultCallback*>(user_data));
std::move(*callback).Run(result);
}
} // namespace
pp::CompletionCallback PPCompletionCallbackFromResultCallback(
ResultCallback callback) {
return pp::CompletionCallback(RunAndDeleteResultCallback,
new ResultCallback(std::move(callback)));
}
} // namespace chrome_pdf
| {
"content_hash": "75628c2cea37a2abd491a9e26bf76b84",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 73,
"avg_line_length": 26.842105263157894,
"alnum_prop": 0.7098039215686275,
"repo_name": "ric2b/Vivaldi-browser",
"id": "adc58a71b886cf2afe539800f6cd5d000640a96b",
"size": "849",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chromium/pdf/ppapi_migration/callback.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.editors">
<editor
name="Speedy ESB Editor"
extensions="mpe"
icon="icons/sample.gif"
contributorClass="com.github.bechtelcandoit.speedyesb.editors.SpeedyESBMultiPageEditorContributor"
class="com.github.bechtelcandoit.speedyesb.editors.SpeedyESBMultiPageEditor"
id="com.github.bechtelcandoit.speedyesb.editors.SpeedyESBMultiPageEditor">
</editor>
</extension>
<extension
point="org.eclipse.ui.newWizards">
<category
name="SpeedyESB Wizards"
id="SpeedyESB">
</category>
<wizard
name="SpeedyESB Multi-page Editor file"
icon="icons/sample.gif"
category="SpeedyESB"
class="com.github.bechtelcandoit.speedyesb.wizards.SpeedyESBWizard"
id="com.github.bechtelcandoit.speedyesb.wizards.SpeedyESBWizard">
</wizard>
</extension>
</plugin>
| {
"content_hash": "3fe87991a932064009f02cf7038cca9e",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 110,
"avg_line_length": 34.12903225806452,
"alnum_prop": 0.6285444234404537,
"repo_name": "BechtelCanDoIt/SpeedyESB",
"id": "826f909c2eef39d7a559029b9690fc4b5d70ec6d",
"size": "1058",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SpeedyESB/plugin.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "31455"
}
],
"symlink_target": ""
} |
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\SlackMessage;
class CronExecuted extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['slack'];
}
public function toSlack($notifiable)
{
$message = "Cron exécuté.";
return (new SlackMessage)->content($message);
}
}
| {
"content_hash": "a991c2634930d1ebbd11ede0a6c26d07",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 53,
"avg_line_length": 18.57894736842105,
"alnum_prop": 0.6175637393767706,
"repo_name": "gpoussel/cyclopaca",
"id": "375c1eec22e815082b98ace4ae96acdd4929827e",
"size": "708",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Notifications/CronExecuted.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "209330"
},
{
"name": "JavaScript",
"bytes": "10732"
},
{
"name": "PHP",
"bytes": "289435"
},
{
"name": "Shell",
"bytes": "697"
}
],
"symlink_target": ""
} |
require 'spec_helper'
describe Raemon::Instrumentation do
# Have to extend due to the way anonymous classes work
subject { Class.new { extend Raemon::Instrumentation } }
describe '#instrument' do
context 'instrumentor available' do
let(:instrumentor) { double('Instrumentor') }
before do
instrumentor.stub(:instrument) do |name, payload={}|
yield payload if block_given?
name
end
Raemon.config.instrumentor = instrumentor
end
after do
Raemon.config.instrumentor = nil
end
it 'uses it appropriately' do
instrumentor.should_receive(:instrument).with('raemon.bacon', { hello: 'world' })
subject.instrument('bacon', { hello: 'world' })
end
it 'yields the payload correctly' do
subject.instrument('bacon', 'my payload') do |payload|
payload.should eq('my payload')
end
end
end
context 'instrumentor not available' do
it 'does nothing' do
expect {
subject.instrument 'bacon'
}.to_not raise_error
end
end
end
end
| {
"content_hash": "6ad55ab79620a3f390855eb5ba8831ac",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 89,
"avg_line_length": 25.545454545454547,
"alnum_prop": 0.6165480427046264,
"repo_name": "pressly/raemon",
"id": "752206cb5eed4a271675ae94d557f79332d8f995",
"size": "1124",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "spec/raemon/instrumentation_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "33103"
}
],
"symlink_target": ""
} |
Since the project is in an early stage, the contributing guide will develop over time. For the time being you can use
the following sections for some orientation.
## How to contribute?
It's too early to write this chapter beacuse there is a lot of things we just develop and discuss. If you want to
help out building this app, just contact us. When you want to report a bugfix or propose a feature just open an issue.
We will review any pull request you propose. Before developing a new feature, please open an issue to discuss the new
feature beforehand.
## Tools
We're using IntelliJ (Java) and Visual Studio Code (Java / Typescript) to develop the project. You can import the project
as a Gradle Project to get started. If you want to develop the web frontend just import the `web` folder
in IntelliJ or VSC.
## How to run things
TBA :smirk:
For the time being just run the server with the `bootrun` task which is placed under `BudgetFreak` > `Tasks` >
`application` in the Gradle tool window in IntelliJ. If you want to start the web module use `ng serve` on your console.
## How to code
### Writing database migrations
We use Flyway to initialize and migrate our database.
For your migration scripts use the following form
```
V<MAJOR_VERSION>_<MINOR_VERSION>_<PATCH_VERSION>_<INCREMENTED_INDEX>__<DESCRIPTION>.sql
```
and check the `flyway.locations` property in `application.properties` to find the correct path and `root build.gradle`
for current versions.
## Styleguides
The code style will be checked via our CI build at some point. Until then please take account of the following
guidelines.
### Git Commit Messages
* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* Reference issues and pull requests liberally after the first line
* Consider starting the commit message with an applicable emoji:
* :rocket:`:rocket:` when adding a feature
* :art: `:art:` when improving the format/structure of the code
* :racehorse: `:racehorse:` when improving performance
* :memo: `:memo:` when writing docs
* :bug: `:bug:` when fixing a bug
* :fire: `:fire:` when removing code or files
* :green_heart: `:green_heart:` when fixing the CI build
* :white_check_mark: `:white_check_mark:` when adding tests
* :lock: `:lock:` when dealing with security
* :arrow_up: `:arrow_up:` when upgrading dependencies
* :arrow_down: `:arrow_down:` when downgrading dependencies
* :shirt: `:shirt:` when removing linter warnings
### Java Code
We're using IntelliJ to develop the backend. Just use the build-in formatter. Currenty we're evaluating other options
like using the Gradle Spotless plugin to check the Java code style.
### TypeScript
The Angular application was created via the Angular CLI. That's why there is EditConfig and TSLint present. Please
install the necessary plugins for respecting those rulsets.
| {
"content_hash": "b8da3289de4ba4e79459967213257da0",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 121,
"avg_line_length": 42.46478873239437,
"alnum_prop": 0.7429519071310116,
"repo_name": "BudgetFreak/BudgetFreak",
"id": "8c43890949a11711055d4436f08543a27caa861a",
"size": "3031",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".github/CONTRIBUTING.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5884"
},
{
"name": "HTML",
"bytes": "21786"
},
{
"name": "Java",
"bytes": "91070"
},
{
"name": "JavaScript",
"bytes": "1945"
},
{
"name": "TSQL",
"bytes": "1508"
},
{
"name": "TypeScript",
"bytes": "14518"
}
],
"symlink_target": ""
} |
namespace MassTransit
{
using System;
using System.IO;
using System.Linq;
using System.Text;
public class ArrayMessageBody :
MessageBody
{
readonly ArraySegment<byte> _bytes;
public ArrayMessageBody(ArraySegment<byte> bytes)
{
_bytes = bytes;
}
public long? Length => _bytes.Count;
public Stream GetStream()
{
return new MemoryStream(_bytes.Array ?? throw new InvalidOperationException("Array not accessible"), _bytes.Offset, _bytes.Count, false);
}
public byte[] GetBytes()
{
return _bytes.ToArray();
}
public string GetString()
{
return Encoding.UTF8.GetString(_bytes.Array ?? throw new InvalidOperationException("Array not accessible"), _bytes.Offset, _bytes.Count);
}
}
}
| {
"content_hash": "9db59faa5b41d5133c3a3f77325583ff",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 149,
"avg_line_length": 24.416666666666668,
"alnum_prop": 0.5858930602957907,
"repo_name": "phatboyg/MassTransit",
"id": "5fff406b03737ae2a20cb50e244224f08f3f1f89",
"size": "879",
"binary": false,
"copies": "3",
"ref": "refs/heads/develop",
"path": "src/MassTransit.Abstractions/Serialization/ArrayMessageBody.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "12646003"
},
{
"name": "Dockerfile",
"bytes": "781"
},
{
"name": "PowerShell",
"bytes": "3303"
},
{
"name": "Shell",
"bytes": "907"
},
{
"name": "Smalltalk",
"bytes": "4"
}
],
"symlink_target": ""
} |
package javaImportTool;
public class NodeInitializer {
public NodeInitializer(String nodeType, String[][] children)
{
nodeType_ = nodeType;
children_ = children;
}
public NodeInitializer(String nodeType, boolean isPersistenceUnit, String[][] children)
{
nodeType_ = nodeType;
children_ = children;
isPersistenceUnit_ = isPersistenceUnit;
}
public NodeInitializer(String nodeType, long initialValue)
{
nodeType_ = nodeType;
initialLongValue_ = new Long(initialValue);
}
public NodeInitializer(String nodeType, double initialValue)
{
nodeType_ = nodeType;
initialDoubleValue_ = new Double(initialValue);
}
public NodeInitializer(String nodeType, String initialValue)
{
nodeType_ = nodeType;
initialStringValue_ = initialValue;
}
public NodeInitializer(String nodeType, String baseNodeType, String[][] children)
{
nodeType_ = nodeType;
baseNodeType_ = baseNodeType;
children_ = children;
}
public NodeInitializer(String nodeType, boolean isPersistenceUnit, String baseNodeType, String[][] children)
{
nodeType_ = nodeType;
baseNodeType_ = baseNodeType;
children_ = children;
isPersistenceUnit_ = isPersistenceUnit;
}
public void initialize(Node node)
{
if (baseNodeType_ != null) NodeDescriptors.initialize(node, baseNodeType_);
if (children_ != null)
for (String[] childAttributes : children_)
node.add(new Node(node, childAttributes[0], childAttributes[1]));
if (initialDoubleValue_ != null) node.setDoubleValue(initialDoubleValue_);
if (initialLongValue_ != null) node.setLongValue(initialLongValue_);
if (initialStringValue_ != null) node.setStringValue(initialStringValue_);
}
private String nodeType_;
private String baseNodeType_;
private String[][] children_;
private Double initialDoubleValue_;
private Long initialLongValue_;
private String initialStringValue_;
private boolean isPersistenceUnit_ = false;
public String nodeType() { return nodeType_; }
public boolean isPersistenceUnit() { return isPersistenceUnit_; }
}
| {
"content_hash": "45d77fc80c49aa155be922412a7b4de5",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 109,
"avg_line_length": 26.571428571428573,
"alnum_prop": 0.7409579667644184,
"repo_name": "BalzGuenat/Envision",
"id": "773e375092e1936496b9a4f6b7271ceff5bcc43f",
"size": "3875",
"binary": false,
"copies": "2",
"ref": "refs/heads/version-control",
"path": "JavaImportTool/src/javaImportTool/NodeInitializer.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "780"
},
{
"name": "C",
"bytes": "106053"
},
{
"name": "C++",
"bytes": "5470359"
},
{
"name": "CSS",
"bytes": "31"
},
{
"name": "HTML",
"bytes": "1755"
},
{
"name": "Java",
"bytes": "110229"
},
{
"name": "Python",
"bytes": "2951"
},
{
"name": "QMake",
"bytes": "63976"
},
{
"name": "Shell",
"bytes": "9014"
}
],
"symlink_target": ""
} |
package net.hasor.security;
import net.hasor.core.Hasor;
/**
* 代表一个权限点。
* @version : 2013-3-26
* @author 赵永春 ([email protected])
*/
public class Permission {
private String perCode = null;
//
public Permission(String perCode) {
Hasor.assertIsNotNull(perCode, "permission code is null.");
this.perCode = perCode;
}
/**获取权限点的Code值。*/
public String getPermissionCode() {
return this.perCode;
}
public boolean equals(Object obj) {
if (obj == null)
return false;
if (obj instanceof Permission) {
String preCode = ((Permission) obj).getPermissionCode();
return this.hashCode() == preCode.hashCode();
} else if (obj instanceof String) {
return this.perCode.equals(obj);
}
return super.equals(obj);
}
public int hashCode() {
return this.perCode.hashCode();
}
} | {
"content_hash": "0b6388ae9b20083d8baeba37a9ac8382",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 68,
"avg_line_length": 27.029411764705884,
"alnum_prop": 0.5952121871599565,
"repo_name": "zycgit/configuration",
"id": "ee12ec70ee6742d05b6c87a20549a65e1bbab817",
"size": "1584",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hasor-garbage/hasor-security/src/main/java/net/hasor/security/Permission.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "69146"
},
{
"name": "Batchfile",
"bytes": "5407"
},
{
"name": "CSS",
"bytes": "180921"
},
{
"name": "FreeMarker",
"bytes": "2212"
},
{
"name": "HTML",
"bytes": "103324"
},
{
"name": "Java",
"bytes": "4052340"
},
{
"name": "JavaScript",
"bytes": "1358752"
},
{
"name": "Python",
"bytes": "25570"
},
{
"name": "Scala",
"bytes": "9529"
},
{
"name": "Shell",
"bytes": "9450"
},
{
"name": "XSLT",
"bytes": "24923"
}
],
"symlink_target": ""
} |
package org.onosproject.net.flow;
import com.google.common.collect.Iterables;
import org.onosproject.core.ApplicationId;
import org.onosproject.event.ListenerService;
import org.onosproject.net.DeviceId;
/**
* Service for injecting flow rules into the environment and for obtaining
* information about flow rules already in the environment. This implements
* semantics of a distributed authoritative flow table where the master copy
* of the flow rules lies with the controller and the devices hold only the
* 'cached' copy.
*/
public interface FlowRuleService
extends ListenerService<FlowRuleEvent, FlowRuleListener> {
/**
* The topic used for obtaining globally unique ids.
*/
String FLOW_OP_TOPIC = "flow-ops-ids";
/**
* Returns the number of flow rules in the system.
*
* @return flow rule count
*/
int getFlowRuleCount();
/**
* Returns the number of flow rules for the given device.
*
* @param deviceId device identifier
* @return number of flow rules for the given device
*/
default int getFlowRuleCount(DeviceId deviceId) {
return 0;
}
/**
* Returns the number of flow rules in the given state for the given device.
*
* @param deviceId the device identifier
* @param state the state for which to count flow rules
* @return number of flow rules in the given state for the given device
*/
default int getFlowRuleCount(DeviceId deviceId, FlowEntry.FlowEntryState state) {
return 0;
}
/**
* Returns the collection of flow entries applied on the specified device.
* This will include flow rules which may not yet have been applied to
* the device.
*
* @param deviceId device identifier
* @return collection of flow rules
*/
Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
/**
* Returns a list of rules filtered by device id and flow live type.
*
* @param deviceId the device id to lookup
* @param liveType the flow live type to lookup
* @return collection of flow entries
*/
default Iterable<FlowEntry> getFlowEntriesByLiveType(DeviceId deviceId,
FlowEntry.FlowLiveType liveType) {
return Iterables.filter(getFlowEntries(deviceId), fe -> fe.liveType() == liveType);
}
/**
* Returns a list of rules filtered by device id and flow state.
*
* @param deviceId the device id to lookup
* @param flowState the flow state to lookup
* @return collection of flow entries
*/
default Iterable<FlowEntry> getFlowEntriesByState(DeviceId deviceId,
FlowEntry.FlowEntryState flowState) {
return Iterables.filter(getFlowEntries(deviceId), fe -> fe.state() == flowState);
}
// TODO: add createFlowRule factory method and execute operations method
/**
* Applies the specified flow rules onto their respective devices. These
* flow rules will be retained by the system and re-applied anytime the
* device reconnects to the controller.
*
* @param flowRules one or more flow rules
*/
void applyFlowRules(FlowRule... flowRules);
/**
* Purges all the flow rules on the specified device.
* @param deviceId device identifier
*/
void purgeFlowRules(DeviceId deviceId);
/**
* Removes the specified flow rules from their respective devices. If the
* device is not presently connected to the controller, these flow will
* be removed once the device reconnects.
*
* @param flowRules one or more flow rules
*/
void removeFlowRules(FlowRule... flowRules);
/**
* Removes all rules submitted by a particular application.
*
* @param appId ID of application whose flows will be removed
*/
void removeFlowRulesById(ApplicationId appId);
/**
* Returns a list of rules with this application ID.
*
* @param id the application ID to look up
* @return collection of flow rules
*/
Iterable<FlowEntry> getFlowEntriesById(ApplicationId id);
/**
* Returns a list of rules filtered by application and group id.
* <p>
* Note that the group concept here is simply a logical grouping of flows.
* This is not the same as a group in the
* {@link org.onosproject.net.group.GroupService}, and this method will not
* return flows that are mapped to a particular {@link org.onosproject.net.group.Group}.
* </p>
*
* @param appId the application ID to look up
* @param groupId the group ID to look up
* @return collection of flow rules
*/
Iterable<FlowRule> getFlowRulesByGroupId(ApplicationId appId, short groupId);
/**
* Applies a batch operation of FlowRules.
*
* @param ops batch operation to apply
*/
void apply(FlowRuleOperations ops);
/**
* Returns the collection of flow table statistics of the specified device.
*
* @param deviceId device identifier
* @return collection of flow table statistics
*/
Iterable<TableStatisticsEntry> getFlowTableStatistics(DeviceId deviceId);
/**
* Returns number of flow rules in ADDED state for specified device.
*
* @param deviceId device identifier
* @return number of flow rules in ADDED state
* @deprecated since 2.1
*/
@Deprecated
default long getActiveFlowRuleCount(DeviceId deviceId) {
return 0;
}
}
| {
"content_hash": "37bcc949553a720e639f97ba0bdad628",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 92,
"avg_line_length": 33.07142857142857,
"alnum_prop": 0.6654067674586033,
"repo_name": "oplinkoms/onos",
"id": "78aef84a7df8b58d3878e06923c64ea6fc661d12",
"size": "6173",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "364443"
},
{
"name": "Dockerfile",
"bytes": "2443"
},
{
"name": "HTML",
"bytes": "319812"
},
{
"name": "Java",
"bytes": "46767333"
},
{
"name": "JavaScript",
"bytes": "4022973"
},
{
"name": "Makefile",
"bytes": "1658"
},
{
"name": "P4",
"bytes": "171319"
},
{
"name": "Python",
"bytes": "977954"
},
{
"name": "Ruby",
"bytes": "8615"
},
{
"name": "Shell",
"bytes": "336303"
},
{
"name": "TypeScript",
"bytes": "894995"
}
],
"symlink_target": ""
} |
<?php
/**
*
* @package Org_Apache_Oodt_Security
* @author Chris A. Mattmann
* @author Andrew F. Hart
* @version $Revision$
*
* PHP Single Sign On Library for EDRN PHP-based products.
*
*/
class Org_Apache_Oodt_Security_SingleSignOn {
private $connectionStatus;
private $conn;
public function __construct() {
$this->connectionStatus = 1;
}
public function getCurrentUsername() {
return $this->getSingleSignOnUsername();
}
public function isLoggedIn() {
return ($this->getSingleSignOnUsername() != null);
}
public function login($username, $password) {
// first check to see if we are already signed in
if ($this->getSingleSignOnUsername() <> ""
&& strcmp($this->getSingleSignOnUsername(), $username) == 0) {
// we're logged in already
return true;
} else {
// log in via LDAP
$ldaprdn = "uid=" . $username . ',' . SSO_BASE_DN;
$ldappass = $password;
// connect to ldap server
$ldapconn = $this->connect(SSO_LDAP_HOST, SSO_LDAP_PORT);
if ($ldapconn) {
// binding to ldap server
$ldapbind = @ ldap_bind($ldapconn, $ldaprdn, $ldappass);
// verify binding
if ($ldapbind) {
$this->createSingleSignOnCookie($username, $password);
return true;
} else {
return false;
}
} else {
$this->connectionStatus = 0;
return false;
}
}
}
public function logout() {
$this->clearSingleSignOnInfo();
}
public function getLastConnectionStatus() {
return ($this->connectionStatus == 1);
}
public function retrieveGroupsForUser($username,$searchDirectory = SSO_BASE_DN) {
// attempt to connect to ldap server
$ldapconn = $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT);
$groups = array();
if ($ldapconn) {
$filter = "(&(objectClass=groupOfUniqueNames)"
."(uniqueMember=uid={$username}," . SSO_BASE_DN . "))";
$result = ldap_search($ldapconn,$searchDirectory,$filter,array('cn'));
if ($result) {
$entries = ldap_get_entries($ldapconn,$result);
foreach ($entries as $rawGroup) {
if (isset($rawGroup['cn'][0])
&& $rawGroup['cn'][0] != '') {
$groups[] = $rawGroup['cn'][0];
}
}
}
}
return $groups;
}
/**
*
* retrieves the set of attributes from the users ldap entry
* @param string $username user for which attributes will be returned
* @param array $attributes ldap attributes to retrieve
* @param string $searchDirectory optional path to users ldap entry
*/
public function retrieveUserAttributes($username,$attributes,$searchDirectory = SSO_BASE_DN) {
// attempt to connect to ldap server
$ldapconn = $this->connect(SSO_LDAP_HOST,SSO_LDAP_PORT);
$attr = array();
if ($ldapconn) {
// get user attributes
$filter = "uid=".$username;
$result = ldap_search($ldapconn,$searchDirectory,$filter,$attributes);
if ($result) {
$entries = ldap_get_entries($ldapconn,$result);
return $entries;
} else {
return array();
}
}
}
public function changePassword($newPass,$encryptionMethod = "SHA") {
if ($this->isLoggedIn()) {
$user = "uid={$this->getSingleSignOnUsername()}," . SSO_BASE_DN ;
$entry = array();
switch (strtoupper($encryptionMethod)) {
case "SHA":
$entry['userPassword'] = "{SHA} " . base64_encode(pack("H*",sha1($newPass)));
break;
case "MD5":
$entry['userPassword'] = "{MD5} " . base64_encode(pack("H*",md5($newPass)));
break;
default:
throw new Exception("Unsupported encryption method requested");
}
if (ldap_mod_replace($this->conn,$user,$entry)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public function connect($server,$port) {
if ($conn = ldap_connect($server,$port)) {
// Connection established
$this->connectionStatus = 1;
ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($conn, LDAP_OPT_DEBUG_LEVEL, 7);
ldap_set_option($conn, LDAP_OPT_REFERRALS, 0);
$this->conn = $conn;
return $conn;
} else {
// Connection failed
return false;
}
}
private function clearSingleSignOnInfo() {
$oldCookie = $_COOKIE[SSO_COOKIE_KEY];
setcookie(SSO_COOKIE_KEY, $oldCookie, 1, "/");
}
private function getSingleSignOnUsername() {
$theCookie = $_COOKIE[SSO_COOKIE_KEY];
if ($theCookie <> "") {
$userpass = base64_decode(urldecode($theCookie));
$userpassArr = explode(":", $userpass);
return $userpassArr[0];
} else
return null;
}
private function createSingleSignOnCookie($username, $password) {
if (!isset ($_COOKIE[SSO_COOKIE_KEY])) {
$theCookieStrUnencoded = $username . ":" . $password;
$theCookieStrEncoded = "\"".base64_encode($theCookieStrUnencoded)."\"";
setcookie(SSO_COOKIE_KEY, $theCookieStrEncoded, time() + (86400 * 7), "/"); // expire in 1 day
}
}
}
?>
| {
"content_hash": "902a9b6c99ee45f1dc0b7bbe003c7e53",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 97,
"avg_line_length": 25.914438502673796,
"alnum_prop": 0.6314486174164259,
"repo_name": "LeStarch/oodt",
"id": "512dffabdcc4a90a41d86f8c2845110f84cd057d",
"size": "5647",
"binary": false,
"copies": "4",
"ref": "refs/heads/trunk",
"path": "sso/src/main/php/pear/SingleSignOn.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "2030"
},
{
"name": "C++",
"bytes": "22622"
},
{
"name": "CSS",
"bytes": "130561"
},
{
"name": "HTML",
"bytes": "105622"
},
{
"name": "Java",
"bytes": "7509195"
},
{
"name": "JavaScript",
"bytes": "189227"
},
{
"name": "Makefile",
"bytes": "1135"
},
{
"name": "PHP",
"bytes": "432498"
},
{
"name": "PLSQL",
"bytes": "3736"
},
{
"name": "Perl",
"bytes": "4459"
},
{
"name": "Python",
"bytes": "131018"
},
{
"name": "Ruby",
"bytes": "4884"
},
{
"name": "Scala",
"bytes": "1015"
},
{
"name": "Shell",
"bytes": "108646"
},
{
"name": "TeX",
"bytes": "862979"
},
{
"name": "XSLT",
"bytes": "28584"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
null
#### Original name
Placodium diplacioides Vain.
### Remarks
null | {
"content_hash": "cabe8f6607e45df7425088a902a3e2ef",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 28,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.7142857142857143,
"repo_name": "mdoering/backbone",
"id": "9f018516e0604d9de6d68d0ff2bb9a87c8561c8c",
"size": "185",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Lecanoromycetes/Teloschistales/Teloschistaceae/Placodium/Placodium diplacioides/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
.. SoftLayer API Python Client documentation
SoftLayer API Python Client |version|
========================================
`API Docs <https://softlayer.github.io/reference/softlayerapi/>`_ ``|``
`GitHub <https://github.com/softlayer/softlayer-python>`_ ``|``
`Issues <https://github.com/softlayer/softlayer-python/issues>`_ ``|``
`Pull Requests <https://github.com/softlayer/softlayer-python/pulls>`_ ``|``
`PyPI <https://pypi.python.org/pypi/softlayer/>`_ ``|``
This is the documentation to SoftLayer's Python API Bindings. These bindings
use SoftLayer's `XML-RPC interface <https://softlayer.github.io/article/xml-rpc/>`_
in order to manage SoftLayer services.
.. toctree::
:maxdepth: 3
:glob:
install
config_file
api/*
cli
Contributing
------------
.. toctree::
:maxdepth: 1
:glob:
dev/index
dev/cli
External Links
--------------
* `SoftLayer API Documentation <https://softlayer.github.io/reference/softlayerapi/>`_
* `Source on GitHub <https://github.com/softlayer/softlayer-python>`_
* `Issues <https://github.com/softlayer/softlayer-python/issues>`_
* `Pull Requests <https://github.com/softlayer/softlayer-python/pulls>`_
* `PyPI <https://pypi.python.org/pypi/softlayer/>`_
| {
"content_hash": "b105d6a1f2eafd808a20185e0e237369",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 86,
"avg_line_length": 27.84090909090909,
"alnum_prop": 0.6718367346938775,
"repo_name": "kyubifire/softlayer-python",
"id": "1b3c2b390883e3c17678de7b1b1925912a87f5ca",
"size": "1225",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/index.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "DIGITAL Command Language",
"bytes": "854"
},
{
"name": "Makefile",
"bytes": "7458"
},
{
"name": "Python",
"bytes": "1957876"
}
],
"symlink_target": ""
} |
/**
* <p><b>MODULE: remove</b></p>
*
* <p>Provides functions to remove single files or whole directories recursively.</p>
*
* @version 0.1.0
*/
var fs = require("fs"),
collectErr = require("./collectErr");
/**
* <p>Removes single files or whole directories recursively.</p>
*
* <p>All errors that occure are stored in an errors-array that is passed
* to the final callback. If no error occured null is passed.</p>
*
* @param {String} abspath an absolute path to the item that should be removed.
* @param {Function} callback after everything has been removed.
*/
function remove(abspath, callback) {
var errors = [];
function finished() {
if (errors.length > 0) {
callback(errors);
} else {
callback(null);
}
}
function recursiveRemove(abspath, callback) {
var pending,
itemRemoved;
itemRemoved = function itemRemoved() {
pending--;
if (pending === 0) {
fs.rmdir(abspath, callback);
}
}
function onLstat(err, stat) {
if (err) {
errors.push(err);
callback();
} else {
if (stat.isFile() || stat.isSymbolicLink()) {
fs.unlink(abspath, callback);
} else if (stat.isDirectory()) {
fs.readdir(abspath, walkDir);
}
}
}
function walkDir(err, items) {
var i,
item;
if (err) {
errors.push(err);
callback();
} else if(items.length > 0) {
pending = items.length;
for (i = 0; i < items.length; i++) {
item = items[i];
recursiveRemove(abspath + "/" + item, itemRemoved);
}
} else {
fs.rmdir(abspath, callback);
}
}
fs.lstat(abspath, onLstat);
}
finished = collectErr(finished, errors);
recursiveRemove(abspath, finished);
}
/**
* <p>Synchronous version of remove.</p>
*
* <p>This function throws no errors. If an error occures, it is stored in
* an errors-array that is returned after execution. If no error occured, null
* is returned</p>
*
* @param {String} abspath an absolute path to the item that should be removed.
* @return {Mixed} errors can be null or an array carrying all error objects
*/
function removeSync(abspath) {
var errors = [];
function tryIt(fn) {
try {
fn();
} catch(err) {
errors.push(err);
}
}
function recursiveRemove(abspath) {
var stat,
items,
item,
i;
function lstat() {
stat = fs.lstatSync(abspath);
}
function removeFile() {
fs.unlinkSync(abspath);
}
function removeDir() {
fs.rmdirSync(abspath);
}
function readDir() {
items = fs.readdirSync(abspath);
}
tryIt(lstat);
if (stat) {
if (stat.isFile() || stat.isSymbolicLink()) {
tryIt(removeFile);
} else if (stat.isDirectory()) {
tryIt(readDir);
for (i = 0; i < items.length; i++) {
item = items[i];
recursiveRemove(abspath + "/" + item);
}
tryIt(removeDir);
}
}
}
recursiveRemove(abspath);
if (errors.length > 0) {
return errors;
} else {
return null;
}
}
exports.remove = remove;
exports.removeSync = removeSync; | {
"content_hash": "85653bd2928739b4130bbeb144db2115",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 85,
"avg_line_length": 24.585526315789473,
"alnum_prop": 0.4955846936044956,
"repo_name": "peerigon/fshelpers",
"id": "a15eecb9df51e3dc186b88723bb7963723554034",
"size": "3737",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/remove.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "80506"
}
],
"symlink_target": ""
} |
Write-Host "Checking if the Active Directory Module is installed"
if ((Get-Module -name ActiveDirectory -ErrorAction SilentlyContinue | foreach { $_.Name }) -ne "ActiveDirectory")
{
Write-Host Active Directory Management has not been added to this session, adding it now...
Import-Module ActiveDirectory
}
else
{
Write-Host Active Directory Module is ready for commands. -backgroundcolor green -foregroundcolor yellow
Start-Sleep -s 1
}
$cred = Get-Credential $env:userdomain\$env:username
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://(URL)/PowerShell/ -Authentication Kerbeross -Credential $cred
Import-PSSession $Session
$timestamp = Get-Date -Format 'MM/dd/yyyy - h:mm:ss tt'
$dnsroot = '@' + (Get-ADDomain).dnsroot
# Groups not pulled from the template account
# $AdditionalGroups = ('','','','','','')
$filePath = Split-Path -Parent $MyInvocation.MyCommand.Definition
$importCSV = $filePath + '\accounts_to_make.csv'
$CSVdata = Import-CSV $importCSV
foreach ($cell in $CSVdata)
{
$TicketNumber = $cell.'Ticket Number'.trim()
$template_sAMAccountName = $cell.'Template Account'.trim()
$new_FirstName = $cell.'First Name'.trim()
$new_LastName = $cell.'Last Name'.trim()
$new_sAMAccountName = $cell.'User_Logon'.trim()
if ($new_sAMAccountName.length -gt 20)
{
$new_sAMAccountName = $new_sAMAccountName.substring(0,20)
}
$new_DisplayName = $new_FirstName + ' ' + $new_LastName
$new_Name = $new_FirstName + ' ' + $new_LastName
$new_UserPrincipalName = $new_sAMAccountName + $dnsroot
$new_primaryEmailAddress = $new_FirstName.replace(" ", "") + "." + $new_LastName.replace("'", "") + "@domain.com"
$new_secondaryEmailAddress = $new_FirstName.replace(" ", "") + "." + $new_LastName.replace("'", "") + "@domain.net"
$new_thirdEmailAddress = $new_FirstName.replace(" ", "") + "_" + $new_LastName.replace("'", "") + "@domain.net"
$new_Password = 'Abc1234'
$new_Office = $cell.'Office'.trim()
$new_DriveLetter = 'U:'
$new_HomeDir = $cell.'Home Drive Path'.trim() + $new_sAMAccountName
$new_Manager = $cell.Manager.trim()
$mgr = Get-ADUser -Identity $new_Manager
$mgrOU = ($mgr.DistinguishedName -split ",", 2)[1]
$new_Title = $cell.'Title / Position'.trim()
$new_Department = $cell.Department.trim()
$new_Description = 'AA/B//CCCCC/' + $new_Department + ' - ' + $timestamp
$new_Notes = $cell.Notes.trim()
$enable_afterCreation = $true
$change_passAtLogon = $true
$accountExpires = ([DateTime]($cell.'Account Expiration')).AddDays(1)
$cloneADInstance = Get-Aduser $template_sAMAccountName -Properties city,company,country,postalCode,ScriptPath,State,StreetAddress,MemberOf
$params = @{'SamAccountName' = $new_sAMAccountName;
'Instance' = $cloneADInstance;
'DisplayName' = $new_DisplayName;
'GivenName' = $new_FirstName;
'Surname' = $new_LastName;
'ChangePasswordAtLogon' = $change_passAtLogon;
'Description' = $new_Description;
'Title' = $new_Title;
'Department' = $new_Department;
'Office' = $new_Office;
'Manager' = $new_Manager;
'Enabled' = $enable_afterCreation;
'UserPrincipalName' = $new_UserPrincipalName;
'AccountPassword' = (ConvertTo-SecureString -AsPlainText $new_Password -Force);
'OtherAttributes' = @{'info'=$TicketNumber + ' - ' + $timestamp + ' - ' + $new_Notes};
}
# Create the new user account using template account
Get-ADUser -Filter {SamAccountName -eq $template_sAMAccountName} -Properties city,company,country,postalCode,ScriptPath,State,StreetAddress | New-ADUser -Name $new_Name @params
# Mirror template Security Groups
$cloneADInstance.MemberOf |
ForEach-Object {
$_ | Add-ADGroupMember -Members $new_sAMAccountName
}
# Additional Groups to add
# $AdditionalGroups | Add-ADGroupMember -Members $new_sAMAccountName
# Move the new user to Manager's OU
Get-ADUser $new_sAMAccountName | Move-ADObject -TargetPath $mgrOU
New-Item $new_HomeDir -type Directory -Force
$ACL = Get-Acl "$new_HomeDir"
$ACL.Access | ForEach { [Void]$ACL.RemoveAccessRule($_) }
$ACL.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("DOMAIN\$new_sAMAccountName","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")))
$ACL.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("DOMAIN\Domain Admins","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")))
$ACL.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("DOMAIN\Administrator","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")))
$ACL.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("BUILTIN\Administrators","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")))
Set-Acl "$new_HomeDir" $ACL
Set-ADUser -Identity $new_sAMAccountName -HomeDrive "$new_DriveLetter" -HomeDirectory "$new_HomeDir"
Set-ADAccountExpiration $new_sAMAccountName -DateTime $accountExpires -Server (Get-ADDomain).PDCEmulator
Enable-Mailbox -Identity $new_sAMAccountName
Set-Mailbox -Identity $new_sAMAccountName -EmailAddresses $new_primaryEmailAddress,$new_secondaryEmailAddress,$new_thirdEmailAddress -Alias $new_sAMAccountName
}
| {
"content_hash": "97b3bcb017998b08e220f6727e3cc33d",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 187,
"avg_line_length": 51.857142857142854,
"alnum_prop": 0.6475550964187328,
"repo_name": "HMcC-Tek/ActiveDirectory",
"id": "8a9261a43ee5e175ad2065f6d4a8698224429848",
"size": "5827",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "massCreator.ps1",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PowerShell",
"bytes": "5827"
}
],
"symlink_target": ""
} |
package com.alibaba.druid.bvt.pool.exception;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import junit.framework.TestCase;
import org.junit.Assert;
import com.alibaba.druid.mock.MockConnection;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.alibaba.druid.pool.vendor.OracleExceptionSorter;
import com.alibaba.druid.stat.DruidDataSourceStatManager;
import com.alibaba.druid.stat.JdbcStatManager;
import com.alibaba.druid.test.util.OracleMockDriver;
import com.alibaba.druid.util.JdbcUtils;
public class OracleExceptionSorterTest_stmt_executeUpdate_1 extends TestCase {
private DruidDataSource dataSource;
protected void setUp() throws Exception {
Assert.assertEquals(0, JdbcStatManager.getInstance().getSqlList().size());
dataSource = new DruidDataSource();
dataSource.setExceptionSorter(new OracleExceptionSorter());
dataSource.setDriver(new OracleMockDriver());
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setPoolPreparedStatements(true);
dataSource.setMaxOpenPreparedStatements(100);
}
@Override
protected void tearDown() throws Exception {
JdbcUtils.close(dataSource);
Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
}
public void test_connect() throws Exception {
String sql = "SELECT 1";
{
DruidPooledConnection conn = dataSource.getConnection();
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.execute();
pstmt.close();
conn.close();
}
DruidPooledConnection conn = dataSource.getConnection();
MockConnection mockConn = conn.unwrap(MockConnection.class);
Assert.assertNotNull(mockConn);
Statement stmt = conn.createStatement();
SQLException exception = new SQLException("xx", "xxx", 28);
mockConn.setError(exception);
SQLException execErrror = null;
try {
stmt.executeUpdate(sql, Statement.RETURN_GENERATED_KEYS);
} catch (SQLException ex) {
execErrror = ex;
}
Assert.assertNotNull(execErrror);
Assert.assertSame(exception, execErrror);
SQLException commitError = null;
try {
conn.commit();
} catch (SQLException ex) {
commitError = ex;
}
Assert.assertNotNull(commitError);
Assert.assertSame(exception, commitError.getCause());
conn.close();
}
}
| {
"content_hash": "d8f611bbfd6f29a227f3605ac54ceeaf",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 100,
"avg_line_length": 31.152941176470588,
"alnum_prop": 0.6805135951661632,
"repo_name": "xiaomozhang/druid",
"id": "6b357493f270f80ca7e2956e58f81ca13e491c0b",
"size": "2648",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "druid-1.0.9/src/test/java/com/alibaba/druid/bvt/pool/exception/OracleExceptionSorterTest_stmt_executeUpdate_1.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "822"
},
{
"name": "CSS",
"bytes": "834"
},
{
"name": "HTML",
"bytes": "107230"
},
{
"name": "Java",
"bytes": "9452355"
},
{
"name": "JavaScript",
"bytes": "27929"
},
{
"name": "PLSQL",
"bytes": "3943"
},
{
"name": "Shell",
"bytes": "439"
}
],
"symlink_target": ""
} |
jest
.dontMock('body-checker')
.dontMock('check-types');
describe('parameter count', function() {
var check = require('body-checker');
it('Should reject the wrong number of parameters', function() {
var reqBody = {
name: 'Randy',
rogue: 'DROP users'
};
check(reqBody, {
name: {
type: 'string',
required: true
}
}, function(err, body) {
expect(err).toBeDefined();
expect(err.message).toEqual('Illegal parameter "rogue" provided');
expect(body).toBeUndefined();
});
});
});
describe('undefined params', function() {
var check = require('body-checker');
it('Should not return undefined key values when leys are missing', function() {
var reqBody = {
name: "Randy"
};
var strongParams = { name: { type: 'string', required: true},
address: { type: 'string', required: false}};
check(reqBody, strongParams, function(err, body) {
expect(err).toBeNull();
expect(body).toBeDefined();
expect(Object.keys(body).length).toEqual(1);
});
});
it('Should handle empty object when strong params without keys', function() {
var reqBody = {};
var strongParams = {};
check(reqBody, strongParams, function(err, body) {
expect(err).toBeNull();
expect(body).toBeDefined();
expect(Object.keys(body).length).toEqual(0);
});
});
it('Should handle bad object as strong params without keys', function() {
var reqBody = { test: 'should fail'};
var strongParams = {};
check(reqBody, strongParams, function(err, body) {
expect(err).toBeDefined();
expect(err.message).toEqual('Illegal parameter "test" provided');
expect(body).toBeUndefined();
});
});
});
describe('required parameters', function() {
var check = require('body-checker');
it('Should fail on an undefined required parameter', function() {
var reqBody = {
name: 'Randy',
email: ''
};
check(reqBody, {
name: {
type: 'string',
required: true
},
email: {
type: 'string',
required: true
}
}, function(err, body) {
expect(err).toBeDefined();
expect(err.message).toEqual('Missing required parameter email');
expect(body).toBeUndefined();
});
});
it('Should NOT fail on an undefined required parameter', function() {
var reqBody = {
name: 'Randy'
};
check(reqBody, {
name: {
type: 'string',
required: true
},
email: {
type: 'string',
required: false
}
}, function(err, body) {
expect(body).toBeDefined();
expect(err).toBeNull();
expect(body.name).toEqual('Randy');
expect(body.email).toBeUndefined();
});
});
});
describe('default parameters', function() {
var check = require('body-checker');
it('Should set the default on an undefined optional parameter', function() {
var reqBody = {
name: 'Randy',
email: ''
};
check(reqBody, {
name: {
type: 'string',
required: true
},
email: {
type: 'string',
required: false,
default: '[email protected]'
}
}, function(err, body) {
expect(err).toBeNull();
expect(body).toBeDefined();
expect(body.email).toEqual('[email protected]');
});
});
});
describe('type check', function() {
var check = require('body-checker');
it('Should fail on type error', function() {
var reqBody = {
name: 'Randy',
id: '1'
};
check(reqBody, {
name: {
type: 'string',
required: true
},
id: {
type: 'number',
required: true
}
}, function(err, body) {
expect(err).toBeDefined();
expect(err.message).toEqual('Expected "id" to be type number, instead found string');
expect(body).toBeUndefined();
});
});
});
describe('illegal parameter', function() {
var check = require('body-checker');
it('Should fail on illegal parameter', function(done) {
var reqBody = {
name: 'Randy',
email: '',
evil: 'attack'
};
check(reqBody, {
name: {
type: 'string',
required: true
},
email: {
type: 'string',
required: false,
default: '[email protected]'
},
id: {
type: 'any',
required: false
}
}, function(err, body) {
expect(err).toBeDefined();
expect(err.message).toEqual('Illegal parameter "evil" provided');
expect(body).toBeUndefined();
});
});
});
describe('valid parameters', function() {
var check = require('body-checker');
it('Should return the body if all is good', function() {
var reqBody = {
name: 'Randy',
id: 1,
price: 2.2,
bool: false,
email: ''
};
check(reqBody, {
name: {
type: 'string',
default: 'A default',
required: true
},
id: {
type: 'number',
default: 20,
required: true
},
bool: {
type: 'boolean',
default: false,
required: false
},
price: {
type: 'number',
default: 20,
required: false
},
email: {
type: 'string',
default: '[email protected]',
required: false
}
}, function(err, body) {
expect(err).toBeNull();
expect(body).toBeDefined();
expect(body.name).toEqual('Randy');
expect(body.id).toEqual(1);
expect(body.bool).toBeFalsy();
expect(body.email).toEqual('[email protected]');
});
});
});
| {
"content_hash": "0f591a320ceb1e9ff92c1d81b720d00c",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 88,
"avg_line_length": 16.905228758169933,
"alnum_prop": 0.5967523680649527,
"repo_name": "luceracloud/body-checker",
"id": "fc1d30b8b946713a390dd51e3763599d90c3deda",
"size": "5173",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "__tests__/test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "6634"
}
],
"symlink_target": ""
} |
#ifndef MITKCONTROLPOINTMANAGER_H
#define MITKCONTROLPOINTMANAGER_H
#include <MitkSemanticRelationsExports.h>
// semantic relations module
#include "mitkSemanticTypes.h"
// mitk core
#include <mitkDataNode.h>
namespace mitk
{
/**
* @brief Provides helper functions that are needed to work with control points.
*
* These functions help to generate new control points, check for overlapping / containing control points or provide functionality
* to find a fitting control point or even extend an already existing control point.
*/
/**
* @brief Generates a control point from a given data node.
* The date is extracted from the data node by using the 'DICOMHelper::GetDICOMDateFromDataNode'-function.
*
* @param datanode A data node pointer, whose date should be included in the newly generated control point.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint GenerateControlPoint(const mitk::DataNode* datanode);
/**
* @brief Find and return a whole control point including its date given a specific control point UID.
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPointUID The control point UID as string.
*
* @return The control point with its UID and the date.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint GetControlPointByUID(const SemanticTypes::CaseID& caseID, const SemanticTypes::ID& controlPointUID);
/**
* @brief Returns an already existing control point from the given vector of control points. This existing control point has the
* the same date (year, month, day) as the given single control point.
* If no existing control point can be found an empty control point is returned.
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint The control point to check for existence.
*
* @return The existing control point.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint FindExistingControlPoint(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint);
/**
* @brief Returns an already existing close control point from the given vector of control points. This closest control point has a
* date that is within a certain distance-in-days to the given control point.
* If no closest control point can be found within the distance threshold an empty control point is returned.
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint The control point to check for distance.
*
* @return The closest control point.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint FindClosestControlPoint(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint);
/**
* @brief Returns the examination period to which the given control point belongs.
* Each examination point holds a vector of control point UIDs so that the UID of the given control point can be compared against the UIDs of the vector.
* An empty examination period is returned if,
* - the given vector of examination periods is empty
* - the examination periods do not contain any control point UIDs
* - the UID of the given control point is not contained in any examination period
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint The control point of which the examination period should be found.
*
* @return The examination period that contains the given control point.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ExaminationPeriod FindContainingExaminationPeriod(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint);
/**
* @brief Return the examination period to which the given data node belongs.
* The control point is used to find an already existing or the closest control point in the semantic relations storage.
* If such a control point is found, the 'FindClosestControlPoint'-function with this control point as an argument is used
* to actually find the corresponding examination period.
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint The control point of which the examination period should be found.
*
* @return The examination period that fits the given data node.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ExaminationPeriod FindFittingExaminationPeriod(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint);
/**
* @brief Return the examination period to which the given data node belongs.
* The DICOM date of the data node is used to find an already existing or the closest control point in the semantic relations storage.
* If such a control point is found, the 'FindFittingExaminationPeriod'-function with this control point as an argument is used
* to actually find the corresponding examination period.
*
* @param datanode A data node pointer, whose date should be included in the newly generated control point.
*
* @return The examination period that contains the given data node.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ExaminationPeriod FindFittingExaminationPeriod(const DataNode* dataNode);
/**
* @brief Sort the given vector of examination periods.
* Each examination period has a vector of control point UIDs (stored in chronological order).
* The examination periods can be sorted by comparing the first control points of the examination periods.
*
* @param caseID The current case identifier is defined by the given string.
* @param allExaminationPeriods The examination periods to sort.
*/
MITKSEMANTICRELATIONS_EXPORT void SortAllExaminationPeriods(const SemanticTypes::CaseID& caseID, SemanticTypes::ExaminationPeriodVector& allExaminationPeriods);
} // namespace mitk
#endif // MITKCONTROLPOINTMANAGER_H
| {
"content_hash": "c8daa7067dc72b3b9e939647281f42ae",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 182,
"avg_line_length": 56.22018348623853,
"alnum_prop": 0.7483681462140992,
"repo_name": "fmilano/mitk",
"id": "601ca9c945cbb125d9add7e24c6f01aae794fce1",
"size": "6509",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Modules/SemanticRelations/include/mitkControlPointManager.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "2668761"
},
{
"name": "C++",
"bytes": "25270216"
},
{
"name": "CSS",
"bytes": "52056"
},
{
"name": "Java",
"bytes": "350330"
},
{
"name": "JavaScript",
"bytes": "47660"
},
{
"name": "Makefile",
"bytes": "742"
},
{
"name": "Objective-C",
"bytes": "509788"
},
{
"name": "Perl",
"bytes": "982"
},
{
"name": "Python",
"bytes": "7545"
},
{
"name": "Shell",
"bytes": "6507"
},
{
"name": "TeX",
"bytes": "1204"
},
{
"name": "XSLT",
"bytes": "15769"
}
],
"symlink_target": ""
} |
use std::fs::File;
use std::io::{BufReader, BufRead};
use std::path::Path;
use super::super::context::{Context};
use super::super::packages;
use super::generic::{run_command_at_env, capture_command};
use builder::distrib::Distribution;
pub fn scan_features(ver: u8, pkgs: &Vec<String>) -> Vec<packages::Package> {
let mut res = vec!();
res.push(packages::BuildEssential);
if ver == 2 {
res.push(packages::Python2);
res.push(packages::Python2Dev);
res.push(packages::PipPy2);
} else {
res.push(packages::Python3);
res.push(packages::Python3Dev);
res.push(packages::PipPy3);
}
for name in pkgs.iter() {
if name[..].starts_with("git+https") {
res.push(packages::Git);
res.push(packages::Https);
} else if name[..].starts_with("git+") {
res.push(packages::Git);
} else if name[..].starts_with("hg+https") {
res.push(packages::Mercurial);
res.push(packages::Https);
} else if name[..].starts_with("hg+") {
res.push(packages::Mercurial);
}
}
return res;
}
fn pip_args(ctx: &mut Context, ver: u8) -> Vec<String> {
let mut args = vec!(
(if ver == 2 { "python2" } else { "python3" }).to_string(),
"-m".to_string(), "pip".to_string(),
"install".to_string(),
"--ignore-installed".to_string(),
);
if ctx.pip_settings.index_urls.len() > 0 {
let mut indexes = ctx.pip_settings.index_urls.iter();
if let Some(ref lnk) = indexes.next() {
args.push(format!("--index-url={}", lnk));
for lnk in indexes {
args.push(format!("--extra-index-url={}", lnk));
}
}
}
ctx.pip_settings.trusted_hosts.iter().map(|h| {
args.push("--trusted-host".to_string());
args.push(h.to_string());
}).last();
if !ctx.pip_settings.dependencies {
args.push("--no-deps".to_string());
}
for lnk in ctx.pip_settings.find_links.iter() {
args.push(format!("--find-links={}", lnk));
}
return args;
}
pub fn pip_install(distro: &mut Box<Distribution>, ctx: &mut Context,
ver: u8, pkgs: &Vec<String>)
-> Result<(), String>
{
try!(packages::ensure_packages(distro, ctx,
&scan_features(ver, pkgs)[0..]));
let mut pip_cli = pip_args(ctx, ver);
pip_cli.extend(pkgs.clone().into_iter());
run_command_at_env(ctx, &pip_cli, &Path::new("/work"), &[
("PYTHONPATH", "/tmp/non-existent:/tmp/pip-install")])
}
pub fn pip_requirements(distro: &mut Box<Distribution>, ctx: &mut Context,
ver: u8, reqtxt: &Path)
-> Result<(), String>
{
let f = try!(File::open(&Path::new("/work").join(reqtxt))
.map_err(|e| format!("Can't open requirements file: {}", e)));
let f = BufReader::new(f);
let mut names = vec!();
for line in f.lines() {
let line = try!(line
.map_err(|e| format!("Error reading requirements: {}", e)));
let chunk = line[..].trim();
// Ignore empty lines and comments
if chunk.len() == 0 || chunk.starts_with("#") {
continue;
}
names.push(chunk.to_string());
}
try!(packages::ensure_packages(distro, ctx,
&scan_features(ver, &names)[0..]));
let mut pip_cli = pip_args(ctx, ver);
pip_cli.push("--requirement".to_string());
pip_cli.push(reqtxt.display().to_string()); // TODO(tailhook) fix conversion
run_command_at_env(ctx, &pip_cli, &Path::new("/work"), &[
("PYTHONPATH", "/tmp/non-existent:/tmp/pip-install")])
}
pub fn configure(ctx: &mut Context) -> Result<(), String> {
try!(ctx.add_cache_dir(Path::new("/tmp/pip-cache"),
"pip-cache".to_string()));
ctx.environ.insert("PIP_CACHE_DIR".to_string(),
"/tmp/pip-cache".to_string());
Ok(())
}
pub fn freeze(ctx: &mut Context) -> Result<(), String> {
use std::fs::File; // TODO(tailhook) migrate whole module
use std::io::Write; // TODO(tailhook) migrate whole module
if ctx.featured_packages.contains(&packages::PipPy2) {
try!(capture_command(ctx, &[
"python2".to_string(),
"-m".to_string(),
"pip".to_string(),
"freeze".to_string(),
], &[("PYTHONPATH", "/tmp/non-existent:/tmp/pip-install")])
.and_then(|out| {
File::create("/vagga/container/pip2-freeze.txt")
.and_then(|mut f| f.write_all(&out))
.map_err(|e| format!("Error dumping package list: {}", e))
}));
}
if ctx.featured_packages.contains(&packages::PipPy3) {
try!(capture_command(ctx, &[
"python3".to_string(),
"-m".to_string(),
"pip".to_string(),
"freeze".to_string(),
], &[("PYTHONPATH", "/tmp/non-existent:/tmp/pip-install")])
.and_then(|out| {
File::create("/vagga/container/pip3-freeze.txt")
.and_then(|mut f| f.write_all(&out))
.map_err(|e| format!("Error dumping package list: {}", e))
}));
}
Ok(())
}
| {
"content_hash": "742253e7e19dad3ea262fa0a67f81d5d",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 80,
"avg_line_length": 35.89041095890411,
"alnum_prop": 0.5341603053435114,
"repo_name": "rrader/vagga",
"id": "9a4a42a2802366050adde2fbaaf90fb9d30454d2",
"size": "5240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/builder/commands/pip.rs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "1259"
},
{
"name": "Python",
"bytes": "1664"
},
{
"name": "Rust",
"bytes": "310667"
},
{
"name": "Shell",
"bytes": "19114"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "3a27c9a0cb0ae9e1399e74b0bd54f9b5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "f700958d9c26c6036f804244df03de827184f32f",
"size": "192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Bromeliaceae/Hohenbergia/Hohenbergia pabstii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
'use strict';
module.exports = function(sequelize, DataTypes) {
var Category = sequelize.define('Category', {
name: DataTypes.STRING,
description: DataTypes.STRING
}, {
classMethods: {
associate: function(models) {
// associations can be defined here
Category.hasMany(models.Book);
}
},
timestamps: true,
createdAt: 'createdAt',
updatedAt: 'updatedAt',
deletedAt: false
});
return Category;
}; | {
"content_hash": "403a45fd1fdbdab3d2e1a5039818765c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 49,
"avg_line_length": 24.68421052631579,
"alnum_prop": 0.6247334754797441,
"repo_name": "Jalaj-khajotia/Library-backend",
"id": "0db2814e072e3da9e121c6ec6235cd1bbe8026b8",
"size": "469",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dbmodels/category.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "65771"
}
],
"symlink_target": ""
} |
package com.teleca.jamendo.util.download;
import java.io.File;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import com.teleca.jamendo.JamendoApplication;
import com.teleca.jamendo.api.PlaylistEntry;
import com.teleca.jamendo.api.Track;
import com.teleca.jamendo.db.AlbumDatabaseBuilder;
import com.teleca.jamendo.db.TrackDatabaseBuilder;
/**
* Database implementation
*
* @author Lukasz Wisniewski
*/
public class DownloadDatabaseImpl implements DownloadDatabase {
private String mPath;
private static final String TABLE_LIBRARY = "library";
/**
* Default constructor
*
* @param path Database file
*/
public DownloadDatabaseImpl(String path){
mPath = path;
SQLiteDatabase db = getDb();
if(db == null)
return;
db.execSQL("CREATE TABLE IF NOT EXISTS "
+ TABLE_LIBRARY
+ " (track_id INTEGER UNIQUE, downloaded INTEGER, track_name VARCHAR,"
+ " track_duration INTEGER, track_url VARCHAR, track_stream VARCHAR, track_rating REAL,"
+ " album_id INTEGER, album_name VARCHAR, album_image VARCHAR, album_rating REAL, artist_name VARCHAR);");
db.close();
}
private SQLiteDatabase getDb(){
// FIXME hardcoded path
boolean success = (new File("/sdcard/music")).mkdirs();
if (success) {
Log.i(JamendoApplication.TAG, "Directory: " + "/sdcard/music" + " created");
}
try {
return SQLiteDatabase.openDatabase(mPath, null, SQLiteDatabase.CREATE_IF_NECESSARY);
} catch (SQLException e) {
Log.e(JamendoApplication.TAG, "Failed creating database");
return null;
}
}
@Override
public boolean addToLibrary(PlaylistEntry entry) {
SQLiteDatabase db = getDb();
// put playlistentry data the table
ContentValues values = new ContentValues();
values.put("downloaded", 0);
values.putAll(new TrackDatabaseBuilder().deconstruct(entry.getTrack()));
values.putAll(new AlbumDatabaseBuilder().deconstruct(entry.getAlbum()));
String[] whereArgs = {""+entry.getTrack().getId()};
int row_count = db.update(TABLE_LIBRARY, values, "track_id=?", whereArgs);
if(row_count == 0){
db.insert(TABLE_LIBRARY, null, values);
}
db.close();
return row_count != 0;
}
@Override
public void setStatus(PlaylistEntry entry, boolean downloaded) {
SQLiteDatabase db = getDb();
ContentValues values = new ContentValues();
values.put("downloaded", downloaded ? 1 : 0);
String[] whereArgs = {""+entry.getTrack().getId()};
int row_count = db.update(TABLE_LIBRARY, values, "track_id=?", whereArgs);
if(row_count == 0){
Log.e(JamendoApplication.TAG, "Failed to update "+TABLE_LIBRARY);
}
db.close();
}
@Override
public boolean trackAvailable(Track track) {
SQLiteDatabase db = getDb();
if(db == null)
return false;
String[] selectionArgs = {""+track.getId()};
Cursor query = db.query(TABLE_LIBRARY, null, "track_id=? and downloaded>0", selectionArgs, null, null, null);
boolean value = query.getCount() > 0;
query.close();
db.close();
return value;
}
}
| {
"content_hash": "d57ec6bed1b889fd7a5c01a9c2506ec3",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 111,
"avg_line_length": 26.317073170731707,
"alnum_prop": 0.6793327154772938,
"repo_name": "simceChina/welfare",
"id": "66ad0489b2ebfbce0fa3d79bf076e6d52a46b740",
"size": "3884",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/teleca/jamendo/util/download/DownloadDatabaseImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/******************************************************************************
*
* Module Name: nswalk - Functions for walking the ACPI namespace
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2007, R. Byron Moore
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nswalk")
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_next_node
*
* PARAMETERS: Type - Type of node to be searched for
* parent_node - Parent node whose children we are
* getting
* child_node - Previous child that was found.
* The NEXT child will be returned
*
* RETURN: struct acpi_namespace_node - Pointer to the NEXT child or NULL if
* none is found.
*
* DESCRIPTION: Return the next peer node within the namespace. If Handle
* is valid, Scope is ignored. Otherwise, the first node
* within Scope is returned.
*
******************************************************************************/
struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct acpi_namespace_node
*parent_node, struct acpi_namespace_node
*child_node)
{
struct acpi_namespace_node *next_node = NULL;
ACPI_FUNCTION_ENTRY();
if (!child_node) {
/* It's really the parent's _scope_ that we want */
if (parent_node->child) {
next_node = parent_node->child;
}
}
else {
/* Start search at the NEXT node */
next_node = acpi_ns_get_next_valid_node(child_node);
}
/* If any type is OK, we are done */
if (type == ACPI_TYPE_ANY) {
/* next_node is NULL if we are at the end-of-list */
return (next_node);
}
/* Must search for the node -- but within this scope only */
while (next_node) {
/* If type matches, we are done */
if (next_node->type == type) {
return (next_node);
}
/* Otherwise, move on to the next node */
next_node = acpi_ns_get_next_valid_node(next_node);
}
/* Not found */
return (NULL);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_walk_namespace
*
* PARAMETERS: Type - acpi_object_type to search for
* start_node - Handle in namespace where search begins
* max_depth - Depth to which search is to reach
* Flags - Whether to unlock the NS before invoking
* the callback routine
* user_function - Called when an object of "Type" is found
* Context - Passed to user function
* return_value - from the user_function if terminated early.
* Otherwise, returns NULL.
* RETURNS: Status
*
* DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
* starting (and ending) at the node specified by start_handle.
* The user_function is called whenever a node that matches
* the type parameter is found. If the user function returns
* a non-zero value, the search is terminated immediately and this
* value is returned to the caller.
*
* The point of this procedure is to provide a generic namespace
* walk routine that can be called from multiple places to
* provide multiple services; the User Function can be tailored
* to each task, whether it is a print function, a compare
* function, etc.
*
******************************************************************************/
acpi_status
acpi_ns_walk_namespace(acpi_object_type type,
acpi_handle start_node,
u32 max_depth,
u32 flags,
acpi_walk_callback user_function,
void *context, void **return_value)
{
acpi_status status;
acpi_status mutex_status;
struct acpi_namespace_node *child_node;
struct acpi_namespace_node *parent_node;
acpi_object_type child_type;
u32 level;
ACPI_FUNCTION_TRACE(ns_walk_namespace);
/* Special case for the namespace Root Node */
if (start_node == ACPI_ROOT_OBJECT) {
start_node = acpi_gbl_root_node;
}
/* Null child means "get first node" */
parent_node = start_node;
child_node = NULL;
child_type = ACPI_TYPE_ANY;
level = 1;
/*
* Traverse the tree of nodes until we bubble back up to where we
* started. When Level is zero, the loop is done because we have
* bubbled up to (and passed) the original parent handle (start_entry)
*/
while (level > 0) {
/* Get the next node in this scope. Null if not found */
status = AE_OK;
child_node =
acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
child_node);
if (child_node) {
/* Found next child, get the type if we are not searching for ANY */
if (type != ACPI_TYPE_ANY) {
child_type = child_node->type;
}
/*
* Ignore all temporary namespace nodes (created during control
* method execution) unless told otherwise. These temporary nodes
* can cause a race condition because they can be deleted during the
* execution of the user function (if the namespace is unlocked before
* invocation of the user function.) Only the debugger namespace dump
* will examine the temporary nodes.
*/
if ((child_node->flags & ANOBJ_TEMPORARY) &&
!(flags & ACPI_NS_WALK_TEMP_NODES)) {
status = AE_CTRL_DEPTH;
}
/* Type must match requested type */
else if (child_type == type) {
/*
* Found a matching node, invoke the user callback function.
* Unlock the namespace if flag is set.
*/
if (flags & ACPI_NS_WALK_UNLOCK) {
mutex_status =
acpi_ut_release_mutex
(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(mutex_status)) {
return_ACPI_STATUS
(mutex_status);
}
}
status =
user_function(child_node, level, context,
return_value);
if (flags & ACPI_NS_WALK_UNLOCK) {
mutex_status =
acpi_ut_acquire_mutex
(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(mutex_status)) {
return_ACPI_STATUS
(mutex_status);
}
}
switch (status) {
case AE_OK:
case AE_CTRL_DEPTH:
/* Just keep going */
break;
case AE_CTRL_TERMINATE:
/* Exit now, with OK status */
return_ACPI_STATUS(AE_OK);
default:
/* All others are valid exceptions */
return_ACPI_STATUS(status);
}
}
/*
* Depth first search: Attempt to go down another level in the
* namespace if we are allowed to. Don't go any further if we have
* reached the caller specified maximum depth or if the user
* function has specified that the maximum depth has been reached.
*/
if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
if (acpi_ns_get_next_node
(ACPI_TYPE_ANY, child_node, NULL)) {
/* There is at least one child of this node, visit it */
level++;
parent_node = child_node;
child_node = NULL;
}
}
} else {
/*
* No more children of this node (acpi_ns_get_next_node failed), go
* back upwards in the namespace tree to the node's parent.
*/
level--;
child_node = parent_node;
parent_node = acpi_ns_get_parent_node(parent_node);
}
}
/* Complete walk, not terminated by user function */
return_ACPI_STATUS(AE_OK);
}
| {
"content_hash": "b1b88142dfd8279990f4cf5b1ff10b2f",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 99,
"avg_line_length": 31.912457912457914,
"alnum_prop": 0.6035028487022579,
"repo_name": "ut-osa/laminar",
"id": "280b8357c46c32ebe3f5dc9933f6a19ae95f4d0e",
"size": "9478",
"binary": false,
"copies": "67",
"ref": "refs/heads/master",
"path": "linux-2.6.22.6/drivers/acpi/namespace/nswalk.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "4526"
},
{
"name": "Assembly",
"bytes": "7753785"
},
{
"name": "Awk",
"bytes": "5239"
},
{
"name": "Bison",
"bytes": "75151"
},
{
"name": "C",
"bytes": "209779557"
},
{
"name": "C++",
"bytes": "5954668"
},
{
"name": "CSS",
"bytes": "11885"
},
{
"name": "Java",
"bytes": "12132154"
},
{
"name": "Makefile",
"bytes": "731243"
},
{
"name": "Objective-C",
"bytes": "564040"
},
{
"name": "Perl",
"bytes": "196100"
},
{
"name": "Python",
"bytes": "11786"
},
{
"name": "Ruby",
"bytes": "3219"
},
{
"name": "Scala",
"bytes": "12158"
},
{
"name": "Scilab",
"bytes": "22980"
},
{
"name": "Shell",
"bytes": "205177"
},
{
"name": "TeX",
"bytes": "62636"
},
{
"name": "UnrealScript",
"bytes": "20822"
},
{
"name": "XSLT",
"bytes": "6544"
}
],
"symlink_target": ""
} |
module WebkitRemote
class Client
# API for the Input domain.
module Input
# Dispatches a mouse event.
#
# @param [Symbol] type the event type (:move, :down, :up)
# @param [Integer] x the X coordinate, relative to the main frame's viewport
# @param [Integer] y the Y coordinate, relative to the main frame's viewport
# @param [Hash] opts optional information
# @option opts [Symbol] button :left, :right, :middle, or nil (none); nil by
# default
# @option opts [Array<Symbol>] modifiers combination of :alt, :ctrl, :shift,
# and :command / :meta (empty by default)
# @option opts [Number] time the event's time, as a JavaScript timestamp
# @option opts [Number] clicks number of times the mouse button was clicked
# (0 by default)
# @return [WebkitRemote::Client] self
def mouse_event(type, x, y, opts = {})
options = { x: x, y: y }
options[:type] = case type
when :move
'mouseMoved'
when :down
'mousePressed'
when :up
'mouseReleased'
else
raise RuntimeError, "Unsupported mouse event type #{type}"
end
options[:timestamp] = opts[:time] if opts[:time]
options[:clickCount] = opts[:clicks] if opts[:clicks]
if opts[:button]
options[:button] = opts[:button].to_s
else
options[:button] = 'none'
end
if opts[:modifiers]
flags = 0
opts[:modifiers].each do |modifier|
flags |= case modifier
when :alt
1
when :ctrl
2
when :command, :meta
4
when :shift
8
end
end
options[:modifiers] = flags
end
@rpc.call 'Input.dispatchMouseEvent', options
self
end
# Dispatches a keyboard event.
#
# @param [Symbol] type the event type (:char, :down, :up, :raw_down)
# @param [Hash] opts optional information
# @option opts [Array<Symbol>] modifiers combination of :alt, :ctrl, :shift,
# and :command / :meta (empty by default)
# @option opts [Number] time the event's time, as a JavaScript timestamp
# @option opts [Number] clicks number of times the mouse button was clicked
# (0 by default)
# @option opts [String] text as generated by processing a virtual key code
# with a keyboard layout; not needed for :up and :raw_down events;
# ('' by default)
# @option opts [String] unmodified_text text that would have been generated
# by the keyboard if no modifiers were pressed (except for shift);
# useful for shortcut (accelerator) key handling; ('' by default)
# @option opts [Number] vkey the Windows virtual key code for the key;
# see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Virtual_key_codes
# @option opts [Number] key the unique key identifier (e.g., 'U+0041');
# ('' by default)
# @option opts [Boolean] auto_repeat true if the event was generated by an
# auto-repeat while the key was being held down
# @option opts [Boolean] keypad true if the event was generated from the
# keypad
# @option opts [Boolean] system_key true if the event was a system key event
# @return [WebkitRemote::Client] self
def key_event(type, opts)
options = {}
options[:type] = case type
when :char
'char'
when :down
'keyDown'
when :up
'keyUp'
when :raw_down
'rawKeyDown'
else
raise RuntimeError, "Unsupported keyboard event type #{type}"
end
options[:timestamp] = opts[:time] if opts[:time]
if opts[:modifiers]
flags = 0
opts[:modifiers].each do |modifier|
flags |= case modifier
when :alt
1
when :ctrl
2
when :command, :meta
4
when :shift
8
end
end
options[:modifiers] = flags
end
options[:key] = opts[:key] if opts[:key]
options[:windowsVirtualKeyCode] = opts[:vkey] if opts[:vkey]
options[:unmodifiedText] = opts[:unmodified_text] if opts[:unmodified_text]
if opts[:text]
options[:text] = opts[:text]
options[:unmodifiedText] ||= opts[:text]
end
options[:autoRepeat] = true if opts[:auto_repeat]
options[:isKeypad] = true if opts[:keypad]
options[:isSystemKey] = true if opts[:system_key]
@rpc.call 'Input.dispatchKeyEvent', options
self
end
end # module WebkitRemote::Client::Input
include WebkitRemote::Client::Input
end # namespace WebkitRemote::Client
end # namespace WebkitRemote
| {
"content_hash": "04d0388cbfc9d6eb4b345920141a4f6b",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 92,
"avg_line_length": 31.928571428571427,
"alnum_prop": 0.6328859060402685,
"repo_name": "pwnall/webkit_remote",
"id": "31ae12a3b1707c034dc8b587cb0e7c345be0b6b8",
"size": "4470",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/webkit_remote/client/input.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "157057"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>graphs: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.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">
<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="../..">clean / released</a></li>
<li class="active"><a href="">8.5.2~camlp4 / graphs - 8.8.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
graphs
<small>
8.8.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-29 00:16:15 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-29 00:16:15 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp4 4.04+1 Camlp4 is a system for writing extensible parsers for programming languages
conf-findutils 1 Virtual package relying on findutils
coq 8.5.2~camlp4 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.04.2 The OCaml compiler (virtual package)
ocaml-base-compiler 4.04.2 Official 4.04.2 release
ocaml-config 1 OCaml Switch Configuration
ocamlbuild 0.14.2 OCamlbuild is a build system with builtin rules to easily build most OCaml projects
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/coq-contribs/graphs"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Graphs"]
depends: [
"ocaml"
"coq" {>= "8.8" & < "8.9~"}
"coq-int-map" {>= "8.8" & < "8.9~"}
]
tags: [ "keyword: graphs" "keyword: graph theory" "keyword: cycle detection" "keyword: paths" "keyword: constraints" "keyword: inequalities" "keyword: reflection" "category: Computer Science/Decision Procedures and Certified Algorithms/Decision procedures" "category: Miscellaneous/Extracted Programs/Combinatorics" ]
authors: [ "Jean Goubault" ]
bug-reports: "https://github.com/coq-contribs/graphs/issues"
dev-repo: "git+https://github.com/coq-contribs/graphs.git"
synopsis: "Satisfiability of inequality constraints and detection of cycles with negative weight in graphs"
description:
"*******************************************************************"
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/graphs/archive/v8.8.0.tar.gz"
checksum: "md5=aa176fba6a90b6ffff8f673958baa68d"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</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 --show-action coq-graphs.8.8.0 coq.8.5.2~camlp4</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.2~camlp4).
The following dependencies couldn't be met:
- coq-graphs -> coq >= 8.8 -> ocaml >= 4.05.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-graphs.8.8.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<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 🚀</h2>
<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>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</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">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</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>
| {
"content_hash": "caa0e27c498ceb8dc0260c79f3345761",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 407,
"avg_line_length": 44.31927710843374,
"alnum_prop": 0.5487291015359521,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "cfeba9f29d9103d185d21e1a0730fbee72c4b83e",
"size": "7382",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.04.2-2.0.5/released/8.5.2~camlp4/graphs/8.8.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package ru.stqa.pft.addressbook.model;
import com.google.gson.annotations.Expose;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
@XStreamAlias("group")
@Entity
@Table(name="group_list")
public class GroupData {
@XStreamOmitField
@Id
@Column(name="group_id")
private int id=Integer.MAX_VALUE;
@Expose
@Column(name="group_name")
private String name;
@Expose
@Column(name="group_header")
@Type(type="text")
private String header;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GroupData groupData = (GroupData) o;
if (id != groupData.id) return false;
if (name != null ? !name.equals(groupData.name) : groupData.name != null) return false;
if (header != null ? !header.equals(groupData.header) : groupData.header != null) return false;
return footer != null ? footer.equals(groupData.footer) : groupData.footer == null;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (header != null ? header.hashCode() : 0);
result = 31 * result + (footer != null ? footer.hashCode() : 0);
return result;
}
@Expose
@Column(name="group_footer")
@Type(type="text")
private String footer;
public GroupData withtId(int id) {
this.id = id;
return this;
}
public GroupData withName(String name) {
this.name = name;
return this;
}
public GroupData withHeader(String header) {
this.header = header;
return this;
}
public GroupData withFooter(String footer) {
this.footer = footer;
return this;
}
public String getName() {
return name;
}
public String getHeader() {
return header;
}
public String getFooter() {
return footer;
}
public int getId() {
return id;
}
public Contacts getContacts() {
return new Contacts (contacts);
}
@ManyToMany(mappedBy = "groups")
private Set<ContactData> contacts=new HashSet<ContactData>();
@Override
public String toString() {
return "GroupData{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
'}';
}
}
| {
"content_hash": "b3b17ebf6e3ecce39f82aaa1926e2e4d",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 99,
"avg_line_length": 22.635514018691588,
"alnum_prop": 0.6453344343517754,
"repo_name": "Zadorozhia/java_pft",
"id": "e810e302f65fb58e67cd7f7ed0ba261aa811bd08",
"size": "2422",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/model/GroupData.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "92354"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals
from django.db import migrations
import django_countries.fields
class Migration(migrations.Migration):
dependencies = [
('crm', '0009_auto_20171115_2254'),
]
operations = [
migrations.AlterField(
model_name='client',
name='country',
field=django_countries.fields.CountryField(default='NL', max_length=2, verbose_name='Country'),
),
migrations.AlterField(
model_name='contact',
name='country',
field=django_countries.fields.CountryField(default='NL', max_length=2, verbose_name='Country'),
),
]
| {
"content_hash": "6cd0032d2d9fa863f0cc0c3627ff5022",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 107,
"avg_line_length": 27.791666666666668,
"alnum_prop": 0.6101949025487257,
"repo_name": "Clarity-89/clarityv2",
"id": "73c45c9b79fa5f39675bf18d6787b004d6345888",
"size": "740",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/clarityv2/crm/migrations/0010_auto_20171126_2024.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "272"
},
{
"name": "Dockerfile",
"bytes": "2230"
},
{
"name": "HTML",
"bytes": "46778"
},
{
"name": "JavaScript",
"bytes": "5460"
},
{
"name": "Python",
"bytes": "131598"
},
{
"name": "SCSS",
"bytes": "18878"
},
{
"name": "Shell",
"bytes": "2008"
}
],
"symlink_target": ""
} |
package edu.stanford.isis.atb.ui.validation;
import javax.swing.tree.DefaultMutableTreeNode;
import edu.stanford.isis.atb.system.validation.ValidationError;
import edu.stanford.isis.atb.ui.model.tree.TemplateNodeType;
/**
* @author Vitaliy Semeshko
*/
public class TemplateValidationError {
private ValidationError validationError;
private TemplateNodeType nodeType;
private DefaultMutableTreeNode node;
public TemplateValidationError(ValidationError validationError, TemplateNodeType nodeType,
DefaultMutableTreeNode node) {
this.validationError = validationError;
this.nodeType = nodeType;
this.node = node;
}
public ValidationError getValidationError() {
return validationError;
}
public TemplateNodeType getNodeType() {
return nodeType;
}
public DefaultMutableTreeNode getNode() {
return node;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((validationError == null) ? 0 : validationError.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TemplateValidationError other = (TemplateValidationError) obj;
if (validationError == null) {
if (other.validationError != null)
return false;
} else if (!validationError.equals(other.validationError))
return false;
return true;
}
}
| {
"content_hash": "aa1bde0b88385735dce3283190926cbb",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 92,
"avg_line_length": 21.573529411764707,
"alnum_prop": 0.7341513292433538,
"repo_name": "NCIP/annotation-and-image-markup",
"id": "adf965c27096ab7edc5e3688ad4e11b78ad5a3b9",
"size": "1709",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ATB_1.1_src/src/main/java/edu/stanford/isis/atb/ui/validation/TemplateValidationError.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "31363450"
},
{
"name": "C#",
"bytes": "5152916"
},
{
"name": "C++",
"bytes": "148605530"
},
{
"name": "CSS",
"bytes": "85406"
},
{
"name": "Java",
"bytes": "2039090"
},
{
"name": "Objective-C",
"bytes": "381107"
},
{
"name": "Perl",
"bytes": "502054"
},
{
"name": "Shell",
"bytes": "11832"
},
{
"name": "Tcl",
"bytes": "30867"
}
],
"symlink_target": ""
} |
/**
* stores key-value pair
*/
define(
[
'module',
'../Jet',
'../Impl/StdClassImpl',
'../Impl/CollectionImpl'
],
function (module, Jet, StdClassImpl, CollectionImpl) {
/**
* Stores key-value pair
*
* Required for ClassDecl
*/
var Pair = StdClassImpl.extend({
moduleId: module.id,
model: StdClassImpl,
decl: {
fields: [
{
name: "key",
jet: "String"
},
{
name: "value"
}
]
},
constructor: function (attrs) {
attrs.key && (this.key = attrs.key);
attrs.value && (this.value = (attrs.value instanceof this.model ? attrs.value : new this.model(attrs.value)));
}
});
Jet.mixin('quickdecl', {
constructor: Pair,
decl: Pair.prototype.decl
});
Pair.Collection = CollectionImpl.extend({
moduleId: "Collection/" + module.id,
itemConstructor: Pair,
constructor: function (attributes) {
if (_.isPlainObject(attributes.items)) {
this._reset();
for (var key in attributes.items) {
this.add(new this.model({
key: key,
value: attributes.items[key]
}), {silent: true})
}
} else {
CollectionImpl.prototype.constructor.call(this, attributes);
}
},
get: function (key) {
for (var i = 0; i < this.items.length; i++) {
var model = this.items[i];
if (model.key == key)
return model.value;
}
}
});
Pair.extend = function (protoProps, staticProps) {
!staticProps && (staticProps = {});
if (!protoProps.model) {
throw new Error("Please specify model for Pair child");
}
protoProps.moduleId = "Pair/" + protoProps.model.moduleId;
var ext = StdClassImpl.extend.call(this, protoProps, staticProps);
ext.extend = Pair.extend;
Jet.mixin('quickdecl', {
constructor: ext,
decl: protoProps.decl
});
ext.Collection = this.Collection.extend({moduleId: 'Collection/' + protoProps.moduleId, itemConstructor: ext});
return ext;
};
return Pair;
}
); | {
"content_hash": "3ceb713ab4bc5db156fe7ca24cee2786",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 126,
"avg_line_length": 29.126315789473683,
"alnum_prop": 0.4289844597036502,
"repo_name": "amuzalevskiy/Jet",
"id": "dfc31e32b66856e75e179e74f0fbf964d4db96d7",
"size": "2767",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/js/Jet/Basic/Pair.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "17363"
},
{
"name": "JavaScript",
"bytes": "1647258"
},
{
"name": "Shell",
"bytes": "163"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en"><meta charset="utf-8" />
<title>Posts - Reflections</title>
<meta name="description" content="Default Page Description" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="http://blog.shiv.me/css/latex.css" />
<link rel="stylesheet" href="http://blog.shiv.me/css/main.css" />
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<meta name="generator" content="Hugo 0.75.1" /><body>
<header>
<nav class="navbar">
<div class="nav">
<ul class="nav-links">
</ul>
</div>
</nav>
<div class="intro-header">
<div class="container">
<div class="post-heading">
<h1>Posts</h1>
</div>
</div>
</div>
</header>
<div id="content">
<div class="container" role="main">
<div class="posts-list">
<article class="post-preview">
<a href="http://blog.shiv.me/2005/08/24/google-talk/">
<h2 class="post-title">Google Talk</h2>
</a>
<div class="postmeta">
<span class="meta-post">
<i class="fa fa-calendar-alt"></i>Aug 24, 2005
</span>
</div>
<div class="post-entry">
</div>
</article>
<article class="post-preview">
<a href="http://blog.shiv.me/2005/08/19/obl-2005/">
<h2 class="post-title">OBL 2005</h2>
</a>
<div class="postmeta">
<span class="meta-post">
<i class="fa fa-calendar-alt"></i>Aug 19, 2005
</span>
</div>
<div class="post-entry">
<p>OBL - Out about learning, the second time to the same place, same people, but totally a new experience. On a deeper note, I rediscovered myself! Quite a few things about myself, that I hadn’t noticed before came to light.
I had a great time too, meeting a few new people, and a few new versions of old ones!
The day we were returning to Chennai, we went to a kewl pub called “Alibi” in Church Street, where we managed to get two free pitchers of beer (try the Castle beer there … really neat!</p>
<a href="http://blog.shiv.me/2005/08/19/obl-2005/" class="post-read-more">Read More</a>
</div>
</article>
<article class="post-preview">
<a href="http://blog.shiv.me/2005/07/29/book-review-five-point-someone/">
<h2 class="post-title">Book review: Five point someone</h2>
</a>
<div class="postmeta">
<span class="meta-post">
<i class="fa fa-calendar-alt"></i>Jul 29, 2005
</span>
</div>
<div class="post-entry">
<p>I’m at office, after an all-nighter! I chanced to come by this amazing un-put-downable book by name “Five point someone” by Chetan Bhagat (Check out the book’s site). Not many books that I read get read, in a day.The amazing story of three friends through life at IIT, brought back memories that had been shelved for the past four years. Of the gazillion trees that were felled for the books I have bought, read and enjoyed, the trees that made this book lost their lives to a worthy cause.</p>
<a href="http://blog.shiv.me/2005/07/29/book-review-five-point-someone/" class="post-read-more">Read More</a>
</div>
</article>
<article class="post-preview">
<a href="http://blog.shiv.me/2005/07/19/attrocious-site-bonsaikitten.com/">
<h2 class="post-title">attrocious site - bonsaikitten.com</h2>
</a>
<div class="postmeta">
<span class="meta-post">
<i class="fa fa-calendar-alt"></i>Jul 19, 2005
</span>
</div>
<div class="post-entry">
<p>I encountered, by far, the sickest website I have seen in my entire life.
Kittyculture is the act of stuffing a sweet little kitten into a jar, sealing its anus shut and feeding it to a tube, and keeping it that way for 4 weeks and more, so that it may be given “fair” treatment by giving it an “unique” shape that nature has denied it!! Wow, I just read what I wrote and the absurdity just baffles me!</p>
<a href="http://blog.shiv.me/2005/07/19/attrocious-site-bonsaikitten.com/" class="post-read-more">Read More</a>
</div>
</article>
<article class="post-preview">
<a href="http://blog.shiv.me/2005/07/19/the-new-face-of-google/">
<h2 class="post-title">The new face of google</h2>
</a>
<div class="postmeta">
<span class="meta-post">
<i class="fa fa-calendar-alt"></i>Jul 19, 2005
</span>
</div>
<div class="post-entry">
</div>
</article>
</div>
<ul class="pager">
<li class="previous">
<a href="http://blog.shiv.me/post/50/">← Newer</a>
</li>
<li class="next">
<a href="http://blog.shiv.me/post/52/">Older →</a>
</li>
</ul>
</div>
</div><footer>
<div class="container">
<p class="credits copyright">
<p class="credits theme-by">
Powered By <a href="https://gohugo.io">Hugo</a> / Theme <a href="https://github.com/7ma7X/HugoTeX">HugoTeX</a>
<br>
<a href="http://blog.shiv.me/about">Shiva Velmurugan</a>
©
2016
</p>
</div>
</footer></body>
</html>
| {
"content_hash": "68b1c19cc4dd30e9bfef4a2dfd77f603",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 527,
"avg_line_length": 32.08433734939759,
"alnum_prop": 0.6224183251971461,
"repo_name": "shiva/shiva.github.io",
"id": "729f579da4bf34af3a13f73b817c24d759293c63",
"size": "5326",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "post/page/51/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "24620"
},
{
"name": "HTML",
"bytes": "1863844"
},
{
"name": "Shell",
"bytes": "2974"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.robomaker.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.robomaker.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* DeregisterRobotRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class DeregisterRobotRequestProtocolMarshaller implements Marshaller<Request<DeregisterRobotRequest>, DeregisterRobotRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.REST_JSON).requestUri("/deregisterRobot")
.httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true).serviceName("AWSRoboMaker").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public DeregisterRobotRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<DeregisterRobotRequest> marshall(DeregisterRobotRequest deregisterRobotRequest) {
if (deregisterRobotRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<DeregisterRobotRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING,
deregisterRobotRequest);
protocolMarshaller.startMarshalling();
DeregisterRobotRequestMarshaller.getInstance().marshall(deregisterRobotRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| {
"content_hash": "786b490178dcfb0007eb29121b6c6e6b",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 152,
"avg_line_length": 40.509803921568626,
"alnum_prop": 0.7666989351403679,
"repo_name": "aws/aws-sdk-java",
"id": "05f828c4ee91db0d2d9db16342379407ccfc5de0",
"size": "2646",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/transform/DeregisterRobotRequestProtocolMarshaller.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package org.elasticsearch.cluster.metadata;
import com.carrotsearch.hppc.ObjectArrayList;
import com.carrotsearch.hppc.ObjectOpenHashSet;
import com.carrotsearch.hppc.cursors.ObjectCursor;
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import com.google.common.base.Predicate;
import com.google.common.collect.*;
import org.elasticsearch.ElasticsearchIllegalArgumentException;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.cluster.block.ClusterBlock;
import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.HppcMaps;
import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.loader.SettingsLoader;
import org.elasticsearch.common.xcontent.*;
import org.elasticsearch.index.Index;
import org.elasticsearch.indices.IndexClosedException;
import org.elasticsearch.indices.IndexMissingException;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.warmer.IndexWarmersMetaData;
import java.io.IOException;
import java.util.*;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Maps.newHashMap;
import static org.elasticsearch.common.settings.ImmutableSettings.*;
/**
*
*/
public class MetaData implements Iterable<IndexMetaData> {
public static final String ALL = "_all";
public enum XContentContext {
/* Custom metadata should be returns as part of API call */
API,
/* Custom metadata should be stored as part of the persistent cluster state */
GATEWAY,
/* Custom metadata should be stored as part of a snapshot */
SNAPSHOT;
}
public static EnumSet<XContentContext> API_ONLY = EnumSet.of(XContentContext.API);
public static EnumSet<XContentContext> API_AND_GATEWAY = EnumSet.of(XContentContext.API, XContentContext.GATEWAY);
public static EnumSet<XContentContext> API_AND_SNAPSHOT = EnumSet.of(XContentContext.API, XContentContext.SNAPSHOT);
public interface Custom {
abstract class Factory<T extends Custom> {
public abstract String type();
public abstract T readFrom(StreamInput in) throws IOException;
public abstract void writeTo(T customIndexMetaData, StreamOutput out) throws IOException;
public abstract T fromXContent(XContentParser parser) throws IOException;
public abstract void toXContent(T customIndexMetaData, XContentBuilder builder, ToXContent.Params params) throws IOException;
public EnumSet<XContentContext> context() {
return API_ONLY;
}
}
}
public static Map<String, Custom.Factory> customFactories = new HashMap<>();
static {
// register non plugin custom metadata
registerFactory(RepositoriesMetaData.TYPE, RepositoriesMetaData.FACTORY);
registerFactory(SnapshotMetaData.TYPE, SnapshotMetaData.FACTORY);
registerFactory(RestoreMetaData.TYPE, RestoreMetaData.FACTORY);
registerFactory(BenchmarkMetaData.TYPE, BenchmarkMetaData.FACTORY);
}
/**
* Register a custom index meta data factory. Make sure to call it from a static block.
*/
public static void registerFactory(String type, Custom.Factory factory) {
customFactories.put(type, factory);
}
@Nullable
public static <T extends Custom> Custom.Factory<T> lookupFactory(String type) {
return customFactories.get(type);
}
public static <T extends Custom> Custom.Factory<T> lookupFactorySafe(String type) throws ElasticsearchIllegalArgumentException {
Custom.Factory<T> factory = customFactories.get(type);
if (factory == null) {
throw new ElasticsearchIllegalArgumentException("No custom index metadata factory registered for type [" + type + "]");
}
return factory;
}
public static final String SETTING_READ_ONLY = "cluster.blocks.read_only";
public static final ClusterBlock CLUSTER_READ_ONLY_BLOCK = new ClusterBlock(6, "cluster read-only (api)", false, false, RestStatus.FORBIDDEN, EnumSet.of(ClusterBlockLevel.WRITE, ClusterBlockLevel.METADATA));
public static final MetaData EMPTY_META_DATA = builder().build();
public static final String CONTEXT_MODE_PARAM = "context_mode";
public static final String CONTEXT_MODE_SNAPSHOT = XContentContext.SNAPSHOT.toString();
public static final String CONTEXT_MODE_GATEWAY = XContentContext.GATEWAY.toString();
private final String uuid;
private final long version;
private final Settings transientSettings;
private final Settings persistentSettings;
private final Settings settings;
private final ImmutableOpenMap<String, IndexMetaData> indices;
private final ImmutableOpenMap<String, IndexTemplateMetaData> templates;
private final ImmutableOpenMap<String, Custom> customs;
private final transient int totalNumberOfShards; // Transient ? not serializable anyway?
private final int numberOfShards;
private final String[] allIndices;
private final String[] allOpenIndices;
private final String[] allClosedIndices;
private final ImmutableOpenMap<String, ImmutableOpenMap<String, AliasMetaData>> aliases;
private final ImmutableOpenMap<String, String[]> aliasAndIndexToIndexMap;
@SuppressWarnings("unchecked")
MetaData(String uuid, long version, Settings transientSettings, Settings persistentSettings, ImmutableOpenMap<String, IndexMetaData> indices, ImmutableOpenMap<String, IndexTemplateMetaData> templates, ImmutableOpenMap<String, Custom> customs) {
this.uuid = uuid;
this.version = version;
this.transientSettings = transientSettings;
this.persistentSettings = persistentSettings;
this.settings = ImmutableSettings.settingsBuilder().put(persistentSettings).put(transientSettings).build();
this.indices = indices;
this.customs = customs;
this.templates = templates;
int totalNumberOfShards = 0;
int numberOfShards = 0;
int numAliases = 0;
for (ObjectCursor<IndexMetaData> cursor : indices.values()) {
totalNumberOfShards += cursor.value.totalNumberOfShards();
numberOfShards += cursor.value.numberOfShards();
numAliases += cursor.value.aliases().size();
}
this.totalNumberOfShards = totalNumberOfShards;
this.numberOfShards = numberOfShards;
// build all indices map
List<String> allIndicesLst = Lists.newArrayList();
for (ObjectCursor<IndexMetaData> cursor : indices.values()) {
allIndicesLst.add(cursor.value.index());
}
allIndices = allIndicesLst.toArray(new String[allIndicesLst.size()]);
int numIndices = allIndicesLst.size();
List<String> allOpenIndices = Lists.newArrayList();
List<String> allClosedIndices = Lists.newArrayList();
for (ObjectCursor<IndexMetaData> cursor : indices.values()) {
IndexMetaData indexMetaData = cursor.value;
if (indexMetaData.state() == IndexMetaData.State.OPEN) {
allOpenIndices.add(indexMetaData.index());
} else if (indexMetaData.state() == IndexMetaData.State.CLOSE) {
allClosedIndices.add(indexMetaData.index());
}
}
this.allOpenIndices = allOpenIndices.toArray(new String[allOpenIndices.size()]);
this.allClosedIndices = allClosedIndices.toArray(new String[allClosedIndices.size()]);
// build aliases map
ImmutableOpenMap.Builder<String, Object> tmpAliases = ImmutableOpenMap.builder(numAliases);
for (ObjectCursor<IndexMetaData> cursor : indices.values()) {
IndexMetaData indexMetaData = cursor.value;
String index = indexMetaData.index();
for (ObjectCursor<AliasMetaData> aliasCursor : indexMetaData.aliases().values()) {
AliasMetaData aliasMd = aliasCursor.value;
ImmutableOpenMap.Builder<String, AliasMetaData> indexAliasMap = (ImmutableOpenMap.Builder<String, AliasMetaData>) tmpAliases.get(aliasMd.alias());
if (indexAliasMap == null) {
indexAliasMap = ImmutableOpenMap.builder(1); // typically, there is 1 alias pointing to an index
tmpAliases.put(aliasMd.alias(), indexAliasMap);
}
indexAliasMap.put(index, aliasMd);
}
}
for (ObjectCursor<String> cursor : tmpAliases.keys()) {
String alias = cursor.value;
// if there is access to the raw values buffer of the map that the immutable maps wraps, then we don't need to use put, and just set array slots
ImmutableOpenMap<String, AliasMetaData> map = ((ImmutableOpenMap.Builder) tmpAliases.get(alias)).cast().build();
tmpAliases.put(alias, map);
}
this.aliases = tmpAliases.<String, ImmutableOpenMap<String, AliasMetaData>>cast().build();
ImmutableOpenMap.Builder<String, Object> aliasAndIndexToIndexMap = ImmutableOpenMap.builder(numAliases + numIndices);
for (ObjectCursor<IndexMetaData> cursor : indices.values()) {
IndexMetaData indexMetaData = cursor.value;
ObjectArrayList<String> indicesLst = (ObjectArrayList<String>) aliasAndIndexToIndexMap.get(indexMetaData.index());
if (indicesLst == null) {
indicesLst = new ObjectArrayList<>();
aliasAndIndexToIndexMap.put(indexMetaData.index(), indicesLst);
}
indicesLst.add(indexMetaData.index());
for (ObjectCursor<String> cursor1 : indexMetaData.aliases().keys()) {
String alias = cursor1.value;
indicesLst = (ObjectArrayList<String>) aliasAndIndexToIndexMap.get(alias);
if (indicesLst == null) {
indicesLst = new ObjectArrayList<>();
aliasAndIndexToIndexMap.put(alias, indicesLst);
}
indicesLst.add(indexMetaData.index());
}
}
for (ObjectObjectCursor<String, Object> cursor : aliasAndIndexToIndexMap) {
String[] indicesLst = ((ObjectArrayList<String>) cursor.value).toArray(String.class);
aliasAndIndexToIndexMap.put(cursor.key, indicesLst);
}
this.aliasAndIndexToIndexMap = aliasAndIndexToIndexMap.<String, String[]>cast().build();
}
public long version() {
return this.version;
}
public String uuid() {
return this.uuid;
}
/**
* Returns the merges transient and persistent settings.
*/
public Settings settings() {
return this.settings;
}
public Settings transientSettings() {
return this.transientSettings;
}
public Settings persistentSettings() {
return this.persistentSettings;
}
public ImmutableOpenMap<String, ImmutableOpenMap<String, AliasMetaData>> aliases() {
return this.aliases;
}
public ImmutableOpenMap<String, ImmutableOpenMap<String, AliasMetaData>> getAliases() {
return aliases();
}
/**
* Finds the specific index aliases that match with the specified aliases directly or partially via wildcards and
* that point to the specified concrete indices or match partially with the indices via wildcards.
*
* @param aliases The names of the index aliases to find
* @param concreteIndices The concrete indexes the index aliases must point to order to be returned.
* @return the found index aliases grouped by index
*/
public ImmutableOpenMap<String, ImmutableList<AliasMetaData>> findAliases(final String[] aliases, String[] concreteIndices) {
assert aliases != null;
assert concreteIndices != null;
if (concreteIndices.length == 0) {
return ImmutableOpenMap.of();
}
boolean matchAllAliases = matchAllAliases(aliases);
ImmutableOpenMap.Builder<String, ImmutableList<AliasMetaData>> mapBuilder = ImmutableOpenMap.builder();
Iterable<String> intersection = HppcMaps.intersection(ObjectOpenHashSet.from(concreteIndices), indices.keys());
for (String index : intersection) {
IndexMetaData indexMetaData = indices.get(index);
List<AliasMetaData> filteredValues = Lists.newArrayList();
for (ObjectCursor<AliasMetaData> cursor : indexMetaData.getAliases().values()) {
AliasMetaData value = cursor.value;
if (matchAllAliases || Regex.simpleMatch(aliases, value.alias())) {
filteredValues.add(value);
}
}
if (!filteredValues.isEmpty()) {
mapBuilder.put(index, ImmutableList.copyOf(filteredValues));
}
}
return mapBuilder.build();
}
private boolean matchAllAliases(final String[] aliases) {
for (String alias : aliases) {
if (alias.equals("_all")) {
return true;
}
}
return aliases.length == 0;
}
/**
* Checks if at least one of the specified aliases exists in the specified concrete indices. Wildcards are supported in the
* alias names for partial matches.
*
* @param aliases The names of the index aliases to find
* @param concreteIndices The concrete indexes the index aliases must point to order to be returned.
* @return whether at least one of the specified aliases exists in one of the specified concrete indices.
*/
public boolean hasAliases(final String[] aliases, String[] concreteIndices) {
assert aliases != null;
assert concreteIndices != null;
if (concreteIndices.length == 0) {
return false;
}
Iterable<String> intersection = HppcMaps.intersection(ObjectOpenHashSet.from(concreteIndices), indices.keys());
for (String index : intersection) {
IndexMetaData indexMetaData = indices.get(index);
List<AliasMetaData> filteredValues = Lists.newArrayList();
for (ObjectCursor<AliasMetaData> cursor : indexMetaData.getAliases().values()) {
AliasMetaData value = cursor.value;
if (Regex.simpleMatch(aliases, value.alias())) {
filteredValues.add(value);
}
}
if (!filteredValues.isEmpty()) {
return true;
}
}
return false;
}
/*
* Finds all mappings for types and concrete indices. Types are expanded to
* include all types that match the glob patterns in the types array. Empty
* types array, null or {"_all"} will be expanded to all types available for
* the given indices.
*/
public ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> findMappings(String[] concreteIndices, final String[] types) {
assert types != null;
assert concreteIndices != null;
if (concreteIndices.length == 0) {
return ImmutableOpenMap.of();
}
ImmutableOpenMap.Builder<String, ImmutableOpenMap<String, MappingMetaData>> indexMapBuilder = ImmutableOpenMap.builder();
Iterable<String> intersection = HppcMaps.intersection(ObjectOpenHashSet.from(concreteIndices), indices.keys());
for (String index : intersection) {
IndexMetaData indexMetaData = indices.get(index);
ImmutableOpenMap.Builder<String, MappingMetaData> filteredMappings;
if (isAllTypes(types)) {
indexMapBuilder.put(index, indexMetaData.getMappings()); // No types specified means get it all
} else {
filteredMappings = ImmutableOpenMap.builder();
for (ObjectObjectCursor<String, MappingMetaData> cursor : indexMetaData.mappings()) {
if (Regex.simpleMatch(types, cursor.key)) {
filteredMappings.put(cursor.key, cursor.value);
}
}
if (!filteredMappings.isEmpty()) {
indexMapBuilder.put(index, filteredMappings.build());
}
}
}
return indexMapBuilder.build();
}
public ImmutableOpenMap<String, ImmutableList<IndexWarmersMetaData.Entry>> findWarmers(String[] concreteIndices, final String[] types, final String[] uncheckedWarmers) {
assert uncheckedWarmers != null;
assert concreteIndices != null;
if (concreteIndices.length == 0) {
return ImmutableOpenMap.of();
}
// special _all check to behave the same like not specifying anything for the warmers (not for the indices)
final String[] warmers = Strings.isAllOrWildcard(uncheckedWarmers) ? Strings.EMPTY_ARRAY : uncheckedWarmers;
ImmutableOpenMap.Builder<String, ImmutableList<IndexWarmersMetaData.Entry>> mapBuilder = ImmutableOpenMap.builder();
Iterable<String> intersection = HppcMaps.intersection(ObjectOpenHashSet.from(concreteIndices), indices.keys());
for (String index : intersection) {
IndexMetaData indexMetaData = indices.get(index);
IndexWarmersMetaData indexWarmersMetaData = indexMetaData.custom(IndexWarmersMetaData.TYPE);
if (indexWarmersMetaData == null || indexWarmersMetaData.entries().isEmpty()) {
continue;
}
Collection<IndexWarmersMetaData.Entry> filteredWarmers = Collections2.filter(indexWarmersMetaData.entries(), new Predicate<IndexWarmersMetaData.Entry>() {
@Override
public boolean apply(IndexWarmersMetaData.Entry warmer) {
if (warmers.length != 0 && types.length != 0) {
return Regex.simpleMatch(warmers, warmer.name()) && Regex.simpleMatch(types, warmer.types());
} else if (warmers.length != 0) {
return Regex.simpleMatch(warmers, warmer.name());
} else if (types.length != 0) {
return Regex.simpleMatch(types, warmer.types());
} else {
return true;
}
}
});
if (!filteredWarmers.isEmpty()) {
mapBuilder.put(index, ImmutableList.copyOf(filteredWarmers));
}
}
return mapBuilder.build();
}
/**
* Returns all the concrete indices.
*/
public String[] concreteAllIndices() {
return allIndices;
}
public String[] getConcreteAllIndices() {
return concreteAllIndices();
}
public String[] concreteAllOpenIndices() {
return allOpenIndices;
}
public String[] getConcreteAllOpenIndices() {
return allOpenIndices;
}
public String[] concreteAllClosedIndices() {
return allClosedIndices;
}
public String[] getConcreteAllClosedIndices() {
return allClosedIndices;
}
/**
* Returns indexing routing for the given index.
*/
public String resolveIndexRouting(@Nullable String routing, String aliasOrIndex) {
// Check if index is specified by an alias
ImmutableOpenMap<String, AliasMetaData> indexAliases = aliases.get(aliasOrIndex);
if (indexAliases == null || indexAliases.isEmpty()) {
return routing;
}
if (indexAliases.size() > 1) {
throw new ElasticsearchIllegalArgumentException("Alias [" + aliasOrIndex + "] has more than one index associated with it [" + Arrays.toString(indexAliases.keys().toArray(String.class)) + "], can't execute a single index op");
}
AliasMetaData aliasMd = indexAliases.values().iterator().next().value;
if (aliasMd.indexRouting() != null) {
if (routing != null) {
if (!routing.equals(aliasMd.indexRouting())) {
throw new ElasticsearchIllegalArgumentException("Alias [" + aliasOrIndex + "] has index routing associated with it [" + aliasMd.indexRouting() + "], and was provided with routing value [" + routing + "], rejecting operation");
}
}
routing = aliasMd.indexRouting();
}
if (routing != null) {
if (routing.indexOf(',') != -1) {
throw new ElasticsearchIllegalArgumentException("index/alias [" + aliasOrIndex + "] provided with routing value [" + routing + "] that resolved to several routing values, rejecting operation");
}
}
return routing;
}
public Map<String, Set<String>> resolveSearchRouting(@Nullable String routing, String aliasOrIndex) {
return resolveSearchRouting(routing, convertFromWildcards(new String[]{aliasOrIndex}, IndicesOptions.lenientExpandOpen()));
}
public Map<String, Set<String>> resolveSearchRouting(@Nullable String routing, String[] aliasesOrIndices) {
if (isAllIndices(aliasesOrIndices)) {
return resolveSearchRoutingAllIndices(routing);
}
aliasesOrIndices = convertFromWildcards(aliasesOrIndices, IndicesOptions.lenientExpandOpen());
if (aliasesOrIndices.length == 1) {
return resolveSearchRoutingSingleValue(routing, aliasesOrIndices[0]);
}
Map<String, Set<String>> routings = null;
Set<String> paramRouting = null;
// List of indices that don't require any routing
Set<String> norouting = new HashSet<>();
if (routing != null) {
paramRouting = Strings.splitStringByCommaToSet(routing);
}
for (String aliasOrIndex : aliasesOrIndices) {
ImmutableOpenMap<String, AliasMetaData> indexToRoutingMap = aliases.get(aliasOrIndex);
if (indexToRoutingMap != null && !indexToRoutingMap.isEmpty()) {
for (ObjectObjectCursor<String, AliasMetaData> indexRouting : indexToRoutingMap) {
if (!norouting.contains(indexRouting.key)) {
if (!indexRouting.value.searchRoutingValues().isEmpty()) {
// Routing alias
if (routings == null) {
routings = newHashMap();
}
Set<String> r = routings.get(indexRouting.key);
if (r == null) {
r = new HashSet<>();
routings.put(indexRouting.key, r);
}
r.addAll(indexRouting.value.searchRoutingValues());
if (paramRouting != null) {
r.retainAll(paramRouting);
}
if (r.isEmpty()) {
routings.remove(indexRouting.key);
}
} else {
// Non-routing alias
if (!norouting.contains(indexRouting.key)) {
norouting.add(indexRouting.key);
if (paramRouting != null) {
Set<String> r = new HashSet<>(paramRouting);
if (routings == null) {
routings = newHashMap();
}
routings.put(indexRouting.key, r);
} else {
if (routings != null) {
routings.remove(indexRouting.key);
}
}
}
}
}
}
} else {
// Index
if (!norouting.contains(aliasOrIndex)) {
norouting.add(aliasOrIndex);
if (paramRouting != null) {
Set<String> r = new HashSet<>(paramRouting);
if (routings == null) {
routings = newHashMap();
}
routings.put(aliasOrIndex, r);
} else {
if (routings != null) {
routings.remove(aliasOrIndex);
}
}
}
}
}
if (routings == null || routings.isEmpty()) {
return null;
}
return routings;
}
private Map<String, Set<String>> resolveSearchRoutingSingleValue(@Nullable String routing, String aliasOrIndex) {
Map<String, Set<String>> routings = null;
Set<String> paramRouting = null;
if (routing != null) {
paramRouting = Strings.splitStringByCommaToSet(routing);
}
ImmutableOpenMap<String, AliasMetaData> indexToRoutingMap = aliases.get(aliasOrIndex);
if (indexToRoutingMap != null && !indexToRoutingMap.isEmpty()) {
// It's an alias
for (ObjectObjectCursor<String, AliasMetaData> indexRouting : indexToRoutingMap) {
if (!indexRouting.value.searchRoutingValues().isEmpty()) {
// Routing alias
Set<String> r = new HashSet<>(indexRouting.value.searchRoutingValues());
if (paramRouting != null) {
r.retainAll(paramRouting);
}
if (!r.isEmpty()) {
if (routings == null) {
routings = newHashMap();
}
routings.put(indexRouting.key, r);
}
} else {
// Non-routing alias
if (paramRouting != null) {
Set<String> r = new HashSet<>(paramRouting);
if (routings == null) {
routings = newHashMap();
}
routings.put(indexRouting.key, r);
}
}
}
} else {
// It's an index
if (paramRouting != null) {
routings = ImmutableMap.of(aliasOrIndex, paramRouting);
}
}
return routings;
}
/**
* Sets the same routing for all indices
*/
private Map<String, Set<String>> resolveSearchRoutingAllIndices(String routing) {
if (routing != null) {
Set<String> r = Strings.splitStringByCommaToSet(routing);
Map<String, Set<String>> routings = newHashMap();
String[] concreteIndices = concreteAllIndices();
for (String index : concreteIndices) {
routings.put(index, r);
}
return routings;
}
return null;
}
/**
* Translates the provided indices or aliases, eventually containing wildcard expressions, into actual indices.
*
* @param indicesOptions how the aliases or indices need to be resolved to concrete indices
* @param aliasesOrIndices the aliases or indices to be resolved to concrete indices
* @return the obtained concrete indices
* @throws IndexMissingException if one of the aliases or indices is missing and the provided indices options
* don't allow such a case, or if the final result of the indices resolution is no indices and the indices options
* don't allow such a case.
* @throws ElasticsearchIllegalArgumentException if one of the aliases resolve to multiple indices and the provided
* indices options don't allow such a case.
*/
public String[] concreteIndices(IndicesOptions indicesOptions, String... aliasesOrIndices) throws IndexMissingException, ElasticsearchIllegalArgumentException {
if (indicesOptions.expandWildcardsOpen() || indicesOptions.expandWildcardsClosed()) {
if (isAllIndices(aliasesOrIndices)) {
String[] concreteIndices;
if (indicesOptions.expandWildcardsOpen() && indicesOptions.expandWildcardsClosed()) {
concreteIndices = concreteAllIndices();
} else if (indicesOptions.expandWildcardsOpen()) {
concreteIndices = concreteAllOpenIndices();
} else {
concreteIndices = concreteAllClosedIndices();
}
if (!indicesOptions.allowNoIndices() && concreteIndices.length == 0) {
throw new IndexMissingException(new Index("_all"));
}
return concreteIndices;
}
aliasesOrIndices = convertFromWildcards(aliasesOrIndices, indicesOptions);
}
boolean failClosed = indicesOptions.forbidClosedIndices() && !indicesOptions.ignoreUnavailable();
// optimize for single element index (common case)
if (aliasesOrIndices.length == 1) {
return concreteIndices(aliasesOrIndices[0], indicesOptions, !indicesOptions.allowNoIndices());
}
// check if its a possible aliased index, if not, just return the passed array
boolean possiblyAliased = false;
boolean closedIndices = false;
for (String index : aliasesOrIndices) {
IndexMetaData indexMetaData = indices.get(index);
if (indexMetaData == null) {
possiblyAliased = true;
break;
} else {
if (indicesOptions.forbidClosedIndices() && indexMetaData.getState() == IndexMetaData.State.CLOSE) {
if (failClosed) {
throw new IndexClosedException(new Index(index));
} else {
closedIndices = true;
}
}
}
}
if (!possiblyAliased) {
if (closedIndices) {
Set<String> actualIndices = new HashSet<>(Arrays.asList(aliasesOrIndices));
actualIndices.retainAll(new HashSet<Object>(Arrays.asList(allOpenIndices)));
return actualIndices.toArray(new String[actualIndices.size()]);
} else {
return aliasesOrIndices;
}
}
Set<String> actualIndices = new HashSet<>();
for (String aliasOrIndex : aliasesOrIndices) {
String[] indices = concreteIndices(aliasOrIndex, indicesOptions, !indicesOptions.ignoreUnavailable());
Collections.addAll(actualIndices, indices);
}
if (!indicesOptions.allowNoIndices() && actualIndices.isEmpty()) {
throw new IndexMissingException(new Index(Arrays.toString(aliasesOrIndices)));
}
return actualIndices.toArray(new String[actualIndices.size()]);
}
/**
* Utility method that allows to resolve an index or alias to its corresponding single concrete index.
* Callers should make sure they provide proper {@link org.elasticsearch.action.support.IndicesOptions}
* that require a single index as a result. The indices resolution must in fact return a single index when
* using this method, an {@link org.elasticsearch.ElasticsearchIllegalArgumentException} gets thrown otherwise.
*
* @param indexOrAlias the index or alias to be resolved to concrete index
* @param indicesOptions the indices options to be used for the index resolution
* @return the concrete index obtained as a result of the index resolution
* @throws IndexMissingException if the index or alias provided doesn't exist
* @throws ElasticsearchIllegalArgumentException if the index resolution lead to more than one index
*/
public String concreteSingleIndex(String indexOrAlias, IndicesOptions indicesOptions) throws IndexMissingException, ElasticsearchIllegalArgumentException {
String[] indices = concreteIndices(indicesOptions, indexOrAlias);
if (indices.length != 1) {
throw new ElasticsearchIllegalArgumentException("unable to return a single index as the index and options provided got resolved to multiple indices");
}
return indices[0];
}
private String[] concreteIndices(String aliasOrIndex, IndicesOptions options, boolean failNoIndices) throws IndexMissingException, ElasticsearchIllegalArgumentException {
boolean failClosed = options.forbidClosedIndices() && !options.ignoreUnavailable();
// a quick check, if this is an actual index, if so, return it
IndexMetaData indexMetaData = indices.get(aliasOrIndex);
if (indexMetaData != null) {
if (indexMetaData.getState() == IndexMetaData.State.CLOSE) {
if (failClosed) {
throw new IndexClosedException(new Index(aliasOrIndex));
} else {
return options.forbidClosedIndices() ? Strings.EMPTY_ARRAY : new String[]{aliasOrIndex};
}
} else {
return new String[]{aliasOrIndex};
}
}
// not an actual index, fetch from an alias
String[] indices = aliasAndIndexToIndexMap.getOrDefault(aliasOrIndex, Strings.EMPTY_ARRAY);
if (indices.length == 0 && failNoIndices) {
throw new IndexMissingException(new Index(aliasOrIndex));
}
if (indices.length > 1 && !options.allowAliasesToMultipleIndices()) {
throw new ElasticsearchIllegalArgumentException("Alias [" + aliasOrIndex + "] has more than one indices associated with it [" + Arrays.toString(indices) + "], can't execute a single index op");
}
// No need to check whether indices referred by aliases are closed, because there are no closed indices.
if (allClosedIndices.length == 0) {
return indices;
}
switch (indices.length) {
case 0:
return indices;
case 1:
indexMetaData = this.indices.get(indices[0]);
if (indexMetaData != null && indexMetaData.getState() == IndexMetaData.State.CLOSE) {
if (failClosed) {
throw new IndexClosedException(new Index(indexMetaData.getIndex()));
} else {
if (options.forbidClosedIndices()) {
return Strings.EMPTY_ARRAY;
}
}
}
return indices;
default:
ObjectArrayList<String> concreteIndices = new ObjectArrayList<>();
for (String index : indices) {
indexMetaData = this.indices.get(index);
if (indexMetaData != null) {
if (indexMetaData.getState() == IndexMetaData.State.CLOSE) {
if (failClosed) {
throw new IndexClosedException(new Index(indexMetaData.getIndex()));
} else if (!options.forbidClosedIndices()) {
concreteIndices.add(index);
}
} else if (indexMetaData.getState() == IndexMetaData.State.OPEN) {
concreteIndices.add(index);
} else {
throw new IllegalStateException("index state [" + indexMetaData.getState() + "] not supported");
}
}
}
return concreteIndices.toArray(String.class);
}
}
/**
* Converts a list of indices or aliases wildcards, and special +/- signs, into their respective full matches. It
* won't convert only to indices, but also to aliases. For example, alias_* will expand to alias_1 and alias_2, not
* to the respective indices those aliases point to.
*/
public String[] convertFromWildcards(String[] aliasesOrIndices, IndicesOptions indicesOptions) {
if (aliasesOrIndices == null) {
return null;
}
Set<String> result = null;
for (int i = 0; i < aliasesOrIndices.length; i++) {
String aliasOrIndex = aliasesOrIndices[i];
if (aliasAndIndexToIndexMap.containsKey(aliasOrIndex)) {
if (result != null) {
result.add(aliasOrIndex);
}
continue;
}
boolean add = true;
if (aliasOrIndex.charAt(0) == '+') {
// if its the first, add empty result set
if (i == 0) {
result = new HashSet<>();
}
add = true;
aliasOrIndex = aliasOrIndex.substring(1);
} else if (aliasOrIndex.charAt(0) == '-') {
// if its the first, fill it with all the indices...
if (i == 0) {
String[] concreteIndices;
if (indicesOptions.expandWildcardsOpen() && indicesOptions.expandWildcardsClosed()) {
concreteIndices = concreteAllIndices();
} else if (indicesOptions.expandWildcardsOpen()) {
concreteIndices = concreteAllOpenIndices();
} else if (indicesOptions.expandWildcardsClosed()) {
concreteIndices = concreteAllClosedIndices();
} else {
assert false : "Shouldn't end up here";
concreteIndices = Strings.EMPTY_ARRAY;
}
result = new HashSet<>(Arrays.asList(concreteIndices));
}
add = false;
aliasOrIndex = aliasOrIndex.substring(1);
}
if (!Regex.isSimpleMatchPattern(aliasOrIndex)) {
if (!indicesOptions.ignoreUnavailable() && !aliasAndIndexToIndexMap.containsKey(aliasOrIndex)) {
throw new IndexMissingException(new Index(aliasOrIndex));
}
if (result != null) {
if (add) {
result.add(aliasOrIndex);
} else {
result.remove(aliasOrIndex);
}
}
continue;
}
if (result == null) {
// add all the previous ones...
result = new HashSet<>();
result.addAll(Arrays.asList(aliasesOrIndices).subList(0, i));
}
String[] indices;
if (indicesOptions.expandWildcardsOpen() && indicesOptions.expandWildcardsClosed()) {
indices = concreteAllIndices();
} else if (indicesOptions.expandWildcardsOpen()) {
indices = concreteAllOpenIndices();
} else if (indicesOptions.expandWildcardsClosed()) {
indices = concreteAllClosedIndices();
} else {
assert false : "convertFromWildcards shouldn't get called if wildcards expansion is disabled";
indices = Strings.EMPTY_ARRAY;
}
boolean found = false;
// iterating over all concrete indices and see if there is a wildcard match
for (String index : indices) {
if (Regex.simpleMatch(aliasOrIndex, index)) {
found = true;
if (add) {
result.add(index);
} else {
result.remove(index);
}
}
}
// iterating over all aliases and see if there is a wildcard match
for (ObjectCursor<String> cursor : aliases.keys()) {
String alias = cursor.value;
if (Regex.simpleMatch(aliasOrIndex, alias)) {
found = true;
if (add) {
result.add(alias);
} else {
result.remove(alias);
}
}
}
if (!found && !indicesOptions.allowNoIndices()) {
throw new IndexMissingException(new Index(aliasOrIndex));
}
}
if (result == null) {
return aliasesOrIndices;
}
if (result.isEmpty() && !indicesOptions.allowNoIndices()) {
throw new IndexMissingException(new Index(Arrays.toString(aliasesOrIndices)));
}
return result.toArray(new String[result.size()]);
}
public boolean hasIndex(String index) {
return indices.containsKey(index);
}
public boolean hasConcreteIndex(String index) {
return aliasAndIndexToIndexMap.containsKey(index);
}
public IndexMetaData index(String index) {
return indices.get(index);
}
public ImmutableOpenMap<String, IndexMetaData> indices() {
return this.indices;
}
public ImmutableOpenMap<String, IndexMetaData> getIndices() {
return indices();
}
public ImmutableOpenMap<String, IndexTemplateMetaData> templates() {
return this.templates;
}
public ImmutableOpenMap<String, IndexTemplateMetaData> getTemplates() {
return this.templates;
}
public ImmutableOpenMap<String, Custom> customs() {
return this.customs;
}
public ImmutableOpenMap<String, Custom> getCustoms() {
return this.customs;
}
public <T extends Custom> T custom(String type) {
return (T) customs.get(type);
}
public int totalNumberOfShards() {
return this.totalNumberOfShards;
}
public int getTotalNumberOfShards() {
return totalNumberOfShards();
}
public int numberOfShards() {
return this.numberOfShards;
}
public int getNumberOfShards() {
return numberOfShards();
}
/**
* Iterates through the list of indices and selects the effective list of filtering aliases for the
* given index.
* <p/>
* <p>Only aliases with filters are returned. If the indices list contains a non-filtering reference to
* the index itself - null is returned. Returns <tt>null</tt> if no filtering is required.</p>
*/
public String[] filteringAliases(String index, String... indicesOrAliases) {
// expand the aliases wildcard
indicesOrAliases = convertFromWildcards(indicesOrAliases, IndicesOptions.lenientExpandOpen());
if (isAllIndices(indicesOrAliases)) {
return null;
}
// optimize for the most common single index/alias scenario
if (indicesOrAliases.length == 1) {
String alias = indicesOrAliases[0];
IndexMetaData indexMetaData = this.indices.get(index);
if (indexMetaData == null) {
// Shouldn't happen
throw new IndexMissingException(new Index(index));
}
AliasMetaData aliasMetaData = indexMetaData.aliases().get(alias);
boolean filteringRequired = aliasMetaData != null && aliasMetaData.filteringRequired();
if (!filteringRequired) {
return null;
}
return new String[]{alias};
}
List<String> filteringAliases = null;
for (String alias : indicesOrAliases) {
if (alias.equals(index)) {
return null;
}
IndexMetaData indexMetaData = this.indices.get(index);
if (indexMetaData == null) {
// Shouldn't happen
throw new IndexMissingException(new Index(index));
}
AliasMetaData aliasMetaData = indexMetaData.aliases().get(alias);
// Check that this is an alias for the current index
// Otherwise - skip it
if (aliasMetaData != null) {
boolean filteringRequired = aliasMetaData.filteringRequired();
if (filteringRequired) {
// If filtering required - add it to the list of filters
if (filteringAliases == null) {
filteringAliases = newArrayList();
}
filteringAliases.add(alias);
} else {
// If not, we have a non filtering alias for this index - no filtering needed
return null;
}
}
}
if (filteringAliases == null) {
return null;
}
return filteringAliases.toArray(new String[filteringAliases.size()]);
}
/**
* Identifies whether the array containing index names given as argument refers to all indices
* The empty or null array identifies all indices
*
* @param aliasesOrIndices the array containing index names
* @return true if the provided array maps to all indices, false otherwise
*/
public static boolean isAllIndices(String[] aliasesOrIndices) {
return aliasesOrIndices == null || aliasesOrIndices.length == 0 || isExplicitAllPattern(aliasesOrIndices);
}
/**
* Identifies whether the array containing type names given as argument refers to all types
* The empty or null array identifies all types
*
* @param types the array containing index names
* @return true if the provided array maps to all indices, false otherwise
*/
public boolean isAllTypes(String[] types) {
return types == null || types.length == 0 || isExplicitAllPattern(types);
}
/**
* Identifies whether the array containing index names given as argument explicitly refers to all indices
* The empty or null array doesn't explicitly map to all indices
*
* @param aliasesOrIndices the array containing index names
* @return true if the provided array explicitly maps to all indices, false otherwise
*/
public static boolean isExplicitAllPattern(String[] aliasesOrIndices) {
return aliasesOrIndices != null && aliasesOrIndices.length == 1 && ALL.equals(aliasesOrIndices[0]);
}
/**
* Identifies whether the first argument (an array containing index names) is a pattern that matches all indices
*
* @param indicesOrAliases the array containing index names
* @param concreteIndices array containing the concrete indices that the first argument refers to
* @return true if the first argument is a pattern that maps to all available indices, false otherwise
*/
public boolean isPatternMatchingAllIndices(String[] indicesOrAliases, String[] concreteIndices) {
// if we end up matching on all indices, check, if its a wildcard parameter, or a "-something" structure
if (concreteIndices.length == concreteAllIndices().length && indicesOrAliases.length > 0) {
//we might have something like /-test1,+test1 that would identify all indices
//or something like /-test1 with test1 index missing and IndicesOptions.lenient()
if (indicesOrAliases[0].charAt(0) == '-') {
return true;
}
//otherwise we check if there's any simple regex
for (String indexOrAlias : indicesOrAliases) {
if (Regex.isSimpleMatchPattern(indexOrAlias)) {
return true;
}
}
}
return false;
}
/**
* @param concreteIndex The concrete index to check if routing is required
* @param type The type to check if routing is required
* @return Whether routing is required according to the mapping for the specified index and type
*/
public boolean routingRequired(String concreteIndex, String type) {
IndexMetaData indexMetaData = indices.get(concreteIndex);
if (indexMetaData != null) {
MappingMetaData mappingMetaData = indexMetaData.getMappings().get(type);
if (mappingMetaData != null) {
return mappingMetaData.routing().required();
}
}
return false;
}
@Override
public UnmodifiableIterator<IndexMetaData> iterator() {
return indices.valuesIt();
}
public static boolean isGlobalStateEquals(MetaData metaData1, MetaData metaData2) {
if (!metaData1.persistentSettings.equals(metaData2.persistentSettings)) {
return false;
}
if (!metaData1.templates.equals(metaData2.templates())) {
return false;
}
// Check if any persistent metadata needs to be saved
int customCount1 = 0;
for (ObjectObjectCursor<String, Custom> cursor : metaData1.customs) {
if (customFactories.get(cursor.key).context().contains(XContentContext.GATEWAY)) {
if (!cursor.value.equals(metaData2.custom(cursor.key))) return false;
customCount1++;
}
}
int customCount2 = 0;
for (ObjectObjectCursor<String, Custom> cursor : metaData2.customs) {
if (customFactories.get(cursor.key).context().contains(XContentContext.GATEWAY)) {
customCount2++;
}
}
if (customCount1 != customCount2) return false;
return true;
}
public static Builder builder() {
return new Builder();
}
public static Builder builder(MetaData metaData) {
return new Builder(metaData);
}
public static class Builder {
private String uuid;
private long version;
private Settings transientSettings = ImmutableSettings.Builder.EMPTY_SETTINGS;
private Settings persistentSettings = ImmutableSettings.Builder.EMPTY_SETTINGS;
private final ImmutableOpenMap.Builder<String, IndexMetaData> indices;
private final ImmutableOpenMap.Builder<String, IndexTemplateMetaData> templates;
private final ImmutableOpenMap.Builder<String, Custom> customs;
public Builder() {
uuid = "_na_";
indices = ImmutableOpenMap.builder();
templates = ImmutableOpenMap.builder();
customs = ImmutableOpenMap.builder();
}
public Builder(MetaData metaData) {
this.uuid = metaData.uuid;
this.transientSettings = metaData.transientSettings;
this.persistentSettings = metaData.persistentSettings;
this.version = metaData.version;
this.indices = ImmutableOpenMap.builder(metaData.indices);
this.templates = ImmutableOpenMap.builder(metaData.templates);
this.customs = ImmutableOpenMap.builder(metaData.customs);
}
public Builder put(IndexMetaData.Builder indexMetaDataBuilder) {
// we know its a new one, increment the version and store
indexMetaDataBuilder.version(indexMetaDataBuilder.version() + 1);
IndexMetaData indexMetaData = indexMetaDataBuilder.build();
indices.put(indexMetaData.index(), indexMetaData);
return this;
}
public Builder put(IndexMetaData indexMetaData, boolean incrementVersion) {
if (indices.get(indexMetaData.index()) == indexMetaData) {
return this;
}
// if we put a new index metadata, increment its version
if (incrementVersion) {
indexMetaData = IndexMetaData.builder(indexMetaData).version(indexMetaData.version() + 1).build();
}
indices.put(indexMetaData.index(), indexMetaData);
return this;
}
public IndexMetaData get(String index) {
return indices.get(index);
}
public Builder remove(String index) {
indices.remove(index);
return this;
}
public Builder removeAllIndices() {
indices.clear();
return this;
}
public Builder put(IndexTemplateMetaData.Builder template) {
return put(template.build());
}
public Builder put(IndexTemplateMetaData template) {
templates.put(template.name(), template);
return this;
}
public Builder removeTemplate(String templateName) {
templates.remove(templateName);
return this;
}
public Custom getCustom(String type) {
return customs.get(type);
}
public Builder putCustom(String type, Custom custom) {
customs.put(type, custom);
return this;
}
public Builder removeCustom(String type) {
customs.remove(type);
return this;
}
public Builder updateSettings(Settings settings, String... indices) {
if (indices == null || indices.length == 0) {
indices = this.indices.keys().toArray(String.class);
}
for (String index : indices) {
IndexMetaData indexMetaData = this.indices.get(index);
if (indexMetaData == null) {
throw new IndexMissingException(new Index(index));
}
put(IndexMetaData.builder(indexMetaData)
.settings(settingsBuilder().put(indexMetaData.settings()).put(settings)));
}
return this;
}
public Builder updateNumberOfReplicas(int numberOfReplicas, String... indices) {
if (indices == null || indices.length == 0) {
indices = this.indices.keys().toArray(String.class);
}
for (String index : indices) {
IndexMetaData indexMetaData = this.indices.get(index);
if (indexMetaData == null) {
throw new IndexMissingException(new Index(index));
}
put(IndexMetaData.builder(indexMetaData).numberOfReplicas(numberOfReplicas));
}
return this;
}
public Settings transientSettings() {
return this.transientSettings;
}
public Builder transientSettings(Settings settings) {
this.transientSettings = settings;
return this;
}
public Settings persistentSettings() {
return this.persistentSettings;
}
public Builder persistentSettings(Settings settings) {
this.persistentSettings = settings;
return this;
}
public Builder version(long version) {
this.version = version;
return this;
}
public Builder generateUuidIfNeeded() {
if (uuid.equals("_na_")) {
uuid = Strings.randomBase64UUID();
}
return this;
}
public MetaData build() {
return new MetaData(uuid, version, transientSettings, persistentSettings, indices.build(), templates.build(), customs.build());
}
public static String toXContent(MetaData metaData) throws IOException {
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
builder.startObject();
toXContent(metaData, builder, ToXContent.EMPTY_PARAMS);
builder.endObject();
return builder.string();
}
public static void toXContent(MetaData metaData, XContentBuilder builder, ToXContent.Params params) throws IOException {
XContentContext context = XContentContext.valueOf(params.param(CONTEXT_MODE_PARAM, "API"));
builder.startObject("meta-data");
builder.field("version", metaData.version());
builder.field("uuid", metaData.uuid);
if (!metaData.persistentSettings().getAsMap().isEmpty()) {
builder.startObject("settings");
for (Map.Entry<String, String> entry : metaData.persistentSettings().getAsMap().entrySet()) {
builder.field(entry.getKey(), entry.getValue());
}
builder.endObject();
}
if (context == XContentContext.API && !metaData.transientSettings().getAsMap().isEmpty()) {
builder.startObject("transient_settings");
for (Map.Entry<String, String> entry : metaData.transientSettings().getAsMap().entrySet()) {
builder.field(entry.getKey(), entry.getValue());
}
builder.endObject();
}
builder.startObject("templates");
for (ObjectCursor<IndexTemplateMetaData> cursor : metaData.templates().values()) {
IndexTemplateMetaData.Builder.toXContent(cursor.value, builder, params);
}
builder.endObject();
if (context == XContentContext.API && !metaData.indices().isEmpty()) {
builder.startObject("indices");
for (IndexMetaData indexMetaData : metaData) {
IndexMetaData.Builder.toXContent(indexMetaData, builder, params);
}
builder.endObject();
}
for (ObjectObjectCursor<String, Custom> cursor : metaData.customs()) {
Custom.Factory factory = lookupFactorySafe(cursor.key);
if (factory.context().contains(context)) {
builder.startObject(cursor.key);
factory.toXContent(cursor.value, builder, params);
builder.endObject();
}
}
builder.endObject();
}
public static MetaData fromXContent(XContentParser parser) throws IOException {
Builder builder = new Builder();
// we might get here after the meta-data element, or on a fresh parser
XContentParser.Token token = parser.currentToken();
String currentFieldName = parser.currentName();
if (!"meta-data".equals(currentFieldName)) {
token = parser.nextToken();
if (token == XContentParser.Token.START_OBJECT) {
// move to the field name (meta-data)
token = parser.nextToken();
// move to the next object
token = parser.nextToken();
}
currentFieldName = parser.currentName();
if (token == null) {
// no data...
return builder.build();
}
}
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == XContentParser.Token.START_OBJECT) {
if ("settings".equals(currentFieldName)) {
builder.persistentSettings(ImmutableSettings.settingsBuilder().put(SettingsLoader.Helper.loadNestedFromMap(parser.mapOrdered())).build());
} else if ("indices".equals(currentFieldName)) {
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
builder.put(IndexMetaData.Builder.fromXContent(parser), false);
}
} else if ("templates".equals(currentFieldName)) {
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
builder.put(IndexTemplateMetaData.Builder.fromXContent(parser, parser.currentName()));
}
} else {
// check if its a custom index metadata
Custom.Factory<Custom> factory = lookupFactory(currentFieldName);
if (factory == null) {
//TODO warn
parser.skipChildren();
} else {
builder.putCustom(factory.type(), factory.fromXContent(parser));
}
}
} else if (token.isValue()) {
if ("version".equals(currentFieldName)) {
builder.version = parser.longValue();
} else if ("uuid".equals(currentFieldName)) {
builder.uuid = parser.text();
}
}
}
return builder.build();
}
public static MetaData readFrom(StreamInput in) throws IOException {
Builder builder = new Builder();
builder.version = in.readLong();
builder.uuid = in.readString();
builder.transientSettings(readSettingsFromStream(in));
builder.persistentSettings(readSettingsFromStream(in));
int size = in.readVInt();
for (int i = 0; i < size; i++) {
builder.put(IndexMetaData.Builder.readFrom(in), false);
}
size = in.readVInt();
for (int i = 0; i < size; i++) {
builder.put(IndexTemplateMetaData.Builder.readFrom(in));
}
int customSize = in.readVInt();
for (int i = 0; i < customSize; i++) {
String type = in.readString();
Custom customIndexMetaData = lookupFactorySafe(type).readFrom(in);
builder.putCustom(type, customIndexMetaData);
}
return builder.build();
}
public static void writeTo(MetaData metaData, StreamOutput out) throws IOException {
out.writeLong(metaData.version);
out.writeString(metaData.uuid);
writeSettingsToStream(metaData.transientSettings(), out);
writeSettingsToStream(metaData.persistentSettings(), out);
out.writeVInt(metaData.indices.size());
for (IndexMetaData indexMetaData : metaData) {
IndexMetaData.Builder.writeTo(indexMetaData, out);
}
out.writeVInt(metaData.templates.size());
for (ObjectCursor<IndexTemplateMetaData> cursor : metaData.templates.values()) {
IndexTemplateMetaData.Builder.writeTo(cursor.value, out);
}
out.writeVInt(metaData.customs().size());
for (ObjectObjectCursor<String, Custom> cursor : metaData.customs()) {
out.writeString(cursor.key);
lookupFactorySafe(cursor.key).writeTo(cursor.value, out);
}
}
}
}
| {
"content_hash": "31a3e17edb165ec60bd3565cf87df9dc",
"timestamp": "",
"source": "github",
"line_count": 1451,
"max_line_length": 248,
"avg_line_length": 43.56650585802895,
"alnum_prop": 0.5931345408526457,
"repo_name": "heng4fun/elasticsearch",
"id": "6fd591fd0bb84877aa147829bf5ab6a011fcc0a0",
"size": "64003",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/main/java/org/elasticsearch/cluster/metadata/MetaData.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "299"
},
{
"name": "Java",
"bytes": "26234602"
},
{
"name": "Perl",
"bytes": "6858"
},
{
"name": "Python",
"bytes": "62027"
},
{
"name": "Ruby",
"bytes": "17776"
},
{
"name": "Shell",
"bytes": "34719"
}
],
"symlink_target": ""
} |
package org.locationtech.geomesa.tools.ingest
import java.io.{File, Serializable}
import java.util.{Map => JMap}
import com.twitter.scalding.Args
import com.typesafe.scalalogging.LazyLogging
import org.geotools.coverage.grid.io.AbstractGridCoverage2DReader
import org.geotools.coverageio.gdal.dted.DTEDReader
import org.geotools.factory.Hints
import org.geotools.gce.geotiff.GeoTiffReader
import org.locationtech.geomesa.accumulo.data.AccumuloDataStoreFactory.{params => dsp}
import org.locationtech.geomesa.raster.data.AccumuloRasterStore
import org.locationtech.geomesa.raster.util.RasterUtils.IngestRasterParams
import org.locationtech.geomesa.raster.{RasterParams => rsp}
import org.locationtech.geomesa.tools.Utils.Formats._
import scala.collection.JavaConversions._
trait RasterIngest extends LazyLogging {
def getAccumuloRasterStoreConf(config: Map[String, Option[String]]): JMap[String, Serializable] =
mapAsJavaMap(Map(
dsp.instanceIdParam.getName -> config(IngestRasterParams.ACCUMULO_INSTANCE).get,
dsp.zookeepersParam.getName -> config(IngestRasterParams.ZOOKEEPERS).get,
dsp.userParam.getName -> config(IngestRasterParams.ACCUMULO_USER).get,
dsp.passwordParam.getName -> config(IngestRasterParams.ACCUMULO_PASSWORD).get,
dsp.tableNameParam.getName -> config(IngestRasterParams.TABLE).get,
dsp.authsParam.getName -> config(IngestRasterParams.AUTHORIZATIONS),
dsp.visibilityParam.getName -> config(IngestRasterParams.VISIBILITIES),
rsp.writeMemoryParam.getName -> config(IngestRasterParams.WRITE_MEMORY),
dsp.writeThreadsParam -> config(IngestRasterParams.WRITE_THREADS),
dsp.queryThreadsParam.getName -> config(IngestRasterParams.QUERY_THREADS),
dsp.mockParam.getName -> config(IngestRasterParams.ACCUMULO_MOCK)
).collect {
case (key, Some(value)) => (key, value);
case (key, value: String) => (key, value)
}).asInstanceOf[java.util.Map[String, Serializable]]
def createRasterStore(config: Map[String, Option[String]]): AccumuloRasterStore = {
val rasterName = config(IngestRasterParams.TABLE)
if (rasterName == null || rasterName.isEmpty) {
logger.error("No raster name specified for raster feature ingest." +
" Please check that all arguments are correct in the previous command. ")
sys.exit()
}
val csConfig: JMap[String, Serializable] = getAccumuloRasterStoreConf(config)
AccumuloRasterStore(csConfig)
}
def createRasterStore(args: Args): AccumuloRasterStore = {
val dsConfig: Map[String, Option[String]] =
Map(
IngestRasterParams.ZOOKEEPERS -> args.optional(IngestRasterParams.ZOOKEEPERS),
IngestRasterParams.ACCUMULO_INSTANCE -> args.optional(IngestRasterParams.ACCUMULO_INSTANCE),
IngestRasterParams.ACCUMULO_USER -> args.optional(IngestRasterParams.ACCUMULO_USER),
IngestRasterParams.ACCUMULO_PASSWORD -> args.optional(IngestRasterParams.ACCUMULO_PASSWORD),
IngestRasterParams.TABLE -> args.optional(IngestRasterParams.TABLE),
IngestRasterParams.AUTHORIZATIONS -> args.optional(IngestRasterParams.AUTHORIZATIONS),
IngestRasterParams.VISIBILITIES -> args.optional(IngestRasterParams.VISIBILITIES),
IngestRasterParams.WRITE_MEMORY -> args.optional(IngestRasterParams.WRITE_MEMORY),
IngestRasterParams.WRITE_THREADS -> args.optional(IngestRasterParams.WRITE_THREADS),
IngestRasterParams.QUERY_THREADS -> args.optional(IngestRasterParams.QUERY_THREADS),
IngestRasterParams.ACCUMULO_MOCK -> args.optional(IngestRasterParams.ACCUMULO_MOCK)
)
createRasterStore(dsConfig)
}
def getReader(imageFile: File, imageType: String): AbstractGridCoverage2DReader = {
imageType match {
case TIFF => new GeoTiffReader(imageFile, defaultHints)
case DTED => new DTEDReader(imageFile, defaultHints)
case _ => throw new Exception("Image type is not supported.")
}
}
val defaultHints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, true)
}
| {
"content_hash": "4c8c65114612d8be77db8780cf75815a",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 100,
"avg_line_length": 51.5875,
"alnum_prop": 0.7438817543009449,
"repo_name": "vpipkt/geomesa",
"id": "7a7e144a136b52d58108f456e0f8bbda6571270f",
"size": "4586",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "geomesa-tools/src/main/scala/org/locationtech/geomesa/tools/ingest/RasterIngest.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "73384"
},
{
"name": "Scala",
"bytes": "3049272"
},
{
"name": "Shell",
"bytes": "26626"
}
],
"symlink_target": ""
} |
+(function ($) {
'use strict';
$.fn.historyTabs = function () {
var that = this;
window.addEventListener('popstate', function (event) {
if (event.state) {
$(that)
.filter('[href="' + event.state.url + '"]')
.tab('show');
}
});
return this.each(function (index, element) {
$(element).on('show.bs.tab', function () {
var stateObject = { url: $(this).attr('href') };
if (window.location.hash && stateObject.url !== window.location.hash) {
window.history.pushState(
stateObject,
document.title,
window.location.pathname + $(this).attr('href')
);
} else {
window.history.replaceState(
stateObject,
document.title,
window.location.pathname + $(this).attr('href')
);
}
});
if (!window.location.hash && $(element).is('.active')) {
// Shows the first element if there are no query parameters.
$(element).tab('show');
} else if ($(this).attr('href') === window.location.hash) {
$(element).tab('show');
}
});
};
})(jQuery);
| {
"content_hash": "6feaefcf42717cacb16fce0213f7f8c3",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 79,
"avg_line_length": 31,
"alnum_prop": 0.5076400679117148,
"repo_name": "jeffdavidgreen/bootstrap-html5-history-tabs",
"id": "76e772422e33844825b7f12e3c556f35d6b7fdc4",
"size": "1178",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bootstrap-history-tabs.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2661"
}
],
"symlink_target": ""
} |
Reality Keys Examples
====================
This repo is for scripts that help you set up contracts with Reality Keys:
https://www.realitykeys.com/
They should be considered EXPERIMENTAL and in some cases are put here for review.
| {
"content_hash": "9eb8f8518bfb6d664a8c8d2567feb6b1",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 81,
"avg_line_length": 33,
"alnum_prop": 0.7272727272727273,
"repo_name": "edmundedgar/realitykeys-examples",
"id": "9bc4eaf82d41cdd85acbe51aac5ca25081bf4c87",
"size": "231",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "47833"
}
],
"symlink_target": ""
} |
<?php
/**
* ContactsDeletedTest
*
* PHP version 5
*
* @category Class
* @package Clever
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Clever API
*
* The Clever API
*
* OpenAPI spec version: 2.0.0
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Please update the test case below to test the model.
*/
namespace Clever;
/**
* ContactsDeletedTest Class Doc Comment
*
* @category Class */
// * @description ContactsDeleted
/**
* @package Clever
* @author Swagger Codegen team
* @link https://github.com/swagger-api/swagger-codegen
*/
class ContactsDeletedTest extends \PHPUnit_Framework_TestCase
{
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
{
}
/**
* Setup before running each test case
*/
public function setUp()
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
{
}
/**
* Test "ContactsDeleted"
*/
public function testContactsDeleted()
{
}
/**
* Test attribute "data"
*/
public function testPropertyData()
{
}
}
| {
"content_hash": "b63a659390a764ac56f1f2cd6e7d959d",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 76,
"avg_line_length": 17.658823529411766,
"alnum_prop": 0.6102598267821452,
"repo_name": "Clever/clever-php",
"id": "27fa8d6ab7243ba9aaf4f2672408bab6ec161c0f",
"size": "1501",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/Model/ContactsDeletedTest.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "169"
},
{
"name": "PHP",
"bytes": "1258252"
},
{
"name": "Shell",
"bytes": "1170"
}
],
"symlink_target": ""
} |
package com.limagiran.hearthstone.partida.util;
import static com.limagiran.hearthstone.HearthStone.CARTAS;
import com.limagiran.hearthstone.card.control.Card;
import com.limagiran.hearthstone.util.Utils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.limagiran.hearthstone.util.Values;
/**
*
* @author Vinicius
*/
public class Random implements Values {
public static final int QUALQUER_CUSTO = -1;
public static List<Card> listOnlyFeitico(int qtd) {
return getList(qtd, "Spell");
}
public static List<Card> deck(int qtd) {
return getList(qtd, "Minion", "Weapon", "Spell");
}
private static List<Card> getList(int qtd, String... typesArray) {
List<Card> deck = new ArrayList<>();
List<String> types = new ArrayList<>(Arrays.asList(typesArray));
while (deck.size() < qtd) {
Card card = CARTAS.getAllCards().get(Utils.random(CARTAS.getAllCards().size()) - 1);
while (!types.contains(card.getType()) || deck.contains(card) || !card.isCollectible()) {
card = CARTAS.getAllCards().get(Utils.random(CARTAS.getAllCards().size()) - 1);
}
deck.add(CARTAS.createCard(card.getId()));
}
return deck;
}
public static Card lacaio() {
return byType("Minion");
}
public static Card arma() {
return byType("Weapon");
}
public static Card feitico() {
return byType("Spell");
}
public static Card getCard(String type, String playerClass, int custo, String race, String rarity, String mechanic) {
Card card = CARTAS.getAllCards().get(Utils.random(CARTAS.getAllCards().size()) - 1);
while (!card.isCollectible() || !validarRandom(card, type, playerClass, custo, race, rarity, mechanic)) {
card = CARTAS.getAllCards().get(Utils.random(CARTAS.getAllCards().size()) - 1);
}
return card;
}
private static boolean validarRandom(Card card, String type, String playerClass,
int custo, String race, String rarity, String mechanic) {
try {
if (!type.equals(GERAL) && !type.equals(card.getType())) {
return false;
} else if (!playerClass.equals(GERAL) && !playerClass.equals(card.getPlayerClass())) {
return false;
} else if ((custo != QUALQUER_CUSTO) && (custo != card.getCost())) {
return false;
} else if (!race.equals(GERAL) && !race.equals(card.getRace())) {
return false;
} else if (!rarity.equals(GERAL) && !rarity.equals(card.getRarity())) {
return false;
} else if (!mechanic.equals(GERAL) && ((card.getMechanics() == null) || !card.getMechanics().contains(mechanic))) {
return false;
}
return true;
} catch (Exception e) {
return false;
}
}
public static Card byType(String type) {
return getCard(type, GERAL, QUALQUER_CUSTO, GERAL, GERAL, GERAL);
}
public static Card byPlayerClass(String playerClass) {
return getCard(GERAL, playerClass, QUALQUER_CUSTO, GERAL, GERAL, GERAL);
}
public static Card byCusto(int custo) {
return getCard(GERAL, GERAL, custo, GERAL, GERAL, GERAL);
}
public static Card byRace(String race) {
return getCard(GERAL, GERAL, QUALQUER_CUSTO, race, GERAL, GERAL);
}
public static Card byRarity(String rarity) {
return getCard(GERAL, GERAL, QUALQUER_CUSTO, GERAL, rarity, GERAL);
}
public static Card byMechanic(String mechanic) {
return getCard(GERAL, GERAL, QUALQUER_CUSTO, GERAL, GERAL, mechanic);
}
public static String pecaSobressalente() {
return PECA_SOBRESSALENTE[Utils.random(PECA_SOBRESSALENTE.length) - 1];
}
public static String companheiroAnimal() {
return COMPANHEIRO_ANIMAL[Utils.random(COMPANHEIRO_ANIMAL.length) - 1];
}
public static String acordePoderoso() {
return ACORDE_PODEROSO[Utils.random(ACORDE_PODEROSO.length) - 1];
}
public static String guerreiroDaHorda() {
return GUERREIRO_DA_HORDA[Utils.random(GUERREIRO_DA_HORDA.length) - 1];
}
} | {
"content_hash": "87e304f468636a688c28f9a2556dafd8",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 127,
"avg_line_length": 35.40495867768595,
"alnum_prop": 0.6225490196078431,
"repo_name": "limagiran/hearthstone",
"id": "de1794a4e70494548390e1158a9d01ac5bce8f1f",
"size": "4284",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/limagiran/hearthstone/partida/util/Random.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1933767"
}
],
"symlink_target": ""
} |
var jive = require("jive-sdk");
var q = require('q');
/**
* Handles actually pushing data to the tile instance
* @param instance
*/
function processTileInstance(instance) {
jive.logger.debug('running pusher for ', instance.name, 'instance', instance.id);
// creates a data update structure
function getFormattedData(count) {
return {
data: {
"title": "Simple Counter",
"contents": [
{
"text": "Current count: " + count,
"icon": "https://community.jivesoftware.com/servlet/JiveServlet/showImage/102-99994-1-1023036/j.png",
"linkDescription": "Current counter."
}
],
"config": {
"listStyle": "contentList"
},
"action": {
"text": "Share State",
"context": {
"count": count
}
}
}
};
}
var store = jive.service.persistence();
return store.find('exampleStore', { 'key': 'count' } ).then(function(found) {
found = found.length > 0 ? found[0].count : parseInt(instance.config.startSequence, 10);
store.save('exampleStore', 'count', {
'key':'count',
'count':found + 1
}).then(function() {
return jive.tiles.pushData(instance, getFormattedData(found));
});
}, function(err) {
jive.logger.debug('Error encountered, push failed', err);
});
}
/**
* Iterates through the tile instances registered in the service, and pushes an update to it
*/
var pushData = function() {
var deferred = q.defer();
jive.tiles.findByDefinitionName('{{{TILE_NAME}}}').then(function(instances) {
if (instances) {
q.all(instances.map(processTileInstance)).then(function() {
deferred.resolve(); //success
}, function() {
deferred.reject(); //failure
});
} else {
jive.logger.debug("No jive instances to push to");
deferred.resolve();
}
});
return deferred.promise;
};
/**
* Schedules the tile update task to automatically fire every 10 seconds
*/
exports.task = [
{
'interval' : 10000,
'handler' : pushData
}
];
/**
* Defines event handlers for the tile life cycle events
*/
exports.eventHandlers = [
// process tile instance whenever a new one is registered with the service
{
'event' : jive.constants.globalEventNames.NEW_INSTANCE,
'handler' : processTileInstance
},
// process tile instance whenever an existing tile instance is updated
{
'event' : jive.constants.globalEventNames.INSTANCE_UPDATED,
'handler' : processTileInstance
}
];
| {
"content_hash": "b8c10687647bc9f42f894f78589d171e",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 125,
"avg_line_length": 28.831683168316832,
"alnum_prop": 0.5367445054945055,
"repo_name": "matthewmccullough/jive-sdk",
"id": "d4bfc9209d8d20a133351ba5139fed735daff68b",
"size": "3534",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jive-sdk-service/generator/styles/tile-list/backend/services.js",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package com.github.hiendo.tsa.web.entities;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
/**
*
*/
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
isGetterVisibility= JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
public class DataPoint {
private long timestamp;
private double value;
// Json serialization
private DataPoint(){}
public DataPoint(long timestamp, double value) {
this.timestamp = timestamp;
this.value = value;
}
public long getTimestamp() {
return timestamp;
}
public double getValue() {
return value;
}
}
| {
"content_hash": "ca9f2aa24f531d652b23e2b3c4bffa4b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 115,
"avg_line_length": 23.419354838709676,
"alnum_prop": 0.7011019283746557,
"repo_name": "hiendo/tsa",
"id": "b0ef8574f037022c327b17961d8a54551782923f",
"size": "726",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/github/hiendo/tsa/web/entities/DataPoint.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "56"
},
{
"name": "HTML",
"bytes": "939"
},
{
"name": "Java",
"bytes": "119699"
}
],
"symlink_target": ""
} |
package com.laytonsmith.abstraction.bukkit.events.drivers;
import com.laytonsmith.abstraction.bukkit.events.BukkitWeatherEvents;
import com.laytonsmith.core.events.Driver;
import com.laytonsmith.core.events.EventUtils;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.weather.LightningStrikeEvent;
import org.bukkit.event.weather.ThunderChangeEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
/**
* @author jacobwgillespie
*/
public class BukkitWeatherListener implements Listener{
@EventHandler(priority = EventPriority.LOWEST)
public void onLightningStrike(LightningStrikeEvent event) {
EventUtils.TriggerListener(Driver.LIGHTNING_STRIKE, "lightning_strike", new BukkitWeatherEvents.BukkitMCLightningStrikeEvent(event));
}
@EventHandler(priority = EventPriority.LOWEST)
public void onThunderChange(ThunderChangeEvent event) {
EventUtils.TriggerListener(Driver.THUNDER_CHANGE, "thunder_change", new BukkitWeatherEvents.BukkitMCThunderChangeEvent(event));
}
@EventHandler(priority = EventPriority.LOWEST)
public void onWeatherChange(WeatherChangeEvent event) {
EventUtils.TriggerListener(Driver.WEATHER_CHANGE, "weather_change", new BukkitWeatherEvents.BukkitMCWeatherChangeEvent(event));
}
}
| {
"content_hash": "71170af92c931cba369e939409825ee1",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 141,
"avg_line_length": 43.67741935483871,
"alnum_prop": 0.8057607090103397,
"repo_name": "dbuxo/CommandHelper",
"id": "9307db9110e6f68b9e7eddcd1e4d2d9faad72d0b",
"size": "1354",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "src/main/java/com/laytonsmith/abstraction/bukkit/events/drivers/BukkitWeatherListener.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "1977"
},
{
"name": "Groff",
"bytes": "6766"
},
{
"name": "HTML",
"bytes": "6362"
},
{
"name": "Java",
"bytes": "4727459"
},
{
"name": "PHP",
"bytes": "3135"
},
{
"name": "Shell",
"bytes": "1391"
},
{
"name": "VimL",
"bytes": "1607"
}
],
"symlink_target": ""
} |
/* $NetBSD: cd9660_debug.c,v 1.13 2013/10/19 17:16:37 christos Exp $ */
/*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
* Perez-Rathke and Ram Vedam. All rights reserved.
*
* This code was written by Daniel Watt, Walter Deignan, Ryan Gabrys,
* Alan Perez-Rathke and Ram Vedam.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY DANIEL WATT, WALTER DEIGNAN, RYAN
* GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL DANIEL WATT, WALTER DEIGNAN, RYAN
* GABRYS, ALAN PEREZ-RATHKE AND RAM VEDAM BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*/
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h>
#include <sys/param.h>
#if defined(__RCSID) && !defined(__lint)
__RCSID("$NetBSD: cd9660_debug.c,v 1.13 2013/10/19 17:16:37 christos Exp $");
#endif /* !__lint */
#if !HAVE_NBTOOL_CONFIG_H
#include <sys/mount.h>
#endif
#include "makefs.h"
#include "cd9660.h"
#include "iso9660_rrip.h"
static void debug_print_susp_attrs(cd9660node *, int);
static void debug_dump_to_xml_padded_hex_output(const char *, unsigned char *,
int);
static inline void
print_n_tabs(int n)
{
int i;
for (i = 1; i <= n; i ++)
printf("\t");
}
#if 0
void
debug_print_rrip_info(n)
cd9660node *n;
{
struct ISO_SUSP_ATTRIBUTES *t;
TAILQ_FOREACH(t, &node->head, rr_ll) {
}
}
#endif
static void
debug_print_susp_attrs(cd9660node *n, int indent)
{
struct ISO_SUSP_ATTRIBUTES *t;
TAILQ_FOREACH(t, &n->head, rr_ll) {
print_n_tabs(indent);
printf("-");
printf("%c%c: L:%i",t->attr.su_entry.SP.h.type[0],
t->attr.su_entry.SP.h.type[1],
(int)t->attr.su_entry.SP.h.length[0]);
printf("\n");
}
}
void
debug_print_tree(iso9660_disk *diskStructure, cd9660node *node, int level)
{
#if !HAVE_NBTOOL_CONFIG_H
cd9660node *cn;
print_n_tabs(level);
if (node->type & CD9660_TYPE_DOT) {
printf(". (%i)\n",
isonum_733(node->isoDirRecord->extent));
} else if (node->type & CD9660_TYPE_DOTDOT) {
printf("..(%i)\n",
isonum_733(node->isoDirRecord->extent));
} else if (node->isoDirRecord->name[0]=='\0') {
printf("(ROOT) (%" PRIu32 " to %" PRId64 ")\n",
node->fileDataSector,
node->fileDataSector +
node->fileSectorsUsed - 1);
} else {
printf("%s (%s) (%" PRIu32 " to %" PRId64 ")\n",
node->isoDirRecord->name,
(node->isoDirRecord->flags[0]
& ISO_FLAG_DIRECTORY) ? "DIR" : "FILE",
node->fileDataSector,
(node->fileSectorsUsed == 0) ?
node->fileDataSector :
node->fileDataSector
+ node->fileSectorsUsed - 1);
}
if (diskStructure->rock_ridge_enabled)
debug_print_susp_attrs(node, level + 1);
TAILQ_FOREACH(cn, &node->cn_children, cn_next_child)
debug_print_tree(diskStructure, cn, level + 1);
#else
printf("Sorry, debugging is not supported in host-tools mode.\n");
#endif
}
void
debug_print_path_tree(cd9660node *n)
{
cd9660node *iterator = n;
/* Only display this message when called with the root node */
if (n->parent == NULL)
printf("debug_print_path_table: Dumping path table contents\n");
while (iterator != NULL) {
if (iterator->isoDirRecord->name[0] == '\0')
printf("0) (ROOT)\n");
else
printf("%i) %s\n", iterator->level,
iterator->isoDirRecord->name);
iterator = iterator->ptnext;
}
}
void
debug_print_volume_descriptor_information(iso9660_disk *diskStructure)
{
volume_descriptor *tmp = diskStructure->firstVolumeDescriptor;
char temp[CD9660_SECTOR_SIZE];
printf("==Listing Volume Descriptors==\n");
while (tmp != NULL) {
memset(temp, 0, CD9660_SECTOR_SIZE);
memcpy(temp, tmp->volumeDescriptorData + 1, 5);
printf("Volume descriptor in sector %" PRId64
": type %i, ID %s\n",
tmp->sector, tmp->volumeDescriptorData[0], temp);
switch(tmp->volumeDescriptorData[0]) {
case 0:/*boot record*/
break;
case 1: /* PVD */
break;
case 2: /* SVD */
break;
case 3: /* Volume Partition Descriptor */
break;
case 255: /* terminator */
break;
}
tmp = tmp->next;
}
printf("==Done Listing Volume Descriptors==\n");
}
void
debug_dump_to_xml_ptentry(path_table_entry *pttemp, int num, int mode)
{
printf("<ptentry num=\"%i\">\n" ,num);
printf("<length>%i</length>\n", pttemp->length[0]);
printf("<extended_attribute_length>%i</extended_attribute_length>\n",
pttemp->extended_attribute_length[0]);
printf("<parent_number>%i</parent_number>\n",
debug_get_encoded_number(pttemp->parent_number,mode));
debug_dump_to_xml_padded_hex_output("name",
pttemp->name, pttemp->length[0]);
printf("</ptentry>\n");
}
void
debug_dump_to_xml_path_table(FILE *fd, off_t sector, int size, int mode)
{
path_table_entry pttemp;
int t = 0;
int n = 0;
if (fseeko(fd, CD9660_SECTOR_SIZE * sector, SEEK_SET) == -1)
err(1, "fseeko");
while (t < size) {
/* Read fixed data first */
fread(&pttemp, 1, 8, fd);
t += 8;
/* Read variable */
fread(((unsigned char*)&pttemp) + 8, 1, pttemp.length[0], fd);
t += pttemp.length[0];
debug_dump_to_xml_ptentry(&pttemp, n, mode);
n++;
}
}
/*
* XML Debug output functions
* Dump hierarchy of CD, as well as volume info, to XML
* Can be used later to diff against a standard,
* or just provide easy to read detailed debug output
*/
void
debug_dump_to_xml(FILE *fd)
{
unsigned char buf[CD9660_SECTOR_SIZE];
off_t sector;
int t, t2;
struct iso_primary_descriptor primaryVD;
struct _boot_volume_descriptor bootVD;
memset(&primaryVD, 0, sizeof(primaryVD));
printf("<cd9660dump>\n");
/* Display Volume Descriptors */
sector = 16;
do {
if (fseeko(fd, CD9660_SECTOR_SIZE * sector, SEEK_SET) == -1)
err(1, "fseeko");
fread(buf, 1, CD9660_SECTOR_SIZE, fd);
t = (int)((unsigned char)buf[0]);
switch (t) {
case 0:
memcpy(&bootVD, buf, CD9660_SECTOR_SIZE);
break;
case 1:
memcpy(&primaryVD, buf, CD9660_SECTOR_SIZE);
break;
}
debug_dump_to_xml_volume_descriptor(buf, sector);
sector++;
} while (t != 255);
t = debug_get_encoded_number((u_char *)primaryVD.type_l_path_table,
731);
t2 = debug_get_encoded_number((u_char *)primaryVD.path_table_size, 733);
printf("Path table 1 located at sector %i and is %i bytes long\n",
t,t2);
debug_dump_to_xml_path_table(fd, t, t2, 721);
t = debug_get_encoded_number((u_char *)primaryVD.type_m_path_table,
731);
debug_dump_to_xml_path_table(fd, t, t2, 722);
printf("</cd9660dump>\n");
}
static void
debug_dump_to_xml_padded_hex_output(const char *element, unsigned char *buf,
int len)
{
int i;
int t;
printf("<%s>",element);
for (i = 0; i < len; i++) {
t = (unsigned char)buf[i];
if (t >= 32 && t < 127)
printf("%c",t);
}
printf("</%s>\n",element);
printf("<%s:hex>",element);
for (i = 0; i < len; i++) {
t = (unsigned char)buf[i];
printf(" %x",t);
}
printf("</%s:hex>\n",element);
}
int
debug_get_encoded_number(unsigned char* buf, int mode)
{
#if !HAVE_NBTOOL_CONFIG_H
switch (mode) {
/* 711: Single bite */
case 711:
return isonum_711(buf);
/* 712: Single signed byte */
case 712:
return isonum_712((signed char *)buf);
/* 721: 16 bit LE */
case 721:
return isonum_721(buf);
/* 731: 32 bit LE */
case 731:
return isonum_731(buf);
/* 722: 16 bit BE */
case 722:
return isonum_722(buf);
/* 732: 32 bit BE */
case 732:
return isonum_732(buf);
/* 723: 16 bit bothE */
case 723:
return isonum_723(buf);
/* 733: 32 bit bothE */
case 733:
return isonum_733(buf);
}
#endif
return 0;
}
void
debug_dump_integer(const char *element, char* buf, int mode)
{
printf("<%s>%i</%s>\n", element,
debug_get_encoded_number((unsigned char *)buf, mode), element);
}
void
debug_dump_string(const char *element __unused, unsigned char *buf __unused, int len __unused)
{
}
void
debug_dump_directory_record_9_1(unsigned char* buf)
{
printf("<directoryrecord>\n");
debug_dump_integer("length",
((struct iso_directory_record*) buf)->length, 711);
debug_dump_integer("ext_attr_length",
((struct iso_directory_record*) buf)->ext_attr_length,711);
debug_dump_integer("extent",
(char *)((struct iso_directory_record*) buf)->extent, 733);
debug_dump_integer("size",
(char *)((struct iso_directory_record*) buf)->size, 733);
debug_dump_integer("flags",
((struct iso_directory_record*) buf)->flags, 711);
debug_dump_integer("file_unit_size",
((struct iso_directory_record*) buf)->file_unit_size,711);
debug_dump_integer("interleave",
((struct iso_directory_record*) buf)->interleave, 711);
debug_dump_integer("volume_sequence_number",
((struct iso_directory_record*) buf)->volume_sequence_number,
723);
debug_dump_integer("name_len",
((struct iso_directory_record*) buf)->name_len, 711);
debug_dump_to_xml_padded_hex_output("name",
(u_char *)((struct iso_directory_record*) buf)->name,
debug_get_encoded_number((u_char *)
((struct iso_directory_record*) buf)->length, 711));
printf("</directoryrecord>\n");
}
void
debug_dump_to_xml_volume_descriptor(unsigned char* buf, int sector)
{
printf("<volumedescriptor sector=\"%i\">\n", sector);
printf("<vdtype>");
switch(buf[0]) {
case 0:
printf("boot");
break;
case 1:
printf("primary");
break;
case 2:
printf("supplementary");
break;
case 3:
printf("volume partition descriptor");
break;
case 255:
printf("terminator");
break;
}
printf("</vdtype>\n");
switch(buf[0]) {
case 1:
debug_dump_integer("type",
((struct iso_primary_descriptor*)buf)->type, 711);
debug_dump_to_xml_padded_hex_output("id",
(u_char *)((struct iso_primary_descriptor*) buf)->id,
ISODCL ( 2, 6));
debug_dump_integer("version",
((struct iso_primary_descriptor*)buf)->version,
711);
debug_dump_to_xml_padded_hex_output("system_id",
(u_char *)((struct iso_primary_descriptor*)buf)->system_id,
ISODCL(9,40));
debug_dump_to_xml_padded_hex_output("volume_id",
(u_char *)((struct iso_primary_descriptor*)buf)->volume_id,
ISODCL(41,72));
debug_dump_integer("volume_space_size",
((struct iso_primary_descriptor*)buf)->volume_space_size,
733);
debug_dump_integer("volume_set_size",
((struct iso_primary_descriptor*)buf)->volume_set_size,
733);
debug_dump_integer("volume_sequence_number",
((struct iso_primary_descriptor*)buf)->volume_sequence_number,
723);
debug_dump_integer("logical_block_size",
((struct iso_primary_descriptor*)buf)->logical_block_size,
723);
debug_dump_integer("path_table_size",
((struct iso_primary_descriptor*)buf)->path_table_size,
733);
debug_dump_integer("type_l_path_table",
((struct iso_primary_descriptor*)buf)->type_l_path_table,
731);
debug_dump_integer("opt_type_l_path_table",
((struct iso_primary_descriptor*)buf)->opt_type_l_path_table,
731);
debug_dump_integer("type_m_path_table",
((struct iso_primary_descriptor*)buf)->type_m_path_table,
732);
debug_dump_integer("opt_type_m_path_table",
((struct iso_primary_descriptor*)buf)->opt_type_m_path_table,732);
debug_dump_directory_record_9_1(
(u_char *)((struct iso_primary_descriptor*)buf)->root_directory_record);
debug_dump_to_xml_padded_hex_output("volume_set_id",
(u_char *)((struct iso_primary_descriptor*) buf)->volume_set_id,
ISODCL (191, 318));
debug_dump_to_xml_padded_hex_output("publisher_id",
(u_char *)((struct iso_primary_descriptor*) buf)->publisher_id,
ISODCL (319, 446));
debug_dump_to_xml_padded_hex_output("preparer_id",
(u_char *)((struct iso_primary_descriptor*) buf)->preparer_id,
ISODCL (447, 574));
debug_dump_to_xml_padded_hex_output("application_id",
(u_char *)((struct iso_primary_descriptor*) buf)->application_id,
ISODCL (575, 702));
debug_dump_to_xml_padded_hex_output("copyright_file_id",
(u_char *)((struct iso_primary_descriptor*) buf)->copyright_file_id,
ISODCL (703, 739));
debug_dump_to_xml_padded_hex_output("abstract_file_id",
(u_char *)((struct iso_primary_descriptor*) buf)->abstract_file_id,
ISODCL (740, 776));
debug_dump_to_xml_padded_hex_output("bibliographic_file_id",
(u_char *)((struct iso_primary_descriptor*) buf)->bibliographic_file_id,
ISODCL (777, 813));
debug_dump_to_xml_padded_hex_output("creation_date",
(u_char *)((struct iso_primary_descriptor*) buf)->creation_date,
ISODCL (814, 830));
debug_dump_to_xml_padded_hex_output("modification_date",
(u_char *)((struct iso_primary_descriptor*) buf)->modification_date,
ISODCL (831, 847));
debug_dump_to_xml_padded_hex_output("expiration_date",
(u_char *)((struct iso_primary_descriptor*) buf)->expiration_date,
ISODCL (848, 864));
debug_dump_to_xml_padded_hex_output("effective_date",
(u_char *)((struct iso_primary_descriptor*) buf)->effective_date,
ISODCL (865, 881));
debug_dump_to_xml_padded_hex_output("file_structure_version",
(u_char *)((struct iso_primary_descriptor*) buf)->file_structure_version,
ISODCL(882,882));
break;
}
printf("</volumedescriptor>\n");
}
| {
"content_hash": "56adf4b72ca80401e1522c8af9dff77e",
"timestamp": "",
"source": "github",
"line_count": 498,
"max_line_length": 94,
"avg_line_length": 28.542168674698797,
"alnum_prop": 0.6571689883213733,
"repo_name": "execunix/vinos",
"id": "33e2b3e01f4a8a81e444352e18707afbb48e2b8a",
"size": "14214",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "usr.sbin/makefs/cd9660/cd9660_debug.c",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
class Ramp_Controller_KeyParameters
{
/* Controller names */
const ACT_CONTROLLER = 'activity';
const DOC_CONTROLLER = 'document';
const REP_CONTROLLER = 'report';
const TBL_CONTROLLER = 'table';
const ADMIN_CONTROLLER = 'admin-table';
const DEFAULT_CONTROLLER = self::TBL_CONTROLLER;
/* Key parameter names */
const ACT_KEY_PARAM = 'activity';
const DOC_KEY_PARAM = 'document';
const SETTING_PARAM = '_setting';
// STATIC (CLASS) VARIABLES
protected static $_settingControllerTypes = array(
self::TBL_CONTROLLER,
self::REP_CONTROLLER, self::ADMIN_CONTROLLER,
);
// STATIC (CLASS) FUNCTIONS
public static function isASettingController($controllerName)
{
return in_array($controllerName, self::$_settingControllerTypes);
}
/**
* Gets the key parameter (activity, document, setting, etc)
* in the given request.
*
* @param $request the Controller Action request
*/
public static function
getKeyParam(Zend_Controller_Request_Abstract $request)
{
$controller = $request->getControllerName();
$keyParam = "";
$keyword = self::getKeyParamKeyword($controller);
$keyParam = $request->getUserParam($keyword, '');
if ( $controller == self::DOC_CONTROLLER )
{
$keyParam = $keyParam ? :
$request->getUserParam(self::ACT_KEY_PARAM, '');
}
return urldecode($keyParam);
}
/**
* Gets the key parameter keyword for the given controller type.
*
* @param controller the given controller type ('activity',
* 'table', etc.)
*/
public static function getKeyParamKeyword($controller)
{
if ( $controller == self::ACT_CONTROLLER )
{
return self::ACT_KEY_PARAM;
}
else if ( $controller == self::DOC_CONTROLLER )
{
return self::DOC_KEY_PARAM;
}
else if ( self::isASettingController($controller) )
{
return self::SETTING_PARAM;
}
return "";
}
}
| {
"content_hash": "6dc34f4f86b165d86baf2b39fd96dee7",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 75,
"avg_line_length": 27.4875,
"alnum_prop": 0.5716234652114598,
"repo_name": "AlyceBrady/ramp",
"id": "16d2d9ae826554e1255484dc93854d30ae7b52dc",
"size": "2683",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "library/Ramp/Controller/KeyParameters.php",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "38518"
},
{
"name": "JavaScript",
"bytes": "3949"
},
{
"name": "PHP",
"bytes": "15677523"
},
{
"name": "Shell",
"bytes": "1048"
}
],
"symlink_target": ""
} |
<?php
namespace Craft;
class RoutesService extends BaseApplicationComponent
{
// Public Methods
// =========================================================================
/**
* Returns the routes defined in craft/config/routes.php
*
* @return array
*/
public function getConfigFileRoutes()
{
$path = craft()->path->getConfigPath().'routes.php';
if (IOHelper::fileExists($path))
{
$routes = require_once($path);
if (is_array($routes))
{
// Check for any locale-specific routes
$locale = craft()->language;
if (isset($routes[$locale]) && is_array($routes[$locale]))
{
$localizedRoutes = $routes[$locale];
unset($routes[$locale]);
// Merge them so that the localized routes come first
$routes = array_merge($localizedRoutes, $routes);
}
return $routes;
}
}
return array();
}
/**
* Returns the routes defined in the CP.
*
* @return array
*/
public function getDbRoutes()
{
$results = craft()->db->createCommand()
->select('urlPattern, template')
->from('routes')
->where(array('or', 'locale is null', 'locale = :locale'), array(':locale' => craft()->language))
->order('sortOrder')
->queryAll();
if ($results)
{
$routes = array();
foreach ($results as $result)
{
$routes[$result['urlPattern']] = $result['template'];
}
return $routes;
}
return array();
}
/**
* Saves a new or existing route.
*
* @param array $urlParts The URL as defined by the user. This is an array where each element is either a
* string or an array containing the name of a subpattern and the subpattern.
* @param string $template The template to route matching URLs to.
* @param int|null $routeId The route ID, if editing an existing route.
* @param string|null $locale
*
* @throws Exception
* @return RouteRecord
*/
public function saveRoute($urlParts, $template, $routeId = null, $locale = null)
{
if ($routeId !== null)
{
$routeRecord = RouteRecord::model()->findById($routeId);
if (!$routeRecord)
{
throw new Exception(Craft::t('No route exists with the ID “{id}”.', array('id' => $routeId)));
}
}
else
{
$routeRecord = new RouteRecord();
// Get the next biggest sort order
$maxSortOrder = craft()->db->createCommand()
->select('max(sortOrder)')
->from('routes')
->queryScalar();
$routeRecord->sortOrder = $maxSortOrder + 1;
}
// Compile the URL parts into a regex pattern
$urlPattern = '';
$urlParts = array_filter($urlParts);
foreach ($urlParts as $part)
{
if (is_string($part))
{
// Escape any special regex characters
$urlPattern .= StringHelper::escapeRegexChars($part);
}
else if (is_array($part))
{
// Is the name a valid handle?
if (preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $part[0]))
{
// Add the var as a named subpattern
$urlPattern .= '(?P<'.preg_quote($part[0]).'>'.$part[1].')';
}
else
{
// Just match it
$urlPattern .= '('.$part[1].')';
}
}
}
$routeRecord->locale = $locale;
$routeRecord->urlParts = JsonHelper::encode($urlParts);
$routeRecord->urlPattern = $urlPattern;
$routeRecord->template = $template;
$routeRecord->save();
return $routeRecord;
}
/**
* Deletes a route by its ID.
*
* @param int $routeId
*
* @return bool
*/
public function deleteRouteById($routeId)
{
craft()->db->createCommand()->delete('routes', array('id' => $routeId));
return true;
}
/**
* Updates the route order.
*
* @param array $routeIds An array of each of the route IDs, in their new order.
*
* @return null
*/
public function updateRouteOrder($routeIds)
{
foreach ($routeIds as $order => $routeId)
{
$data = array('sortOrder' => $order + 1);
$condition = array('id' => $routeId);
craft()->db->createCommand()->update('routes', $data, $condition);
}
}
}
| {
"content_hash": "508f3371e37a5fef678d3fbf0069877e",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 112,
"avg_line_length": 22.7816091954023,
"alnum_prop": 0.5925832492431887,
"repo_name": "jelyman2/vagrant-craftcms",
"id": "fc6d38aa25844350611f611846b21bbb37cbd9d0",
"size": "4280",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "craft/craft/app/services/RoutesService.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "14"
},
{
"name": "Batchfile",
"bytes": "2790"
},
{
"name": "CSS",
"bytes": "192822"
},
{
"name": "HTML",
"bytes": "251325"
},
{
"name": "JavaScript",
"bytes": "1489535"
},
{
"name": "PHP",
"bytes": "12104916"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="eo" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About UniCoin</source>
<translation>Pri UniCoin</translation>
</message>
<message>
<location line="+39"/>
<source><b>UniCoin</b> version</source>
<translation><b>UniCoin</b>-a versio</translation>
</message>
<message>
<location line="+57"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The UniCoin developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Adresaro</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Duoble-klaku por redakti adreson aŭ etikedon</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Kreu novan adreson</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopiu elektitan adreson al la tondejo</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Nova Adreso</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your UniCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>&Kopiu Adreson</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a UniCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified UniCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Forviŝu</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your UniCoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>Kopiu &Etikedon</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Redaktu</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Eksportu Adresarajn Datumojn</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Diskoma dosiero (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Eraro dum eksportado</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Ne eblis skribi al dosiero %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Etikedo</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adreso</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(ne etikedo)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Enigu pasfrazon</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Nova pasfrazo</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Ripetu novan pasfrazon</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Enigu novan pasfrazon por la monujo.<br/>Bonvolu, uzu pasfrazon kun <b>10 aŭ pli hazardaj signoj</b>, aŭ <b>ok aŭ pli vortoj</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Ĉifru monujon</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Ĉi tiu operacio devas vian monujan pasfrazon, por malŝlosi la monujon.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Malŝlosu monujon</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Ĉi tiu operacio devas vian monujan pasfrazon, por malĉifri la monujon.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Malĉifru monujon</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Anstataŭigu pasfrazon</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Enigu la malnovan kaj novan monujan pasfrazon.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Konfirmu ĉifrado de monujo</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR ZETACOINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Monujo ĉifrita</translation>
</message>
<message>
<location line="-56"/>
<source>UniCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your abccoins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Monujo ĉifrado fiaskis</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Ĉifrado de monujo fiaskis, kaŭze de interna eraro. Via monujo ne ĉifritas.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>La pasfrazoj enigitaj ne samas.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Monujo malŝlosado fiaskis</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>La pasfrazo enigita por ĉifrado de monujo ne konformas.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Monujo malĉifrado fiaskis</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>Subskribu &mesaĝon...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Sinkronigante kun reto...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Superrigardo</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Transakcioj</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Esploru historion de transakcioj</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>&Eliru</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Eliru de aplikaĵo</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about UniCoin</source>
<translation>Vidigu informaĵon pri Bitmono</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Pri &QT</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Vidigu informaĵon pri Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Opcioj...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>&Ĉifru Monujon...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Anstataŭigu pasfrazon...</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-347"/>
<source>Send coins to a UniCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for UniCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>&Kontrolu mesaĝon...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>UniCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Monujo</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>&About UniCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your UniCoin addresses to prove you own them</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified UniCoin addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Dosiero</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Agordoj</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Helpo</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>UniCoin client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to UniCoin network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation><numerusform>%n horo</numerusform><numerusform>%n horoj</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n tago</numerusform><numerusform>%n tagoj</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation><numerusform>%n semajno</numerusform><numerusform>%n semajnoj</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation>Eraro</translation>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Ĝisdata</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Ĝisdatigante...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Sendita transakcio</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Envenanta transakcio</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid UniCoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Monujo estas <b>ĉifrita</b> kaj nun <b>malŝlosita</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Monujo estas <b>ĉifrita</b> kaj nun <b>ŝlosita</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. UniCoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Reta Averto</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Redaktu Adreson</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Etikedo</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>La etikedo interrilatita kun ĉi tiun adreso</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adreso</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>La adreso enigita "%1" jam ekzistas en la adresaro.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid UniCoin address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Ne eblis malŝlosi monujon</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>UniCoin-Qt</source>
<translation>UniCoin-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>versio</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Opcioj</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start UniCoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start UniCoin on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the UniCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Connect to the UniCoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting UniCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show UniCoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Nuligu</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Apliku</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting UniCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the UniCoin network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Nekonfirmita:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Monujo</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Lastaj transakcioj</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start abccoin: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Etikedo:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Reto</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Malfermu</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the UniCoin-Qt help message to get a list with possible UniCoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>UniCoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>UniCoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the UniCoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the UniCoin RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Sendu Monojn</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Sendu samtempe al multaj ricevantoj</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123,456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> al %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Ĉu vi vere volas sendi %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>kaj</translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Etikedo:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Elektu adreson el adresaro</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Algluu adreson de tondejo</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Forigu ĉi tiun ricevanton</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a UniCoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>Algluu adreson de tondejo</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this UniCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified UniCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a UniCoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter UniCoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+25"/>
<source>The UniCoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/nekonfirmita</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 konfirmoj</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Sumo</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, ankoraŭ ne elsendita sukcese</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>nekonata</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Transakciaj detaloj</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Tipo</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adreso</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Sumo</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Ricevita kun</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Ricevita de</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Sendita al</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Pago al vi mem</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Minita</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Transakcia tipo.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Ĉiuj</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Hodiaŭ</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Ricevita kun</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Sendita al</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Al vi mem</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Minita</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Kopiu adreson</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Redaktu etikedon</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Diskoma dosiero (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Konfirmita</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Dato</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Tipo</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Etikedo</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adreso</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Sumo</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Eraro dum eksportado</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Ne eblis skribi al dosiero %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>UniCoin version</source>
<translation>UniCoin-a versio</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or abccoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Listigu instrukciojn</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Opcioj:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: abccoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: abccoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 8333 or testnet: 18333)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=abccoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "UniCoin Alert" [email protected]
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. UniCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong UniCoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the UniCoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Ŝarĝante adresojn...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of UniCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart UniCoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Ŝarĝante blok-indekson...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. UniCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Ŝarĝante monujon...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Ŝarĝado finitas</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>Por uzi la opcion %s</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Eraro</translation>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation type="unfinished"/>
</message>
</context>
</TS> | {
"content_hash": "a240689b631f479a50c92f9b793d85a6",
"timestamp": "",
"source": "github",
"line_count": 2917,
"max_line_length": 395,
"avg_line_length": 33.73842989372643,
"alnum_prop": 0.5915663262714017,
"repo_name": "unicoindev/unicoin",
"id": "618a5c5fb434a3b56dda01c2a0b59221c8285333",
"size": "98465",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/qt/locale/bitcoin_eo.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "103127"
},
{
"name": "C++",
"bytes": "2474639"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "IDL",
"bytes": "14029"
},
{
"name": "Objective-C",
"bytes": "5711"
},
{
"name": "Python",
"bytes": "3773"
},
{
"name": "Shell",
"bytes": "1144"
},
{
"name": "TypeScript",
"bytes": "5233403"
}
],
"symlink_target": ""
} |
all: check_dependencies test
filename=dominic-`python -c 'import dominic;print dominic.version'`.tar.gz
export PYTHONPATH:= ${PYTHONPATH}:${PWD}
check_dependencies:
@echo "Checking for dependencies to run tests ..."
@python -c "import sure" 2>/dev/null || (echo "You must install sure in order to run dominic's tests" && exit 3)
@python -c "import xpath" 2>/dev/null || (echo "You must install py-dom-xpath in order to run dominic's tests" && exit 3)
test: clean
@echo "Running dominic tests ..."
@nosetests -s --verbosity=2 --with-coverage --cover-erase --cover-inclusive ./tests/ --cover-package=dominic
doctest: clean
@cd docs && make doctest
documentation:
@cd docs && make html
clean:
@printf "Cleaning up files that are already in .gitignore... "
@for pattern in `cat .gitignore`; do rm -rf $$pattern; find . -name "$$pattern" -exec rm -rf {} \;; done
@echo "OK!"
release: clean
@printf "Exporting to $(filename)... "
@tar czf $(filename) dominic setup.py README.md COPYING
@echo "DONE!"
| {
"content_hash": "d5464e9875b7066d51a6ded93a578431",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 122,
"avg_line_length": 33.86666666666667,
"alnum_prop": 0.6929133858267716,
"repo_name": "gabrielfalcao/dominic",
"id": "246c76924e84ddc4578d7f5774f62cc9edf6d2b1",
"size": "1016",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Makefile",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "216538"
}
],
"symlink_target": ""
} |
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 26.1.9
description: >
Return abrupt result.
info: >
26.1.9 Reflect.has ( target, propertyKey )
...
4. Return target.[[HasProperty]](key).
features: [Proxy]
---*/
var o = {};
var p = new Proxy(o, {
has: function() {
throw new Test262Error();
}
});
assert.throws(Test262Error, function() {
Reflect.has(p, 'p1');
});
| {
"content_hash": "b71db4e4ee1cbf5f91d5acd3057203f1",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 70,
"avg_line_length": 20.25,
"alnum_prop": 0.6378600823045267,
"repo_name": "baslr/ArangoDB",
"id": "78efba9f6c0703dc1f65cc068e7cd7ed7c25a165",
"size": "486",
"binary": false,
"copies": "3",
"ref": "refs/heads/3.1-silent",
"path": "3rdParty/V8/V8-5.0.71.39/test/test262/data/test/built-ins/Reflect/has/return-abrupt-from-result.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ada",
"bytes": "89080"
},
{
"name": "Assembly",
"bytes": "391227"
},
{
"name": "Awk",
"bytes": "4272"
},
{
"name": "Batchfile",
"bytes": "62892"
},
{
"name": "C",
"bytes": "7932707"
},
{
"name": "C#",
"bytes": "96430"
},
{
"name": "C++",
"bytes": "284363933"
},
{
"name": "CLIPS",
"bytes": "5291"
},
{
"name": "CMake",
"bytes": "681903"
},
{
"name": "CSS",
"bytes": "1036656"
},
{
"name": "CWeb",
"bytes": "174166"
},
{
"name": "Cuda",
"bytes": "52444"
},
{
"name": "DIGITAL Command Language",
"bytes": "259402"
},
{
"name": "Emacs Lisp",
"bytes": "14637"
},
{
"name": "Fortran",
"bytes": "1856"
},
{
"name": "Groovy",
"bytes": "131"
},
{
"name": "HTML",
"bytes": "2318016"
},
{
"name": "Java",
"bytes": "2325801"
},
{
"name": "JavaScript",
"bytes": "67878359"
},
{
"name": "LLVM",
"bytes": "24129"
},
{
"name": "Lex",
"bytes": "1231"
},
{
"name": "Lua",
"bytes": "16189"
},
{
"name": "M4",
"bytes": "600550"
},
{
"name": "Makefile",
"bytes": "509612"
},
{
"name": "Max",
"bytes": "36857"
},
{
"name": "Module Management System",
"bytes": "1545"
},
{
"name": "NSIS",
"bytes": "28404"
},
{
"name": "Objective-C",
"bytes": "19321"
},
{
"name": "Objective-C++",
"bytes": "2503"
},
{
"name": "PHP",
"bytes": "98503"
},
{
"name": "Pascal",
"bytes": "145688"
},
{
"name": "Perl",
"bytes": "720157"
},
{
"name": "Perl 6",
"bytes": "9918"
},
{
"name": "Python",
"bytes": "5859911"
},
{
"name": "QMake",
"bytes": "16692"
},
{
"name": "R",
"bytes": "5123"
},
{
"name": "Rebol",
"bytes": "354"
},
{
"name": "Roff",
"bytes": "1010686"
},
{
"name": "Ruby",
"bytes": "922159"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Scheme",
"bytes": "10604"
},
{
"name": "Shell",
"bytes": "511077"
},
{
"name": "Swift",
"bytes": "116"
},
{
"name": "Tcl",
"bytes": "1172"
},
{
"name": "TeX",
"bytes": "32117"
},
{
"name": "Vim script",
"bytes": "4075"
},
{
"name": "Visual Basic",
"bytes": "11568"
},
{
"name": "XSLT",
"bytes": "551977"
},
{
"name": "Yacc",
"bytes": "53005"
}
],
"symlink_target": ""
} |
#ifndef __PU_SLAVE_EMITTER_FACTORY_H__
#define __PU_SLAVE_EMITTER_FACTORY_H__
#include "ParticleUniversePrerequisites.h"
#include "ParticleUniverseEmitterFactory.h"
#include "ParticleUniverseSlaveEmitter.h"
#include "ParticleUniverseSlaveEmitterTokens.h"
namespace ParticleUniverse
{
/** This is the factory class that is responsible for creating a SlaveEmitter.
*/
class _ParticleUniverseExport SlaveEmitterFactory : public ParticleEmitterFactory
{
protected:
SlaveEmitterWriter mSlaveEmitterWriter;
SlaveEmitterTranslator mSlaveEmitterTranslator;
public:
SlaveEmitterFactory(void) {};
virtual ~SlaveEmitterFactory(void) {};
/** See ParticleEmitterFactory */
String getEmitterType(void) const
{
return "Slave";
}
/** See ParticleEmitterFactory */
ParticleEmitter* createEmitter(void)
{
return _createEmitter<SlaveEmitter>();
}
/** See ScriptReader */
virtual bool translateChildProperty(ScriptCompiler* compiler, const AbstractNodePtr &node)
{
return mSlaveEmitterTranslator.translateChildProperty(compiler, node);
};
/** See ScriptReader */
virtual bool translateChildObject(ScriptCompiler* compiler, const AbstractNodePtr &node)
{
return mSlaveEmitterTranslator.translateChildObject(compiler, node);
};
/* */
virtual void write(ParticleScriptSerializer* serializer, const IElement* element)
{
// Delegate to mSlaveEmitterWriter
mSlaveEmitterWriter.write(serializer, element);
}
};
}
#endif
| {
"content_hash": "08a851dad1dfcb6bbfcc3fb91dda36cd",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 93,
"avg_line_length": 27.189655172413794,
"alnum_prop": 0.7152821813570069,
"repo_name": "gsage/engine",
"id": "22d6f33da30887b20f907ad1c967f7c10eb2283f",
"size": "2877",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "PlugIns/ParticleUniverse/include/ParticleEmitters/ParticleUniverseSlaveEmitterFactory.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "5889"
},
{
"name": "C++",
"bytes": "3005063"
},
{
"name": "CMake",
"bytes": "40211"
},
{
"name": "CSS",
"bytes": "8658"
},
{
"name": "GLSL",
"bytes": "155433"
},
{
"name": "HLSL",
"bytes": "127072"
},
{
"name": "HTML",
"bytes": "4971"
},
{
"name": "JavaScript",
"bytes": "10941"
},
{
"name": "Lua",
"bytes": "259716"
},
{
"name": "Makefile",
"bytes": "3365"
},
{
"name": "Metal",
"bytes": "104765"
},
{
"name": "Objective-C",
"bytes": "3975"
},
{
"name": "Objective-C++",
"bytes": "10158"
},
{
"name": "Python",
"bytes": "20756"
},
{
"name": "Shell",
"bytes": "1559"
}
],
"symlink_target": ""
} |
from __future__ import print_function
import os.path
import subprocess
import mxnet as mx
import numpy as np
from time import time
import sys
def get_use_tensorrt():
return int(os.environ.get("MXNET_USE_TENSORRT", 0))
def set_use_tensorrt(status = False):
os.environ["MXNET_USE_TENSORRT"] = str(int(status))
def get_cifar10(data_dir):
if not os.path.isdir(data_dir):
os.system("mkdir " + data_dir)
cwd = os.path.abspath(os.getcwd())
os.chdir(data_dir)
if (not os.path.exists('train.rec')) or \
(not os.path.exists('test.rec')) :
import urllib, zipfile, glob
dirname = os.getcwd()
zippath = os.path.join(dirname, "cifar10.zip")
urllib.urlretrieve("http://data.mxnet.io/mxnet/data/cifar10.zip", zippath)
zf = zipfile.ZipFile(zippath, "r")
zf.extractall()
zf.close()
os.remove(zippath)
for f in glob.glob(os.path.join(dirname, "cifar", "*")):
name = f.split(os.path.sep)[-1]
os.rename(f, os.path.join(dirname, name))
os.rmdir(os.path.join(dirname, "cifar"))
os.chdir(cwd)
def get_cifar10_iterator(args, kv):
data_shape = (3, 32, 32) #28, 28)
data_dir = args['data_dir']
if os.name == "nt":
data_dir = data_dir[:-1] + "\\"
if '://' not in args['data_dir']:
get_cifar10(data_dir)
train = mx.io.ImageRecordIter(
path_imgrec = os.path.join(data_dir, "train.rec"),
mean_img = os.path.join(data_dir, "mean.bin"),
data_shape = data_shape,
batch_size = args['batch_size'],
rand_crop = True,
rand_mirror = True,
num_parts = kv['num_workers'],
part_index = kv['rank'])
val = mx.io.ImageRecordIter(
path_imgrec = os.path.join(data_dir, "test.rec"),
mean_img = os.path.join(data_dir, "mean.bin"),
rand_crop = False,
rand_mirror = False,
data_shape = data_shape,
batch_size = args['batch_size'],
num_parts = kv['num_workers'],
part_index = kv['rank'])
return (train, val)
# To support Python 2 and 3.x < 3.5
def merge_dicts(*dict_args):
result = {}
for dictionary in dict_args:
result.update(dictionary)
return result
def get_exec(model_prefix='resnet50', image_size=(32, 32), batch_size = 128, ctx=mx.gpu(0), epoch=1):
sym, arg_params, aux_params = mx.model.load_checkpoint(model_prefix, epoch)
h, w = image_size
data_shape=(batch_size, 3, h, w)
sm_shape=(batch_size,)
data = mx.sym.Variable("data")
softmax_label = mx.sym.Variable("softmax_label")
all_params = merge_dicts(arg_params, aux_params)
if not get_use_tensorrt():
all_params = dict([(k, v.as_in_context(mx.gpu(0))) for k, v in all_params.items()])
executor = sym.simple_bind(ctx=ctx, data = data_shape,
softmax_label=sm_shape, grad_req='null', shared_buffer=all_params, force_rebind=True)
return executor, h, w
def compute(model_prefix, epoch, data_dir, batch_size=128):
executor, h, w = get_exec(model_prefix=model_prefix,
image_size=(32, 32),
batch_size=batch_size,
ctx=mx.gpu(0),
epoch=epoch)
num_ex = 10000
all_preds = np.zeros([num_ex, 10])
train_iter, test_iter = get_cifar10_iterator(args={'data_dir':data_dir, 'batch_size':batch_size}, kv={'num_workers':1, 'rank':0})
train_iter2, test_iter2 = get_cifar10_iterator(args={'data_dir':data_dir, 'batch_size':num_ex}, kv={'num_workers':1, 'rank':0})
all_label_train = train_iter2.next().label[0].asnumpy()
all_label_test = test_iter2.next().label[0].asnumpy().astype(np.int32)
train_iter, test_iter = get_cifar10_iterator(args={'data_dir':'./data', 'batch_size':batch_size}, kv={'num_workers':1, 'rank':0})
start = time()
example_ct = 0
for idx, dbatch in enumerate(test_iter):
data = dbatch.data[0]
executor.arg_dict["data"][:] = data
executor.forward(is_train=False)
preds = executor.outputs[0].asnumpy()
offset = idx*batch_size
extent = batch_size if num_ex - offset > batch_size else num_ex - offset
all_preds[offset:offset+extent, :] = preds[:extent]
example_ct += extent
all_preds = np.argmax(all_preds, axis=1)
matches = (all_preds[:example_ct] == all_label_test[:example_ct]).sum()
percentage = 100.0 * matches / example_ct
return percentage, time() - start
if __name__ == '__main__':
model_prefix = sys.argv[1]
epoch = int(sys.argv[2])
data_dir = sys.argv[3]
batch_size = 1024
print("\nRunning inference in MxNet\n")
set_use_tensorrt(False)
mxnet_pct, mxnet_time = compute(model_prefix, epoch, data_dir, batch_size)
print("\nRunning inference in MxNet-TensorRT\n")
set_use_tensorrt(True)
trt_pct, trt_time = compute(model_prefix, epoch, data_dir, batch_size)
print("MxNet time: %f" % mxnet_time)
print("MxNet-TensorRT time: %f" % trt_time)
print("Speedup: %fx" % (mxnet_time / trt_time))
| {
"content_hash": "7726bef7c4c1322dafdf6aac9b1aa3dc",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 133,
"avg_line_length": 33.422077922077925,
"alnum_prop": 0.5968525354575481,
"repo_name": "mlperf/training_results_v0.6",
"id": "f4fb399f8720cd122002b7079cc1f76e5a0d6557",
"size": "5147",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Fujitsu/benchmarks/resnet/implementations/mxnet/nvidia-examples/tensorrt-integration/test_tensorrt_resnet50.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "1731"
},
{
"name": "Batchfile",
"bytes": "13941"
},
{
"name": "C",
"bytes": "208630"
},
{
"name": "C++",
"bytes": "10999411"
},
{
"name": "CMake",
"bytes": "129712"
},
{
"name": "CSS",
"bytes": "64767"
},
{
"name": "Clojure",
"bytes": "396764"
},
{
"name": "Cuda",
"bytes": "2272433"
},
{
"name": "Dockerfile",
"bytes": "67820"
},
{
"name": "Groovy",
"bytes": "62557"
},
{
"name": "HTML",
"bytes": "19753082"
},
{
"name": "Java",
"bytes": "166294"
},
{
"name": "JavaScript",
"bytes": "71846"
},
{
"name": "Julia",
"bytes": "408765"
},
{
"name": "Jupyter Notebook",
"bytes": "2713169"
},
{
"name": "Lua",
"bytes": "4430"
},
{
"name": "MATLAB",
"bytes": "34903"
},
{
"name": "Makefile",
"bytes": "115694"
},
{
"name": "Perl",
"bytes": "1535873"
},
{
"name": "Perl 6",
"bytes": "7280"
},
{
"name": "PowerShell",
"bytes": "6150"
},
{
"name": "Python",
"bytes": "24905683"
},
{
"name": "R",
"bytes": "351865"
},
{
"name": "Roff",
"bytes": "293052"
},
{
"name": "Scala",
"bytes": "1189019"
},
{
"name": "Shell",
"bytes": "794096"
},
{
"name": "Smalltalk",
"bytes": "3497"
},
{
"name": "TypeScript",
"bytes": "361164"
}
],
"symlink_target": ""
} |
package org.spongepowered.mod.mixin.core.forge;
import net.minecraft.block.state.IBlockState;
import org.spongepowered.api.block.BlockSnapshot;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.util.annotation.NonnullByDefault;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@NonnullByDefault
@Mixin(value = net.minecraftforge.common.util.BlockSnapshot.class, remap = false)
public abstract class MixinBlockSnapshot implements BlockSnapshot {
@Shadow
public transient IBlockState replacedBlock;
@Override
public BlockState getState() {
return (BlockState) this.replacedBlock;
}
}
| {
"content_hash": "bbe6aaca92e88432122946de927cf49e",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 81,
"avg_line_length": 29.47826086956522,
"alnum_prop": 0.7949852507374632,
"repo_name": "caseif/Sponge",
"id": "b44cda1304a6162cbfbc238ee7a64bf142c9f075",
"size": "1925",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/spongepowered/mod/mixin/core/forge/MixinBlockSnapshot.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "290660"
},
{
"name": "Shell",
"bytes": "78"
}
],
"symlink_target": ""
} |
package org.apache.accumulo.tserver.constraints;
import org.apache.accumulo.core.constraints.Constraint;
public abstract class SystemConstraint implements Constraint {}
| {
"content_hash": "ab179440858ca320ba6332dee5c8b17b",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 63,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.8430232558139535,
"repo_name": "ivakegg/accumulo",
"id": "813054e0c4943b8acf5ba020017b7d3dfd95a42d",
"size": "979",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/SystemConstraint.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2437"
},
{
"name": "C++",
"bytes": "37312"
},
{
"name": "CSS",
"bytes": "6443"
},
{
"name": "FreeMarker",
"bytes": "57216"
},
{
"name": "HTML",
"bytes": "5454"
},
{
"name": "Java",
"bytes": "18482234"
},
{
"name": "JavaScript",
"bytes": "71761"
},
{
"name": "Makefile",
"bytes": "2872"
},
{
"name": "Python",
"bytes": "7344"
},
{
"name": "Shell",
"bytes": "62351"
},
{
"name": "Thrift",
"bytes": "40724"
}
],
"symlink_target": ""
} |
namespace sn_Function {
namespace ref {
template <typename R, typename ...Args>
class function_ref<R(Args...)> {
void* ptr;
R(*erased_fn)(void*, Args...);
public:
template <typename F> // some constraints here
function_ref(F&& f) noexcept : ptr{&f} {
erased_fn = [](void* ptr_, Args... xs) -> R {
return (*reintrepret_cast<F*>(ptr_))(
std::forward<Args>(xs)...
);
};
}
// noexcept as call
R operator()(Args... xs) const noexcept {
return erased_fn(ptr, std::forward<Args>(xs)...);
}
};
}
}
#endif | {
"content_hash": "17924df46d37c01885bfba485047b837",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 65,
"avg_line_length": 28.73076923076923,
"alnum_prop": 0.42168674698795183,
"repo_name": "Airtnp/SuperNaiveCppLib",
"id": "d1281c4f3b2933b3fdb7167967ed9fb968c367cc",
"size": "800",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/sn_Function/ref.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "968285"
}
],
"symlink_target": ""
} |
<html>
<head>
<title>User agent detail - Mozilla/5.0 (Linux; Android 4.4.4; xx; SAMSUNG SM-A7000 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="section">
<h1 class="header center orange-text">User agent detail</h1>
<div class="row center">
<h5 class="header light">
Mozilla/5.0 (Linux; Android 4.4.4; xx; SAMSUNG SM-A7000 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36
</h5>
</div>
</div>
<div class="section">
<table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Source result (test suite)</th></tr><tr><td>whichbrowser/parser<br /><small>/tests/data/mobile/manufacturer-samsung-android.yaml</small></td><td>Samsung Browser 2.0</td><td>Android 4.4.4</td><td>Blink 537.36</td><td style="border-left: 1px solid #555">Samsung</td><td>Galaxy A7</td><td>mobile:smart</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-test">Detail</a>
<!-- Modal Structure -->
<div id="modal-test" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Testsuite result detail</h4>
<p><pre><code class="php">Array
(
[headers] => User-Agent: Mozilla/5.0 (Linux; Android 4.4.4; xx; SAMSUNG SM-A7000 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36
[result] => Array
(
[browser] => Array
(
[name] => Samsung Browser
[version] => 2.0
[type] => browser
)
[engine] => Array
(
[name] => Blink
[version] => 537.36
)
[os] => Array
(
[name] => Android
[version] => 4.4.4
)
[device] => Array
(
[type] => mobile
[subtype] => smart
[manufacturer] => Samsung
[model] => Galaxy A7
)
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapPhp<br /><small>6012</small></td><td>Android WebView 2.0</td><td>Blink </td><td>Android 4.4</td><td style="border-left: 1px solid #555"></td><td></td><td>Mobile Phone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.023</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-215ac98d-ccf8-4615-916e-5a819d6a59c9">Detail</a>
<!-- Modal Structure -->
<div id="modal-215ac98d-ccf8-4615-916e-5a819d6a59c9" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>BrowscapPhp result detail</h4>
<p><pre><code class="php">stdClass Object
(
[browser_name_regex] => /^mozilla\/5\.0 \(.*linux.*android.4\.4.* build\/.*\) applewebkit\/.* \(khtml,.*like gecko.*\) version\/2\.0.*chrome.*safari.*$/
[browser_name_pattern] => mozilla/5.0 (*linux*android?4.4* build/*) applewebkit/* (khtml,*like gecko*) version/2.0*chrome*safari*
[parent] => Android WebView 2.0
[comment] => Android WebView 2.0
[browser] => Android WebView
[browser_type] => Browser
[browser_bits] => 32
[browser_maker] => Google Inc
[browser_modus] => unknown
[version] => 2.0
[majorver] => 2
[minorver] => 0
[platform] => Android
[platform_version] => 4.4
[platform_description] => Android OS
[platform_bits] => 32
[platform_maker] => Google Inc
[alpha] =>
[beta] =>
[win16] =>
[win32] =>
[win64] =>
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[javascript] => 1
[vbscript] =>
[javaapplets] =>
[activexcontrols] =>
[ismobiledevice] => 1
[istablet] =>
[issyndicationreader] =>
[crawler] =>
[cssversion] => 3
[aolversion] => 0
[device_name] => general Mobile Phone
[device_maker] => unknown
[device_type] => Mobile Phone
[device_pointing_method] => touchscreen
[device_code_name] => general Mobile Phone
[device_brand_name] => unknown
[renderingengine_name] => Blink
[renderingengine_version] => unknown
[renderingengine_description] => a WebKit Fork by Google
[renderingengine_maker] => Google Inc
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>DonatjUAParser<br /><small>v0.5.0</small></td><td>Chrome 34.0.1847.76</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661">Detail</a>
<!-- Modal Structure -->
<div id="modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>DonatjUAParser result detail</h4>
<p><pre><code class="php">Array
(
[platform] => Android
[browser] => Chrome
[version] => 34.0.1847.76
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>NeutrinoApiCom<br /><small></small></td><td>Android Webkit 2.0</td><td><i class="material-icons">close</i></td><td>Android 4.4.4</td><td style="border-left: 1px solid #555">Generic</td><td>Android</td><td>mobile-browser</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.25802</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc">Detail</a>
<!-- Modal Structure -->
<div id="modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>NeutrinoApiCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[mobile_screen_height] => 320
[is_mobile] => 1
[type] => mobile-browser
[mobile_brand] => Generic
[mobile_model] => Android
[version] => 2.0
[is_android] => 1
[browser_name] => Android Webkit
[operating_system_family] => Android
[operating_system_version] => 4.4.4
[is_ios] =>
[producer] => Google Inc.
[operating_system] => Android 4.0.x Ice Cream Sandwich
[mobile_screen_width] => 240
[mobile_browser] => Android Webkit
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>PiwikDeviceDetector<br /><small>3.5.2</small></td><td>Chrome Mobile 34.0</td><td>Blink </td><td>Android 4.4</td><td style="border-left: 1px solid #555">Samsung</td><td>SM-A7000</td><td>smartphone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.016</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-21638055-738d-46ba-a1b1-f5114bc26475">Detail</a>
<!-- Modal Structure -->
<div id="modal-21638055-738d-46ba-a1b1-f5114bc26475" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>PiwikDeviceDetector result detail</h4>
<p><pre><code class="php">Array
(
[client] => Array
(
[type] => browser
[name] => Chrome Mobile
[short_name] => CM
[version] => 34.0
[engine] => Blink
)
[operatingSystem] => Array
(
[name] => Android
[short_name] => AND
[version] => 4.4
[platform] =>
)
[device] => Array
(
[brand] => SA
[brandName] => Samsung
[model] => SM-A7000
[device] => 1
[deviceName] => smartphone
)
[bot] =>
[extra] => Array
(
[isBot] =>
[isBrowser] => 1
[isFeedReader] =>
[isMobileApp] =>
[isPIM] =>
[isLibrary] =>
[isMediaPlayer] =>
[isCamera] =>
[isCarBrowser] =>
[isConsole] =>
[isFeaturePhone] =>
[isPhablet] =>
[isPortableMediaPlayer] =>
[isSmartDisplay] =>
[isSmartphone] => 1
[isTablet] =>
[isTV] =>
[isDesktop] =>
[isMobile] => 1
[isTouchEnabled] =>
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.0</small></td><td>Chrome 34.0.1847.76</td><td><i class="material-icons">close</i></td><td>Android 4.4.4</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c">Detail</a>
<!-- Modal Structure -->
<div id="modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>SinergiBrowserDetector result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Sinergi\BrowserDetector\Browser Object
(
[userAgent:Sinergi\BrowserDetector\Browser:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 4.4.4; xx; SAMSUNG SM-A7000 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36
)
[name:Sinergi\BrowserDetector\Browser:private] => Chrome
[version:Sinergi\BrowserDetector\Browser:private] => 34.0.1847.76
[isRobot:Sinergi\BrowserDetector\Browser:private] =>
[isChromeFrame:Sinergi\BrowserDetector\Browser:private] =>
)
[operatingSystem] => Sinergi\BrowserDetector\Os Object
(
[name:Sinergi\BrowserDetector\Os:private] => Android
[version:Sinergi\BrowserDetector\Os:private] => 4.4.4
[isMobile:Sinergi\BrowserDetector\Os:private] => 1
[userAgent:Sinergi\BrowserDetector\Os:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 4.4.4; xx; SAMSUNG SM-A7000 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36
)
)
[device] => Sinergi\BrowserDetector\Device Object
(
[name:Sinergi\BrowserDetector\Device:private] => unknown
[userAgent:Sinergi\BrowserDetector\Device:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 4.4.4; xx; SAMSUNG SM-A7000 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36
)
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UAParser<br /><small>v3.4.5</small></td><td>Chrome Mobile 34.0.1847</td><td><i class="material-icons">close</i></td><td>Android 4.4.4</td><td style="border-left: 1px solid #555">Samsung</td><td>SM-A7000</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.002</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b">Detail</a>
<!-- Modal Structure -->
<div id="modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UAParser result detail</h4>
<p><pre><code class="php">UAParser\Result\Client Object
(
[ua] => UAParser\Result\UserAgent Object
(
[major] => 34
[minor] => 0
[patch] => 1847
[family] => Chrome Mobile
)
[os] => UAParser\Result\OperatingSystem Object
(
[major] => 4
[minor] => 4
[patch] => 4
[patchMinor] =>
[family] => Android
)
[device] => UAParser\Result\Device Object
(
[brand] => Samsung
[model] => SM-A7000
[family] => Samsung SM-A7000
)
[originalUserAgent] => Mozilla/5.0 (Linux; Android 4.4.4; xx; SAMSUNG SM-A7000 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UserAgentStringCom<br /><small></small></td><td>Android Webkit Browser </td><td><i class="material-icons">close</i></td><td>Android 4.4.4</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.05201</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9cdd8b45-a2eb-406b-bd27-7e48af38ffd4">Detail</a>
<!-- Modal Structure -->
<div id="modal-9cdd8b45-a2eb-406b-bd27-7e48af38ffd4" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UserAgentStringCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[agent_type] => Browser
[agent_name] => Android Webkit Browser
[agent_version] => --
[os_type] => Android
[os_name] => Android
[os_versionName] =>
[os_versionNumber] => 4.4.4
[os_producer] =>
[os_producerURL] =>
[linux_distibution] => Null
[agent_language] =>
[agent_languageTag] =>
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhatIsMyBrowserCom<br /><small></small></td><td>Chrome 34.0.1847.76</td><td>WebKit 537.36</td><td>Android 4.4.4</td><td style="border-left: 1px solid #555">Samsung</td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.40304</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9795f66f-7271-430e-973a-a5c0e14dc35a">Detail</a>
<!-- Modal Structure -->
<div id="modal-9795f66f-7271-430e-973a-a5c0e14dc35a" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhatIsMyBrowserCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[operating_system_name] => Android
[simple_sub_description_string] =>
[simple_browser_string] => Chrome 34 on Android (KitKat)
[browser_version] => 34
[extra_info] => Array
(
)
[operating_platform] =>
[extra_info_table] => stdClass Object
(
[System Build] => KTU84P
)
[layout_engine_name] => WebKit
[detected_addons] => Array
(
)
[operating_system_flavour_code] =>
[hardware_architecture] =>
[operating_system_flavour] =>
[operating_system_frameworks] => Array
(
)
[browser_name_code] => chrome
[operating_system_version] => KitKat
[simple_operating_platform_string] => Samsung SM-A7000
[is_abusive] =>
[layout_engine_version] => 537.36
[browser_capabilities] => Array
(
)
[operating_platform_vendor_name] => Samsung
[operating_system] => Android (KitKat)
[operating_system_version_full] => 4.4.4
[operating_platform_code] => SM-A7000
[browser_name] => Chrome
[operating_system_name_code] => android
[user_agent] => Mozilla/5.0 (Linux; Android 4.4.4; xx; SAMSUNG SM-A7000 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36
[browser_version_full] => 34.0.1847.76
[browser] => Chrome 34
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhichBrowser<br /><small>2.0.10</small></td><td>Samsung Internet 2.0</td><td>Blink </td><td>Android 4.4.4</td><td style="border-left: 1px solid #555">Samsung</td><td>Galaxy A7</td><td>mobile:smart</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.06101</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4">Detail</a>
<!-- Modal Structure -->
<div id="modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhichBrowser result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Array
(
[name] => Samsung Internet
[version] => 2.0
[type] => browser
)
[engine] => Array
(
[name] => Blink
)
[os] => Array
(
[name] => Android
[version] => 4.4.4
)
[device] => Array
(
[type] => mobile
[subtype] => smart
[manufacturer] => Samsung
[model] => Galaxy A7
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Woothee<br /><small>v1.2.0</small></td><td>Chrome 34.0.1847.76</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>smartphone</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-3f285ff5-314b-4db4-9948-54572e92e7b6">Detail</a>
<!-- Modal Structure -->
<div id="modal-3f285ff5-314b-4db4-9948-54572e92e7b6" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Woothee result detail</h4>
<p><pre><code class="php">Array
(
[name] => Chrome
[vendor] => Google
[version] => 34.0.1847.76
[category] => smartphone
[os] => Android
[os_version] => 4.4.4
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Wurfl<br /><small>1.6.4</small></td><td>Chromium 34</td><td><i class="material-icons">close</i></td><td>Android 4.4</td><td style="border-left: 1px solid #555">Samsung</td><td>SM-A7000</td><td>Smartphone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.037</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-1a1aee36-7ce7-4111-a391-8e2c501f1532">Detail</a>
<!-- Modal Structure -->
<div id="modal-1a1aee36-7ce7-4111-a391-8e2c501f1532" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Wurfl result detail</h4>
<p><pre><code class="php">Array
(
[virtual] => Array
(
[is_android] => true
[is_ios] => false
[is_windows_phone] => false
[is_app] => false
[is_full_desktop] => false
[is_largescreen] => true
[is_mobile] => true
[is_robot] => false
[is_smartphone] => true
[is_touchscreen] => true
[is_wml_preferred] => false
[is_xhtmlmp_preferred] => false
[is_html_preferred] => true
[advertised_device_os] => Android
[advertised_device_os_version] => 4.4
[advertised_browser] => Chromium
[advertised_browser_version] => 34
[complete_device_name] => Samsung SM-A7000 (Galaxy A7 Duos)
[form_factor] => Smartphone
[is_phone] => true
[is_app_webview] => false
)
[all] => Array
(
[brand_name] => Samsung
[model_name] => SM-A7000
[unique] => true
[ununiqueness_handler] =>
[is_wireless_device] => true
[device_claims_web_support] => true
[has_qwerty_keyboard] => true
[can_skip_aligned_link_row] => true
[uaprof] =>
[uaprof2] =>
[uaprof3] =>
[nokia_series] => 0
[nokia_edition] => 0
[device_os] => Android
[mobile_browser] => Chrome Mobile
[mobile_browser_version] =>
[device_os_version] => 4.4
[pointing_method] => touchscreen
[release_date] => 2015_january
[marketing_name] => Galaxy A7 Duos
[model_extra_info] =>
[nokia_feature_pack] => 0
[can_assign_phone_number] => true
[is_tablet] => false
[manufacturer_name] =>
[is_bot] => false
[is_google_glass] => false
[proportional_font] => false
[built_in_back_button_support] => false
[card_title_support] => true
[softkey_support] => false
[table_support] => true
[numbered_menus] => false
[menu_with_select_element_recommended] => false
[menu_with_list_of_links_recommended] => true
[icons_on_menu_items_support] => false
[break_list_of_links_with_br_element_recommended] => true
[access_key_support] => false
[wrap_mode_support] => false
[times_square_mode_support] => false
[deck_prefetch_support] => false
[elective_forms_recommended] => true
[wizards_recommended] => false
[image_as_link_support] => false
[insert_br_element_after_widget_recommended] => false
[wml_can_display_images_and_text_on_same_line] => false
[wml_displays_image_in_center] => false
[opwv_wml_extensions_support] => false
[wml_make_phone_call_string] => wtai://wp/mc;
[chtml_display_accesskey] => false
[emoji] => false
[chtml_can_display_images_and_text_on_same_line] => false
[chtml_displays_image_in_center] => false
[imode_region] => none
[chtml_make_phone_call_string] => tel:
[chtml_table_support] => false
[xhtml_honors_bgcolor] => true
[xhtml_supports_forms_in_table] => true
[xhtml_support_wml2_namespace] => false
[xhtml_autoexpand_select] => false
[xhtml_select_as_dropdown] => false
[xhtml_select_as_radiobutton] => false
[xhtml_select_as_popup] => false
[xhtml_display_accesskey] => false
[xhtml_supports_invisible_text] => false
[xhtml_supports_inline_input] => false
[xhtml_supports_monospace_font] => false
[xhtml_supports_table_for_layout] => true
[xhtml_supports_css_cell_table_coloring] => true
[xhtml_format_as_css_property] => false
[xhtml_format_as_attribute] => false
[xhtml_nowrap_mode] => false
[xhtml_marquee_as_css_property] => false
[xhtml_readable_background_color1] => #FFFFFF
[xhtml_readable_background_color2] => #FFFFFF
[xhtml_allows_disabled_form_elements] => true
[xhtml_document_title_support] => true
[xhtml_preferred_charset] => iso-8859-1
[opwv_xhtml_extensions_support] => false
[xhtml_make_phone_call_string] => tel:
[xhtmlmp_preferred_mime_type] => text/html
[xhtml_table_support] => true
[xhtml_send_sms_string] => sms:
[xhtml_send_mms_string] => mms:
[xhtml_file_upload] => supported
[cookie_support] => true
[accept_third_party_cookie] => true
[xhtml_supports_iframe] => full
[xhtml_avoid_accesskeys] => true
[xhtml_can_embed_video] => none
[ajax_support_javascript] => true
[ajax_manipulate_css] => true
[ajax_support_getelementbyid] => true
[ajax_support_inner_html] => true
[ajax_xhr_type] => standard
[ajax_manipulate_dom] => true
[ajax_support_events] => true
[ajax_support_event_listener] => true
[ajax_preferred_geoloc_api] => w3c_api
[xhtml_support_level] => 4
[preferred_markup] => html_web_4_0
[wml_1_1] => false
[wml_1_2] => false
[wml_1_3] => false
[html_wi_w3_xhtmlbasic] => true
[html_wi_oma_xhtmlmp_1_0] => true
[html_wi_imode_html_1] => false
[html_wi_imode_html_2] => false
[html_wi_imode_html_3] => false
[html_wi_imode_html_4] => false
[html_wi_imode_html_5] => false
[html_wi_imode_htmlx_1] => false
[html_wi_imode_htmlx_1_1] => false
[html_wi_imode_compact_generic] => false
[html_web_3_2] => true
[html_web_4_0] => true
[voicexml] => false
[multipart_support] => false
[total_cache_disable_support] => false
[time_to_live_support] => false
[resolution_width] => 1080
[resolution_height] => 1920
[columns] => 60
[max_image_width] => 320
[max_image_height] => 640
[rows] => 40
[physical_screen_width] => 69
[physical_screen_height] => 122
[dual_orientation] => true
[density_class] => 1.0
[wbmp] => true
[bmp] => false
[epoc_bmp] => false
[gif_animated] => false
[jpg] => true
[png] => true
[tiff] => false
[transparent_png_alpha] => true
[transparent_png_index] => true
[svgt_1_1] => true
[svgt_1_1_plus] => false
[greyscale] => false
[gif] => true
[colors] => 65536
[webp_lossy_support] => true
[webp_lossless_support] => true
[post_method_support] => true
[basic_authentication_support] => true
[empty_option_value_support] => true
[emptyok] => false
[nokia_voice_call] => false
[wta_voice_call] => false
[wta_phonebook] => false
[wta_misc] => false
[wta_pdc] => false
[https_support] => true
[phone_id_provided] => false
[max_data_rate] => 3600
[wifi] => true
[sdio] => false
[vpn] => false
[has_cellular_radio] => true
[max_deck_size] => 2000000
[max_url_length_in_requests] => 256
[max_url_length_homepage] => 0
[max_url_length_bookmark] => 0
[max_url_length_cached_page] => 0
[max_no_of_connection_settings] => 0
[max_no_of_bookmarks] => 0
[max_length_of_username] => 0
[max_length_of_password] => 0
[max_object_size] => 0
[downloadfun_support] => false
[directdownload_support] => true
[inline_support] => false
[oma_support] => true
[ringtone] => false
[ringtone_3gpp] => false
[ringtone_midi_monophonic] => false
[ringtone_midi_polyphonic] => false
[ringtone_imelody] => false
[ringtone_digiplug] => false
[ringtone_compactmidi] => false
[ringtone_mmf] => false
[ringtone_rmf] => false
[ringtone_xmf] => false
[ringtone_amr] => false
[ringtone_awb] => false
[ringtone_aac] => false
[ringtone_wav] => false
[ringtone_mp3] => false
[ringtone_spmidi] => false
[ringtone_qcelp] => false
[ringtone_voices] => 1
[ringtone_df_size_limit] => 0
[ringtone_directdownload_size_limit] => 0
[ringtone_inline_size_limit] => 0
[ringtone_oma_size_limit] => 0
[wallpaper] => false
[wallpaper_max_width] => 0
[wallpaper_max_height] => 0
[wallpaper_preferred_width] => 0
[wallpaper_preferred_height] => 0
[wallpaper_resize] => none
[wallpaper_wbmp] => false
[wallpaper_bmp] => false
[wallpaper_gif] => false
[wallpaper_jpg] => false
[wallpaper_png] => false
[wallpaper_tiff] => false
[wallpaper_greyscale] => false
[wallpaper_colors] => 2
[wallpaper_df_size_limit] => 0
[wallpaper_directdownload_size_limit] => 0
[wallpaper_inline_size_limit] => 0
[wallpaper_oma_size_limit] => 0
[screensaver] => false
[screensaver_max_width] => 0
[screensaver_max_height] => 0
[screensaver_preferred_width] => 0
[screensaver_preferred_height] => 0
[screensaver_resize] => none
[screensaver_wbmp] => false
[screensaver_bmp] => false
[screensaver_gif] => false
[screensaver_jpg] => false
[screensaver_png] => false
[screensaver_greyscale] => false
[screensaver_colors] => 2
[screensaver_df_size_limit] => 0
[screensaver_directdownload_size_limit] => 0
[screensaver_inline_size_limit] => 0
[screensaver_oma_size_limit] => 0
[picture] => false
[picture_max_width] => 0
[picture_max_height] => 0
[picture_preferred_width] => 0
[picture_preferred_height] => 0
[picture_resize] => none
[picture_wbmp] => false
[picture_bmp] => false
[picture_gif] => false
[picture_jpg] => false
[picture_png] => false
[picture_greyscale] => false
[picture_colors] => 2
[picture_df_size_limit] => 0
[picture_directdownload_size_limit] => 0
[picture_inline_size_limit] => 0
[picture_oma_size_limit] => 0
[video] => false
[oma_v_1_0_forwardlock] => false
[oma_v_1_0_combined_delivery] => false
[oma_v_1_0_separate_delivery] => false
[streaming_video] => true
[streaming_3gpp] => true
[streaming_mp4] => true
[streaming_mov] => false
[streaming_video_size_limit] => 0
[streaming_real_media] => none
[streaming_flv] => false
[streaming_3g2] => false
[streaming_vcodec_h263_0] => 10
[streaming_vcodec_h263_3] => -1
[streaming_vcodec_mpeg4_sp] => 2
[streaming_vcodec_mpeg4_asp] => -1
[streaming_vcodec_h264_bp] => 3.0
[streaming_acodec_amr] => nb
[streaming_acodec_aac] => lc
[streaming_wmv] => none
[streaming_preferred_protocol] => http
[streaming_preferred_http_protocol] => apple_live_streaming
[wap_push_support] => false
[connectionless_service_indication] => false
[connectionless_service_load] => false
[connectionless_cache_operation] => false
[connectionoriented_unconfirmed_service_indication] => false
[connectionoriented_unconfirmed_service_load] => false
[connectionoriented_unconfirmed_cache_operation] => false
[connectionoriented_confirmed_service_indication] => false
[connectionoriented_confirmed_service_load] => false
[connectionoriented_confirmed_cache_operation] => false
[utf8_support] => true
[ascii_support] => false
[iso8859_support] => false
[expiration_date] => false
[j2me_cldc_1_0] => false
[j2me_cldc_1_1] => false
[j2me_midp_1_0] => false
[j2me_midp_2_0] => false
[doja_1_0] => false
[doja_1_5] => false
[doja_2_0] => false
[doja_2_1] => false
[doja_2_2] => false
[doja_3_0] => false
[doja_3_5] => false
[doja_4_0] => false
[j2me_jtwi] => false
[j2me_mmapi_1_0] => false
[j2me_mmapi_1_1] => false
[j2me_wmapi_1_0] => false
[j2me_wmapi_1_1] => false
[j2me_wmapi_2_0] => false
[j2me_btapi] => false
[j2me_3dapi] => false
[j2me_locapi] => false
[j2me_nokia_ui] => false
[j2me_motorola_lwt] => false
[j2me_siemens_color_game] => false
[j2me_siemens_extension] => false
[j2me_heap_size] => 0
[j2me_max_jar_size] => 0
[j2me_storage_size] => 0
[j2me_max_record_store_size] => 0
[j2me_screen_width] => 0
[j2me_screen_height] => 0
[j2me_canvas_width] => 0
[j2me_canvas_height] => 0
[j2me_bits_per_pixel] => 0
[j2me_audio_capture_enabled] => false
[j2me_video_capture_enabled] => false
[j2me_photo_capture_enabled] => false
[j2me_capture_image_formats] => none
[j2me_http] => false
[j2me_https] => false
[j2me_socket] => false
[j2me_udp] => false
[j2me_serial] => false
[j2me_gif] => false
[j2me_gif89a] => false
[j2me_jpg] => false
[j2me_png] => false
[j2me_bmp] => false
[j2me_bmp3] => false
[j2me_wbmp] => false
[j2me_midi] => false
[j2me_wav] => false
[j2me_amr] => false
[j2me_mp3] => false
[j2me_mp4] => false
[j2me_imelody] => false
[j2me_rmf] => false
[j2me_au] => false
[j2me_aac] => false
[j2me_realaudio] => false
[j2me_xmf] => false
[j2me_wma] => false
[j2me_3gpp] => false
[j2me_h263] => false
[j2me_svgt] => false
[j2me_mpeg4] => false
[j2me_realvideo] => false
[j2me_real8] => false
[j2me_realmedia] => false
[j2me_left_softkey_code] => 0
[j2me_right_softkey_code] => 0
[j2me_middle_softkey_code] => 0
[j2me_select_key_code] => 0
[j2me_return_key_code] => 0
[j2me_clear_key_code] => 0
[j2me_datefield_no_accepts_null_date] => false
[j2me_datefield_broken] => false
[receiver] => false
[sender] => false
[mms_max_size] => 0
[mms_max_height] => 0
[mms_max_width] => 0
[built_in_recorder] => false
[built_in_camera] => true
[mms_jpeg_baseline] => false
[mms_jpeg_progressive] => false
[mms_gif_static] => false
[mms_gif_animated] => false
[mms_png] => false
[mms_bmp] => false
[mms_wbmp] => false
[mms_amr] => false
[mms_wav] => false
[mms_midi_monophonic] => false
[mms_midi_polyphonic] => false
[mms_midi_polyphonic_voices] => 0
[mms_spmidi] => false
[mms_mmf] => false
[mms_mp3] => false
[mms_evrc] => false
[mms_qcelp] => false
[mms_ota_bitmap] => false
[mms_nokia_wallpaper] => false
[mms_nokia_operatorlogo] => false
[mms_nokia_3dscreensaver] => false
[mms_nokia_ringingtone] => false
[mms_rmf] => false
[mms_xmf] => false
[mms_symbian_install] => false
[mms_jar] => false
[mms_jad] => false
[mms_vcard] => false
[mms_vcalendar] => false
[mms_wml] => false
[mms_wbxml] => false
[mms_wmlc] => false
[mms_video] => false
[mms_mp4] => false
[mms_3gpp] => false
[mms_3gpp2] => false
[mms_max_frame_rate] => 0
[nokiaring] => false
[picturemessage] => false
[operatorlogo] => false
[largeoperatorlogo] => false
[callericon] => false
[nokiavcard] => false
[nokiavcal] => false
[sckl_ringtone] => false
[sckl_operatorlogo] => false
[sckl_groupgraphic] => false
[sckl_vcard] => false
[sckl_vcalendar] => false
[text_imelody] => false
[ems] => false
[ems_variablesizedpictures] => false
[ems_imelody] => false
[ems_odi] => false
[ems_upi] => false
[ems_version] => 0
[siemens_ota] => false
[siemens_logo_width] => 101
[siemens_logo_height] => 29
[siemens_screensaver_width] => 101
[siemens_screensaver_height] => 50
[gprtf] => false
[sagem_v1] => false
[sagem_v2] => false
[panasonic] => false
[sms_enabled] => true
[wav] => false
[mmf] => false
[smf] => false
[mld] => false
[midi_monophonic] => false
[midi_polyphonic] => false
[sp_midi] => false
[rmf] => false
[xmf] => false
[compactmidi] => false
[digiplug] => false
[nokia_ringtone] => false
[imelody] => false
[au] => false
[amr] => false
[awb] => false
[aac] => true
[mp3] => true
[voices] => 1
[qcelp] => false
[evrc] => false
[flash_lite_version] =>
[fl_wallpaper] => false
[fl_screensaver] => false
[fl_standalone] => false
[fl_browser] => false
[fl_sub_lcd] => false
[full_flash_support] => false
[css_supports_width_as_percentage] => true
[css_border_image] => webkit
[css_rounded_corners] => webkit
[css_gradient] => none
[css_spriting] => true
[css_gradient_linear] => none
[is_transcoder] => false
[transcoder_ua_header] => user-agent
[rss_support] => false
[pdf_support] => true
[progressive_download] => true
[playback_vcodec_h263_0] => 10
[playback_vcodec_h263_3] => -1
[playback_vcodec_mpeg4_sp] => 0
[playback_vcodec_mpeg4_asp] => -1
[playback_vcodec_h264_bp] => 3.0
[playback_real_media] => none
[playback_3gpp] => true
[playback_3g2] => false
[playback_mp4] => true
[playback_mov] => false
[playback_acodec_amr] => nb
[playback_acodec_aac] => none
[playback_df_size_limit] => 0
[playback_directdownload_size_limit] => 0
[playback_inline_size_limit] => 0
[playback_oma_size_limit] => 0
[playback_acodec_qcelp] => false
[playback_wmv] => none
[hinted_progressive_download] => true
[html_preferred_dtd] => html4
[viewport_supported] => true
[viewport_width] => device_width_token
[viewport_userscalable] => no
[viewport_initial_scale] =>
[viewport_maximum_scale] =>
[viewport_minimum_scale] =>
[mobileoptimized] => false
[handheldfriendly] => false
[canvas_support] => full
[image_inlining] => true
[is_smarttv] => false
[is_console] => false
[nfc_support] => true
[ux_full_desktop] => false
[jqm_grade] => A
[is_sencha_touch_ok] => false
[controlcap_is_smartphone] => default
[controlcap_is_ios] => default
[controlcap_is_android] => default
[controlcap_is_robot] => default
[controlcap_is_app] => default
[controlcap_advertised_device_os] => default
[controlcap_advertised_device_os_version] => default
[controlcap_advertised_browser] => default
[controlcap_advertised_browser_version] => default
[controlcap_is_windows_phone] => default
[controlcap_is_full_desktop] => default
[controlcap_is_largescreen] => default
[controlcap_is_mobile] => default
[controlcap_is_touchscreen] => default
[controlcap_is_wml_preferred] => default
[controlcap_is_xhtmlmp_preferred] => default
[controlcap_is_html_preferred] => default
[controlcap_form_factor] => default
[controlcap_complete_device_name] => default
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr></table>
</div>
<div class="section">
<h1 class="header center orange-text">About this comparison</h1>
<div class="row center">
<h5 class="header light">
The primary goal of this project is simple<br />
I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br />
<br />
The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br />
<br />
You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br />
<br />
The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a>
</h5>
</div>
</div>
<div class="card">
<div class="card-content">
Comparison created <i>2016-02-13 13:30:20</i> | by
<a href="https://github.com/ThaDafinser">ThaDafinser</a>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.1.1/list.min.js"></script>
<script>
$(document).ready(function(){
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
$('.modal-trigger').leanModal();
});
</script>
</body>
</html> | {
"content_hash": "5cf41d11973562e3c2b23f6b6df2add0",
"timestamp": "",
"source": "github",
"line_count": 1151,
"max_line_length": 810,
"avg_line_length": 41.12076455256299,
"alnum_prop": 0.5351785336995563,
"repo_name": "ThaDafinser/UserAgentParserComparison",
"id": "9e5d9afc731d2c2942b3e213951cd0ec019fb05a",
"size": "47331",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "v4/user-agent-detail/48/a9/48a9d685-78b5-4417-8e40-5565e051d569.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2060859160"
}
],
"symlink_target": ""
} |
require "spec_helper"
RSpec.describe FileManagement do
it "has a version number" do
expect(FileManagement::VERSION).not_to be nil
end
# it "does something useful" do
# expect(false).to eq(true)
# end
end
| {
"content_hash": "a44c286a0dec74173332fdd9d533be8d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 49,
"avg_line_length": 20.181818181818183,
"alnum_prop": 0.6981981981981982,
"repo_name": "Mikeks81/File-Management",
"id": "d2ece1f32b1f4d09e0206b423d83bd9dbcd9068f",
"size": "222",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/file_management_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "8481"
},
{
"name": "Shell",
"bytes": "131"
}
],
"symlink_target": ""
} |
<?php
namespace PHPExiftool\Driver\Tag\CanonVRD;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class BrightnessAdj extends AbstractTag
{
protected $Id = 276;
protected $Name = 'BrightnessAdj';
protected $FullName = 'CanonVRD::Ver1';
protected $GroupName = 'CanonVRD';
protected $g0 = 'CanonVRD';
protected $g1 = 'CanonVRD';
protected $g2 = 'Image';
protected $Type = 'int8s';
protected $Writable = true;
protected $Description = 'Brightness Adj';
}
| {
"content_hash": "46ea8c2933224751c56bdefeb910d1a0",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 46,
"avg_line_length": 16.457142857142856,
"alnum_prop": 0.671875,
"repo_name": "romainneutron/PHPExiftool",
"id": "52b18a26949bf6913c5fc97f1e0f0e0e284f920f",
"size": "798",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/PHPExiftool/Driver/Tag/CanonVRD/BrightnessAdj.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "22042446"
}
],
"symlink_target": ""
} |
<?php
namespace Nette\Database\Reflection;
use Nette;
/**
* Reflection metadata class with discovery for a database.
*
* @author Jan Skrasek
* @property-write Nette\Database\Connection $connection
*/
class DiscoveredReflection extends Nette\Object implements Nette\Database\IReflection
{
/** @var Nette\Caching\Cache */
protected $cache;
/** @var Nette\Caching\IStorage */
protected $cacheStorage;
/** @var Nette\Database\Connection */
protected $connection;
/** @var array */
protected $structure = array();
/** @var array */
protected $loadedStructure;
/**
* Create autodiscovery structure.
*/
public function __construct(Nette\Caching\IStorage $storage = NULL)
{
$this->cacheStorage = $storage;
}
public function setConnection(Nette\Database\Connection $connection)
{
$this->connection = $connection;
if ($this->cacheStorage) {
$this->cache = new Nette\Caching\Cache($this->cacheStorage, 'Nette.Database.' . md5($connection->getDsn()));
$this->structure = $this->loadedStructure = $this->cache->load('structure') ?: $this->structure;
}
}
public function __destruct()
{
if ($this->cache && $this->structure !== $this->loadedStructure) {
$this->cache->save('structure', $this->structure);
}
}
public function getPrimary($table)
{
$primary = & $this->structure['primary'][strtolower($table)];
if (isset($primary)) {
return empty($primary) ? NULL : $primary;
}
$columns = $this->connection->getSupplementalDriver()->getColumns($table);
$primary = array();
foreach ($columns as $column) {
if ($column['primary']) {
$primary[] = $column['name'];
}
}
if (count($primary) === 0) {
return NULL;
} elseif (count($primary) === 1) {
$primary = reset($primary);
}
return $primary;
}
public function getHasManyReference($table, $key, $refresh = TRUE)
{
$reference = & $this->structure['hasMany'][strtolower($table)];
if (!empty($reference)) {
$candidates = $columnCandidates = array();
foreach ($reference as $targetPair) {
list($targetColumn, $targetTable) = $targetPair;
if (stripos($targetTable, $key) === FALSE)
continue;
$candidates[] = array($targetTable, $targetColumn);
if (stripos($targetColumn, $table) !== FALSE) {
$columnCandidates[] = $candidate = array($targetTable, $targetColumn);
if (strtolower($targetTable) === strtolower($key))
return $candidate;
}
}
if (count($columnCandidates) === 1) {
return reset($columnCandidates);
} elseif (count($candidates) === 1) {
return reset($candidates);
}
foreach ($candidates as $candidate) {
list($targetTable, $targetColumn) = $candidate;
if (strtolower($targetTable) === strtolower($key))
return $candidate;
}
if (!$refresh && !empty($candidates)) {
throw new \PDOException('Ambiguous joining column in related call.');
}
}
if (!$refresh) {
throw new \PDOException("No reference found for \${$table}->related({$key}).");
}
$this->reloadAllForeignKeys();
return $this->getHasManyReference($table, $key, FALSE);
}
public function getBelongsToReference($table, $key, $refresh = TRUE)
{
$reference = & $this->structure['belongsTo'][strtolower($table)];
if (!empty($reference)) {
foreach ($reference as $column => $targetTable) {
if (stripos($column, $key) !== FALSE) {
return array(
$targetTable,
$column,
);
}
}
}
if (!$refresh) {
throw new \PDOException("No reference found for \${$table}->{$key}.");
}
$this->reloadForeignKeys($table);
return $this->getBelongsToReference($table, $key, FALSE);
}
protected function reloadAllForeignKeys()
{
foreach ($this->connection->getSupplementalDriver()->getTables() as $table) {
if ($table['view'] == FALSE) {
$this->reloadForeignKeys($table['name']);
}
}
foreach (array_keys($this->structure['hasMany']) as $table) {
uksort($this->structure['hasMany'][$table], function($a, $b) {
return strlen($a) - strlen($b);
});
}
}
protected function reloadForeignKeys($table)
{
foreach ($this->connection->getSupplementalDriver()->getForeignKeys($table) as $row) {
$this->structure['belongsTo'][strtolower($table)][$row['local']] = $row['table'];
$this->structure['hasMany'][strtolower($row['table'])][$row['local'] . $table] = array($row['local'], $table);
}
if (isset($this->structure['belongsTo'][$table])) {
uksort($this->structure['belongsTo'][$table], function($a, $b) {
return strlen($a) - strlen($b);
});
}
}
}
| {
"content_hash": "f15355dd7d0e20c29ef328ff934e519b",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 113,
"avg_line_length": 24.802083333333332,
"alnum_prop": 0.6112977740445191,
"repo_name": "janpecha/heymaster",
"id": "a04dfe30252e2dd3939e077152b94263eb20515f",
"size": "5034",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "libs/Nette/Database/Reflection/DiscoveredReflection.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "9027"
},
{
"name": "PHP",
"bytes": "1181249"
},
{
"name": "Shell",
"bytes": "753"
}
],
"symlink_target": ""
} |
<!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 -->
<title>com.centurylink.mdw.export (MDW 6 API JavaDocs)</title>
<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="com.centurylink.mdw.export (MDW 6 API JavaDocs)";
}
}
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 class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-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><a href="../../../../com/centurylink/mdw/event/package-summary.html">Prev Package</a></li>
<li><a href="../../../../com/centurylink/mdw/file/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/centurylink/mdw/export/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.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">
<h1 title="Package" class="title">Package com.centurylink.mdw.export</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation">
<caption><span>Interface Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/centurylink/mdw/export/ProcessExporter.html" title="interface in com.centurylink.mdw.export">ProcessExporter</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/centurylink/mdw/export/ExportHelper.html" title="class in com.centurylink.mdw.export">ExportHelper</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/centurylink/mdw/export/Table.html" title="class in com.centurylink.mdw.export">Table</a></td>
<td class="colLast">
<div class="block">Tabular presentation.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-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><a href="../../../../com/centurylink/mdw/event/package-summary.html">Prev Package</a></li>
<li><a href="../../../../com/centurylink/mdw/file/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/centurylink/mdw/export/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.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 © 2019 CenturyLink, Inc.</i></small></p>
</body>
</html>
| {
"content_hash": "04fe59a7eea1b349f4b3f0686de2cdc0",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 163,
"avg_line_length": 35.36024844720497,
"alnum_prop": 0.6320042157034955,
"repo_name": "CenturyLinkCloud/mdw",
"id": "fd44e74dd4d867b4d39a5eccd57cf87689efe5a2",
"size": "5693",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/_docs/javadoc/com/centurylink/mdw/export/package-summary.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "213"
},
{
"name": "CSS",
"bytes": "360257"
},
{
"name": "Dockerfile",
"bytes": "1606"
},
{
"name": "Groovy",
"bytes": "1370"
},
{
"name": "HTML",
"bytes": "253602"
},
{
"name": "Java",
"bytes": "4874323"
},
{
"name": "JavaScript",
"bytes": "1588812"
},
{
"name": "Kotlin",
"bytes": "49698"
},
{
"name": "PLSQL",
"bytes": "34878"
},
{
"name": "Python",
"bytes": "1790"
},
{
"name": "Shell",
"bytes": "24146"
},
{
"name": "XSLT",
"bytes": "15751"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.4"/>
<title>tbb::interface5::concurrent_hash_map< Key, T, HashCompare, A >::node Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!-- end header part -->
<!-- Generated by Doxygen 1.8.4 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="a00240.html">tbb</a></li><li class="navelem"><b>interface5</b></li><li class="navelem"><a class="el" href="a00043.html">concurrent_hash_map</a></li><li class="navelem"><a class="el" href="a00100.html">node</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pub-attribs">Public Attributes</a> |
<a href="a00374.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">tbb::interface5::concurrent_hash_map< Key, T, HashCompare, A >::node Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="dynheader">
Inheritance diagram for tbb::interface5::concurrent_hash_map< Key, T, HashCompare, A >::node:</div>
<div class="dyncontent">
<div class="center">
<img src="a00100.png" usemap="#tbb::interface5::concurrent_hash_map< Key, T, HashCompare, A >::node_map" alt=""/>
<map id="tbb::interface5::concurrent_hash_map< Key, T, HashCompare, A >::node_map" name="tbb::interface5::concurrent_hash_map< Key, T, HashCompare, A >::node_map">
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ace61f7bd9d097375f6e33fea4758fbf9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ace61f7bd9d097375f6e33fea4758fbf9"></a>
 </td><td class="memItemRight" valign="bottom"><b>node</b> (const Key &key)</td></tr>
<tr class="separator:ace61f7bd9d097375f6e33fea4758fbf9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6755d387982f27a06d859811699e40b7"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6755d387982f27a06d859811699e40b7"></a>
 </td><td class="memItemRight" valign="bottom"><b>node</b> (const Key &key, const T &t)</td></tr>
<tr class="separator:a6755d387982f27a06d859811699e40b7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a61f7e6e835b09c4387fd0c8498fbf603"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a61f7e6e835b09c4387fd0c8498fbf603"></a>
 </td><td class="memItemRight" valign="bottom"><b>node</b> (const Key &key, T &&t)</td></tr>
<tr class="separator:a61f7e6e835b09c4387fd0c8498fbf603"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac28d72d857eccf6e7cc06a9ee146d416"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac28d72d857eccf6e7cc06a9ee146d416"></a>
 </td><td class="memItemRight" valign="bottom"><b>node</b> (value_type &&i)</td></tr>
<tr class="separator:ac28d72d857eccf6e7cc06a9ee146d416"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae7c083b7efff342469789f487e3561ec"><td class="memTemplParams" colspan="2"><a class="anchor" id="ae7c083b7efff342469789f487e3561ec"></a>
template<typename... Args> </td></tr>
<tr class="memitem:ae7c083b7efff342469789f487e3561ec"><td class="memTemplItemLeft" align="right" valign="top"> </td><td class="memTemplItemRight" valign="bottom"><b>node</b> (Args &&...args)</td></tr>
<tr class="separator:ae7c083b7efff342469789f487e3561ec"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad7a5d977900af48a359f428658e2876b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad7a5d977900af48a359f428658e2876b"></a>
 </td><td class="memItemRight" valign="bottom"><b>node</b> (value_type &i)</td></tr>
<tr class="separator:ad7a5d977900af48a359f428658e2876b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:acbdc995156da4cf9b11561d006cf6821"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acbdc995156da4cf9b11561d006cf6821"></a>
 </td><td class="memItemRight" valign="bottom"><b>node</b> (const value_type &i)</td></tr>
<tr class="separator:acbdc995156da4cf9b11561d006cf6821"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a15b3c8955eb1b104db439e9caf3737c3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a15b3c8955eb1b104db439e9caf3737c3"></a>
void * </td><td class="memItemRight" valign="bottom"><b>operator new</b> (size_t, node_allocator_type &a)</td></tr>
<tr class="separator:a15b3c8955eb1b104db439e9caf3737c3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa3115742612b79db574914741f2fff45"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa3115742612b79db574914741f2fff45"></a>
void </td><td class="memItemRight" valign="bottom"><b>operator delete</b> (void *ptr, node_allocator_type &a)</td></tr>
<tr class="separator:aa3115742612b79db574914741f2fff45"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a6977520eaa2f1dee220f726c8a884b46"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6977520eaa2f1dee220f726c8a884b46"></a>
value_type </td><td class="memItemRight" valign="bottom"><b>item</b></td></tr>
<tr class="separator:a6977520eaa2f1dee220f726c8a884b46"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>concurrent_hash_map.h</li>
</ul>
</div><!-- contents -->
<hr>
<p></p>
Copyright © 2005-2015 Intel Corporation. All Rights Reserved.
<p></p>
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
registered trademarks or trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
<p></p>
* Other names and brands may be claimed as the property of others.
| {
"content_hash": "530a89b97982f0931df2bc016803b702",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 261,
"avg_line_length": 72.04716981132076,
"alnum_prop": 0.7027628649993453,
"repo_name": "DrPizza/reed-solomon",
"id": "f1db948a4710f658c740615589c780d4d803e153",
"size": "7637",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "tbb/doc/html/a00100.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "125597"
},
{
"name": "Batchfile",
"bytes": "14199"
},
{
"name": "C",
"bytes": "522308"
},
{
"name": "C++",
"bytes": "6155224"
},
{
"name": "CSS",
"bytes": "21672"
},
{
"name": "HTML",
"bytes": "4229477"
},
{
"name": "Java",
"bytes": "11966"
},
{
"name": "JavaScript",
"bytes": "14447"
},
{
"name": "Makefile",
"bytes": "81911"
},
{
"name": "Objective-C",
"bytes": "13678"
},
{
"name": "PHP",
"bytes": "6205"
},
{
"name": "Shell",
"bytes": "33928"
},
{
"name": "SourcePawn",
"bytes": "4814"
}
],
"symlink_target": ""
} |
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20130908094643 extends AbstractMigration
{
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
}
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
}
}
| {
"content_hash": "9cbb38442c358640100269248d8f1b49",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 140,
"avg_line_length": 32.34615384615385,
"alnum_prop": 0.6587395957193817,
"repo_name": "GoogleMap/placesProject",
"id": "953d8b291e916b2d0bfcd264b9bcd6c2899f12cc",
"size": "841",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/DoctrineMigrations/Version20130908094643.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "24548"
},
{
"name": "JavaScript",
"bytes": "10166"
},
{
"name": "PHP",
"bytes": "118273"
}
],
"symlink_target": ""
} |
package org.apache.beam.runners.dataflow;
import static org.apache.beam.runners.dataflow.util.Structs.getString;
import static org.apache.beam.sdk.util.StringUtils.jsonStringToByteArray;
import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkArgument;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.google.api.services.dataflow.Dataflow;
import com.google.api.services.dataflow.model.Job;
import com.google.api.services.dataflow.model.Step;
import com.google.api.services.dataflow.model.WorkerPool;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.beam.model.pipeline.v1.RunnerApi;
import org.apache.beam.model.pipeline.v1.RunnerApi.ArtifactInformation;
import org.apache.beam.model.pipeline.v1.RunnerApi.Components;
import org.apache.beam.model.pipeline.v1.RunnerApi.DockerPayload;
import org.apache.beam.model.pipeline.v1.RunnerApi.Environment;
import org.apache.beam.runners.core.construction.Environments;
import org.apache.beam.runners.core.construction.ModelCoders;
import org.apache.beam.runners.core.construction.PTransformTranslation;
import org.apache.beam.runners.core.construction.PipelineTranslation;
import org.apache.beam.runners.core.construction.SdkComponents;
import org.apache.beam.runners.dataflow.DataflowPipelineTranslator.JobSpecification;
import org.apache.beam.runners.dataflow.options.DataflowPipelineOptions;
import org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions;
import org.apache.beam.runners.dataflow.util.CloudObject;
import org.apache.beam.runners.dataflow.util.CloudObjects;
import org.apache.beam.runners.dataflow.util.PropertyNames;
import org.apache.beam.runners.dataflow.util.Structs;
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.coders.Coder;
import org.apache.beam.sdk.coders.KvCoder;
import org.apache.beam.sdk.coders.SerializableCoder;
import org.apache.beam.sdk.coders.StringUtf8Coder;
import org.apache.beam.sdk.coders.VarIntCoder;
import org.apache.beam.sdk.coders.VoidCoder;
import org.apache.beam.sdk.extensions.gcp.auth.TestCredential;
import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
import org.apache.beam.sdk.extensions.gcp.util.GcsUtil;
import org.apache.beam.sdk.extensions.gcp.util.gcsfs.GcsPath;
import org.apache.beam.sdk.io.FileSystems;
import org.apache.beam.sdk.io.TextIO;
import org.apache.beam.sdk.io.range.OffsetRange;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.options.ValueProvider;
import org.apache.beam.sdk.state.StateSpec;
import org.apache.beam.sdk.state.StateSpecs;
import org.apache.beam.sdk.state.ValueState;
import org.apache.beam.sdk.testing.PAssert;
import org.apache.beam.sdk.transforms.Count;
import org.apache.beam.sdk.transforms.Create;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.transforms.GroupIntoBatches;
import org.apache.beam.sdk.transforms.Impulse;
import org.apache.beam.sdk.transforms.MapElements;
import org.apache.beam.sdk.transforms.PTransform;
import org.apache.beam.sdk.transforms.ParDo;
import org.apache.beam.sdk.transforms.SimpleFunction;
import org.apache.beam.sdk.transforms.Sum;
import org.apache.beam.sdk.transforms.View;
import org.apache.beam.sdk.transforms.display.DisplayData;
import org.apache.beam.sdk.transforms.resourcehints.ResourceHints;
import org.apache.beam.sdk.transforms.resourcehints.ResourceHintsOptions;
import org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker;
import org.apache.beam.sdk.transforms.windowing.FixedWindows;
import org.apache.beam.sdk.transforms.windowing.Window;
import org.apache.beam.sdk.transforms.windowing.WindowFn;
import org.apache.beam.sdk.util.DoFnInfo;
import org.apache.beam.sdk.util.SerializableUtils;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.PCollectionTuple;
import org.apache.beam.sdk.values.PCollectionView;
import org.apache.beam.sdk.values.PDone;
import org.apache.beam.sdk.values.TupleTag;
import org.apache.beam.sdk.values.TupleTagList;
import org.apache.beam.sdk.values.TypeDescriptors;
import org.apache.beam.sdk.values.WindowingStrategy;
import org.apache.beam.vendor.grpc.v1p43p2.com.google.protobuf.ByteString;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableSet;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Iterables;
import org.hamcrest.Matchers;
import org.joda.time.Duration;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.ArgumentMatcher;
/** Tests for DataflowPipelineTranslator. */
@RunWith(JUnit4.class)
@SuppressWarnings({
"rawtypes", // TODO(https://issues.apache.org/jira/browse/BEAM-10556)
})
public class DataflowPipelineTranslatorTest implements Serializable {
@Rule public transient ExpectedException thrown = ExpectedException.none();
private SdkComponents createSdkComponents(PipelineOptions options) {
SdkComponents sdkComponents = SdkComponents.create();
String containerImageURL =
DataflowRunner.getContainerImageForJob(options.as(DataflowPipelineOptions.class));
RunnerApi.Environment defaultEnvironmentForDataflow =
Environments.createDockerEnvironment(containerImageURL);
sdkComponents.registerEnvironment(defaultEnvironmentForDataflow);
return sdkComponents;
}
// A Custom Mockito matcher for an initial Job that checks that all
// expected fields are set.
private static class IsValidCreateRequest implements ArgumentMatcher<Job> {
@Override
public boolean matches(Job o) {
Job job = (Job) o;
return job.getId() == null
&& job.getProjectId() == null
&& job.getName() != null
&& job.getType() != null
&& job.getEnvironment() != null
&& job.getSteps() != null
&& job.getCurrentState() == null
&& job.getCurrentStateTime() == null
&& job.getExecutionInfo() == null
&& job.getCreateTime() == null;
}
}
private Pipeline buildPipeline(DataflowPipelineOptions options) {
options.setRunner(DataflowRunner.class);
Pipeline p = Pipeline.create(options);
p.apply("ReadMyFile", TextIO.read().from("gs://bucket/object"))
.apply("WriteMyFile", TextIO.write().to("gs://bucket/object"));
DataflowRunner runner = DataflowRunner.fromOptions(options);
runner.replaceV1Transforms(p);
return p;
}
private static Dataflow buildMockDataflow(ArgumentMatcher<Job> jobMatcher) throws IOException {
Dataflow mockDataflowClient = mock(Dataflow.class);
Dataflow.Projects mockProjects = mock(Dataflow.Projects.class);
Dataflow.Projects.Jobs mockJobs = mock(Dataflow.Projects.Jobs.class);
Dataflow.Projects.Jobs.Create mockRequest = mock(Dataflow.Projects.Jobs.Create.class);
when(mockDataflowClient.projects()).thenReturn(mockProjects);
when(mockProjects.jobs()).thenReturn(mockJobs);
when(mockJobs.create(eq("someProject"), argThat(jobMatcher))).thenReturn(mockRequest);
Job resultJob = new Job();
resultJob.setId("newid");
when(mockRequest.execute()).thenReturn(resultJob);
return mockDataflowClient;
}
private static DataflowPipelineOptions buildPipelineOptions() throws IOException {
GcsUtil mockGcsUtil = mock(GcsUtil.class);
when(mockGcsUtil.expand(any(GcsPath.class)))
.then(invocation -> ImmutableList.of((GcsPath) invocation.getArguments()[0]));
when(mockGcsUtil.bucketAccessible(any(GcsPath.class))).thenReturn(true);
DataflowPipelineOptions options = PipelineOptionsFactory.as(DataflowPipelineOptions.class);
options.setRunner(DataflowRunner.class);
options.setGcpCredential(new TestCredential());
options.setJobName("some-job-name");
options.setProject("some-project");
options.setRegion("some-region");
options.setTempLocation(GcsPath.fromComponents("somebucket", "some/path").toString());
options.setFilesToStage(new ArrayList<>());
options.setDataflowClient(buildMockDataflow(new IsValidCreateRequest()));
options.setGcsUtil(mockGcsUtil);
// Enable the FileSystems API to know about gs:// URIs in this test.
FileSystems.setDefaultPipelineOptions(options);
return options;
}
@Test
public void testNetworkConfig() throws IOException {
final String testNetwork = "test-network";
DataflowPipelineOptions options = buildPipelineOptions();
options.setNetwork(testNetwork);
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertEquals(1, job.getEnvironment().getWorkerPools().size());
assertEquals(testNetwork, job.getEnvironment().getWorkerPools().get(0).getNetwork());
}
@Test
public void testNetworkConfigMissing() throws IOException {
DataflowPipelineOptions options = buildPipelineOptions();
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertEquals(1, job.getEnvironment().getWorkerPools().size());
assertNull(job.getEnvironment().getWorkerPools().get(0).getNetwork());
}
@Test
public void testSubnetworkConfig() throws IOException {
final String testSubnetwork = "regions/REGION/subnetworks/SUBNETWORK";
DataflowPipelineOptions options = buildPipelineOptions();
options.setSubnetwork(testSubnetwork);
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertEquals(1, job.getEnvironment().getWorkerPools().size());
assertEquals(testSubnetwork, job.getEnvironment().getWorkerPools().get(0).getSubnetwork());
}
@Test
public void testSubnetworkConfigMissing() throws IOException {
DataflowPipelineOptions options = buildPipelineOptions();
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertEquals(1, job.getEnvironment().getWorkerPools().size());
assertNull(job.getEnvironment().getWorkerPools().get(0).getSubnetwork());
}
@Test
public void testScalingAlgorithmMissing() throws IOException {
DataflowPipelineOptions options = buildPipelineOptions();
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertEquals(1, job.getEnvironment().getWorkerPools().size());
// Autoscaling settings are always set.
assertNull(
job.getEnvironment().getWorkerPools().get(0).getAutoscalingSettings().getAlgorithm());
assertEquals(
0,
job.getEnvironment()
.getWorkerPools()
.get(0)
.getAutoscalingSettings()
.getMaxNumWorkers()
.intValue());
}
@Test
public void testScalingAlgorithmNone() throws IOException {
final DataflowPipelineWorkerPoolOptions.AutoscalingAlgorithmType noScaling =
DataflowPipelineWorkerPoolOptions.AutoscalingAlgorithmType.NONE;
DataflowPipelineOptions options = buildPipelineOptions();
options.setAutoscalingAlgorithm(noScaling);
options.setNumWorkers(42);
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertEquals(1, job.getEnvironment().getWorkerPools().size());
assertEquals(
"AUTOSCALING_ALGORITHM_NONE",
job.getEnvironment().getWorkerPools().get(0).getAutoscalingSettings().getAlgorithm());
assertEquals(42, job.getEnvironment().getWorkerPools().get(0).getNumWorkers().intValue());
assertEquals(
0,
job.getEnvironment()
.getWorkerPools()
.get(0)
.getAutoscalingSettings()
.getMaxNumWorkers()
.intValue());
}
@Test
public void testMaxNumWorkersIsPassedWhenNoAlgorithmIsSet() throws IOException {
final DataflowPipelineWorkerPoolOptions.AutoscalingAlgorithmType noScaling = null;
DataflowPipelineOptions options = buildPipelineOptions();
options.setMaxNumWorkers(42);
options.setAutoscalingAlgorithm(noScaling);
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertEquals(1, job.getEnvironment().getWorkerPools().size());
assertNull(
job.getEnvironment().getWorkerPools().get(0).getAutoscalingSettings().getAlgorithm());
assertEquals(
42,
job.getEnvironment()
.getWorkerPools()
.get(0)
.getAutoscalingSettings()
.getMaxNumWorkers()
.intValue());
}
@Test
public void testNumWorkersCannotExceedMaxNumWorkers() throws IOException {
DataflowPipelineOptions options = buildPipelineOptions();
options.setNumWorkers(43);
options.setMaxNumWorkers(42);
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("numWorkers (43) cannot exceed maxNumWorkers (42).");
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
}
@Test
public void testWorkerMachineTypeConfig() throws IOException {
final String testMachineType = "test-machine-type";
DataflowPipelineOptions options = buildPipelineOptions();
options.setWorkerMachineType(testMachineType);
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertEquals(1, job.getEnvironment().getWorkerPools().size());
WorkerPool workerPool = job.getEnvironment().getWorkerPools().get(0);
assertEquals(testMachineType, workerPool.getMachineType());
}
@Test
public void testDiskSizeGbConfig() throws IOException {
final Integer diskSizeGb = 1234;
DataflowPipelineOptions options = buildPipelineOptions();
options.setDiskSizeGb(diskSizeGb);
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertEquals(1, job.getEnvironment().getWorkerPools().size());
assertEquals(diskSizeGb, job.getEnvironment().getWorkerPools().get(0).getDiskSizeGb());
}
/** A composite transform that returns an output that is unrelated to the input. */
private static class UnrelatedOutputCreator
extends PTransform<PCollection<Integer>, PCollection<Integer>> {
@Override
public PCollection<Integer> expand(PCollection<Integer> input) {
// Apply an operation so that this is a composite transform.
input.apply(Count.perElement());
// Return a value unrelated to the input.
return input.getPipeline().apply(Create.of(1, 2, 3, 4));
}
}
/** A composite transform that returns an output that is unbound. */
private static class UnboundOutputCreator extends PTransform<PCollection<Integer>, PDone> {
@Override
public PDone expand(PCollection<Integer> input) {
// Apply an operation so that this is a composite transform.
input.apply(Count.perElement());
return PDone.in(input.getPipeline());
}
}
/**
* A composite transform that returns a partially bound output.
*
* <p>This is not allowed and will result in a failure.
*/
private static class PartiallyBoundOutputCreator
extends PTransform<PCollection<Integer>, PCollectionTuple> {
public final TupleTag<Integer> sumTag = new TupleTag<>("sum");
public final TupleTag<Void> doneTag = new TupleTag<>("done");
@Override
public PCollectionTuple expand(PCollection<Integer> input) {
PCollection<Integer> sum = input.apply(Sum.integersGlobally());
// Fails here when attempting to construct a tuple with an unbound object.
return PCollectionTuple.of(sumTag, sum)
.and(
doneTag,
PCollection.createPrimitiveOutputInternal(
input.getPipeline(),
WindowingStrategy.globalDefault(),
input.isBounded(),
VoidCoder.of()));
}
}
@Test
public void testMultiGraphPipelineSerialization() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
Pipeline p = Pipeline.create(options);
PCollection<Integer> input = p.begin().apply(Create.of(1, 2, 3));
input.apply(new UnrelatedOutputCreator());
input.apply(new UnboundOutputCreator());
DataflowPipelineTranslator t =
DataflowPipelineTranslator.fromOptions(
PipelineOptionsFactory.as(DataflowPipelineOptions.class));
// Check that translation doesn't fail.
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
JobSpecification jobSpecification =
t.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList());
assertAllStepOutputsHaveUniqueIds(jobSpecification.getJob());
}
@Test
public void testPartiallyBoundFailure() throws IOException {
Pipeline p = Pipeline.create(buildPipelineOptions());
PCollection<Integer> input = p.begin().apply(Create.of(1, 2, 3));
thrown.expect(IllegalArgumentException.class);
input.apply(new PartiallyBoundOutputCreator());
Assert.fail("Failure expected from use of partially bound output");
}
/** This tests a few corner cases that should not crash. */
@Test
public void testGoodWildcards() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
Pipeline pipeline = Pipeline.create(options);
DataflowPipelineTranslator t = DataflowPipelineTranslator.fromOptions(options);
applyRead(pipeline, "gs://bucket/foo");
applyRead(pipeline, "gs://bucket/foo/");
applyRead(pipeline, "gs://bucket/foo/*");
applyRead(pipeline, "gs://bucket/foo/?");
applyRead(pipeline, "gs://bucket/foo/[0-9]");
applyRead(pipeline, "gs://bucket/foo/*baz*");
applyRead(pipeline, "gs://bucket/foo/*baz?");
applyRead(pipeline, "gs://bucket/foo/[0-9]baz?");
applyRead(pipeline, "gs://bucket/foo/baz/*");
applyRead(pipeline, "gs://bucket/foo/baz/*wonka*");
applyRead(pipeline, "gs://bucket/foo/*baz/wonka*");
applyRead(pipeline, "gs://bucket/foo*/baz");
applyRead(pipeline, "gs://bucket/foo?/baz");
applyRead(pipeline, "gs://bucket/foo[0-9]/baz");
// Check that translation doesn't fail.
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
JobSpecification jobSpecification =
t.translate(
pipeline,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList());
assertAllStepOutputsHaveUniqueIds(jobSpecification.getJob());
}
private void applyRead(Pipeline pipeline, String path) {
pipeline.apply("Read(" + path + ")", TextIO.read().from(path));
}
private static class TestValueProvider implements ValueProvider<String>, Serializable {
@Override
public boolean isAccessible() {
return false;
}
@Override
public String get() {
throw new RuntimeException("Should not be called.");
}
}
@Test
public void testInaccessibleProvider() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
Pipeline pipeline = Pipeline.create(options);
DataflowPipelineTranslator t = DataflowPipelineTranslator.fromOptions(options);
pipeline.apply(TextIO.read().from(new TestValueProvider()));
// Check that translation does not fail.
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
t.translate(
pipeline,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList());
}
/**
* Test that in translation the name for a collection (in this case just a Create output) is
* overridden to be what the Dataflow service expects.
*/
@Test
public void testNamesOverridden() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
DataflowRunner runner = DataflowRunner.fromOptions(options);
options.setStreaming(false);
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
pipeline.apply("Jazzy", Create.of(3)).setName("foobizzle");
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
Job job =
translator
.translate(pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList())
.getJob();
// The Create step
Step step = job.getSteps().get(0);
// This is the name that is "set by the user" that the Dataflow translator must override
String userSpecifiedName =
getString(
Structs.getListOfMaps(step.getProperties(), PropertyNames.OUTPUT_INFO, null).get(0),
PropertyNames.USER_NAME);
// This is the calculated name that must actually be used
String calculatedName = getString(step.getProperties(), PropertyNames.USER_NAME) + ".out0";
assertThat(userSpecifiedName, equalTo(calculatedName));
}
/**
* Test that in translation the name for collections of a multi-output ParDo - a special case
* because the user can name tags - are overridden to be what the Dataflow service expects.
*/
@Test
public void testTaggedNamesOverridden() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
DataflowRunner runner = DataflowRunner.fromOptions(options);
options.setStreaming(false);
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
TupleTag<Integer> tag1 = new TupleTag<Integer>("frazzle") {};
TupleTag<Integer> tag2 = new TupleTag<Integer>("bazzle") {};
TupleTag<Integer> tag3 = new TupleTag<Integer>() {};
PCollectionTuple outputs =
pipeline
.apply(Create.of(3))
.apply(
ParDo.of(
new DoFn<Integer, Integer>() {
@ProcessElement
public void drop() {}
})
.withOutputTags(tag1, TupleTagList.of(tag2).and(tag3)));
outputs.get(tag1).setName("bizbazzle");
outputs.get(tag2).setName("gonzaggle");
outputs.get(tag3).setName("froonazzle");
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
Job job =
translator
.translate(pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList())
.getJob();
// The ParDo step
Step step = job.getSteps().get(1);
String stepName = getString(step.getProperties(), PropertyNames.USER_NAME);
List<Map<String, Object>> outputInfos =
Structs.getListOfMaps(step.getProperties(), PropertyNames.OUTPUT_INFO, null);
assertThat(outputInfos.size(), equalTo(3));
// The names set by the user _and_ the tags _must_ be ignored, or metrics will not show up.
for (int i = 0; i < outputInfos.size(); ++i) {
assertThat(
getString(outputInfos.get(i), PropertyNames.USER_NAME),
equalTo(String.format("%s.out%s", stepName, i)));
}
}
/** Smoke test to fail fast if translation of a stateful ParDo in batch breaks. */
@Test
public void testBatchStatefulParDoTranslation() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
DataflowRunner runner = DataflowRunner.fromOptions(options);
options.setStreaming(false);
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
TupleTag<Integer> mainOutputTag = new TupleTag<Integer>() {};
pipeline
.apply(Create.of(KV.of(1, 1)))
.apply(
ParDo.of(
new DoFn<KV<Integer, Integer>, Integer>() {
@StateId("unused")
final StateSpec<ValueState<Integer>> stateSpec =
StateSpecs.value(VarIntCoder.of());
@ProcessElement
public void process(ProcessContext c) {
// noop
}
})
.withOutputTags(mainOutputTag, TupleTagList.empty()));
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
Job job =
translator
.translate(pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList())
.getJob();
// The job should look like:
// 0. ParallelRead (Create)
// 1. ParDo(ReifyWVs)
// 2. GroupByKeyAndSortValuesONly
// 3. A ParDo over grouped and sorted KVs that is executed via ungrouping service-side
List<Step> steps = job.getSteps();
assertEquals(4, steps.size());
Step createStep = steps.get(0);
assertEquals("ParallelRead", createStep.getKind());
Step reifyWindowedValueStep = steps.get(1);
assertEquals("ParallelDo", reifyWindowedValueStep.getKind());
Step gbkStep = steps.get(2);
assertEquals("GroupByKey", gbkStep.getKind());
Step statefulParDoStep = steps.get(3);
assertEquals("ParallelDo", statefulParDoStep.getKind());
assertThat(
(String) statefulParDoStep.getProperties().get(PropertyNames.USES_KEYED_STATE),
not(equalTo("true")));
}
/** Testing just the translation of the pipeline from ViewTest#testToList. */
@Test
public void testToList() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
Pipeline pipeline = Pipeline.create(options);
final PCollectionView<List<Integer>> view =
pipeline.apply("CreateSideInput", Create.of(11, 13, 17, 23)).apply(View.asList());
pipeline
.apply("CreateMainInput", Create.of(29, 31))
.apply(
"OutputSideInputs",
ParDo.of(
new DoFn<Integer, Integer>() {
@ProcessElement
public void processElement(ProcessContext c) {
checkArgument(c.sideInput(view).size() == 4);
checkArgument(c.sideInput(view).get(0).equals(c.sideInput(view).get(0)));
for (Integer i : c.sideInput(view)) {
c.output(i);
}
}
})
.withSideInputs(view));
DataflowRunner runner = DataflowRunner.fromOptions(options);
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
Job job =
translator
.translate(pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList())
.getJob();
List<Step> steps = job.getSteps();
// Change detector assertion just to make sure the test was not a noop.
// No need to actually check the pipeline as the ValidatesRunner tests
// ensure translation is correct. This is just a quick check to see that translation
// does not crash.
assertEquals(5, steps.size());
}
@Test
public void testToMap() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
Pipeline pipeline = Pipeline.create(options);
final PCollectionView<Map<String, Integer>> view =
pipeline
.apply("CreateSideInput", Create.of(KV.of("a", 1), KV.of("b", 3)))
.apply(View.asMap());
PCollection<KV<String, Integer>> output =
pipeline
.apply("CreateMainInput", Create.of("apple", "banana", "blackberry"))
.apply(
"OutputSideInputs",
ParDo.of(
new DoFn<String, KV<String, Integer>>() {
@ProcessElement
public void processElement(ProcessContext c) {
c.output(
KV.of(
c.element(),
c.sideInput(view).get(c.element().substring(0, 1))));
}
})
.withSideInputs(view));
PAssert.that(output)
.containsInAnyOrder(KV.of("apple", 1), KV.of("banana", 3), KV.of("blackberry", 3));
DataflowRunner runner = DataflowRunner.fromOptions(options);
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
Job job =
translator
.translate(pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList())
.getJob();
List<Step> steps = job.getSteps();
// Change detector assertion just to make sure the test was not a noop.
// No need to actually check the pipeline as the ValidatesRunner tests
// ensure translation is correct. This is just a quick check to see that translation
// does not crash.
assertEquals(24, steps.size());
}
/** Smoke test to fail fast if translation of a splittable ParDo in streaming breaks. */
@Test
public void testStreamingSplittableParDoTranslation() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
DataflowRunner runner = DataflowRunner.fromOptions(options);
options.setStreaming(true);
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
PCollection<String> windowedInput =
pipeline
.apply(Create.of("a"))
.apply(Window.into(FixedWindows.of(Duration.standardMinutes(1))));
windowedInput.apply(ParDo.of(new TestSplittableFn()));
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
Job job =
translator
.translate(pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList())
.getJob();
// The job should contain a SplittableParDo.ProcessKeyedElements step, translated as
// "SplittableProcessKeyed".
List<Step> steps = job.getSteps();
Step processKeyedStep = null;
for (Step step : steps) {
if ("SplittableProcessKeyed".equals(step.getKind())) {
assertNull(processKeyedStep);
processKeyedStep = step;
}
}
assertNotNull(processKeyedStep);
@SuppressWarnings({"unchecked", "rawtypes"})
DoFnInfo<String, Integer> fnInfo =
(DoFnInfo<String, Integer>)
SerializableUtils.deserializeFromByteArray(
jsonStringToByteArray(
getString(processKeyedStep.getProperties(), PropertyNames.SERIALIZED_FN)),
"DoFnInfo");
assertThat(fnInfo.getDoFn(), instanceOf(TestSplittableFn.class));
assertThat(
fnInfo.getWindowingStrategy().getWindowFn(),
Matchers.<WindowFn>equalTo(FixedWindows.of(Duration.standardMinutes(1))));
assertThat(fnInfo.getInputCoder(), instanceOf(StringUtf8Coder.class));
Coder<?> restrictionCoder =
CloudObjects.coderFromCloudObject(
(CloudObject)
Structs.getObject(
processKeyedStep.getProperties(), PropertyNames.RESTRICTION_CODER));
assertEquals(
KvCoder.of(SerializableCoder.of(OffsetRange.class), VoidCoder.of()), restrictionCoder);
}
@Test
public void testPortablePipelineContainsExpectedDependenciesAndCapabilities() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
options.setExperiments(Arrays.asList("beam_fn_api"));
DataflowRunner runner = DataflowRunner.fromOptions(options);
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
pipeline
.apply(Impulse.create())
.apply(
MapElements.via(
new SimpleFunction<byte[], String>() {
@Override
public String apply(byte[] input) {
return "";
}
}))
.apply(Window.into(FixedWindows.of(Duration.standardMinutes(1))));
runner.replaceV1Transforms(pipeline);
File file1 = File.createTempFile("file1-", ".txt");
file1.deleteOnExit();
File file2 = File.createTempFile("file2-", ".txt");
file2.deleteOnExit();
SdkComponents sdkComponents = SdkComponents.create();
sdkComponents.registerEnvironment(
Environments.createDockerEnvironment(DataflowRunner.getContainerImageForJob(options))
.toBuilder()
.addAllDependencies(
Environments.getArtifacts(
ImmutableList.of("file1.txt=" + file1, "file2.txt=" + file2)))
.addAllCapabilities(Environments.getJavaCapabilities())
.build());
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
JobSpecification result =
translator.translate(
pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList());
Components componentsProto = result.getPipelineProto().getComponents();
assertThat(
Iterables.getOnlyElement(componentsProto.getEnvironmentsMap().values())
.getCapabilitiesList(),
containsInAnyOrder(Environments.getJavaCapabilities().toArray(new String[0])));
assertThat(
Iterables.getOnlyElement(componentsProto.getEnvironmentsMap().values())
.getDependenciesList(),
containsInAnyOrder(
Environments.getArtifacts(ImmutableList.of("file1.txt=" + file1, "file2.txt=" + file2))
.toArray(new ArtifactInformation[0])));
}
@Test
public void testToSingletonTranslationWithIsmSideInput() throws Exception {
// A "change detector" test that makes sure the translation
// of getting a PCollectionView<T> does not change
// in bad ways during refactor
DataflowPipelineOptions options = buildPipelineOptions();
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
pipeline.apply(Create.of(1)).apply(View.asSingleton());
DataflowRunner runner = DataflowRunner.fromOptions(options);
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
Job job =
translator
.translate(pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList())
.getJob();
assertAllStepOutputsHaveUniqueIds(job);
List<Step> steps = job.getSteps();
assertEquals(9, steps.size());
@SuppressWarnings("unchecked")
List<Map<String, Object>> toIsmRecordOutputs =
(List<Map<String, Object>>)
steps.get(steps.size() - 2).getProperties().get(PropertyNames.OUTPUT_INFO);
assertTrue(
Structs.getBoolean(Iterables.getOnlyElement(toIsmRecordOutputs), "use_indexed_format"));
Step collectionToSingletonStep = steps.get(steps.size() - 1);
assertEquals("CollectionToSingleton", collectionToSingletonStep.getKind());
}
@Test
public void testToIterableTranslationWithIsmSideInput() throws Exception {
// A "change detector" test that makes sure the translation
// of getting a PCollectionView<Iterable<T>> does not change
// in bad ways during refactor
DataflowPipelineOptions options = buildPipelineOptions();
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
pipeline.apply(Create.of(1, 2, 3)).apply(View.asIterable());
DataflowRunner runner = DataflowRunner.fromOptions(options);
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
Job job =
translator
.translate(pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList())
.getJob();
assertAllStepOutputsHaveUniqueIds(job);
List<Step> steps = job.getSteps();
assertEquals(3, steps.size());
@SuppressWarnings("unchecked")
List<Map<String, Object>> toIsmRecordOutputs =
(List<Map<String, Object>>)
steps.get(steps.size() - 2).getProperties().get(PropertyNames.OUTPUT_INFO);
assertTrue(
Structs.getBoolean(Iterables.getOnlyElement(toIsmRecordOutputs), "use_indexed_format"));
Step collectionToSingletonStep = steps.get(steps.size() - 1);
assertEquals("CollectionToSingleton", collectionToSingletonStep.getKind());
}
private JobSpecification runBatchGroupIntoBatchesAndGetJobSpec(
Boolean withShardedKey, List<String> experiments) throws IOException {
DataflowPipelineOptions options = buildPipelineOptions();
options.setExperiments(experiments);
options.setStreaming(false);
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
PCollection<KV<Integer, String>> input =
pipeline.apply(Create.of(Arrays.asList(KV.of(1, "1"), KV.of(2, "2"), KV.of(3, "3"))));
if (withShardedKey) {
input.apply(GroupIntoBatches.<Integer, String>ofSize(3).withShardedKey());
} else {
input.apply(GroupIntoBatches.ofSize(3));
}
DataflowRunner runner = DataflowRunner.fromOptions(options);
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
return translator.translate(
pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList());
}
private JobSpecification runStreamingGroupIntoBatchesAndGetJobSpec(
Boolean withShardedKey, List<String> experiments) throws IOException {
DataflowPipelineOptions options = buildPipelineOptions();
options.setExperiments(experiments);
options.setStreaming(true);
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
PCollection<KV<Integer, String>> input =
pipeline.apply(Create.of(Arrays.asList(KV.of(1, "1"), KV.of(2, "2"), KV.of(3, "3"))));
if (withShardedKey) {
input.apply(GroupIntoBatches.<Integer, String>ofSize(3).withShardedKey());
} else {
input.apply(GroupIntoBatches.ofSize(3));
}
DataflowRunner runner = DataflowRunner.fromOptions(options);
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
return translator.translate(
pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList());
}
@Test
public void testBatchGroupIntoBatchesTranslation() throws Exception {
JobSpecification jobSpec =
runBatchGroupIntoBatchesAndGetJobSpec(false, Collections.emptyList());
List<Step> steps = jobSpec.getJob().getSteps();
Step shardedStateStep = steps.get(steps.size() - 1);
Map<String, Object> properties = shardedStateStep.getProperties();
assertTrue(properties.containsKey(PropertyNames.PRESERVES_KEYS));
assertEquals("true", getString(properties, PropertyNames.PRESERVES_KEYS));
}
@Test
public void testBatchGroupIntoBatchesWithShardedKeyTranslation() throws Exception {
List<String> experiments = Collections.emptyList();
JobSpecification jobSpec = runBatchGroupIntoBatchesAndGetJobSpec(true, experiments);
List<Step> steps = jobSpec.getJob().getSteps();
Step shardedStateStep = steps.get(steps.size() - 1);
Map<String, Object> properties = shardedStateStep.getProperties();
assertTrue(properties.containsKey(PropertyNames.PRESERVES_KEYS));
assertEquals("true", getString(properties, PropertyNames.PRESERVES_KEYS));
}
@Test
public void testBatchGroupIntoBatchesTranslationUnifiedWorker() throws Exception {
List<String> experiments = ImmutableList.of("use_runner_v2");
JobSpecification jobSpec = runBatchGroupIntoBatchesAndGetJobSpec(false, experiments);
List<Step> steps = jobSpec.getJob().getSteps();
Step shardedStateStep = steps.get(steps.size() - 1);
Map<String, Object> properties = shardedStateStep.getProperties();
assertTrue(properties.containsKey(PropertyNames.PRESERVES_KEYS));
assertEquals("true", getString(properties, PropertyNames.PRESERVES_KEYS));
// TODO: should check that the urn is populated, however it is not due to the override in
// DataflowRunner.
}
@Test
public void testBatchGroupIntoBatchesWithShardedKeyTranslationUnifiedWorker() throws Exception {
List<String> experiments = ImmutableList.of("use_runner_v2");
JobSpecification jobSpec = runBatchGroupIntoBatchesAndGetJobSpec(true, experiments);
List<Step> steps = jobSpec.getJob().getSteps();
Step shardedStateStep = steps.get(steps.size() - 1);
Map<String, Object> properties = shardedStateStep.getProperties();
assertTrue(properties.containsKey(PropertyNames.PRESERVES_KEYS));
assertEquals("true", getString(properties, PropertyNames.PRESERVES_KEYS));
// TODO: should check that the urn is populated, however it is not due to the override in
// DataflowRunner.
}
@Test
public void testStreamingGroupIntoBatchesTranslation() throws Exception {
List<String> experiments =
new ArrayList<>(
ImmutableList.of(
GcpOptions.STREAMING_ENGINE_EXPERIMENT, GcpOptions.WINDMILL_SERVICE_EXPERIMENT));
JobSpecification jobSpec = runStreamingGroupIntoBatchesAndGetJobSpec(false, experiments);
List<Step> steps = jobSpec.getJob().getSteps();
Step shardedStateStep = steps.get(steps.size() - 1);
Map<String, Object> properties = shardedStateStep.getProperties();
assertTrue(properties.containsKey(PropertyNames.USES_KEYED_STATE));
assertEquals("true", getString(properties, PropertyNames.USES_KEYED_STATE));
assertFalse(properties.containsKey(PropertyNames.ALLOWS_SHARDABLE_STATE));
assertTrue(properties.containsKey(PropertyNames.PRESERVES_KEYS));
}
@Test
public void testStreamingGroupIntoBatchesWithShardedKeyTranslation() throws Exception {
List<String> experiments =
new ArrayList<>(
ImmutableList.of(
GcpOptions.STREAMING_ENGINE_EXPERIMENT, GcpOptions.WINDMILL_SERVICE_EXPERIMENT));
JobSpecification jobSpec = runStreamingGroupIntoBatchesAndGetJobSpec(true, experiments);
List<Step> steps = jobSpec.getJob().getSteps();
Step shardedStateStep = steps.get(steps.size() - 1);
Map<String, Object> properties = shardedStateStep.getProperties();
assertTrue(properties.containsKey(PropertyNames.USES_KEYED_STATE));
assertEquals("true", getString(properties, PropertyNames.USES_KEYED_STATE));
assertTrue(properties.containsKey(PropertyNames.ALLOWS_SHARDABLE_STATE));
assertEquals("true", getString(properties, PropertyNames.ALLOWS_SHARDABLE_STATE));
assertTrue(properties.containsKey(PropertyNames.PRESERVES_KEYS));
assertEquals("true", getString(properties, PropertyNames.PRESERVES_KEYS));
}
@Test
public void testStreamingGroupIntoBatchesTranslationUnifiedWorker() throws Exception {
List<String> experiments =
new ArrayList<>(
ImmutableList.of(
GcpOptions.STREAMING_ENGINE_EXPERIMENT,
GcpOptions.WINDMILL_SERVICE_EXPERIMENT,
"use_runner_v2"));
JobSpecification jobSpec = runStreamingGroupIntoBatchesAndGetJobSpec(false, experiments);
List<Step> steps = jobSpec.getJob().getSteps();
Step shardedStateStep = steps.get(steps.size() - 1);
Map<String, Object> properties = shardedStateStep.getProperties();
assertTrue(properties.containsKey(PropertyNames.USES_KEYED_STATE));
assertFalse(properties.containsKey(PropertyNames.ALLOWS_SHARDABLE_STATE));
assertTrue(properties.containsKey(PropertyNames.PRESERVES_KEYS));
// Also checks runner proto is correctly populated.
Map<String, RunnerApi.PTransform> transformMap =
jobSpec.getPipelineProto().getComponents().getTransformsMap();
boolean transformFound = false;
for (Map.Entry<String, RunnerApi.PTransform> transform : transformMap.entrySet()) {
RunnerApi.FunctionSpec spec = transform.getValue().getSpec();
if (spec.getUrn().equals(PTransformTranslation.GROUP_INTO_BATCHES_URN)) {
transformFound = true;
}
}
assertTrue(transformFound);
}
@Test
public void testStreamingGroupIntoBatchesWithShardedKeyTranslationUnifiedWorker()
throws Exception {
List<String> experiments =
new ArrayList<>(
ImmutableList.of(
GcpOptions.STREAMING_ENGINE_EXPERIMENT,
GcpOptions.WINDMILL_SERVICE_EXPERIMENT,
"use_runner_v2"));
JobSpecification jobSpec = runStreamingGroupIntoBatchesAndGetJobSpec(true, experiments);
List<Step> steps = jobSpec.getJob().getSteps();
Step shardedStateStep = steps.get(steps.size() - 1);
Map<String, Object> properties = shardedStateStep.getProperties();
assertTrue(properties.containsKey(PropertyNames.USES_KEYED_STATE));
assertTrue(properties.containsKey(PropertyNames.ALLOWS_SHARDABLE_STATE));
assertEquals("true", getString(properties, PropertyNames.ALLOWS_SHARDABLE_STATE));
assertTrue(properties.containsKey(PropertyNames.PRESERVES_KEYS));
assertEquals("true", getString(properties, PropertyNames.PRESERVES_KEYS));
// Also checks the runner proto is correctly populated.
Map<String, RunnerApi.PTransform> transformMap =
jobSpec.getPipelineProto().getComponents().getTransformsMap();
boolean transformFound = false;
for (Map.Entry<String, RunnerApi.PTransform> transform : transformMap.entrySet()) {
RunnerApi.FunctionSpec spec = transform.getValue().getSpec();
if (spec.getUrn().equals(PTransformTranslation.GROUP_INTO_BATCHES_WITH_SHARDED_KEY_URN)) {
for (String subtransform : transform.getValue().getSubtransformsList()) {
RunnerApi.PTransform ptransform = transformMap.get(subtransform);
if (ptransform.getSpec().getUrn().equals(PTransformTranslation.GROUP_INTO_BATCHES_URN)) {
transformFound = true;
}
}
}
}
assertTrue(transformFound);
boolean coderFound = false;
Map<String, RunnerApi.Coder> coderMap =
jobSpec.getPipelineProto().getComponents().getCodersMap();
for (Map.Entry<String, RunnerApi.Coder> coder : coderMap.entrySet()) {
if (coder.getValue().getSpec().getUrn().equals(ModelCoders.SHARDED_KEY_CODER_URN)) {
coderFound = true;
}
}
assertTrue(coderFound);
}
@Test
public void testGroupIntoBatchesWithShardedKeyNotSupported() throws IOException {
// Not using streaming engine.
List<String> experiments = new ArrayList<>(ImmutableList.of("use_runner_v2"));
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage(
"Runner determined sharding not available in Dataflow for GroupIntoBatches for non-Streaming-Engine jobs");
runStreamingGroupIntoBatchesAndGetJobSpec(true, experiments);
}
@Test
public void testStepDisplayData() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
DoFn<Integer, Integer> fn1 =
new DoFn<Integer, Integer>() {
@ProcessElement
public void processElement(ProcessContext c) throws Exception {
c.output(c.element());
}
@Override
public void populateDisplayData(DisplayData.Builder builder) {
builder
.add(DisplayData.item("foo", "bar"))
.add(
DisplayData.item("foo2", DataflowPipelineTranslatorTest.class)
.withLabel("Test Class")
.withLinkUrl("http://www.google.com"));
}
};
DoFn<Integer, Integer> fn2 =
new DoFn<Integer, Integer>() {
@ProcessElement
public void processElement(ProcessContext c) throws Exception {
c.output(c.element());
}
@Override
public void populateDisplayData(DisplayData.Builder builder) {
builder.add(DisplayData.item("foo3", 1234));
}
};
ParDo.SingleOutput<Integer, Integer> parDo1 = ParDo.of(fn1);
ParDo.SingleOutput<Integer, Integer> parDo2 = ParDo.of(fn2);
pipeline.apply(Create.of(1, 2, 3)).apply(parDo1).apply(parDo2);
DataflowRunner runner = DataflowRunner.fromOptions(options);
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
Job job =
translator
.translate(pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList())
.getJob();
assertAllStepOutputsHaveUniqueIds(job);
List<Step> steps = job.getSteps();
assertEquals(3, steps.size());
Map<String, Object> parDo1Properties = steps.get(1).getProperties();
Map<String, Object> parDo2Properties = steps.get(2).getProperties();
assertThat(parDo1Properties, hasKey("display_data"));
@SuppressWarnings("unchecked")
Collection<Map<String, String>> fn1displayData =
(Collection<Map<String, String>>) parDo1Properties.get("display_data");
@SuppressWarnings("unchecked")
Collection<Map<String, String>> fn2displayData =
(Collection<Map<String, String>>) parDo2Properties.get("display_data");
ImmutableSet<ImmutableMap<String, Object>> expectedFn1DisplayData =
ImmutableSet.of(
ImmutableMap.<String, Object>builder()
.put("key", "foo")
.put("type", "STRING")
.put("value", "bar")
.put("namespace", fn1.getClass().getName())
.build(),
ImmutableMap.<String, Object>builder()
.put("key", "fn")
.put("label", "Transform Function")
.put("type", "JAVA_CLASS")
.put("value", fn1.getClass().getName())
.put("shortValue", fn1.getClass().getSimpleName())
.put("namespace", parDo1.getClass().getName())
.build(),
ImmutableMap.<String, Object>builder()
.put("key", "foo2")
.put("type", "JAVA_CLASS")
.put("value", DataflowPipelineTranslatorTest.class.getName())
.put("shortValue", DataflowPipelineTranslatorTest.class.getSimpleName())
.put("namespace", fn1.getClass().getName())
.put("label", "Test Class")
.put("linkUrl", "http://www.google.com")
.build());
ImmutableSet<ImmutableMap<String, Object>> expectedFn2DisplayData =
ImmutableSet.of(
ImmutableMap.<String, Object>builder()
.put("key", "fn")
.put("label", "Transform Function")
.put("type", "JAVA_CLASS")
.put("value", fn2.getClass().getName())
.put("shortValue", fn2.getClass().getSimpleName())
.put("namespace", parDo2.getClass().getName())
.build(),
ImmutableMap.<String, Object>builder()
.put("key", "foo3")
.put("type", "INTEGER")
.put("value", 1234L)
.put("namespace", fn2.getClass().getName())
.build());
assertEquals(expectedFn1DisplayData, ImmutableSet.copyOf(fn1displayData));
assertEquals(expectedFn2DisplayData, ImmutableSet.copyOf(fn2displayData));
}
@Test
public void testStepResourceHints() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
DataflowPipelineTranslator translator = DataflowPipelineTranslator.fromOptions(options);
Pipeline pipeline = Pipeline.create(options);
pipeline
.apply(Create.of(1, 2, 3))
.apply(
"Has hints",
MapElements.into(TypeDescriptors.integers())
.via((Integer x) -> x + 1)
.setResourceHints(
ResourceHints.create()
.withMinRam("10.0GiB")
.withAccelerator("type:nvidia-tesla-k80;count:1;install-nvidia-driver")));
DataflowRunner runner = DataflowRunner.fromOptions(options);
runner.replaceV1Transforms(pipeline);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, sdkComponents, true);
Job job =
translator
.translate(pipeline, pipelineProto, sdkComponents, runner, Collections.emptyList())
.getJob();
Step stepWithHints = job.getSteps().get(1);
ImmutableMap<String, Object> expectedHints =
ImmutableMap.<String, Object>builder()
.put("beam:resources:min_ram_bytes:v1", "10737418240")
.put(
"beam:resources:accelerator:v1",
"type:nvidia-tesla-k80;count:1;install-nvidia-driver")
.build();
assertEquals(expectedHints, stepWithHints.getProperties().get("resource_hints"));
}
private RunnerApi.PTransform getLeafTransform(RunnerApi.Pipeline pipelineProto, String label) {
for (RunnerApi.PTransform transform :
pipelineProto.getComponents().getTransformsMap().values()) {
if (transform.getUniqueName().contains(label) && transform.getSubtransformsCount() == 0) {
return transform;
}
}
throw new java.lang.IllegalArgumentException(label);
}
private static class IdentityDoFn<T> extends DoFn<T, T> {
@ProcessElement
public void processElement(@Element T input, OutputReceiver<T> out) {
out.output(input);
}
}
private static class Inner extends PTransform<PCollection<byte[]>, PCollection<byte[]>> {
@Override
public PCollection<byte[]> expand(PCollection<byte[]> input) {
return input.apply(
"Innermost",
ParDo.of(new IdentityDoFn<byte[]>())
.setResourceHints(ResourceHints.create().withAccelerator("set_in_inner_transform")));
}
}
private static class Outer extends PTransform<PCollection<byte[]>, PCollection<byte[]>> {
@Override
public PCollection<byte[]> expand(PCollection<byte[]> input) {
return input.apply(new Inner());
}
}
@Test
public void testResourceHintsTranslationsResolvesHintsOnOptionsAndComposites() {
ResourceHintsOptions options = PipelineOptionsFactory.as(ResourceHintsOptions.class);
options.setResourceHints(Arrays.asList("accelerator=set_via_options", "minRam=1B"));
Pipeline pipeline = Pipeline.create(options);
PCollection<byte[]> root = pipeline.apply(Impulse.create());
root.apply(
new Outer()
.setResourceHints(
ResourceHints.create().withAccelerator("set_on_outer_transform").withMinRam(20)));
root.apply("Leaf", ParDo.of(new IdentityDoFn<byte[]>()));
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(pipeline, false);
assertThat(
pipelineProto
.getComponents()
.getEnvironmentsMap()
.get(getLeafTransform(pipelineProto, "Leaf").getEnvironmentId())
.getResourceHintsMap(),
org.hamcrest.Matchers.allOf(
org.hamcrest.Matchers.hasEntry(
"beam:resources:min_ram_bytes:v1", ByteString.copyFromUtf8("1")),
org.hamcrest.Matchers.hasEntry(
"beam:resources:accelerator:v1", ByteString.copyFromUtf8("set_via_options"))));
assertThat(
pipelineProto
.getComponents()
.getEnvironmentsMap()
.get(getLeafTransform(pipelineProto, "Innermost").getEnvironmentId())
.getResourceHintsMap(),
org.hamcrest.Matchers.allOf(
org.hamcrest.Matchers.hasEntry(
"beam:resources:min_ram_bytes:v1", ByteString.copyFromUtf8("20")),
org.hamcrest.Matchers.hasEntry(
"beam:resources:accelerator:v1",
ByteString.copyFromUtf8("set_in_inner_transform"))));
}
/**
* Tests that when (deprecated) {@link
* DataflowPipelineOptions#setWorkerHarnessContainerImage(String)} pipeline option is set, {@link
* DataflowRunner} sets that value as the {@link DockerPayload#getContainerImage()} of the default
* {@link Environment} used when generating the model pipeline proto.
*/
@Test
public void testSetWorkerHarnessContainerImageInPipelineProto() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
String containerImage = "gcr.io/image:foo";
options.as(DataflowPipelineOptions.class).setWorkerHarnessContainerImage(containerImage);
Pipeline p = Pipeline.create(options);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline proto = PipelineTranslation.toProto(p, sdkComponents, true);
JobSpecification specification =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
proto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList());
RunnerApi.Pipeline pipelineProto = specification.getPipelineProto();
assertEquals(1, pipelineProto.getComponents().getEnvironmentsCount());
Environment defaultEnvironment =
Iterables.getOnlyElement(pipelineProto.getComponents().getEnvironmentsMap().values());
DockerPayload payload = DockerPayload.parseFrom(defaultEnvironment.getPayload());
assertEquals(DataflowRunner.getContainerImageForJob(options), payload.getContainerImage());
}
/**
* Tests that when {@link DataflowPipelineOptions#setSdkContainerImage(String)} pipeline option is
* set, {@link DataflowRunner} sets that value as the {@link DockerPayload#getContainerImage()} of
* the default {@link Environment} used when generating the model pipeline proto.
*/
@Test
public void testSetSdkContainerImageInPipelineProto() throws Exception {
DataflowPipelineOptions options = buildPipelineOptions();
String containerImage = "gcr.io/image:foo";
options.as(DataflowPipelineOptions.class).setSdkContainerImage(containerImage);
Pipeline p = Pipeline.create(options);
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline proto = PipelineTranslation.toProto(p, sdkComponents, true);
JobSpecification specification =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
proto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList());
RunnerApi.Pipeline pipelineProto = specification.getPipelineProto();
assertEquals(1, pipelineProto.getComponents().getEnvironmentsCount());
Environment defaultEnvironment =
Iterables.getOnlyElement(pipelineProto.getComponents().getEnvironmentsMap().values());
DockerPayload payload = DockerPayload.parseFrom(defaultEnvironment.getPayload());
assertEquals(DataflowRunner.getContainerImageForJob(options), payload.getContainerImage());
}
@Test
public void testDataflowServiceOptionsSet() throws IOException {
final List<String> dataflowServiceOptions =
Stream.of("whizz=bang", "foo=bar").collect(Collectors.toList());
DataflowPipelineOptions options = buildPipelineOptions();
options.setDataflowServiceOptions(dataflowServiceOptions);
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertEquals(dataflowServiceOptions, job.getEnvironment().getServiceOptions());
}
@Test
public void testHotKeyLoggingEnabledOption() throws IOException {
DataflowPipelineOptions options = buildPipelineOptions();
options.setHotKeyLoggingEnabled(true);
Pipeline p = buildPipeline(options);
p.traverseTopologically(new RecordingPipelineVisitor());
SdkComponents sdkComponents = createSdkComponents(options);
RunnerApi.Pipeline pipelineProto = PipelineTranslation.toProto(p, sdkComponents, true);
Job job =
DataflowPipelineTranslator.fromOptions(options)
.translate(
p,
pipelineProto,
sdkComponents,
DataflowRunner.fromOptions(options),
Collections.emptyList())
.getJob();
assertTrue(job.getEnvironment().getDebugOptions().getEnableHotKeyLogging());
}
private static void assertAllStepOutputsHaveUniqueIds(Job job) throws Exception {
List<String> outputIds = new ArrayList<>();
for (Step step : job.getSteps()) {
List<Map<String, Object>> outputInfoList =
(List<Map<String, Object>>) step.getProperties().get(PropertyNames.OUTPUT_INFO);
if (outputInfoList != null) {
for (Map<String, Object> outputInfo : outputInfoList) {
outputIds.add(getString(outputInfo, PropertyNames.OUTPUT_NAME));
}
}
}
Set<String> uniqueOutputNames = new HashSet<>(outputIds);
outputIds.removeAll(uniqueOutputNames);
assertTrue(String.format("Found duplicate output ids %s", outputIds), outputIds.isEmpty());
}
private static class TestSplittableFn extends DoFn<String, Integer> {
@ProcessElement
public void process(ProcessContext c, RestrictionTracker<OffsetRange, Long> tracker) {
// noop
}
@GetInitialRestriction
public OffsetRange getInitialRange(@Element String element) {
return null;
}
}
}
| {
"content_hash": "4ba25051fd1f5d941c581f59806972fb",
"timestamp": "",
"source": "github",
"line_count": 1669,
"max_line_length": 115,
"avg_line_length": 41.58897543439185,
"alnum_prop": 0.6948366276724486,
"repo_name": "robertwb/incubator-beam",
"id": "82297b9784ae428ceb53930780455ca00692e15b",
"size": "70217",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/DataflowPipelineTranslatorTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "1598"
},
{
"name": "C",
"bytes": "3869"
},
{
"name": "CSS",
"bytes": "4957"
},
{
"name": "Cython",
"bytes": "59582"
},
{
"name": "Dart",
"bytes": "541526"
},
{
"name": "Dockerfile",
"bytes": "48191"
},
{
"name": "FreeMarker",
"bytes": "7933"
},
{
"name": "Go",
"bytes": "4688736"
},
{
"name": "Groovy",
"bytes": "888171"
},
{
"name": "HCL",
"bytes": "101646"
},
{
"name": "HTML",
"bytes": "164685"
},
{
"name": "Java",
"bytes": "38649211"
},
{
"name": "JavaScript",
"bytes": "105966"
},
{
"name": "Jupyter Notebook",
"bytes": "55818"
},
{
"name": "Kotlin",
"bytes": "209531"
},
{
"name": "Lua",
"bytes": "3620"
},
{
"name": "Python",
"bytes": "9785295"
},
{
"name": "SCSS",
"bytes": "312814"
},
{
"name": "Sass",
"bytes": "19336"
},
{
"name": "Scala",
"bytes": "1429"
},
{
"name": "Shell",
"bytes": "336583"
},
{
"name": "Smarty",
"bytes": "2618"
},
{
"name": "Thrift",
"bytes": "3260"
},
{
"name": "TypeScript",
"bytes": "181369"
}
],
"symlink_target": ""
} |
import settings from '../settings'
import Vue from 'vue'
export default class FileForUpload {
/**
* Initialize new instance of file upload.
* @param {File} file
*/
constructor (file) {
this.file = file
this.name = file.name
this.reader = new FileReader()
this.src = settings.icon('file')
this.$error = ''
this.$loading = false
this.reader.onload = (e) => {
// Mutate content only for images, all other files should show default
// icon of the file
if (e.target.result && e.target.result.startsWith('data:image')) {
Vue.set(this, 'src', e.target.result)
}
}
this.reader.readAsDataURL(file)
}
get hasError () { return !!this.$error }
get title () { return this.hasError ? this.$error : this.name }
}
| {
"content_hash": "05ff4d812004fbcee8a2bfe464db8f20",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 76,
"avg_line_length": 25.483870967741936,
"alnum_prop": 0.6177215189873417,
"repo_name": "crip-laravel/filesys",
"id": "855ef8821c1d14bc25f343ab73c9142e256163d6",
"size": "790",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/resources/assets/models/FileForUpload.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1083"
},
{
"name": "JavaScript",
"bytes": "44999"
},
{
"name": "PHP",
"bytes": "74192"
},
{
"name": "Vue",
"bytes": "43161"
}
],
"symlink_target": ""
} |
package dk.skrypalle.bpl.util;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.tree.*;
import java.util.*;
public final class Parse {
public static String ttos(Token t) {
if (t == null)
throw new NullPointerException("'t' is null");
return t.getText();
}
public static String ttos(ParseTree t) {
if (t == null)
throw new NullPointerException("'t' is null");
return t.getText();
}
public static String join(String delim, List<?> ary) {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < ary.size(); i++) {
buf.append(ary.get(i));
if (i < ary.size() - 1)
buf.append(delim);
}
return buf.toString();
}
private Parse() { /**/ }
}
| {
"content_hash": "dbbc8574c7f841f62e101ac2941bbdb4",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 55,
"avg_line_length": 19.333333333333332,
"alnum_prop": 0.6336206896551724,
"repo_name": "baeda/bpl",
"id": "66b9f56d3e3876011fea0daca72b0669e8070aa4",
"size": "1846",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/dk/skrypalle/bpl/util/Parse.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ANTLR",
"bytes": "3821"
},
{
"name": "Batchfile",
"bytes": "52"
},
{
"name": "Java",
"bytes": "167417"
},
{
"name": "Shell",
"bytes": "52"
}
],
"symlink_target": ""
} |
"""
Exposes utility functions.
"""
from collections import OrderedDict
from contextlib import contextmanager
import json
import logging
import timeit
REPORTING_INDEX_ALL = 0
REPORTING_INDEX_ELD = 1
REPORTING_INDEX_VBM = 2
REPORTING_INDICES_SIMPLE = (REPORTING_INDEX_ALL, )
REPORTING_INDICES_COMPLETE = (REPORTING_INDEX_ELD, REPORTING_INDEX_VBM)
_log = logging.getLogger("wineds")
class EqualityMixin:
def __eq__(self, other):
if type(self) != type(other):
return False
for name in self.equality_attrs:
if getattr(self, name) != getattr(other, name):
return False
return True
def __ne__(self, other):
return not self.__eq__(other)
# This method allows the reporting type field to be either
# "TC-Election Day Reporting" or "Election Day".
def get_reporting_index(reporting_field):
if not reporting_field:
reporting_index = REPORTING_INDEX_ALL
elif "Election Day" in reporting_field:
reporting_index = REPORTING_INDEX_ELD
elif "VBM" in reporting_field:
reporting_index = REPORTING_INDEX_VBM
else:
raise Exception("unrecognized reporting-type field: %r" % reporting_field)
return reporting_index
def prettify(obj):
return json.dumps(obj, indent=4)
def assert_equal(actual, expected, desc=None):
if actual == expected:
return
info = OrderedDict()
if desc is not None:
info['desc'] = desc
info.update([
("actual", actual),
("expected", expected),
])
msg = "value does not match expected:\n>>> {0}".format(prettify(info))
raise AssertionError(msg)
def add_to_set(_set, value, set_name):
if value in _set:
return False
_log.info("adding to {0}: {1}".format(set_name, value))
_set.add(value)
return True
def add_to_dict(mapping, key, value, desc=None):
"""Return whether a value was added."""
try:
old_value = mapping[key]
except KeyError:
mapping[key] = value
return True
# Otherwise, confirm that the new value matches the old.
assert_equal(value, old_value, desc=desc)
return False
@contextmanager
def time_it(task_desc):
"""
A context manager for timing chunks of code and logging it.
Arguments:
task_desc: task description for logging purposes
"""
start_time = timeit.default_timer()
_log.info("begin: %s..." % task_desc)
yield
elapsed = timeit.default_timer() - start_time
_log.info("elapsed (%s): %.4f seconds" % (task_desc, elapsed))
| {
"content_hash": "9cb4f76101bf2cb690bf031f682e381e",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 82,
"avg_line_length": 24.485714285714284,
"alnum_prop": 0.6444963049397122,
"repo_name": "cjerdonek/wineds-converter",
"id": "3bbd67762b23dd747e2bf9f001ff591a712f1a51",
"size": "2572",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pywineds/utils.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "54079"
}
],
"symlink_target": ""
} |
// Copyright NVIDIA Corporation 2010-2013
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <dp/sg/ui/qt5/SceniXQtUtil.h>
#include <dp/sg/core/TextureHost.h>
#include <dp/util/Image.h>
namespace dp
{
namespace sg
{
namespace ui
{
namespace qt5
{
using namespace dp::sg::core;
static QImage errorImage;
// Data in QImage::Format_ARGB32
const static unsigned int rgby[] =
{
0xFFFF0000,
0xFF00FF00,
0xFF0000FF,
0xFFFFFF00
};
template <typename SrcType>
struct UnsignedIntegerToUnsignedChar
{
public:
unsigned char operator()( const char *&src ) const
{
unsigned char result = *((SrcType*)src) >> ((sizeof(SrcType) * 8) - 8);
src += sizeof(SrcType);
return result;
}
};
template <typename SrcType>
struct IntegerToUnsignedChar
{
public:
unsigned char operator()( const char *&src ) const
{
unsigned char result = std::max((SrcType)0, *((SrcType*)src)) >> ((sizeof(SrcType) * 8) - 8);
src += sizeof(SrcType);
return result;
}
};
template <typename SrcType>
struct FloatToChar
{
public:
FloatToChar( SrcType maxValue ) : m_scale( 255.0f / maxValue ) {}
unsigned char operator()( const char *&src ) const
{
unsigned char result = static_cast<unsigned char>(*((SrcType*)src) * m_scale);
src += sizeof(SrcType);
return result;
}
protected:
SrcType m_scale;
};
template <typename Converter>
void convertRGBToRGBA( unsigned char *dst, const char *src, unsigned int numPixels, const Converter &converter)
{
for (unsigned int pixel = 0;pixel < numPixels;++pixel)
{
dst[2] = converter(src);
dst[1] = converter(src);
dst[0] = converter(src);
dst[3] = 255;
dst += 4;
}
}
template <typename Converter>
void convertRGBAToRGBA( unsigned char *dst, const char *src, unsigned int numPixels, const Converter &converter)
{
for (unsigned int pixel = 0;pixel < numPixels;++pixel)
{
dst[2] = converter(src);
dst[1] = converter(src);
dst[0] = converter(src);
dst[3] = converter(src);
dst += 4;
}
}
template <typename Converter>
void convertBGRToRGBA( unsigned char *dst, const char *src, unsigned int &numPixels, const Converter &converter)
{
for (unsigned int pixel = 0;pixel < numPixels;++pixel)
{
dst[0] = converter(src);
dst[1] = converter(src);
dst[2] = converter(src);
dst[3] = 255;
dst += 4;
}
}
template <typename Converter>
void convertBGRAToRGBA( unsigned char *dst, const char *src, unsigned int numPixels, const Converter &converter)
{
for (unsigned int pixel = 0;pixel < numPixels;++pixel)
{
dst[0] = converter(src);
dst[1] = converter(src);
dst[2] = converter(src);
dst[3] = converter(src);
dst += 4;
}
}
/** \brief Creates an QImage out of a TextureHost
**/
QImage createQImage( const TextureHostSharedPtr & textureImage, int image, int mipmap )
{
Buffer::DataReadLock buffer( textureImage->getPixels( image, mipmap ) );
const void *srcData = buffer.getPtr();
int width = textureImage->getWidth( image, mipmap );
int height = textureImage->getHeight( image, mipmap );
unsigned int numPixels = width * height;
std::vector<unsigned char> tmpData;
tmpData.resize( width * 4 * height );
QImage result;
// determine QImage format
QImage::Format format = QImage::Format_ARGB32;
bool supported = true;
if (textureImage->getDepth() != 1)
{
supported = false;
}
else
{
// convert to RGBA
switch ( textureImage->getFormat( image, mipmap ) )
{
case Image::IMG_BGR:
switch (textureImage->getType())
{
case Image::IMG_UNSIGNED_BYTE:
convertBGRToRGBA( &tmpData[0], (char*)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned char>() );
break;
case Image::IMG_UNSIGNED_SHORT:
convertBGRToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned short>() );
break;
case Image::IMG_UNSIGNED_INT:
convertBGRToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned int>() );
break;
case Image::IMG_BYTE:
convertBGRToRGBA( &tmpData[0], (char*)srcData, numPixels, IntegerToUnsignedChar<char>() );
break;
case Image::IMG_SHORT:
convertBGRToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<short>() );
break;
case Image::IMG_INT:
convertBGRToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<int>() );
break;
case Image::IMG_FLOAT:
{
const float *src = static_cast<const float *>(srcData);
float max = *std::max_element( src, src + 3 * numPixels );
convertBGRToRGBA( &tmpData[0], (char *)srcData, numPixels, FloatToChar<float>(max) );
}
break;
default:
supported = false;
}
break;
case Image::IMG_RGB:
switch (textureImage->getType())
{
case Image::IMG_UNSIGNED_BYTE:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned char>() );
break;
case Image::IMG_UNSIGNED_SHORT:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned short>() );
break;
case Image::IMG_UNSIGNED_INT:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned int>() );
break;
case Image::IMG_BYTE:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<char>() );
break;
case Image::IMG_SHORT:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<short>() );
break;
case Image::IMG_INT:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<int>() );
break;
case Image::IMG_FLOAT:
{
const float *src = static_cast<const float *>(srcData);
float max = *std::max_element( src, src + 3 * numPixels );
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, FloatToChar<float>( max ) );
}
break;
default:
supported = false;
}
break;
case Image::IMG_RGBA:
switch (textureImage->getType())
{
case Image::IMG_UNSIGNED_BYTE:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned char>() );
break;
case Image::IMG_UNSIGNED_SHORT:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned short>() );
break;
case Image::IMG_UNSIGNED_INT:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned int>() );
break;
case Image::IMG_BYTE:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<char>() );
break;
case Image::IMG_SHORT:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<short>() );
break;
case Image::IMG_INT:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<int>() );
break;
case Image::IMG_FLOAT:
{
const float *src = static_cast<const float *>(srcData);
float max = *std::max_element( src, src + 4 * numPixels );
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, FloatToChar<float>( max ) );
}
break;
default:
supported = false;
}
break;
case Image::IMG_BGRA:
switch (textureImage->getType())
{
case Image::IMG_UNSIGNED_BYTE:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned char>() );
break;
case Image::IMG_UNSIGNED_SHORT:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned short>() );
break;
case Image::IMG_UNSIGNED_INT:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned int>() );
break;
case Image::IMG_BYTE:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<char>() );
break;
case Image::IMG_SHORT:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<short>() );
break;
case Image::IMG_INT:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<int>() );
break;
case Image::IMG_FLOAT:
{
const float *src = static_cast<const float *>(srcData);
float max = *std::max_element( src, src + 4 * numPixels );
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, FloatToChar<float>( max ) );
}
break;
default:
supported = false;
}
break;
default:
supported = false;
break;
};
}
if( !supported )
{
if( errorImage.isNull() )
{
errorImage = QImage( reinterpret_cast<const uchar *>(rgby), 2, 2, QImage::Format_ARGB32 );
}
result = errorImage;
}
else
{
// The QImage is mirrored vertically when using the pixelData of a TextureHost. Mirror it.
// This way it's also ensured that Qt does manage a copy of the pixel data.
// DAR BUG: Won't work with Format_RGB888 and width which is NOT a multiple of four!
// Because: "Constructs an image with the given width, height and format, that uses an existing memory buffer, data.
// The width and height must be specified in pixels, data must be 32-bit aligned,
// and ***each scanline of data in the image must also be 32-bit aligned***."
result = QImage( reinterpret_cast<const uchar *>( &tmpData[0] ),
textureImage->getWidth( image, mipmap ), textureImage->getHeight( image, mipmap ), format ).mirrored();
}
return result;
}
/** \brief Creates an QImage out of a TextureHost
**/
QImage createQImage( const dp::util::ImageSharedPtr& image /*, int image, int mipmap */ )
{
const void *srcData = image->getLayerData( 0, 0 );
int width = static_cast<int>(image->getWidth( ));
int height = static_cast<int>(image->getHeight( ));
unsigned int numPixels = width * height;
std::vector<unsigned char> tmpData;
tmpData.resize( width * 4 * height );
QImage result;
// determine QImage format
QImage::Format format = QImage::Format_ARGB32;
bool supported = true;
// convert to RGBA
switch ( image->getPixelFormat( ) )
{
case dp::PF_BGR:
switch (image->getDataType())
{
case dp::DT_UNSIGNED_INT_8:
convertBGRToRGBA( &tmpData[0], (char*)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned char>() );
break;
case dp::DT_UNSIGNED_INT_16:
convertBGRToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned short>() );
break;
case dp::DT_UNSIGNED_INT_32:
convertBGRToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned int>() );
break;
case dp::DT_INT_8:
convertBGRToRGBA( &tmpData[0], (char*)srcData, numPixels, IntegerToUnsignedChar<char>() );
break;
case dp::DT_INT_16:
convertBGRToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<short>() );
break;
case dp::DT_INT_32:
convertBGRToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<int>() );
break;
case dp::DT_FLOAT_32:
{
const float *src = static_cast<const float *>(srcData);
float max = *std::max_element( src, src + 3 * numPixels );
convertBGRToRGBA( &tmpData[0], (char *)srcData, numPixels, FloatToChar<float>(max) );
}
break;
default:
supported = false;
}
break;
case dp::PF_RGB:
switch (image->getDataType())
{
case dp::DT_UNSIGNED_INT_8:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned char>() );
break;
case dp::DT_UNSIGNED_INT_16:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned short>() );
break;
case dp::DT_UNSIGNED_INT_32:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned int>() );
break;
case dp::DT_INT_8:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<char>() );
break;
case dp::DT_INT_16:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<short>() );
break;
case dp::DT_INT_32:
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<int>() );
break;
case dp::DT_FLOAT_32:
{
const float *src = static_cast<const float *>(srcData);
float max = *std::max_element( src, src + 3 * numPixels );
convertRGBToRGBA( &tmpData[0], (char *)srcData, numPixels, FloatToChar<float>( max ) );
}
break;
default:
supported = false;
}
break;
case dp::PF_RGBA:
switch (image->getDataType())
{
case dp::DT_UNSIGNED_INT_8:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned char>() );
break;
case dp::DT_UNSIGNED_INT_16:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned short>() );
break;
case dp::DT_UNSIGNED_INT_32:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned int>() );
break;
case dp::DT_INT_8:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<char>() );
break;
case dp::DT_INT_16:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<short>() );
break;
case dp::DT_INT_32:
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<int>() );
break;
case dp::DT_FLOAT_32:
{
const float *src = static_cast<const float *>(srcData);
float max = *std::max_element( src, src + 4 * numPixels );
convertRGBAToRGBA( &tmpData[0], (char *)srcData, numPixels, FloatToChar<float>( max ) );
}
break;
default:
supported = false;
}
break;
case dp::PF_BGRA:
switch (image->getDataType())
{
case dp::DT_UNSIGNED_INT_8:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned char>() );
break;
case dp::DT_UNSIGNED_INT_16:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned short>() );
break;
case dp::DT_UNSIGNED_INT_32:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, UnsignedIntegerToUnsignedChar<unsigned int>() );
break;
case dp::DT_INT_8:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<char>() );
break;
case dp::DT_INT_16:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<short>() );
break;
case dp::DT_INT_32:
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, IntegerToUnsignedChar<int>() );
break;
case dp::DT_FLOAT_32:
{
const float *src = static_cast<const float *>(srcData);
float max = *std::max_element( src, src + 4 * numPixels );
convertBGRAToRGBA( &tmpData[0], (char *)srcData, numPixels, FloatToChar<float>( max ) );
}
break;
default:
supported = false;
}
break;
default:
supported = false;
break;
};
// The QImage is mirrored vertically when using the pixelData of a TextureHost. Mirror it.
// This way it's also ensured that Qt does manage a copy of the pixel data.
// DAR BUG: Won't work with Format_RGB888 and width which is NOT a multiple of four!
// Because: "Constructs an image with the given width, height and format, that uses an existing memory buffer, data.
// The width and height must be specified in pixels, data must be 32-bit aligned,
// and ***each scanline of data in the image must also be 32-bit aligned***."
result = QImage( reinterpret_cast<const uchar *>( &tmpData[0] ),
width, height, format ).mirrored();
return result;
}
} // namespace qt5
} // namespace ui
} // namespace sg
} // namespace dp
| {
"content_hash": "eb93bb259d7219e46373b4128f1fc759",
"timestamp": "",
"source": "github",
"line_count": 502,
"max_line_length": 139,
"avg_line_length": 43.86852589641434,
"alnum_prop": 0.5312414857869403,
"repo_name": "swq0553/pipeline",
"id": "1b22759f6b79c0df4b4604a39cd57049cf721398",
"size": "22022",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "dp/sg/ui/qt5/src/SceniXQtUtil.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "10219"
},
{
"name": "C",
"bytes": "74530"
},
{
"name": "C++",
"bytes": "8386101"
},
{
"name": "CMake",
"bytes": "147411"
},
{
"name": "GLSL",
"bytes": "64599"
},
{
"name": "HTML",
"bytes": "1004"
},
{
"name": "Objective-C",
"bytes": "3853"
},
{
"name": "Python",
"bytes": "20995"
}
],
"symlink_target": ""
} |
using namespace std;
class Iterator {
struct Data;
Data* data;
public:
Iterator(const vector<int>& nums);
Iterator(const Iterator& iter);
virtual ~Iterator();
// Returns the next element in the iteration.
int next();
// Returns true if the iteration has more elements.
bool hasNext() const;
};
class PeekingIterator : public Iterator {
private:
bool m_hasNext;
int m_next;
void takeNext() {
m_hasNext = Iterator::hasNext();
if (m_hasNext) {
m_next = Iterator::next();
}
}
public:
PeekingIterator(const vector<int>& nums) : Iterator(nums) {
// Initialize any member here.
// **DO NOT** save a copy of nums and manipulate it directly.
// You should only use the Iterator interface methods.
takeNext();
}
// Returns the next element in the iteration without advancing the iterator.
int peek() {
return m_next;
}
// hasNext() and next() should behave the same as in the Iterator interface.
// Override them if needed.
int next() {
int temp = m_next;
takeNext();
return temp;
}
bool hasNext() const {
return m_hasNext;
}
};
| {
"content_hash": "a906d2c5e6fe83a34a01a33a1ce663fe",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 80,
"avg_line_length": 23.60377358490566,
"alnum_prop": 0.5859312549960032,
"repo_name": "narikbi/LeetCode",
"id": "2b848b081283389603778a8c85de090d549d8223",
"size": "1640",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/284.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "305358"
},
{
"name": "Swift",
"bytes": "2148"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_label" msgid="4489004083283879149">"Лента на състоянието"</string>
<string name="status_bar_clear_all_button" msgid="7774721344716731603">"Изчистване"</string>
<string name="status_bar_no_notifications_title" msgid="4755261167193833213">"Няма известия"</string>
<string name="status_bar_ongoing_events_title" msgid="1682504513316879202">"В момента"</string>
<string name="status_bar_latest_events_title" msgid="6594767438577593172">"Известия"</string>
<string name="battery_low_title" msgid="7923774589611311406">"Моля, включете зарядно устройство"</string>
<string name="battery_low_subtitle" msgid="7388781709819722764">"Батерията се изтощава:"</string>
<string name="battery_low_percent_format" msgid="696154104579022959">"Остава <xliff:g id="NUMBER">%d%%</xliff:g> или по-малко."</string>
<string name="battery_low_why" msgid="7279169609518386372">"Използване на батерията"</string>
<!-- no translation found for usb_accessory_permission_prompt (3969745913539898765) -->
<skip />
<!-- no translation found for usb_device_confirm_prompt (2727793581411868504) -->
<skip />
<!-- no translation found for usb_accessory_confirm_prompt (3947430407252730383) -->
<skip />
<string name="usb_accessory_uri_prompt" msgid="6332150684964235705">"Инсталираните приложения не работят с този аксесоар за USB. Научете повече на адрес <xliff:g id="URL">%1$s</xliff:g>"</string>
<string name="title_usb_accessory" msgid="4966265263465181372">"Аксесоар за USB"</string>
<string name="label_view" msgid="6304565553218192990">"Преглед"</string>
<string name="always_use_accessory" msgid="1210954576979621596">"Използване по подразб. за този аксесоар за USB"</string>
</resources>
| {
"content_hash": "3be81470b4c13bb838f518312b7e356e",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 199,
"avg_line_length": 71.70370370370371,
"alnum_prop": 0.7283057851239669,
"repo_name": "xjwangliang/android_source_note",
"id": "d9ee86a4b7b754c278ced1a456c45475e837bad8",
"size": "2824",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SystemUI/res/values-bg/strings.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1598341"
},
{
"name": "Python",
"bytes": "9928"
}
],
"symlink_target": ""
} |
<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,user-scalable=yes">
<meta name="description" content="QuickSSVEP - A tool for setting up SSVEP stimulator">
<title>Quick SSVEP</title>
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/FileSaver.min.js"></script>
<!--<script type="text/javascript" src="js/jquery-migrate-1.0.0.min.js"></script>-->
<!--<script type="text/javascript" src="js/jquery-migrate-1.0.0.js"></script>-->
<link type="text/css" rel="stylesheet" href="style.css">
<script type="text/javascript" src="js/stim.js"></script>
</head>
<body>
<script type="text/javascript">
SSVEPStim = new SSVEP();
// Check that service workers are registered
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('./sw.js');
});
}
</script>
</body>
</html>
| {
"content_hash": "a77155a9f16f0d3e9b24488e826c6121",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 88,
"avg_line_length": 39.5,
"alnum_prop": 0.6864654333008764,
"repo_name": "OmidS/quickssvep",
"id": "0ea5954de87b640c7b9c28730fd27bf5702a892f",
"size": "1027",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4121"
},
{
"name": "HTML",
"bytes": "1027"
},
{
"name": "JavaScript",
"bytes": "26345"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "d8ae82100b7ef2bce78854acf94710c1",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "c2187c127bab379fee9208c1e1414ea48fb0dfbc",
"size": "193",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Rosaceae/Stephanandra/Stephanandra tanakae/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/*jshint camelcase: false */
'use strict';
module.exports = {
addDefaults: function(options) {
options.proxy = options.proxy || {};
options.proxy.address = options.proxy.address || '172.20.0.253';
options.proxy.url = options.proxy.url || 'http://' + options.proxy.address + ':8888';
},
addEnvironment: function(options, environment) {
environment.PROXY_ADDRESS = options.proxy.address;
if(options.pocci.allServices.indexOf('proxy') > -1) {
environment.http_proxy = options.proxy.url;
environment.https_proxy = options.proxy.url;
}
}
};
| {
"content_hash": "275df02a5ea63e9afae2c1dd990a1ce0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 97,
"avg_line_length": 33.72222222222222,
"alnum_prop": 0.6375617792421746,
"repo_name": "xpfriend/pocci-template-examples",
"id": "ec14bae4192a51a4429421e5922da46bda47162c",
"size": "607",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "services/core/proxy/js/proxy.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1033"
},
{
"name": "JavaScript",
"bytes": "5499"
},
{
"name": "Ruby",
"bytes": "2420"
},
{
"name": "Shell",
"bytes": "9560"
}
],
"symlink_target": ""
} |
using System;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using GSF.Data;
using GSF.TimeSeries.UI;
using PowerCalculations.UI.DataModels;
namespace PowerCalculations.UI.WPF.ViewModels
{
public class PowerCalculationViewModel : PagedViewModelBase<PowerCalculation, int>
{
public PowerCalculationViewModel(int itemsPerPage, bool autoSave = true)
: base(itemsPerPage, autoSave)
{
}
public override int GetCurrentItemKey()
{
return CurrentItem.ID;
}
public override string GetCurrentItemName()
{
return CurrentItem.CircuitDescription;
}
public override bool IsNewRecord
{
get { return CurrentItem.ID == 0; }
}
public string RuntimeID
{
get
{
try
{
using (AdoDataConnection database = new AdoDataConnection("systemSettings"))
{
int id = database.ExecuteScalar<int>("SELECT ID FROM CustomActionAdapter WHERE AdapterName = 'PHASOR!POWERCALC'");
return CommonFunctions.GetRuntimeID("CustomActionAdapter", id, database);
}
}
catch
{
return "-1";
}
}
}
/// <summary>
/// Loads collection of <see cref="PowerCalculation"/> information stored in the database.
/// </summary>
/// <remarks>This method is overridden because MethodInfo.Invoke in the base class did not like optional parameters.</remarks>
public override void Load()
{
Mouse.OverrideCursor = Cursors.Wait;
try
{
if (OnBeforeLoadCanceled())
throw new OperationCanceledException("Load was canceled.");
if (ItemsKeys == null)
{
ItemsKeys = PowerCalculation.LoadKeys(null);
if ((object)SortSelector != null)
{
if (SortDirection == "ASC")
ItemsKeys = ItemsKeys.OrderBy(SortSelector).ToList();
else
ItemsKeys = ItemsKeys.OrderByDescending(SortSelector).ToList();
}
}
var pageKeys = ItemsKeys.Skip((CurrentPageNumber - 1) * ItemsPerPage).Take(ItemsPerPage).ToList();
ItemsSource = PowerCalculation.Load(null, pageKeys);
OnLoaded();
}
catch (Exception ex)
{
if (ex.InnerException != null)
{
Popup(ex.Message + Environment.NewLine + "Inner Exception: " + ex.InnerException.Message, "Load Power Calculations Exception:", MessageBoxImage.Error);
CommonFunctions.LogException(null, "Load Power Calculations", ex.InnerException);
}
else
{
Popup(ex.Message, "Load Power Calculations Exception:", MessageBoxImage.Error);
CommonFunctions.LogException(null, "Load Power Calculations", ex);
}
}
finally
{
Mouse.OverrideCursor = null;
}
}
public void InitializeAdapter()
{
try
{
if (Confirm("Do you want to Initialize the power calculation adapter?", "Confirm Initialize"))
Popup(CommonFunctions.SendCommandToService("Initialize " + RuntimeID), "Initialize", MessageBoxImage.Information);
}
catch (Exception ex)
{
Popup(ex.Message, "Initialize Adapter:", MessageBoxImage.Error);
CommonFunctions.LogException(null, "Initialize Adapter", ex);
}
}
}
}
| {
"content_hash": "3cb8f233eebe6933817cb0261b435be8",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 156,
"avg_line_length": 28.871794871794872,
"alnum_prop": 0.6190053285968028,
"repo_name": "rmc00/gsf",
"id": "2ad48b3479f1ff852e943941b3ee1c4d79e6706e",
"size": "3380",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Libraries/Adapters/PowerCalculations.UI.WPF/ViewModels/PowerCalculationViewModel.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "17182"
},
{
"name": "Batchfile",
"bytes": "8635"
},
{
"name": "C",
"bytes": "24478"
},
{
"name": "C#",
"bytes": "30052352"
},
{
"name": "C++",
"bytes": "135084"
},
{
"name": "CMake",
"bytes": "3519"
},
{
"name": "CSS",
"bytes": "4763"
},
{
"name": "HTML",
"bytes": "3914"
},
{
"name": "Java",
"bytes": "955418"
},
{
"name": "JavaScript",
"bytes": "1274735"
},
{
"name": "Objective-C",
"bytes": "173"
},
{
"name": "PLSQL",
"bytes": "107859"
},
{
"name": "PLpgSQL",
"bytes": "88792"
},
{
"name": "Pascal",
"bytes": "515"
},
{
"name": "SQLPL",
"bytes": "186015"
},
{
"name": "ShaderLab",
"bytes": "137"
},
{
"name": "Shell",
"bytes": "11035"
},
{
"name": "Smalltalk",
"bytes": "8510"
},
{
"name": "Visual Basic",
"bytes": "72875"
},
{
"name": "XSLT",
"bytes": "1070"
}
],
"symlink_target": ""
} |
var config = require('config.json');
var _ = require('lodash');
var jwt = require('jsonwebtoken');
var bcrypt = require('bcryptjs');
var Q = require('q');
var mongo = require('mongoskin');
var db = mongo.db(config.connectionString, { native_parser: true });
db.bind('timesheets');
db.bind('users');
db.bind('projects');
var mongoose = require('mongoose');
var timesheet = require("../models/timesheet.model");
var service = {};
service.createTimesheet = createTimesheet;
service.updateTimesheet = updateTimesheet;
service.setTimesheetStatus = setTimesheetStatus;
service.getTimesheet = getTimesheet;
service.deleteTimesheet = deleteTimesheet;
service.adminDeleteTimesheet = adminDeleteTimesheet;
service.getByWeek = getByWeek;
service.getByMonth = getByMonth;
service.getMine = getMine;
service.adminUpdate = adminUpdate;
service.allUserHoursByWeek = allUserHoursByWeek;
service.projectUserHoursByWeek = projectUserHoursByWeek;
service.clientUserHoursByWeek = clientUserHoursByWeek;
service.allUserHoursByMonth = allUserHoursByMonth;
service.projectUserHoursByMonth = projectUserHoursByMonth;
service.timesheetBetweenDates = timesheetBetweenDates;
service.getProjectInfoById = getProjectInfoById;
service.utilizationByMonth = utilizationByMonth;
service.getByProject = getByProject;
service.remindByProject = remindByProject;
service.usersLeaveBalance = usersLeaveBalance;
service.userTakenLeaves = userTakenLeaves;
service.userTakenLeaveBalance = userTakenLeaveBalance;
service.getTimesheetApproveProjectOwners = getTimesheetApproveProjectOwners;
module.exports = service;
function createTimesheet(currentUser, userParam) {
var deferred = Q.defer();
if (!userParam.userId) {
userParam.userId = currentUser._id + "";
}
if (!userParam.practice) {
userParam.practice = "";
}
_.each(userParam.projects, function (projectObj) {
projectObj.projectId = mongo.helper.toObjectID(projectObj.projectId);
});
var timeOffPrj = _.find(userParam.projects, { projectName: "Timeoff" });
if (timeOffPrj && timeOffPrj.projectHours == 0) {
userParam.projects.splice(userParam.projects.indexOf(timeOffPrj), 1);
}
var allProjects;
db.projects.find({}).toArray(function (err, projects) {
allProjects = projects;
db.users.findById(userParam.userId, function (err, user) {
if (user && user.projects) {
_.each(userParam.projects, function (projectObj) {
var billData = getProjectBillData(projectObj, userParam.weekDate, user);
projectObj.resourceType = billData.resourceType;
projectObj.allocatedHours = billData.allocatedHours;
projectObj.billableMaxHours = billData.billableMaxHours;
projectObj.salesItemId = billData.salesItemId;
projectObj.overtimeHours = 0;
if (projectObj.billableMaxHours > 0 && projectObj.projectHours > projectObj.billableMaxHours) {
projectObj.billableHours = projectObj.billableMaxHours;
projectObj.overtimeHours = projectObj.projectHours - projectObj.billableMaxHours;
} else {
projectObj.billableHours = projectObj.projectHours;
}
projectObj.sheetStatus = projectObj.sheetStatus;
});
userParam.totalHours = 0;
userParam.totalBillableHours = 0;
userParam.timeoffHours = 0;
userParam.overtimeHours = 0;
_.each(userParam.projects, function (projectObj) {
if (!projectObj.businessUnit) {
projectObj.businessUnit = "";
}
var projectInfo = _.find(allProjects, { projectName: projectObj.projectName });
if (projectInfo && projectInfo.businessUnit) {
projectObj.businessUnit = projectInfo.businessUnit;
}
userParam.totalHours += projectObj.projectHours;
userParam.totalBillableHours += projectObj.billableHours;
userParam.timeoffHours += projectObj.sickLeaveHours;
userParam.timeoffHours += projectObj.timeoffHours;
userParam.overtimeHours += projectObj.overtimeHours;
});
}
if (!user.userResourceType) {
user.userResourceType = "";
}
db.timesheets.findOne({ userId: user._id, week: userParam.week }, function (err, sheet) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (!sheet) {
var sheetObj = {
userId: mongo.helper.toObjectID(userParam.userId),
week: userParam.week,
weekDate: new Date(userParam.weekDate),
userResourceType: user.userResourceType,
practice: userParam.practice,
totalHours: userParam.totalHours,
totalBillableHours: userParam.totalBillableHours,
timeoffHours: userParam.timeoffHours,
overtimeHours: userParam.overtimeHours,
projects: userParam.projects,
reportingTo: userParam.reportingTo,
createdOn: new Date(),
updatedOn: new Date()
}
db.timesheets.insert(sheetObj, function (err, sheet) {
if (err) deferred.reject(err.name + ': ' + err.message);
deferred.resolve(sheet);
});
} else {
deferred.reject("You have already posted for current week");
}
});
});
});
return deferred.promise;
}
function updateTimesheet(sheetId, userParam, currentUser) {
var deferred = Q.defer();
var currentUserId = currentUser._id + "";
_.each(userParam.projects, function (projectObj) {
projectObj.projectId = mongo.helper.toObjectID(projectObj.projectId);
});
var timeOffPrj = _.find(userParam.projects, { projectName: "Timeoff" });
if (timeOffPrj && timeOffPrj.projectHours == 0) {
userParam.projects.splice(userParam.projects.indexOf(timeOffPrj), 1);
}
var allProjects;
db.projects.find({}).toArray(function (err, projects) {
allProjects = projects;
db.timesheets.findById(sheetId, function (err, sheetObj) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (sheetObj && (sheetObj.userId == currentUserId || currentUser.admin === true)) {
db.users.findById(sheetObj.userId, function (err, sheetUserObj) {
_.each(userParam.projects, function (projectObj) {
var billData = getProjectBillData(projectObj, userParam.weekDate, sheetUserObj);
projectObj.resourceType = billData.resourceType;
projectObj.allocatedHours = billData.allocatedHours;
projectObj.billableMaxHours = billData.billableMaxHours;
projectObj.salesItemId = billData.salesItemId;
projectObj.overtimeHours = 0;
if (projectObj.billableMaxHours > 0 && projectObj.projectHours > projectObj.billableMaxHours) {
projectObj.billableHours = projectObj.billableMaxHours;
projectObj.overtimeHours = projectObj.projectHours - projectObj.billableMaxHours;
} else {
projectObj.billableHours = projectObj.projectHours;
}
projectObj.sheetStatus = projectObj.sheetStatus;
});
userParam.totalHours = 0;
userParam.totalBillableHours = 0;
userParam.timeoffHours = 0;
userParam.overtimeHours = 0;
_.each(userParam.projects, function (projectObj) {
if (!projectObj.businessUnit) {
projectObj.businessUnit = "";
}
var projectInfo = _.find(allProjects, { _id: projectObj.projectId });
if (projectInfo && projectInfo.businessUnit) {
projectObj.businessUnit = projectInfo.businessUnit;
}
userParam.totalHours += projectObj.projectHours;
userParam.totalBillableHours += projectObj.billableHours;
userParam.timeoffHours += projectObj.sickLeaveHours;
userParam.timeoffHours += projectObj.timeoffHours;
userParam.overtimeHours += projectObj.overtimeHours;
});
if (!sheetUserObj.userResourceType) {
sheetUserObj.userResourceType = "";
}
var newSheetObj = {
userId: mongo.helper.toObjectID(sheetObj.userId),
week: userParam.week,
weekDate: new Date(userParam.weekDate),
userResourceType: sheetUserObj.userResourceType,
totalHours: userParam.totalHours,
totalBillableHours: userParam.totalBillableHours,
timeoffHours: userParam.timeoffHours,
overtimeHours: userParam.overtimeHours,
projects: userParam.projects,
reportingTo: userParam.reportingTo,
timesheetStatus: userParam.timesheetStatus
}
newSheetObj.updatedOn = new Date();
db.timesheets.update({ _id: mongo.helper.toObjectID(sheetId) }, { $set: newSheetObj }, function (err, responseSheet) {
if (err) deferred.reject(err.name + ': ' + err.message);
deferred.resolve(responseSheet);
});
});
} else {
deferred.reject("You are not authorized");
}
});
});
return deferred.promise;
}
function setTimesheetStatus(sheetId, projectId, sheetStatus) {
var deferred = Q.defer();
db.timesheets.find({ '_id': mongo.helper.toObjectID(sheetId), "projects.projectId": mongo.helper.toObjectID(projectId) }).toArray(function (err, doc) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (doc && doc[0]) {
for (var i = 0, len = doc[0].projects.length; i < len; i++) {
if (doc[0].projects[i].projectId == projectId) {
doc[0].projects[i].sheetStatus = sheetStatus;
break;
}
}
db.timesheets.update({ _id: mongo.helper.toObjectID(sheetId), "projects.projectId": mongo.helper.toObjectID(projectId) }, { $set: doc[0] }, function (err, responseSheet) {
if (err) deferred.reject(err.name + ': ' + err.message);
deferred.resolve(responseSheet);
});
} else {
deferred.reject("Invalid project Id");
}
});
return deferred.promise;
}
function getProjectBillData(projectObj, weekDateVal, sheetUserObj) {
var BillData = {
resourceType: "buffer",
allocatedHours: 40,
billableMaxHours: 0,
salesItemId: null
};
if (sheetUserObj && sheetUserObj.projects) {
var prjData = _.find(sheetUserObj.projects, { "projectId": projectObj.projectId + "" });
if (prjData && prjData.billDates) {
var weekDate = new Date(weekDateVal);
_.each(prjData.billDates, function (billDate) {
if (billDate.start && billDate.start != "" && billDate.end && billDate.end != "") {
var startDate = new Date(billDate.start);
var endDate = new Date(billDate.end);
if (weekDate >= startDate && weekDate <= endDate) {
BillData.resourceType = billDate.resourceType;
BillData.allocatedHours = billDate.allocatedHours;
BillData.billableMaxHours = billDate.billableMaxHours;
BillData.salesItemId = (billDate.salesItemId) ? billDate.salesItemId : null;
}
} else if (billDate.start && billDate.start != "") {
var startDate = new Date(billDate.start);
if (weekDate >= startDate) {
BillData.resourceType = billDate.resourceType;
BillData.allocatedHours = billDate.allocatedHours;
BillData.billableMaxHours = billDate.billableMaxHours;
BillData.salesItemId = (billDate.salesItemId) ? billDate.salesItemId : null;
}
} else if (billDate.end && billDate.end != "") {
var endDate = new Date(billDate.end);
if (weekDate <= endDate) {
BillData.resourceType = billDate.resourceType;
BillData.allocatedHours = billDate.allocatedHours;
BillData.billableMaxHours = billDate.billableMaxHours;
BillData.salesItemId = (billDate.salesItemId) ? billDate.salesItemId : null;
}
} else if (billDate.start == "" && billDate.end == "") {
BillData.resourceType = billDate.resourceType;
BillData.allocatedHours = billDate.allocatedHours;
BillData.billableMaxHours = billDate.billableMaxHours;
BillData.salesItemId = (billDate.salesItemId) ? billDate.salesItemId : null;
}
});
}
}
if (!(BillData.allocatedHours >= 0)) {
BillData.allocatedHours = 40;
}
if (!(BillData.billableMaxHours >= 0)) {
BillData.billableMaxHours = 0;
}
return BillData;
}
function getProjectInfoById(projectId) {
var deferred = Q.defer();
db.projects.findById(projectId, function (err, projectInfo) {
if (projectInfo) {
deferred.resolve(projectInfo);
} else {
deferred.reject(false);
}
});
return deferred.promise;
}
function getTimesheet(id) {
var deferred = Q.defer();
db.timesheets.findById(id, function (err, doc) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (doc) {
deferred.resolve(doc);
} else {
deferred.reject("Please select valid id");
}
});
return deferred.promise;
}
function deleteTimesheet(timesheetId, userId) {
var deferred = Q.defer();
db.timesheets.remove({ _id: mongo.helper.toObjectID(timesheetId), userId: mongo.helper.toObjectID(userId) }, function (err, doc) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (doc) {
deferred.resolve(doc);
} else {
deferred.reject("Please select valid id");
}
});
return deferred.promise;
}
function adminDeleteTimesheet(timesheetId) {
var deferred = Q.defer();
db.timesheets.remove({ _id: mongo.helper.toObjectID(timesheetId) }, function (err, doc) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (doc) {
deferred.resolve(doc);
} else {
deferred.reject("Please select valid id");
}
});
return deferred.promise;
}
function getByWeek(week) {
var deferred = Q.defer();
db.timesheets.find({ week: week }).toArray(function (err, doc) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (doc) {
deferred.resolve(doc);
} else {
deferred.reject("Please select valid week");
}
});
return deferred.promise;
}
function getByMonth(weekArr) {
var deferred = Q.defer();
db.timesheets.find({ "week": { "$in": weekArr } }).toArray(function (err, doc) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (doc) {
deferred.resolve(doc);
} else {
deferred.reject("Please select valid week");
}
});
return deferred.promise;
}
function getMine(userId) {
var deferred = Q.defer();
db.timesheets.find({ userId: mongo.helper.toObjectID(userId) }).toArray(function (err, doc) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (doc) {
deferred.resolve(doc);
} else {
deferred.reject("You have already posted for current week");
}
});
return deferred.promise;
}
function adminUpdate(id, params) {
var deferred = Q.defer();
db.timesheets.findById(id, function (err, sheet) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (sheet) {
updateSheet();
} else {
deferred.reject("You are not authorized");
}
});
function updateSheet() {
// fields to update
var set = {
hours: params.hours,
week: params.week,
cDate: params.cDate,
postedOn: new Date(),
project: params.project,
comments: params.comments,
};
db.timesheet.update({ _id: mongo.helper.toObjectID(id) }, { $set: set },
function (err, doc) {
if (err) deferred.reject(err.name + ': ' + err.message);
deferred.resolve(doc);
});
}
return deferred.promise;
}
var resourceTypes = ["shadow", "buffer", "billable", "bizdev", "internal", "operations", "trainee", "bench"];
function weekHoursCal(sheets, resourceTypes, weekVal) {
var report = {
week: weekVal,
availableUserCount: 0,
availableHours: 0,
totalUserCount: 0,
totalHours: 0,
resourceTypes: []
};
_.each(resourceTypes, function (resourceType) {
report.resourceTypes.push({
resourceType: resourceType,
projectUserCount: 0,
projectHours: 0
});
})
_.each(sheets, function (sheet) {
report.totalUserCount += 1;
report.totalHours += sheet.totalHours;
_.each(sheet.projects, function (project) {
var resourceTypeId = (project.resourceType == "") ? "buffer" : project.resourceType;
var resourceTypeObj = _.find(report.resourceTypes, { "resourceType": resourceTypeId });
if (resourceTypeObj) {
resourceTypeObj.projectUserCount += 1;
resourceTypeObj.projectHours += project.projectHours;
}
});
});
return report;
}
function allUserHoursByWeek(week) {
var deferred = Q.defer();
db.timesheets.find({ week: week }).toArray(function (err, sheets) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (sheets) {
/*var report = {
availableUserCount: 0,
availableHours: 0,
totalUserCount: 0,
totalHours: 0,
resourceTypes: []
};
_.each(resourceTypes, function (resourceType) {
report.resourceTypes.push({
resourceType: resourceType,
projectUserCount: 0,
projectHours: 0
});
})
_.each(sheets, function (sheet) {
report.totalUserCount += 1;
report.totalHours += sheet.totalHours;
_.each(sheet.projects, function (project) {
var resourceTypeId = (project.resourceType == "")?"buffer":project.resourceType;
var resourceTypeObj = _.find(report.resourceTypes, {"resourceType": resourceTypeId});
if(resourceTypeObj){
resourceTypeObj.projectUserCount += 1;
resourceTypeObj.projectHours += project.projectHours;
}
});
});*/
deferred.resolve(weekHoursCal(sheets, resourceTypes, week));
} else {
deferred.reject("Please select valid week");
}
});
return deferred.promise;
}
function projectUserHoursByWeek(week, projectId) {
var deferred = Q.defer();
db.timesheets.find({ week: week, "projects.projectId": { "$in": [mongo.helper.toObjectID(projectId)] } }).toArray(function (err, sheets) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (sheets) {
/*var report = {
availableUserCount: 0,
availableHours: 0,
totalUserCount: 0,
totalHours: 0,
resourceTypes: []
};
_.each(resourceTypes, function (resourceType) {
report.resourceTypes.push({
resourceType: resourceType,
projectUserCount: 0,
projectHours: 0
});
})
_.each(sheets, function (sheet) {
report.totalUserCount += 1;
report.totalHours += sheet.totalHours;
_.each(sheet.projects, function (project) {
var resourceTypeId = (project.resourceType == "")?"buffer":project.resourceType;
var resourceTypeObj = _.find(report.resourceTypes, {"resourceType": resourceTypeId});
if(resourceTypeObj){
resourceTypeObj.projectUserCount += 1;
resourceTypeObj.projectHours += project.projectHours;
}
});
});*/
deferred.resolve(weekHoursCal(sheets, resourceTypes, week));
} else {
deferred.reject("Please select valid week");
}
});
return deferred.promise;
}
function clientUserHoursByWeek(week, clientId) {
var deferred = Q.defer();
db.timesheets.find({ week: week }).toArray(function (err, sheets) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (sheets) {
deferred.resolve(sheets);
} else {
deferred.reject("Please select valid week");
}
});
return deferred.promise;
}
function allUserHoursByMonth(month, year) {
var deferred = Q.defer();
Date.prototype.getWeek = function () {
var onejan = new Date(this.getFullYear(), 0, 1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7);
}
var resultData = [];
var weeks = [];
var startDate = new Date(year, month, 1);
if (month >= 11) {
var endDate = new Date(year + 1, 0, 0);
} else {
var endDate = new Date(year, month + 1, 0);
}
var loop = 1;
while (startDate < endDate && loop++ < 6) {
if (startDate.getWeek() <= 9) {
weeks.push(startDate.getFullYear() + "-W0" + startDate.getWeek());
} else {
weeks.push(startDate.getFullYear() + "-W" + startDate.getWeek());
}
startDate.setDate(startDate.getDate() + 7);
}
_.each(weeks, function (weekVal) {
db.timesheets.find({ week: weekVal }).toArray(function (err, sheets) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (sheets) {
/*var report = {
week: weekVal,
availableUserCount: 0,
availableHours: 0,
totalUserCount: 0,
totalHours: 0,
resourceTypes: []
};
_.each(resourceTypes, function (resourceType) {
report.resourceTypes.push({
resourceType: resourceType,
projectUserCount: 0,
projectHours: 0
});
})
_.each(sheets, function (sheet) {
report.totalUserCount += 1;
report.totalHours += sheet.totalHours;
_.each(sheet.projects, function (project) {
var resourceTypeId = (project.resourceType == "")?"buffer":project.resourceType;
var resourceTypeObj = _.find(report.resourceTypes, {"resourceType": resourceTypeId});
if(resourceTypeObj){
resourceTypeObj.projectUserCount += 1;
resourceTypeObj.projectHours += project.projectHours;
}
});
});*/
resultData.push(weekHoursCal(sheets, resourceTypes, weekVal));
if (resultData.length == weeks.length) {
resultData = _.sortBy(resultData, ['week']);
deferred.resolve(resultData);
}
} else {
deferred.reject("Please select valid week");
}
});
});
return deferred.promise;
}
function projectUserHoursByMonth(month, year, projectId) {
var deferred = Q.defer();
Date.prototype.getWeek = function () {
var onejan = new Date(this.getFullYear(), 0, 1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7);
}
var resultData = [];
var weeks = [];
var startDate = new Date(year, month, 1);
if (month >= 11) {
var endDate = new Date(year + 1, 0, 0);
} else {
var endDate = new Date(year, month + 1, 0);
}
var loop = 1;
while (startDate < endDate && loop++ < 6) {
if (startDate.getWeek() <= 9) {
weeks.push(startDate.getFullYear() + "-W0" + startDate.getWeek());
} else {
weeks.push(startDate.getFullYear() + "-W" + startDate.getWeek());
}
startDate.setDate(startDate.getDate() + 7);
}
_.each(weeks, function (weekVal) {
db.timesheets.find({ week: weekVal, "projects.projectId": { "$in": [mongo.helper.toObjectID(projectId)] } }).toArray(function (err, sheets) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (sheets) {
/*var report = {
week: weekVal,
availableUserCount: 0,
availableHours: 0,
totalUserCount: 0,
totalHours: 0,
resourceTypes: []
};
_.each(resourceTypes, function (resourceType) {
report.resourceTypes.push({
resourceType: resourceType,
projectUserCount: 0,
projectHours: 0
});
})
_.each(sheets, function (sheet) {
report.totalUserCount += 1;
report.totalHours += sheet.totalHours;
_.each(sheet.projects, function (project) {
var resourceTypeId = (project.resourceType == "")?"buffer":project.resourceType;
var resourceTypeObj = _.find(report.resourceTypes, {"resourceType": resourceTypeId});
if(resourceTypeObj){
resourceTypeObj.projectUserCount += 1;
resourceTypeObj.projectHours += project.projectHours;
}
});
});*/
resultData.push(weekHoursCal(sheets, resourceTypes, weekVal));
if (resultData.length == weeks.length) {
resultData = _.sortBy(resultData, 'week');
deferred.resolve(resultData);
}
} else {
deferred.reject("Please select valid week");
}
});
});
return deferred.promise;
}
function timesheetBetweenDates(startDateVal, endDateVal, params) {
var deferred = Q.defer();
Date.prototype.getWeek = function () {
var onejan = new Date(this.getFullYear(), 0, 1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7);
}
var weeks = [];
var startDate = new Date(startDateVal);
var endDate = new Date(endDateVal);
var loop = 1;
while (startDate < endDate && loop++ < 50) {
if (startDate.getWeek() <= 9) {
weeks.push(startDate.getFullYear() + "-W0" + startDate.getWeek());
} else {
weeks.push(startDate.getFullYear() + "-W" + startDate.getWeek());
}
startDate.setDate(startDate.getDate() + 7);
}
if (weeks.length > 0) {
var queryStr = {};
var projectList = [];
if (params.projectIds && params.projectIds.length > 0) {
_.each(params.projectIds, function (projectId) {
projectList.push(mongo.helper.toObjectID(projectId));
});
queryStr = {
"projects.projectId": { "$in": projectList }
};
}
var timesheets = [];
var loopCount = 0;
_.each(weeks, function (weekVal) {
queryStr.week = weekVal;
db.timesheets.find(queryStr).toArray(function (err, sheets) {
_.each(sheets, function (sheetObj) {
var timesheetObj = {
_id: sheetObj._id,
userId: sheetObj.userId,
week: sheetObj.week,
weekDate: sheetObj.weekDate,
projects: []
};
if (projectList.length === 0) {
_.each(sheetObj.projects, function (projectObj) {
timesheetObj.projects.push(projectObj);
});
} else {
_.each(projectList, function (projectIdVal) {
projectIdVal = projectIdVal + "";
_.each(sheetObj.projects, function (sheetPrj) {
sheetPrj.projectId = sheetPrj.projectId + "";
if (sheetPrj.projectId == projectIdVal) {
timesheetObj.projects.push(sheetPrj);
}
});
/*var projectObj = _.find(sheetObj.projects, {projectId: projectIdVal});
if(projectObj){
timesheetObj.projects.push(projectObj);
}*/
});
}
timesheets.push(timesheetObj);
});
loopCount++;
if (loopCount >= weeks.length) {
//timesheets = _.groupBy(timesheets, 'userId');
deferred.resolve(timesheets);
}
});
});
} else {
deferred.reject("Please enetr valid date range");
}
return deferred.promise;
}
function utilizationByMonth(month, year, params) {
var deferred = Q.defer();
Date.prototype.getWeek = function () {
var onejan = new Date(this.getFullYear(), 0, 1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7);
}
var resultData = [];
var weeks = [];
var startDate = new Date(year, month, 1);
if (month >= 11) {
var endDate = new Date(year + 1, 0, 0);
} else {
var endDate = new Date(year, month + 1, 0);
}
var loop = 1;
while (startDate < endDate && loop++ < 6) {
if (startDate.getWeek() <= 9) {
weeks.push(startDate.getFullYear() + "-W0" + startDate.getWeek());
} else {
weeks.push(startDate.getFullYear() + "-W" + startDate.getWeek());
}
startDate.setDate(startDate.getDate() + 7);
}
_.each(weeks, function (weekVal) {
db.timesheets.find({ week: weekVal }).toArray(function (err, sheets) {
var report = {
week: weekVal,
weekHeadCount: 0,
weekBillableHours: 0,
businessUnits: [
{ businessUnit: 'Launchpad' },
{ businessUnit: 'Enterprise' }
],
launchpadHeadCount: 0,
launchpadBillableHours: 0,
enterpriseHeadCount: 0,
enterpriseBillableHours: 0,
haveNoBillableProjectHeadCount: 0,
haveBillableProjectHeadCount: 0
};
if (sheets) {
_.each(sheets, function (sheetObj) {
var hasBillableProject = false;
if (sheetObj.userResourceType == "Billable") {
report.weekHeadCount += 1;
_.each(sheetObj.projects, function (projectObj) {
if (projectObj.resourceType == "billable") {
hasBillableProject = true;
report.weekBillableHours += projectObj.billableHours;
if (projectObj.businessUnit == "Launchpad") {
report.launchpadHeadCount += 1;
report.launchpadBillableHours += projectObj.billableHours;
} else if (projectObj.businessUnit == "Enterprise") {
report.enterpriseHeadCount += 1;
report.enterpriseBillableHours += projectObj.billableHours;
}
}
});
if (hasBillableProject === true) {
report.haveBillableProjectHeadCount += 1;
} else {
report.haveNoBillableProjectHeadCount += 1;
}
}
});
}
resultData.push(report);
if (resultData.length == weeks.length) {
resultData = _.sortBy(resultData, 'week');
deferred.resolve(resultData);
}
});
});
return deferred.promise;
}
function getByProject(week, projectId) {
var deferred = Q.defer();
db.timesheets.find({ week: week, "projects.projectId": mongo.helper.toObjectID(projectId) }).toArray(function (err, doc) {
if (err) deferred.reject(err.name + ': ' + err.message);
if (doc) {
deferred.resolve(doc);
} else {
deferred.reject("Please select valid week");
}
});
return deferred.promise;
}
function remindByProject(user, projectName, week) {
}
function usersLeaveBalance(financialYear) {
var deferred = Q.defer();
var financialYearArr = financialYear.split("-");
var startDate = new Date(financialYearArr[0], 3, 1);
var endDate = new Date(financialYearArr[1], 3, 1);
var queryStr = {
weekDate: {
$gte: startDate,
$lt: endDate
},
timeoffHours: {
$gt: 0
}
};
var users = [];
timesheet.aggregate([
{ $match: queryStr },
{ $lookup: { from: 'users', localField: 'userId', foreignField: '_id', as: 'user_info' } },
{ $unwind: "$user_info" },
{ $project: { week: 1, userId: 1, weekDate: 1, userResourceType: 1, totalHours: 1, totalBillableHours: 1, timeoffHours: 1, sickLeaveHours: 1, userJoinDate: "$user_info.joinDate" } }
]).exec(function (err, sheets) {
_.each(sheets, function (sheetObj) {
var weekDate = new Date(sheetObj.weekDate);
var userJoinDate = new Date(sheetObj.userJoinDate);
if (weekDate > userJoinDate && userSheet.userResourceType != "Intern") {
var userObj = _.find(users, { _id: sheetObj.userId });
if (userObj) {
userObj.timesheets.push({
timeoffHours: sheetObj.timeoffHours,
week: sheetObj.week,
weekDate: sheetObj.weekDate,
totalHours: sheetObj.totalHours,
totalBillableHours: sheetObj.totalBillableHours
});
} else {
var userObj = {
_id: sheetObj.userId,
userResourceType: sheetObj.userResourceType,
timesheets: [{
timeoffHours: sheetObj.timeoffHours,
week: sheetObj.week,
weekDate: sheetObj.weekDate,
totalHours: sheetObj.totalHours,
totalBillableHours: sheetObj.totalBillableHours
}]
}
users.push(userObj);
}
}
});
deferred.resolve(users);
});
return deferred.promise;
}
function userTakenLeaves(userId, financialYear = null) {
var deferred = Q.defer();
if (financialYear) {
var financialYearArr = financialYear.split("-");
var startDate = new Date(financialYearArr[0], 3, 1);
var endDate = new Date(financialYearArr[1], 3, 1);
} else {
var now = new Date();
var startYear = (now.getMonth() >= 3) ? now.getFullYear() : now.getFullYear() - 1;
var startDate = new Date(startYear, 3, 1);
var endDate = new Date((startYear + 1), 3, 1);
}
var queryStr = {
userId: mongo.helper.toObjectID(userId),
weekDate: {
$gte: startDate,
$lt: endDate
},
timeoffHours: {
$gt: 0
}
};
var userSheets = [];
timesheet.aggregate([
{ $match: queryStr },
{ $lookup: { from: 'users', localField: 'userId', foreignField: '_id', as: 'user_info' } },
{ $unwind: "$user_info" },
{ $project: { week: 1, userId: 1, weekDate: 1, userResourceType: 1, totalHours: 1, totalBillableHours: 1, timeoffHours: 1, sickLeaveHours: 1, projects: 1, userJoinDate: "$user_info.joinDate" } }
]).exec(function (err, sheets) {
//db.timesheets.find(queryStr).toArray(function(err, sheets) {
_.each(sheets, function (sheetObj) {
var weekDate = new Date(sheetObj.weekDate);
var userJoinDate = new Date(sheetObj.userJoinDate);
if (weekDate > userJoinDate && sheetObj.userResourceType != "Intern") {
sheetObj.sheetTimeoffHours = 0;
sheetObj.sheetSickLeaveHours = 0;
_.each(sheetObj.projects, function (projectObj) {
sheetObj.sheetTimeoffHours += projectObj.timeoffHours;
sheetObj.sheetSickLeaveHours += projectObj.sickLeaveHours;
});
userSheets.push({
totalTimeoffHours: sheetObj.timeoffHours,
timeoffHours: sheetObj.sheetTimeoffHours,
sickLeaveHours: sheetObj.sheetSickLeaveHours,
week: sheetObj.week,
weekDate: sheetObj.weekDate,
totalHours: sheetObj.totalHours,
totalBillableHours: sheetObj.totalBillableHours
});
}
});
deferred.resolve(userSheets);
});
return deferred.promise;
}
function userTakenLeaveBalance(userId, financialYear = null) {
var deferred = Q.defer();
if (financialYear) {
var financialYearArr = financialYear.split("-");
var startDate = new Date(financialYearArr[0], 3, 1);
var endDate = new Date(financialYearArr[1], 3, 1);
} else {
var now = new Date();
var startYear = (now.getMonth() >= 3) ? now.getFullYear() : now.getFullYear() - 1;
var startDate = new Date(startYear, 3, 1);
var endDate = new Date((startYear + 1), 3, 1);
}
var queryStr = {
userId: mongo.helper.toObjectID(userId),
weekDate: {
$gte: startDate,
$lt: endDate
},
timeoffHours: {
$gt: 0
}
};
var userSheetBalance = {
userId: null,
sickLeaveHours: 0.00,
sickLeaveDays: 0.00,
timeoffHours: 0.00,
timeoffDays: 0.00,
totalTimeoffHours: 0.00,
totalTimeoffDays: 0.00
};
timesheet.aggregate([
{ $match: queryStr },
{ $lookup: { from: 'users', localField: 'userId', foreignField: '_id', as: 'user_info' } },
{ $unwind: "$user_info" },
{ $project: { week: 1, userId: 1, weekDate: 1, userResourceType: 1, totalHours: 1, totalBillableHours: 1, timeoffHours: 1, sickLeaveHours: 1, projects: 1, userJoinDate: "$user_info.joinDate" } }
]).exec(function (err, sheets) {
_.each(sheets, function (sheetObj) {
var weekDate = new Date(sheetObj.weekDate);
var userJoinDate = new Date(sheetObj.userJoinDate);
if (weekDate > userJoinDate && sheetObj.userResourceType != "Intern") {
userSheetBalance.userId = sheetObj.userId;
_.each(sheetObj.projects, function (projectObj) {
userSheetBalance.sickLeaveHours += projectObj.sickLeaveHours;
userSheetBalance.timeoffHours += projectObj.timeoffHours;
});
userSheetBalance.totalTimeoffHours += sheetObj.timeoffHours;
}
});
userSheetBalance.sickLeaveDays = parseFloat(userSheetBalance.sickLeaveHours / 8).toFixed(2);
userSheetBalance.timeoffDays = parseFloat(userSheetBalance.timeoffHours / 8).toFixed(2);
userSheetBalance.totalTimeoffDays = parseFloat(userSheetBalance.totalTimeoffHours / 8).toFixed(2);
deferred.resolve(userSheetBalance);
});
return deferred.promise;
}
function getTimesheetApproveProjectOwners(week) {
var deferred = Q.defer();
timesheet.aggregate([
{ $unwind: { path: "$projects", preserveNullAndEmptyArrays: true } },
{ $match: { week: week, 'projects.sheetStatus': 'Pending', $or: [{ 'projects.projectHours': { $gt: 0 } }, { 'projects.sickLeaveHours': { $gt: 0 } }, { 'projects.timeoffHours': { $gt: 0 } }] } },
{ $lookup: { from: 'projects', localField: 'projects.projectId', foreignField: '_id', as: 'project_info' } },
{ $unwind: "$project_info" },
{
$project: {
week: 1, projectId: "$projects.projectId", projectName: "$projects.projectName", sheetStatus: "$projects.sheetStatus",
ownerId: { '$toObjectId': '$project_info.ownerId' }, ownerName: "$project_info.ownerName", userName: "$user_info.name"
}
},
{ $lookup: { from: 'users', localField: 'ownerId', foreignField: '_id', as: 'user_info' } },
{ $unwind: "$user_info" },
]).exec(function (error, response) {
if (error) deferred.reject(error);
deferred.resolve(response);
});
return deferred.promise;
} | {
"content_hash": "3e8a6c0d5ad3c6f4b5eaf73d6dbfab7a",
"timestamp": "",
"source": "github",
"line_count": 1034,
"max_line_length": 202,
"avg_line_length": 42.13926499032882,
"alnum_prop": 0.5333700541632241,
"repo_name": "anudeepjusanu/timesheet",
"id": "2695cb123debb62850fcafef1e5b4a3efd6654c6",
"size": "43572",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "services/timesheet.service.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "507897"
},
{
"name": "HTML",
"bytes": "219176"
},
{
"name": "JavaScript",
"bytes": "1749883"
},
{
"name": "PHP",
"bytes": "65037"
}
],
"symlink_target": ""
} |
package global.utils.factories;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import global.models.BaseElement;
import global.models.serialization.BaseElementConverter;
/**
* Created by Arsen on 16.08.2016.
*/
public class GsonFactory {
private static Gson instance;
public static Gson getInstance() {
if (instance == null) {
instance = new GsonBuilder()
.registerTypeAdapter(BaseElement.class, new BaseElementConverter())
.excludeFieldsWithoutExposeAnnotation()
.setPrettyPrinting()
.create();
}
return instance;
}
public static <T> T cloneObject(T object, Class<T> type){
return getInstance().fromJson(getInstance().toJson(object, type), type);
}
}
| {
"content_hash": "c405d70227a672dbbc3d586201d2f991",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 87,
"avg_line_length": 27.4,
"alnum_prop": 0.6362530413625304,
"repo_name": "CeH9/PackageTemplates",
"id": "39d473b7ef29953822e0fdb4b587c15c75d9cf41",
"size": "822",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/global/utils/factories/GsonFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "431799"
},
{
"name": "Kotlin",
"bytes": "11074"
}
],
"symlink_target": ""
} |
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CategoryBarComponent } from './category-bar.component';
describe('CategoryBarComponent', () => {
let component: CategoryBarComponent;
let fixture: ComponentFixture<CategoryBarComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CategoryBarComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CategoryBarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
| {
"content_hash": "32f81afcd0b6efd564f9e0430173c39f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 73,
"avg_line_length": 26.56,
"alnum_prop": 0.6867469879518072,
"repo_name": "petrstehlik/pyngShop",
"id": "2f4e778a9dfac1901967337efd12d40cae7c6dda",
"size": "664",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "www/src/app/components/category-bar/category-bar.component.spec.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "253"
},
{
"name": "CSS",
"bytes": "15263"
},
{
"name": "HTML",
"bytes": "79492"
},
{
"name": "JavaScript",
"bytes": "26720"
},
{
"name": "PLSQL",
"bytes": "20567"
},
{
"name": "Python",
"bytes": "94376"
},
{
"name": "TypeScript",
"bytes": "96175"
}
],
"symlink_target": ""
} |
package org.apache.hadoop.hbase.util;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.BiConsumer;
import org.apache.hadoop.hbase.exceptions.TimeoutIOException;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Helper class for processing futures.
*/
@InterfaceAudience.Private
public final class FutureUtils {
private static final Logger LOG = LoggerFactory.getLogger(FutureUtils.class);
private FutureUtils() {
}
/**
* This is method is used when you just want to add a listener to the given future. We will call
* {@link CompletableFuture#whenComplete(BiConsumer)} to register the {@code action} to the
* {@code future}. Ignoring the return value of a Future is considered as a bad practice as it may
* suppress exceptions thrown from the code that completes the future, and this method will catch
* all the exception thrown from the {@code action} to catch possible code bugs.
* <p/>
* And the error phone check will always report FutureReturnValueIgnored because every method in
* the {@link CompletableFuture} class will return a new {@link CompletableFuture}, so you always
* have one future that has not been checked. So we introduce this method and add a suppress
* warnings annotation here.
*/
@SuppressWarnings("FutureReturnValueIgnored")
public static <T> void addListener(CompletableFuture<T> future,
BiConsumer<? super T, ? super Throwable> action) {
future.whenComplete((resp, error) -> {
try {
// See this post on stack overflow(shorten since the url is too long),
// https://s.apache.org/completionexception
// For a chain of CompleableFuture, only the first child CompletableFuture can get the
// original exception, others will get a CompletionException, which wraps the original
// exception. So here we unwrap it before passing it to the callback action.
action.accept(resp, unwrapCompletionException(error));
} catch (Throwable t) {
LOG.error("Unexpected error caught when processing CompletableFuture", t);
}
});
}
/**
* Almost the same with {@link #addListener(CompletableFuture, BiConsumer)} method above, the only
* exception is that we will call
* {@link CompletableFuture#whenCompleteAsync(BiConsumer, Executor)}.
* @see #addListener(CompletableFuture, BiConsumer)
*/
@SuppressWarnings("FutureReturnValueIgnored")
public static <T> void addListener(CompletableFuture<T> future,
BiConsumer<? super T, ? super Throwable> action, Executor executor) {
future.whenCompleteAsync((resp, error) -> {
try {
action.accept(resp, unwrapCompletionException(error));
} catch (Throwable t) {
LOG.error("Unexpected error caught when processing CompletableFuture", t);
}
}, executor);
}
/**
* Return a {@link CompletableFuture} which is same with the given {@code future}, but execute all
* the callbacks in the given {@code executor}.
*/
public static <T> CompletableFuture<T> wrapFuture(CompletableFuture<T> future,
Executor executor) {
CompletableFuture<T> wrappedFuture = new CompletableFuture<>();
addListener(future, (r, e) -> {
if (e != null) {
wrappedFuture.completeExceptionally(e);
} else {
wrappedFuture.complete(r);
}
}, executor);
return wrappedFuture;
}
/**
* Get the cause of the {@link Throwable} if it is a {@link CompletionException}.
*/
public static Throwable unwrapCompletionException(Throwable error) {
if (error instanceof CompletionException) {
Throwable cause = error.getCause();
if (cause != null) {
return cause;
}
}
return error;
}
// This method is used to record the stack trace that calling the FutureUtils.get method. As in
// async client, the retry will be done in the retry timer thread, so the exception we get from
// the CompletableFuture will have a stack trace starting from the root of the retry timer. If we
// just throw this exception out when calling future.get(by unwrapping the ExecutionException),
// the upper layer even can not know where is the exception thrown...
// See HBASE-22316.
private static void setStackTrace(Throwable error) {
StackTraceElement[] localStackTrace = Thread.currentThread().getStackTrace();
StackTraceElement[] originalStackTrace = error.getStackTrace();
StackTraceElement[] newStackTrace =
new StackTraceElement[localStackTrace.length + originalStackTrace.length + 1];
System.arraycopy(localStackTrace, 0, newStackTrace, 0, localStackTrace.length);
newStackTrace[localStackTrace.length] =
new StackTraceElement("--------Future", "get--------", null, -1);
System.arraycopy(originalStackTrace, 0, newStackTrace, localStackTrace.length + 1,
originalStackTrace.length);
error.setStackTrace(newStackTrace);
}
private static IOException rethrow(ExecutionException error) throws IOException {
Throwable cause = error.getCause();
if (cause instanceof IOException) {
setStackTrace(cause);
throw (IOException) cause;
} else if (cause instanceof RuntimeException) {
setStackTrace(cause);
throw (RuntimeException) cause;
} else if (cause instanceof Error) {
setStackTrace(cause);
throw (Error) cause;
} else {
throw new IOException(cause);
}
}
/**
* A helper class for getting the result of a Future, and convert the error to an
* {@link IOException}.
*/
public static <T> T get(Future<T> future) throws IOException {
try {
return future.get();
} catch (InterruptedException e) {
throw (IOException) new InterruptedIOException().initCause(e);
} catch (ExecutionException e) {
throw rethrow(e);
}
}
/**
* A helper class for getting the result of a Future with timeout, and convert the error to an
* {@link IOException}.
*/
public static <T> T get(Future<T> future, long timeout, TimeUnit unit) throws IOException {
try {
return future.get(timeout, unit);
} catch (InterruptedException e) {
throw (IOException) new InterruptedIOException().initCause(e);
} catch (ExecutionException e) {
throw rethrow(e);
} catch (TimeoutException e) {
throw new TimeoutIOException(e);
}
}
/**
* Returns a CompletableFuture that is already completed exceptionally with the given exception.
*/
public static <T> CompletableFuture<T> failedFuture(Throwable e) {
CompletableFuture<T> future = new CompletableFuture<>();
future.completeExceptionally(e);
return future;
}
}
| {
"content_hash": "da20b66305d0274c5d55d3ad38bfd5cf",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 100,
"avg_line_length": 39.13333333333333,
"alnum_prop": 0.7075525269733106,
"repo_name": "ultratendency/hbase",
"id": "dfd9ead2785401333b1c644ccda94bff5a661895",
"size": "7850",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "hbase-common/src/main/java/org/apache/hadoop/hbase/util/FutureUtils.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "25330"
},
{
"name": "C",
"bytes": "28534"
},
{
"name": "C++",
"bytes": "56085"
},
{
"name": "CMake",
"bytes": "13186"
},
{
"name": "CSS",
"bytes": "37063"
},
{
"name": "Dockerfile",
"bytes": "6658"
},
{
"name": "Groovy",
"bytes": "38239"
},
{
"name": "HTML",
"bytes": "17275"
},
{
"name": "Java",
"bytes": "34476127"
},
{
"name": "JavaScript",
"bytes": "2694"
},
{
"name": "Makefile",
"bytes": "1359"
},
{
"name": "PHP",
"bytes": "8385"
},
{
"name": "Perl",
"bytes": "383739"
},
{
"name": "Python",
"bytes": "90220"
},
{
"name": "Ruby",
"bytes": "666059"
},
{
"name": "Shell",
"bytes": "288413"
},
{
"name": "Thrift",
"bytes": "52675"
},
{
"name": "XSLT",
"bytes": "6764"
}
],
"symlink_target": ""
} |
package org.cloudfoundry.client.v2.events;
import org.junit.Test;
public final class GetEventRequestTest {
@Test(expected = IllegalStateException.class)
public void noEventId() {
GetEventRequest.builder()
.build();
}
@Test
public void valid() {
GetEventRequest.builder()
.eventId("test-event-id")
.build();
}
}
| {
"content_hash": "951928f24df0734ab2d5b30bec1e2827",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 49,
"avg_line_length": 17.90909090909091,
"alnum_prop": 0.6015228426395939,
"repo_name": "alexander071/cf-java-client",
"id": "760ccafec4983a3db204a0283fa4cfddfbc15fa4",
"size": "1014",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cloudfoundry-client/src/test/java/org/cloudfoundry/client/v2/events/GetEventRequestTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5043"
},
{
"name": "Java",
"bytes": "4410753"
},
{
"name": "Shell",
"bytes": "8834"
}
],
"symlink_target": ""
} |
<?php
namespace Magento\Paypal\Controller\Adminhtml\Paypal\Reports;
class Details extends \Magento\Paypal\Controller\Adminhtml\Paypal\Reports
{
/**
* Authorization level of a basic admin session
*
* @see _isAllowed()
*/
const ADMIN_RESOURCE = 'Magento_Paypal::paypal_settlement_reports_view';
/**
* View transaction details action
*
* @return void
*/
public function execute()
{
$rowId = $this->getRequest()->getParam('id');
$row = $this->_rowFactory->create()->load($rowId);
if (!$row->getId()) {
$this->_redirect('adminhtml/*/');
return;
}
$this->_coreRegistry->register('current_transaction', $row);
$this->_initAction();
$this->_view->getPage()->getConfig()->getTitle()->prepend(__('View Transaction'));
$this->_addContent(
$this->_view->getLayout()->createBlock(
'Magento\Paypal\Block\Adminhtml\Settlement\Details',
'settlementDetails'
)
);
$this->_view->renderLayout();
}
}
| {
"content_hash": "3ba2e6690a76c5004995ae730ccb08d5",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 90,
"avg_line_length": 29.13157894736842,
"alnum_prop": 0.5618789521228545,
"repo_name": "j-froehlich/magento2_wk",
"id": "74a7169309801770261b3898729b24e7d8de0cc3",
"size": "1218",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "vendor/magento/module-paypal/Controller/Adminhtml/Paypal/Reports/Details.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "13636"
},
{
"name": "CSS",
"bytes": "2076720"
},
{
"name": "HTML",
"bytes": "6151072"
},
{
"name": "JavaScript",
"bytes": "2488727"
},
{
"name": "PHP",
"bytes": "12466046"
},
{
"name": "Shell",
"bytes": "6088"
},
{
"name": "XSLT",
"bytes": "19979"
}
],
"symlink_target": ""
} |
/* eslint-disable */
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _SourceNodesVideonodeJs = __webpack_require__(1);
var _SourceNodesVideonodeJs2 = _interopRequireDefault(_SourceNodesVideonodeJs);
var _SourceNodesImagenodeJs = __webpack_require__(101);
var _SourceNodesImagenodeJs2 = _interopRequireDefault(_SourceNodesImagenodeJs);
var _SourceNodesCanvasnodeJs = __webpack_require__(102);
var _SourceNodesCanvasnodeJs2 = _interopRequireDefault(_SourceNodesCanvasnodeJs);
var _SourceNodesSourcenodeJs = __webpack_require__(2);
var _ProcessingNodesCompositingnodeJs = __webpack_require__(103);
var _ProcessingNodesCompositingnodeJs2 = _interopRequireDefault(_ProcessingNodesCompositingnodeJs);
var _DestinationNodeDestinationnodeJs = __webpack_require__(106);
var _DestinationNodeDestinationnodeJs2 = _interopRequireDefault(_DestinationNodeDestinationnodeJs);
var _ProcessingNodesEffectnodeJs = __webpack_require__(107);
var _ProcessingNodesEffectnodeJs2 = _interopRequireDefault(_ProcessingNodesEffectnodeJs);
var _ProcessingNodesDrawingnodeJs = __webpack_require__(108);
var _ProcessingNodesDrawingnodeJs2 = _interopRequireDefault(_ProcessingNodesDrawingnodeJs);
var _ProcessingNodesTransitionnodeJs = __webpack_require__(109);
var _ProcessingNodesTransitionnodeJs2 = _interopRequireDefault(_ProcessingNodesTransitionnodeJs);
var _rendergraphJs = __webpack_require__(110);
var _rendergraphJs2 = _interopRequireDefault(_rendergraphJs);
var _videoelementcacheJs = __webpack_require__(112);
var _videoelementcacheJs2 = _interopRequireDefault(_videoelementcacheJs);
var _utilsJs = __webpack_require__(3);
var _DefinitionsDefinitionsJs = __webpack_require__(4);
var _DefinitionsDefinitionsJs2 = _interopRequireDefault(_DefinitionsDefinitionsJs);
var _PadNodesPadnodeJs = __webpack_require__(111);
var _PadNodesPadnodeJs2 = _interopRequireDefault(_PadNodesPadnodeJs);
var updateablesManager = new _utilsJs.UpdateablesManager();
/**
* VideoContext.
* @module VideoContext
*/
var VideoContext = (function () {
/**
* Initialise the VideoContext and render to the specific canvas. A 2nd parameter can be passed to the constructor which is a function that get's called if the VideoContext fails to initialise.
*
* @param {Canvas} canvas - the canvas element to render the output to.
* @param {function} initErrorCallback - a callback for if initialising the canvas failed.
* @param {Object} options - a nuber of custom options which can be set on the VideoContext, generally best left as default.
*
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement, function(){console.error("Sorry, your browser dosen\'t support WebGL");});
* var videoNode = ctx.video("video.mp4");
* videoNode.connect(ctx.destination);
* videoNode.start(0);
* videoNode.stop(10);
* ctx.play();
*
*/
function VideoContext(canvas, initErrorCallback) {
var options = arguments.length <= 2 || arguments[2] === undefined ? { "preserveDrawingBuffer": true, "manualUpdate": false, "endOnLastSourceEnd": true, useVideoElementCache: true, videoElementCacheSize: 6, webglContextAttributes: { preserveDrawingBuffer: true, alpha: false } } : arguments[2];
_classCallCheck(this, VideoContext);
this._canvas = canvas;
var manualUpdate = false;
this.endOnLastSourceEnd = true;
var webglContextAttributes = { preserveDrawingBuffer: true, alpha: false };
if ("manualUpdate" in options) manualUpdate = options.manualUpdate;
if ("endOnLastSourceEnd" in options) this._endOnLastSourceEnd = options.endOnLastSourceEnd;
if ("webglContextAttributes" in options) webglContextAttributes = options.webglContextAttributes;
if (webglContextAttributes.alpha === undefined) webglContextAttributes.alpha = false;
if (webglContextAttributes.alpha === true) {
console.error("webglContextAttributes.alpha must be false for correct opeation");
}
this._gl = canvas.getContext("experimental-webgl", webglContextAttributes);
if (this._gl === null) {
console.error("Failed to intialise WebGL.");
if (initErrorCallback) initErrorCallback();
return;
}
// Initialise the video element cache
if (!options.useVideoElementCache) options.useVideoElementCache = true;
this._useVideoElementCache = options.useVideoElementCache;
if (this._useVideoElementCache) {
if (!options.videoElementCacheSize) options.videoElementCacheSize = 5;
this._videoElementCache = new _videoelementcacheJs2["default"](options.videoElementCacheSize);
}
this._renderGraph = new _rendergraphJs2["default"]();
this._sourceNodes = [];
this._processingNodes = [];
this._timeline = [];
this._currentTime = 0;
this._state = VideoContext.STATE.PAUSED;
this._playbackRate = 1.0;
this._sourcesPlaying = undefined;
this._destinationNode = new _DestinationNodeDestinationnodeJs2["default"](this._gl, this._renderGraph);
this._callbacks = new Map();
this._callbacks.set("stalled", []);
this._callbacks.set("update", []);
this._callbacks.set("ended", []);
this._callbacks.set("content", []);
this._callbacks.set("nocontent", []);
this._timelineCallbacks = [];
if (!manualUpdate) {
updateablesManager.register(this);
}
}
//playing - all sources are active
//paused - all sources are paused
//stalled - one or more sources is unable to play
//ended - all sources have finished playing
//broken - the render graph is in a broken state
/**
* Register a callback to happen at a specific point in time.
* @param {number} time - the time at which to trigger the callback.
* @param {Function} func - the callback to register.
* @param {number} ordering - the order in which to call the callback if more than one is registered for the same time.
*/
_createClass(VideoContext, [{
key: "registerTimelineCallback",
value: function registerTimelineCallback(time, func) {
var ordering = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2];
this._timelineCallbacks.push({ "time": time, "func": func, "ordering": ordering });
}
/**
* Unregister a callback which happens at a specific point in time.
* @param {Function} func - the callback to unregister.
*/
}, {
key: "unregisterTimelineCallback",
value: function unregisterTimelineCallback(func) {
var toRemove = [];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = this._timelineCallbacks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var callback = _step.value;
if (callback.func === func) {
toRemove.push(callback);
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = toRemove[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var callback = _step2.value;
var index = this._timelineCallbacks.indexOf(callback);
this._timelineCallbacks.splice(index, 1);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2["return"]) {
_iterator2["return"]();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
}
/**
* Regsiter a callback to listen to one of the following events: "stalled", "update", "ended", "content", "nocontent"
*
* "stalled" happend anytime playback is stopped due to unavailbale data for playing assets (i.e video still loading)
* . "update" is called any time a frame is rendered to the screen. "ended" is called once plackback has finished
* (i.e ctx.currentTime == ctx.duration). "content" is called a the start of a time region where there is content
* playing out of one or more sourceNodes. "nocontent" is called at the start of any time region where the
* VideoContext is still playing, but there are currently no activly playing soureces.
*
* @param {String} type - the event to register against ("stalled", "update", or "ended").
* @param {Function} func - the callback to register.
*
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
* ctx.registerCallback("stalled", function(){console.log("Playback stalled");});
* ctx.registerCallback("update", function(){console.log("new frame");});
* ctx.registerCallback("ended", function(){console.log("Playback ended");});
*/
}, {
key: "registerCallback",
value: function registerCallback(type, func) {
if (!this._callbacks.has(type)) return false;
this._callbacks.get(type).push(func);
}
/**
* Remove a previously registed callback
*
* @param {Function} func - the callback to remove.
*
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
*
* //the callback
* var updateCallback = function(){console.log("new frame")};
*
* //register the callback
* ctx.registerCallback("update", updateCallback);
* //then unregister it
* ctx.unregisterCallback(updateCallback);
*
*/
}, {
key: "unregisterCallback",
value: function unregisterCallback(func) {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (var _iterator3 = this._callbacks.values()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var funcArray = _step3.value;
var index = funcArray.indexOf(func);
if (index !== -1) {
funcArray.splice(index, 1);
return true;
}
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3["return"]) {
_iterator3["return"]();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
return false;
}
}, {
key: "_callCallbacks",
value: function _callCallbacks(type) {
var funcArray = this._callbacks.get(type);
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
try {
for (var _iterator4 = funcArray[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var func = _step4.value;
func(this._currentTime);
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4["return"]) {
_iterator4["return"]();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
}
/**
* Get the canvas that the VideoContext is using.
*
* @return {HTMLElement} The canvas that the VideoContext is using.
*
*/
}, {
key: "play",
/**
* Start the VideoContext playing
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
* var videoNode = ctx.video("video.mp4");
* videoNode.connect(ctx.destination);
* videoNode.start(0);
* videoNode.stop(10);
* ctx.play();
*/
value: function play() {
console.debug("VideoContext - playing");
//Initialise the video elemnt cache
if (this._videoElementCache) this._videoElementCache.init();
// set the state.
this._state = VideoContext.STATE.PLAYING;
return true;
}
/**
* Pause playback of the VideoContext
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
* var videoNode = ctx.video("video.mp4");
* videoNode.connect(ctx.destination);
* videoNode.start(0);
* videoNode.stop(20);
* ctx.currentTime = 10; // seek 10 seconds in
* ctx.play();
* setTimeout(function(){ctx.pause();}, 1000); //pause playback after roughly one second.
*/
}, {
key: "pause",
value: function pause() {
console.debug("VideoContext - pausing");
this._state = VideoContext.STATE.PAUSED;
return true;
}
/**
* Create a new node representing a video source
*
* @param {string|Video} - The URL or video element to create the video from.
* @sourceOffset {number} - Offset into the start of the source video to start playing from.
* @preloadTime {number} - How many seconds before the video is to be played to start loading it.
* @videoElementAttributes {Object} - A dictionary of attributes to map onto the underlying video element.
* @return {VideoNode} A new video node.
*
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
* var videoNode = ctx.video("video.mp4");
*
* @example
* var canvasElement = document.getElementById("canvas");
* var videoElement = document.getElementById("video");
* var ctx = new VideoContext(canvasElement);
* var videoNode = ctx.video(videoElement);
*/
}, {
key: "video",
value: function video(src) {
var sourceOffset = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var preloadTime = arguments.length <= 2 || arguments[2] === undefined ? 4 : arguments[2];
var videoElementAttributes = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
var videoNode = new _SourceNodesVideonodeJs2["default"](src, this._gl, this._renderGraph, this._currentTime, this._playbackRate, sourceOffset, preloadTime, this._videoElementCache, videoElementAttributes);
this._sourceNodes.push(videoNode);
return videoNode;
}
/**
* @depricated
*/
}, {
key: "createVideoSourceNode",
value: function createVideoSourceNode(src) {
var sourceOffset = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var preloadTime = arguments.length <= 2 || arguments[2] === undefined ? 4 : arguments[2];
var videoElementAttributes = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
this._depricate("Warning: createVideoSourceNode will be depricated in v1.0, please switch to using VideoContext.video()");
return this.video(src, sourceOffset, preloadTime, videoElementAttributes);
}
/**
* Create a new node representing an image source
* @param {string|Image} src - The url or image element to create the image node from.
* @param {number} [preloadTime] - How long before a node is to be displayed to attmept to load it.
* @param {Object} [imageElementAttributes] - Any attributes to be given to the underlying image element.
* @return {ImageNode} A new image node.
*
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
* var imageNode = ctx.image("image.png");
*
* @example
* var canvasElement = document.getElementById("canvas");
* var imageElement = document.getElementById("image");
* var ctx = new VideoContext(canvasElement);
* var imageNode = ctx.image(imageElement);
*/
}, {
key: "image",
value: function image(src) {
var preloadTime = arguments.length <= 1 || arguments[1] === undefined ? 4 : arguments[1];
var imageElementAttributes = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var imageNode = new _SourceNodesImagenodeJs2["default"](src, this._gl, this._renderGraph, this._currentTime, preloadTime, imageElementAttributes);
this._sourceNodes.push(imageNode);
return imageNode;
}
/**
* @depricated
*/
}, {
key: "createImageSourceNode",
value: function createImageSourceNode(src) {
var sourceOffset = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var preloadTime = arguments.length <= 2 || arguments[2] === undefined ? 4 : arguments[2];
var imageElementAttributes = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
this._depricate("Warning: createImageSourceNode will be depricated in v1.0, please switch to using VideoContext.image()");
return this.image(src, sourceOffset, preloadTime, imageElementAttributes);
}
/**
* Create a new node representing a canvas source
* @param {Canvas} src - The canvas element to create the canvas node from.
* @return {CanvasNode} A new canvas node.
*/
}, {
key: "canvas",
value: function canvas(_canvas) {
var canvasNode = new _SourceNodesCanvasnodeJs2["default"](_canvas, this._gl, this._renderGraph, this._currentTime);
this._sourceNodes.push(canvasNode);
return canvasNode;
}
/**
* @depricated
*/
}, {
key: "createCanvasSourceNode",
value: function createCanvasSourceNode(canvas) {
var sourceOffset = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var preloadTime = arguments.length <= 2 || arguments[2] === undefined ? 4 : arguments[2];
this._depricate("Warning: createCanvasSourceNode will be depricated in v1.0, please switch to using VideoContext.canvas()");
return this.canvas(canvas, sourceOffset, preloadTime);
}
/**
* Create a new effect node.
* @param {Object} definition - this is an object defining the shaders, inputs, and properties of the compositing node to create. Builtin definitions can be found by accessing VideoContext.DEFINITIONS.
* @return {EffectNode} A new effect node created from the passed definition
*/
}, {
key: "effect",
value: function effect(definition) {
var effectNode = new _ProcessingNodesEffectnodeJs2["default"](this._gl, this._renderGraph, definition);
this._processingNodes.push(effectNode);
return effectNode;
}
/**
* @depricated
*/
}, {
key: "createEffectNode",
value: function createEffectNode(definition) {
this._depricate("Warning: createEffectNode will be depricated in v1.0, please switch to using VideoContext.effect()");
return this.effect(definition);
}
/**
* Create a new compositiing node.
*
* Compositing nodes are used for operations such as combining multiple video sources into a single track/connection for further processing in the graph.
*
* A compositing node is slightly different to other processing nodes in that it only has one input in it's definition but can have unlimited connections made to it.
* The shader in the definition is run for each input in turn, drawing them to the output buffer. This means there can be no interaction between the spearte inputs to a compositing node, as they are individually processed in seperate shader passes.
*
* @param {Object} definition - this is an object defining the shaders, inputs, and properties of the compositing node to create. Builtin definitions can be found by accessing VideoContext.DEFINITIONS
*
* @return {CompositingNode} A new compositing node created from the passed definition.
*
* @example
*
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
*
* //A simple compositing node definition which just renders all the inputs to the output buffer.
* var combineDefinition = {
* vertexShader : "\
* attribute vec2 a_position;\
* attribute vec2 a_texCoord;\
* varying vec2 v_texCoord;\
* void main() {\
* gl_Position = vec4(vec2(2.0,2.0)*vec2(1.0, 1.0), 0.0, 1.0);\
* v_texCoord = a_texCoord;\
* }",
* fragmentShader : "\
* precision mediump float;\
* uniform sampler2D u_image;\
* uniform float a;\
* varying vec2 v_texCoord;\
* varying float v_progress;\
* void main(){\
* vec4 color = texture2D(u_image, v_texCoord);\
* gl_FragColor = color;\
* }",
* properties:{
* "a":{type:"uniform", value:0.0},
* },
* inputs:["u_image"]
* };
* //Create the node, passing in the definition.
* var trackNode = videoCtx.compositor(combineDefinition);
*
* //create two videos which will play at back to back
* var videoNode1 = ctx.video("video1.mp4");
* videoNode1.play(0);
* videoNode1.stop(10);
* var videoNode2 = ctx.video("video2.mp4");
* videoNode2.play(10);
* videoNode2.stop(20);
*
* //Connect the nodes to the combine node. This will give a single connection representing the two videos which can
* //be connected to other effects such as LUTs, chromakeyers, etc.
* videoNode1.connect(trackNode);
* videoNode2.connect(trackNode);
*
* //Don't do anything exciting, just connect it to the output.
* trackNode.connect(ctx.destination);
*
*/
}, {
key: "compositor",
value: function compositor(definition) {
var compositingNode = new _ProcessingNodesCompositingnodeJs2["default"](this._gl, this._renderGraph, definition);
this._processingNodes.push(compositingNode);
return compositingNode;
}
/**
* @depricated
*/
}, {
key: "createCompositingNode",
value: function createCompositingNode(definition) {
this._depricate("Warning: createCompositingNode will be depricated in v1.0, please switch to using VideoContext.compositor()");
return this.compositor(definition);
}
/**
* create a new drawing node.
* drawing node is drawing other node in input node.
* drawing at rect that defined in every node "drawRect", update "drawRect" to position
* drawing target. "drawRect" is normalize of 0.0~1.0, respects that [orignx, origny, width, height].
* @param {Object} definition - this is an object defining the shaders, inputs, and properties of the compositing node to create. Builtin definitions can be found by accessing VideoContext.DEFINITIONS
*
* @return {DrawingNode} A new drawing node created from the passed definition.
*
* @example
* later will provide.
*/
}, {
key: "drawing",
value: function drawing(definition) {
var drawingNode = new _ProcessingNodesDrawingnodeJs2["default"](this._gl, this._renderGraph, definition);
this._processingNodes.push(drawingNode);
return drawingNode;
}
/**
* create a new padnode.
* padnode is pad node in input node.
* @param {Array} canvasSize - the Canvas Size, the same as output video size
* @param {Array} videoSize - the input video size
* @param {int} padMode - padding mode: 2 - crop with mean blur; 1 - crop with blackpad; other - crop with glass blur.
* @property {Array} canvasSize - see param canvasSize
* @property {Array} videoSize - see param videoSize
* @property {Array} cropRect - the crop rect.
*
* @return {PadNode} A new padnode created from the passed definition.
*
* @example
* later will provide.
*/
}, {
key: "PaddingNode",
value: function PaddingNode(canvasSize, videoSize, padMode) {
var paddingNode = new _PadNodesPadnodeJs2["default"](this._gl, this._renderGraph, this, canvasSize, videoSize, padMode);
this._processingNodes.push(paddingNode);
return paddingNode;
}
/**
* @depricated
*/
}, {
key: "createDrawingNode",
value: function createDrawingNode(definition) {
this._depricate("Warning: createDrawingNode will be depricated in v1.0, please switch to using VideoContext.drawing()");
return this.drawing(definition);
}
/**
* Create a new transition node.
*
* Transistion nodes are a type of effect node which have parameters which can be changed as events on the timeline.
*
* For example a transition node which cross-fades between two videos could have a "mix" property which sets the
* progress through the transistion. Rather than having to write your own code to adjust this property at specfic
* points in time a transition node has a "transition" function which takes a startTime, stopTime, targetValue, and a
* propertyName (which will be "mix"). This will linearly interpolate the property from the curernt value to
* tragetValue between the startTime and stopTime.
*
* @param {Object} definition - this is an object defining the shaders, inputs, and properties of the transition node to create.
* @return {TransitionNode} A new transition node created from the passed definition.
* @example
*
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
*
* //A simple cross-fade node definition which cross-fades between two videos based on the mix property.
* var crossfadeDefinition = {
* vertexShader : "\
* attribute vec2 a_position;\
* attribute vec2 a_texCoord;\
* varying vec2 v_texCoord;\
* void main() {\
* gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
* v_texCoord = a_texCoord;\
* }",
* fragmentShader : "\
* precision mediump float;\
* uniform sampler2D u_image_a;\
* uniform sampler2D u_image_b;\
* uniform float mix;\
* varying vec2 v_texCoord;\
* varying float v_mix;\
* void main(){\
* vec4 color_a = texture2D(u_image_a, v_texCoord);\
* vec4 color_b = texture2D(u_image_b, v_texCoord);\
* color_a[0] *= mix;\
* color_a[1] *= mix;\
* color_a[2] *= mix;\
* color_a[3] *= mix;\
* color_b[0] *= (1.0 - mix);\
* color_b[1] *= (1.0 - mix);\
* color_b[2] *= (1.0 - mix);\
* color_b[3] *= (1.0 - mix);\
* gl_FragColor = color_a + color_b;\
* }",
* properties:{
* "mix":{type:"uniform", value:0.0},
* },
* inputs:["u_image_a","u_image_b"]
* };
*
* //Create the node, passing in the definition.
* var transitionNode = videoCtx.transition(crossfadeDefinition);
*
* //create two videos which will overlap by two seconds
* var videoNode1 = ctx.video("video1.mp4");
* videoNode1.play(0);
* videoNode1.stop(10);
* var videoNode2 = ctx.video("video2.mp4");
* videoNode2.play(8);
* videoNode2.stop(18);
*
* //Connect the nodes to the transistion node.
* videoNode1.connect(transitionNode);
* videoNode2.connect(transitionNode);
*
* //Set-up a transition which happens at the crossover point of the playback of the two videos
* transitionNode.transition(8,10,1.0,"mix");
*
* //Connect the transition node to the output
* transitionNode.connect(ctx.destination);
*
* //start playback
* ctx.play();
*/
}, {
key: "transition",
value: function transition(definition) {
var transitionNode = new _ProcessingNodesTransitionnodeJs2["default"](this._gl, this._renderGraph, definition);
this._processingNodes.push(transitionNode);
return transitionNode;
}
/**
* @depricated
*/
}, {
key: "createTransitionNode",
value: function createTransitionNode(definition) {
this._depricate("Warning: createTransitionNode will be depricated in v1.0, please switch to using VideoContext.transition()");
return this.transition(definition);
}
}, {
key: "_isStalled",
value: function _isStalled() {
for (var i = 0; i < this._sourceNodes.length; i++) {
var sourceNode = this._sourceNodes[i];
if (!sourceNode._isReady()) {
return true;
}
}
return false;
}
/**
* This allows manual calling of the update loop of the videoContext.
*
* @param {Number} dt - The difference in seconds between this and the previous calling of update.
* @example
*
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement, undefined, {"manualUpdate" : true});
*
* var previousTime;
* function update(time){
* if (previousTime === undefined) previousTime = time;
* var dt = (time - previousTime)/1000;
* ctx.update(dt);
* previousTime = time;
* requestAnimationFrame(update);
* }
* update();
*
*/
}, {
key: "update",
value: function update(dt) {
this._update(dt);
}
}, {
key: "_update",
value: function _update(dt) {
//Remove any destroyed nodes
this._sourceNodes = this._sourceNodes.filter(function (sourceNode) {
if (!sourceNode.destroyed) return sourceNode;
});
this._processingNodes = this._processingNodes.filter(function (processingNode) {
if (!processingNode.destroyed) return processingNode;
});
if (this._state === VideoContext.STATE.PLAYING || this._state === VideoContext.STATE.STALLED || this._state === VideoContext.STATE.PAUSED) {
this._callCallbacks("update");
if (this._state !== VideoContext.STATE.PAUSED) {
if (this._isStalled()) {
this._callCallbacks("stalled");
this._state = VideoContext.STATE.STALLED;
} else {
this._state = VideoContext.STATE.PLAYING;
}
}
if (this._state === VideoContext.STATE.PLAYING) {
//Handle timeline callbacks.
var activeCallbacks = new Map();
var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false;
var _iteratorError5 = undefined;
try {
for (var _iterator5 = this._timelineCallbacks[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var callback = _step5.value;
if (callback.time >= this.currentTime && callback.time < this._currentTime + dt * this._playbackRate) {
//group the callbacks by time
if (!activeCallbacks.has(callback.time)) activeCallbacks.set(callback.time, []);
activeCallbacks.get(callback.time).push(callback);
}
}
//Sort the groups of callbacks by the times of the groups
} catch (err) {
_didIteratorError5 = true;
_iteratorError5 = err;
} finally {
try {
if (!_iteratorNormalCompletion5 && _iterator5["return"]) {
_iterator5["return"]();
}
} finally {
if (_didIteratorError5) {
throw _iteratorError5;
}
}
}
var timeIntervals = Array.from(activeCallbacks.keys());
timeIntervals.sort(function (a, b) {
return a - b;
});
var _iteratorNormalCompletion6 = true;
var _didIteratorError6 = false;
var _iteratorError6 = undefined;
try {
for (var _iterator6 = timeIntervals[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
var t = _step6.value;
var callbacks = activeCallbacks.get(t);
callbacks.sort(function (a, b) {
return a.ordering - b.ordering;
});
var _iteratorNormalCompletion7 = true;
var _didIteratorError7 = false;
var _iteratorError7 = undefined;
try {
for (var _iterator7 = callbacks[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
var callback = _step7.value;
callback.func();
}
} catch (err) {
_didIteratorError7 = true;
_iteratorError7 = err;
} finally {
try {
if (!_iteratorNormalCompletion7 && _iterator7["return"]) {
_iterator7["return"]();
}
} finally {
if (_didIteratorError7) {
throw _iteratorError7;
}
}
}
}
} catch (err) {
_didIteratorError6 = true;
_iteratorError6 = err;
} finally {
try {
if (!_iteratorNormalCompletion6 && _iterator6["return"]) {
_iterator6["return"]();
}
} finally {
if (_didIteratorError6) {
throw _iteratorError6;
}
}
}
this._currentTime += dt * this._playbackRate;
if (this._currentTime > this.duration && this._endOnLastSourceEnd) {
//Do an update od the sourcenodes in case anything in the "ended" callbacks modifes currentTime and sources haven't had a chance to stop.
for (var i = 0; i < this._sourceNodes.length; i++) {
this._sourceNodes[i]._update(this._currentTime);
}
this._state = VideoContext.STATE.ENDED;
this._callCallbacks("ended");
}
}
var sourcesPlaying = false;
for (var i = 0; i < this._sourceNodes.length; i++) {
var sourceNode = this._sourceNodes[i];
if (this._state === VideoContext.STATE.STALLED) {
if (sourceNode._isReady() && sourceNode._state === _SourceNodesSourcenodeJs.SOURCENODESTATE.playing) sourceNode._pause();
}
if (this._state === VideoContext.STATE.PAUSED) {
sourceNode._pause();
}
if (this._state === VideoContext.STATE.PLAYING) {
sourceNode._play();
}
sourceNode._update(this._currentTime);
if (sourceNode._state === _SourceNodesSourcenodeJs.SOURCENODESTATE.paused || sourceNode._state === _SourceNodesSourcenodeJs.SOURCENODESTATE.playing) {
sourcesPlaying = true;
}
}
if (sourcesPlaying !== this._sourcesPlaying && this._state === VideoContext.STATE.PLAYING) {
if (sourcesPlaying === true) {
this._callCallbacks("content");
} else {
this._callCallbacks("nocontent");
}
this._sourcesPlaying = sourcesPlaying;
}
/*
* Itterate the directed acyclic graph using Khan's algorithm (KHAAAAAN!).
*
* This has highlighted a bunch of ineffencies in the rendergraph class about how its stores connections.
* Mainly the fact that to get inputs for a node you have to iterate the full list of connections rather than
* a node owning it's connections.
* The trade off with changing this is making/removing connections becomes more costly performance wise, but
* this is deffinately worth while because getting the connnections is a much more common operation.
*
* TL;DR Future matt - refactor this.
*
*/
var sortedNodes = [];
var connections = this._renderGraph.connections.slice();
var nodes = _rendergraphJs2["default"].getInputlessNodes(connections);
while (nodes.length > 0) {
var node = nodes.pop();
sortedNodes.push(node);
var _iteratorNormalCompletion8 = true;
var _didIteratorError8 = false;
var _iteratorError8 = undefined;
try {
for (var _iterator8 = _rendergraphJs2["default"].outputEdgesFor(node, connections)[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
var edge = _step8.value;
var index = connections.indexOf(edge);
if (index > -1) connections.splice(index, 1);
if (_rendergraphJs2["default"].inputEdgesFor(edge.destination, connections).length === 0) {
nodes.push(edge.destination);
}
}
} catch (err) {
_didIteratorError8 = true;
_iteratorError8 = err;
} finally {
try {
if (!_iteratorNormalCompletion8 && _iterator8["return"]) {
_iterator8["return"]();
}
} finally {
if (_didIteratorError8) {
throw _iteratorError8;
}
}
}
}
var _iteratorNormalCompletion9 = true;
var _didIteratorError9 = false;
var _iteratorError9 = undefined;
try {
for (var _iterator9 = sortedNodes[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
var node = _step9.value;
if (this._sourceNodes.indexOf(node) === -1) {
node._update(this._currentTime);
node._render();
}
}
} catch (err) {
_didIteratorError9 = true;
_iteratorError9 = err;
} finally {
try {
if (!_iteratorNormalCompletion9 && _iterator9["return"]) {
_iterator9["return"]();
}
} finally {
if (_didIteratorError9) {
throw _iteratorError9;
}
}
}
}
}
/**
* Destroy all nodes in the graph and reset the timeline. After calling this any created nodes will be unusable.
*/
}, {
key: "reset",
value: function reset() {
var _iteratorNormalCompletion10 = true;
var _didIteratorError10 = false;
var _iteratorError10 = undefined;
try {
for (var _iterator10 = this._callbacks[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
var callback = _step10.value;
this.unregisterCallback(callback);
}
} catch (err) {
_didIteratorError10 = true;
_iteratorError10 = err;
} finally {
try {
if (!_iteratorNormalCompletion10 && _iterator10["return"]) {
_iterator10["return"]();
}
} finally {
if (_didIteratorError10) {
throw _iteratorError10;
}
}
}
var _iteratorNormalCompletion11 = true;
var _didIteratorError11 = false;
var _iteratorError11 = undefined;
try {
for (var _iterator11 = this._sourceNodes[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
var node = _step11.value;
node.destroy();
}
} catch (err) {
_didIteratorError11 = true;
_iteratorError11 = err;
} finally {
try {
if (!_iteratorNormalCompletion11 && _iterator11["return"]) {
_iterator11["return"]();
}
} finally {
if (_didIteratorError11) {
throw _iteratorError11;
}
}
}
var _iteratorNormalCompletion12 = true;
var _didIteratorError12 = false;
var _iteratorError12 = undefined;
try {
for (var _iterator12 = this._processingNodes[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
var node = _step12.value;
node.destroy();
}
} catch (err) {
_didIteratorError12 = true;
_iteratorError12 = err;
} finally {
try {
if (!_iteratorNormalCompletion12 && _iterator12["return"]) {
_iterator12["return"]();
}
} finally {
if (_didIteratorError12) {
throw _iteratorError12;
}
}
}
this._update(0);
this._sourceNodes = [];
this._processingNodes = [];
this._timeline = [];
this._currentTime = 0;
this._state = VideoContext.STATE.PAUSED;
this._playbackRate = 1.0;
this._sourcesPlaying = undefined;
this._callbacks.set("stalled", []);
this._callbacks.set("update", []);
this._callbacks.set("ended", []);
this._callbacks.set("content", []);
this._callbacks.set("nocontent", []);
this._timelineCallbacks = [];
}
}, {
key: "_depricate",
value: function _depricate(msg) {
console.log(msg);
}
}, {
key: "element",
get: function get() {
return this._canvas;
}
/**
* Get the current state.
*
* This will be either
* - VideoContext.STATE.PLAYING: current sources on timeline are active
* - VideoContext.STATE.PAUSED: all sources are paused
* - VideoContext.STATE.STALLED: one or more sources is unable to play
* - VideoContext.STATE.ENDED: all sources have finished playing
* - VideoContext.STATE.BROKEN: the render graph is in a broken state
* @return {number} The number representing the state.
*
*/
}, {
key: "state",
get: function get() {
return this._state;
}
/**
* Set the progress through the internal timeline.
* Setting this can be used as a way to implement a scrubaable timeline.
*
* @param {number} currentTime - this is the currentTime to set the context to.
*
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
* var videoNode = ctx.video("video.mp4");
* videoNode.connect(ctx.destination);
* videoNode.start(0);
* videoNode.stop(20);
* ctx.currentTime = 10; // seek 10 seconds in
* ctx.play();
*
*/
}, {
key: "currentTime",
set: function set(currentTime) {
console.debug("VideoContext - seeking to", currentTime);
if (currentTime < this._duration && this._state === VideoContext.STATE.ENDED) this._state = VideoContext.STATE.PAUSED;
if (typeof currentTime === "string" || currentTime instanceof String) {
currentTime = parseFloat(currentTime);
}
for (var i = 0; i < this._sourceNodes.length; i++) {
this._sourceNodes[i]._seek(currentTime);
}
for (var i = 0; i < this._processingNodes.length; i++) {
this._processingNodes[i]._seek(currentTime);
}
this._currentTime = currentTime;
},
/**
* Get how far through the internal timeline has been played.
*
* Getting this value will give the current playhead position. Can be used for updating timelines.
* @return {number} The time in seconds through the current playlist.
*
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
* var videoNode = ctx.video("video.mp4");
* videoNode.connect(ctx.destination);
* videoNode.start(0);
* videoNode.stop(10);
* ctx.play();
* setTimeout(function(){console.log(ctx.currentTime);},1000); //should print roughly 1.0
*
*/
get: function get() {
return this._currentTime;
}
/**
* Get the time at which the last node in the current internal timeline finishes playing.
*
* @return {number} The end time in seconds of the last video node to finish playing.
*
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
* console.log(ctx.duration); //prints 0
*
* var videoNode = ctx.video("video.mp4");
* videoNode.connect(ctx.destination);
* videoNode.start(0);
* videoNode.stop(10);
*
* console.log(ctx.duration); //prints 10
*
* ctx.play();
*/
}, {
key: "duration",
get: function get() {
var maxTime = 0;
for (var i = 0; i < this._sourceNodes.length; i++) {
if (this._sourceNodes[i].state !== _SourceNodesSourcenodeJs.SOURCENODESTATE.waiting && this._sourceNodes[i]._stopTime > maxTime) {
maxTime = this._sourceNodes[i]._stopTime;
}
}
return maxTime;
}
/**
* Get the final node in the render graph which represents the canvas to display content on to.
*
* This proprety is read-only and there can only ever be one destination node. Other nodes can connect to this but you cannot connect this node to anything.
*
* @return {DestinationNode} A graph node represnting the canvas to display the content on.
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
* var videoNode = ctx.video("video.mp4");
* videoNode.start(0);
* videoNode.stop(10);
* videoNode.connect(ctx.destination);
*
*/
}, {
key: "destination",
get: function get() {
return this._destinationNode;
}
/**
* Set the playback rate of the VideoContext instance.
* This will alter the playback speed of all media elements played through the VideoContext.
*
* @param {number} rate - this is the playback rate.
*
* @example
* var canvasElement = document.getElementById("canvas");
* var ctx = new VideoContext(canvasElement);
* var videoNode = ctx.video("video.mp4");
* videoNode.start(0);
* videoNode.stop(10);
* videoNode.connect(ctx.destination);
* ctx.playbackRate = 2;
* ctx.play(); // Double playback rate means this will finish playing in 5 seconds.
*/
}, {
key: "playbackRate",
set: function set(rate) {
if (rate <= 0) {
throw new RangeError("playbackRate must be greater than 0");
}
var _iteratorNormalCompletion13 = true;
var _didIteratorError13 = false;
var _iteratorError13 = undefined;
try {
for (var _iterator13 = this._sourceNodes[Symbol.iterator](), _step13; !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {
var node = _step13.value;
if (node.constructor.name === "VideoNode") {
node._globalPlaybackRate = rate;
node._playbackRateUpdated = true;
}
}
} catch (err) {
_didIteratorError13 = true;
_iteratorError13 = err;
} finally {
try {
if (!_iteratorNormalCompletion13 && _iterator13["return"]) {
_iterator13["return"]();
}
} finally {
if (_didIteratorError13) {
throw _iteratorError13;
}
}
}
this._playbackRate = rate;
},
/**
* Return the current playbackRate of the video context.
* @return {number} A value representing the playbackRate. 1.0 by default.
*/
get: function get() {
return this._playbackRate;
}
}], [{
key: "DEFINITIONS",
get: function get() {
return _DefinitionsDefinitionsJs2["default"];
}
}]);
return VideoContext;
})();
exports["default"] = VideoContext;
VideoContext.STATE = {};
VideoContext.STATE.PLAYING = 0;
VideoContext.STATE.PAUSED = 1;
VideoContext.STATE.STALLED = 2;
VideoContext.STATE.ENDED = 3;
VideoContext.STATE.BROKEN = 4;
VideoContext.visualiseVideoContextTimeline = _utilsJs.visualiseVideoContextTimeline;
VideoContext.visualiseVideoContextGraph = _utilsJs.visualiseVideoContextGraph;
VideoContext.createControlFormForNode = _utilsJs.createControlFormForNode;
VideoContext.createSigmaGraphDataFromRenderGraph = _utilsJs.createSigmaGraphDataFromRenderGraph;
VideoContext.exportToJSON = _utilsJs.exportToJSON;
VideoContext.updateablesManager = updateablesManager;
VideoContext.importSimpleEDL = _utilsJs.importSimpleEDL;
module.exports = exports["default"];
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _set = function set(object, property, value, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent !== null) { set(parent, property, value, receiver); } } else if ("value" in desc && desc.writable) { desc.value = value; } else { var setter = desc.set; if (setter !== undefined) { setter.call(receiver, value); } } return value; };
var _get = function get(_x6, _x7, _x8) { var _again = true; _function: while (_again) { var object = _x6, property = _x7, receiver = _x8; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x6 = parent; _x7 = property; _x8 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _sourcenode = __webpack_require__(2);
var _sourcenode2 = _interopRequireDefault(_sourcenode);
var VideoNode = (function (_SourceNode) {
_inherits(VideoNode, _SourceNode);
/**
* Initialise an instance of a VideoNode.
* This should not be called directly, but created through a call to videoContext.createVideoNode();
*/
function VideoNode(src, gl, renderGraph, currentTime) {
var globalPlaybackRate = arguments.length <= 4 || arguments[4] === undefined ? 1.0 : arguments[4];
var sourceOffset = arguments.length <= 5 || arguments[5] === undefined ? 0 : arguments[5];
var preloadTime = arguments.length <= 6 || arguments[6] === undefined ? 4 : arguments[6];
var videoElementCache = arguments.length <= 7 || arguments[7] === undefined ? undefined : arguments[7];
var attributes = arguments.length <= 8 || arguments[8] === undefined ? {} : arguments[8];
_classCallCheck(this, VideoNode);
_get(Object.getPrototypeOf(VideoNode.prototype), "constructor", this).call(this, src, gl, renderGraph, currentTime);
this._preloadTime = preloadTime;
this._sourceOffset = sourceOffset;
this._globalPlaybackRate = globalPlaybackRate;
this._videoElementCache = videoElementCache;
this._playbackRate = 1.0;
this._playbackRateUpdated = true;
this._attributes = attributes;
this._loopElement = false;
this._isElementPlaying = false;
if (this._attributes.loop) {
this._loopElement = this._attributes.loop;
}
this._displayName = "VideoNode";
}
_createClass(VideoNode, [{
key: "_load",
value: function _load() {
var _this = this;
_get(Object.getPrototypeOf(VideoNode.prototype), "_load", this).call(this);
if (this._element !== undefined) {
for (var key in this._attributes) {
this._element[key] = this._attributes[key];
}
if (this._element.readyState > 3 && !this._element.seeking) {
if (this._loopElement === false) {
if (this._stopTime === Infinity || this._stopTime == undefined) {
this._stopTime = this._startTime + this._element.duration;
this._triggerCallbacks("durationchange", this.duration);
}
}
if (this._ready !== true) {
this._triggerCallbacks("loaded");
this._playbackRateUpdated = true;
}
this._ready = true;
} else {
if (this._state !== _sourcenode.SOURCENODESTATE.error) {
this._ready = false;
}
}
return;
}
if (this._isResponsibleForElementLifeCycle) {
if (this._videoElementCache) {
this._element = this._videoElementCache.get();
} else {
this._element = document.createElement("video");
this._element.setAttribute("crossorigin", "anonymous");
this._element.setAttribute("webkit-playsinline", "");
this._playbackRateUpdated = true;
}
this._element.src = this._elementURL;
for (var _key in this._attributes) {
this._element[_key] = this._attributes[_key];
}
}
if (this._element) {
this._element.currentTime = this._sourceOffset;
this._element.onerror = function () {
if (_this._element === undefined) return;
console.debug("Error with element", _this._element);
_this._state = _sourcenode.SOURCENODESTATE.error;
//Event though there's an error ready should be set to true so the node can output transparenn
_this._ready = true;
_this._triggerCallbacks("error");
};
} else {
//If the element doesn't exist for whatever reason enter the error state.
this._state = _sourcenode.SOURCENODESTATE.error;
this._ready = true;
this._triggerCallbacks("error");
}
}
}, {
key: "_destroy",
value: function _destroy() {
_get(Object.getPrototypeOf(VideoNode.prototype), "_destroy", this).call(this);
if (this._isResponsibleForElementLifeCycle && this._element !== undefined) {
this._element.src = "";
for (var key in this._attributes) {
this._element.removeAttribute(key);
}
this._element = undefined;
if (!this._videoElementCache) delete this._element;
}
this._ready = false;
this._isElementPlaying = false;
}
}, {
key: "_seek",
value: function _seek(time) {
_get(Object.getPrototypeOf(VideoNode.prototype), "_seek", this).call(this, time);
if (this.state === _sourcenode.SOURCENODESTATE.playing || this.state === _sourcenode.SOURCENODESTATE.paused) {
if (this._element === undefined) this._load();
var relativeTime = this._currentTime - this._startTime + this._sourceOffset;
this._element.currentTime = relativeTime;
this._ready = false;
}
if ((this._state === _sourcenode.SOURCENODESTATE.sequenced || this._state === _sourcenode.SOURCENODESTATE.ended) && this._element !== undefined) {
this._destroy();
}
}
}, {
key: "_update",
value: function _update(currentTime) {
//if (!super._update(currentTime)) return false;
_get(Object.getPrototypeOf(VideoNode.prototype), "_update", this).call(this, currentTime);
//check if the video has ended
if (this._element !== undefined) {
if (this._element.ended) {
this._state = _sourcenode.SOURCENODESTATE.ended;
this._triggerCallbacks("ended");
}
}
if (this._startTime - this._currentTime < this._preloadTime && this._state !== _sourcenode.SOURCENODESTATE.waiting && this._state !== _sourcenode.SOURCENODESTATE.ended) this._load();
if (this._state === _sourcenode.SOURCENODESTATE.playing) {
if (this._playbackRateUpdated) {
this._element.playbackRate = this._globalPlaybackRate * this._playbackRate;
this._playbackRateUpdated = false;
}
if (!this._isElementPlaying) {
this._element.play();
if (this._stretchPaused) {
this._element.pause();
}
this._isElementPlaying = true;
}
return true;
} else if (this._state === _sourcenode.SOURCENODESTATE.paused) {
this._element.pause();
this._isElementPlaying = false;
return true;
} else if (this._state === _sourcenode.SOURCENODESTATE.ended && this._element !== undefined) {
this._element.pause();
if (this._isElementPlaying) {
this._destroy();
}
return false;
}
}
}, {
key: "clearTimelineState",
value: function clearTimelineState() {
_get(Object.getPrototypeOf(VideoNode.prototype), "clearTimelineState", this).call(this);
if (this._element !== undefined) {
this._element.pause();
this._isElementPlaying = false;
}
this._destroy();
}
}, {
key: "destroy",
value: function destroy() {
if (this._element) this._element.pause();
this._isElementPlaying = false;
_get(Object.getPrototypeOf(VideoNode.prototype), "destroy", this).call(this);
this._destroy();
}
}, {
key: "playbackRate",
set: function set(playbackRate) {
this._playbackRate = playbackRate;
this._playbackRateUpdated = true;
},
get: function get() {
return this._playbackRate;
}
}, {
key: "stretchPaused",
set: function set(stretchPaused) {
_set(Object.getPrototypeOf(VideoNode.prototype), "stretchPaused", stretchPaused, this);
if (this._element) {
if (this._stretchPaused) {
this._element.pause();
} else {
if (this._state === _sourcenode.SOURCENODESTATE.playing) {
this._element.play();
}
}
}
},
get: function get() {
return this._stretchPaused;
}
}, {
key: "elementURL",
get: function get() {
return this._elementURL;
}
}]);
return VideoNode;
})(_sourcenode2["default"]);
exports["default"] = VideoNode;
module.exports = exports["default"];
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _utilsJs = __webpack_require__(3);
var _graphnode = __webpack_require__(100);
var _graphnode2 = _interopRequireDefault(_graphnode);
var STATE = { "waiting": 0, "sequenced": 1, "playing": 2, "paused": 3, "ended": 4, "error": 5 };
var SourceNode = (function (_GraphNode) {
_inherits(SourceNode, _GraphNode);
/**
* Initialise an instance of a SourceNode.
* This is the base class for other Nodes which generate media to be passed into the processing pipeline.
*/
function SourceNode(src, gl, renderGraph, currentTime) {
_classCallCheck(this, SourceNode);
_get(Object.getPrototypeOf(SourceNode.prototype), "constructor", this).call(this, gl, renderGraph, [], true);
this._element = undefined;
this._elementURL = undefined;
this._isResponsibleForElementLifeCycle = true;
if (typeof src === "string") {
//create the node from the passed url
this._elementURL = src;
} else {
//use the passed element to create the SourceNode
this._element = src;
this._isResponsibleForElementLifeCycle = false;
}
this._state = STATE.waiting;
this._currentTime = currentTime;
this._startTime = NaN;
this._stopTime = Infinity;
this._ready = false;
this._loadCalled = false;
this._stretchPaused = false;
this._texture = (0, _utilsJs.createElementTexutre)(gl);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 0, 0]));
this._callbacks = [];
this._renderPaused = false;
this._displayName = "SourceNode";
}
/**
* Returns the state of the node.
* 0 - Waiting, start() has not been called on it yet.
* 1 - Sequenced, start() has been called but it is not playing yet.
* 2 - Playing, the node is playing.
* 3 - Paused, the node is paused.
* 4 - Ended, playback of the node has finished.
*
* @example
* var ctx = new VideoContext();
* var videoNode = ctx.createVideoSourceNode('video.mp4');
* console.log(videoNode.state); //will output 0 (for waiting)
* videoNode.start(5);
* console.log(videoNode.state); //will output 1 (for sequenced)
* videoNode.stop(10);
* ctx.play();
* console.log(videoNode.state); //will output 2 (for playing)
* ctx.paused();
* console.log(videoNode.state); //will output 3 (for paused)
*/
_createClass(SourceNode, [{
key: "_load",
value: function _load() {
if (!this._loadCalled) {
this._triggerCallbacks("load");
this._loadCalled = true;
}
}
}, {
key: "_destroy",
value: function _destroy() {
this._triggerCallbacks("destroy");
this._loadCalled = false;
}
/**
* Register callbacks against one of these events: "load", "destory", "seek", "pause", "play", "ended", "durationchange", "loaded", "error"
*
* @param {String} type - the type of event to register the callback against.
* @param {function} func - the function to call.
*
* @example
* var ctx = new VideoContext();
* var videoNode = ctx.createVideoSourceNode('video.mp4');
*
* videoNode.registerCallback("load", function(){"video is loading"});
* videoNode.registerCallback("play", function(){"video is playing"});
* videoNode.registerCallback("ended", function(){"video has eneded"});
*
*/
}, {
key: "registerCallback",
value: function registerCallback(type, func) {
this._callbacks.push({ type: type, func: func });
}
/**
* Remove callback.
*
* @param {function} [func] - the callback to remove, if undefined will remove all callbacks for this node.
*
* @example
* var ctx = new VideoContext();
* var videoNode = ctx.createVideoSourceNode('video.mp4');
*
* videoNode.registerCallback("load", function(){"video is loading"});
* videoNode.registerCallback("play", function(){"video is playing"});
* videoNode.registerCallback("ended", function(){"video has eneded"});
* videoNode.unregisterCallback(); //remove all of the three callbacks.
*
*/
}, {
key: "unregisterCallback",
value: function unregisterCallback(func) {
var toRemove = [];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = this._callbacks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var callback = _step.value;
if (func === undefined) {
toRemove.push(callback);
} else if (callback.func === func) {
toRemove.push(callback);
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = toRemove[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var callback = _step2.value;
var index = this._callbacks.indexOf(callback);
this._callbacks.splice(index, 1);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2["return"]) {
_iterator2["return"]();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
}
}, {
key: "_triggerCallbacks",
value: function _triggerCallbacks(type, data) {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (var _iterator3 = this._callbacks[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var callback = _step3.value;
if (callback.type === type) {
if (data !== undefined) {
callback.func(this, data);
} else {
callback.func(this);
}
}
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3["return"]) {
_iterator3["return"]();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
}
/**
* Start playback at VideoContext.currentTime plus passed time. If passed time is negative, will play as soon as possible.
*
* @param {number} time - the time from the currentTime of the VideoContext which to start playing, if negative will play as soon as possible.
* @return {boolean} Will return true is seqeuncing has succeded, or false if it is already sequenced.
*/
}, {
key: "start",
value: function start(time) {
if (this._state !== STATE.waiting) {
console.debug("SourceNode is has already been sequenced. Can't sequence twice.");
return false;
}
this._startTime = this._currentTime + time;
this._state = STATE.sequenced;
return true;
}
/**
* Start playback at an absolute time ont the VideoContext's timeline.
*
* @param {number} time - the time on the VideoContexts timeline to start playing.
* @return {boolean} Will return true is seqeuncing has succeded, or false if it is already sequenced.
*/
}, {
key: "startAt",
value: function startAt(time) {
if (this._state !== STATE.waiting) {
console.debug("SourceNode is has already been sequenced. Can't sequence twice.");
return false;
}
this._startTime = time;
this._state = STATE.sequenced;
return true;
}
}, {
key: "stop",
/**
* Stop playback at VideoContext.currentTime plus passed time. If passed time is negative, will play as soon as possible.
*
* @param {number} time - the time from the currentTime of the video context which to stop playback.
* @return {boolean} Will return true is seqeuncing has succeded, or false if the playback has already ended or if start hasn't been called yet, or if time is less than the start time.
*/
value: function stop(time) {
if (this._state === STATE.ended) {
console.debug("SourceNode has already ended. Cannot call stop.");
return false;
} else if (this._state === STATE.waiting) {
console.debug("SourceNode must have start called before stop is called");
return false;
}
if (this._currentTime + time <= this._startTime) {
console.debug("SourceNode must have a stop time after it's start time, not before.");
return false;
}
this._stopTime = this._currentTime + time;
this._stretchPaused = false;
this._triggerCallbacks("durationchange", this.duration);
return true;
}
/**
* Stop playback at an absolute time ont the VideoContext's timeline.
*
* @param {number} time - the time on the VideoContexts timeline to stop playing.
* @return {boolean} Will return true is seqeuncing has succeded, or false if the playback has already ended or if start hasn't been called yet, or if time is less than the start time.
*/
}, {
key: "stopAt",
value: function stopAt(time) {
if (this._state === STATE.ended) {
console.debug("SourceNode has already ended. Cannot call stop.");
return false;
} else if (this._state === STATE.waiting) {
console.debug("SourceNode must have start called before stop is called");
return false;
}
if (time <= this._startTime) {
console.debug("SourceNode must have a stop time after it's start time, not before.");
return false;
}
this._stopTime = time;
this._stretchPaused = false;
this._triggerCallbacks("durationchange", this.duration);
return true;
}
}, {
key: "_seek",
value: function _seek(time) {
this._renderPaused = false;
this._triggerCallbacks("seek", time);
if (this._state === STATE.waiting) return;
if (time < this._startTime) {
(0, _utilsJs.clearTexture)(this._gl, this._texture);
this._state = STATE.sequenced;
}
if (time >= this._startTime && this._state !== STATE.paused) {
this._state = STATE.playing;
}
if (time >= this._stopTime) {
(0, _utilsJs.clearTexture)(this._gl, this._texture);
this._triggerCallbacks("ended");
this._state = STATE.ended;
}
//update the current time
this._currentTime = time;
}
}, {
key: "_pause",
value: function _pause() {
if (this._state === STATE.playing || this._currentTime === 0 && this._startTime === 0) {
this._triggerCallbacks("pause");
this._state = STATE.paused;
this._renderPaused = false;
}
}
}, {
key: "_play",
value: function _play() {
if (this._state === STATE.paused) {
this._triggerCallbacks("play");
this._state = STATE.playing;
}
}
}, {
key: "_isReady",
value: function _isReady() {
if (this._state === STATE.playing || this._state === STATE.paused || this._state === STATE.error) {
return this._ready;
}
return true;
}
}, {
key: "_update",
value: function _update(currentTime) {
var triggerTextureUpdate = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
this._rendered = true;
var timeDelta = currentTime - this._currentTime;
//update the current time
this._currentTime = currentTime;
//update the state
if (this._state === STATE.waiting || this._state === STATE.ended || this._state === STATE.error) return false;
this._triggerCallbacks("render", currentTime);
if (currentTime < this._startTime) {
(0, _utilsJs.clearTexture)(this._gl, this._texture);
this._state = STATE.sequenced;
}
if (currentTime >= this._startTime && this._state !== STATE.paused && this._state !== STATE.error) {
if (this._state !== STATE.playing) this._triggerCallbacks("play");
this._state = STATE.playing;
}
if (currentTime >= this._stopTime) {
(0, _utilsJs.clearTexture)(this._gl, this._texture);
this._triggerCallbacks("ended");
this._state = STATE.ended;
}
//update this source nodes texture
if (this._element === undefined || this._ready === false) return true;
if (!this._renderPaused && this._state === STATE.paused) {
if (triggerTextureUpdate) (0, _utilsJs.updateTexture)(this._gl, this._texture, this._element);
this._renderPaused = true;
}
if (this._state === STATE.playing) {
if (triggerTextureUpdate) (0, _utilsJs.updateTexture)(this._gl, this._texture, this._element);
if (this._stretchPaused) {
this._stopTime += timeDelta;
}
}
return true;
}
/**
* Clear any timeline state the node currently has, this puts the node in the "waiting" state, as if neither start nor stop had been called.
*/
}, {
key: "clearTimelineState",
value: function clearTimelineState() {
this._startTime = NaN;
this._stopTime = Infinity;
this._state = STATE.waiting;
}
/**
* Destroy and clean-up the node.
*/
}, {
key: "destroy",
value: function destroy() {
_get(Object.getPrototypeOf(SourceNode.prototype), "destroy", this).call(this);
this._triggerCallbacks("destroy");
this.unregisterCallback();
delete this._element;
this._elementURL = undefined;
this._state = STATE.waiting;
this._currentTime = 0;
this._startTime = NaN;
this._stopTime = Infinity;
this._ready = false;
this._loadCalled = false;
this._texture = undefined;
}
}, {
key: "state",
get: function get() {
return this._state;
}
/**
* Returns the underlying DOM element which represents this source node.
* Note: If a source node is created with a url rather than passing in an existing element then this will return undefined until the source node preloads the element.
*
* @return {Element} The underlying DOM element representing the media for the node. If the lifecycle of the video is owned UNSIGNED_BYTE the node itself, this can return undefined if the element hasn't been loaded yet.
*
* @example
* //Accessing the Element on a VideoNode created via a URL
* var ctx = new VideoContext();
* var videoNode = ctx.createVideoSourceNode('video.mp4');
* videoNode.start(0);
* videoNode.stop(5);
* //When the node starts playing the element should exist so set it's volume to 0
* videoNode.regsiterCallback("play", function(){videoNode.element.volume = 0;});
*
*
* @example
* //Accessing the Element on a VideoNode created via an already existing element
* var ctx = new VideoContext();
* var videoElement = document.createElement("video");
* var videoNode = ctx.createVideoSourceNode(videoElement);
* videoNode.start(0);
* videoNode.stop(5);
* //The elemnt can be accessed any time because it's lifecycle is managed outside of the VideoContext
* videoNode.element.volume = 0;
*
*/
}, {
key: "element",
get: function get() {
return this._element;
}
/**
* Returns the duration of the node on a timeline. If no start time is set will return undefiend, if no stop time is set will return Infinity.
*
* @return {number} The duration of the node in seconds.
*
* @example
* var ctx = new VideoContext();
* var videoNode = ctx.createVideoSourceNode('video.mp4');
* videoNode.start(5);
* videoNode.stop(10);
* console.log(videoNode.duration); //will output 10
*/
}, {
key: "duration",
get: function get() {
if (isNaN(this._startTime)) return undefined;
if (this._stopTime === Infinity) return Infinity;
return this._stopTime - this._startTime;
}
}, {
key: "stretchPaused",
set: function set(stretchPaused) {
this._stretchPaused = stretchPaused;
},
get: function get() {
return this._stretchPaused;
}
}, {
key: "startTime",
get: function get() {
return this._startTime;
}
}, {
key: "stopTime",
get: function get() {
return this._stopTime;
}
}]);
return SourceNode;
})(_graphnode2["default"]);
exports.SOURCENODESTATE = STATE;
exports["default"] = SourceNode;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
exports.compileShader = compileShader;
exports.createShaderProgram = createShaderProgram;
exports.createElementTexutre = createElementTexutre;
exports.updateTexture = updateTexture;
exports.clearTexture = clearTexture;
exports.exportToJSON = exportToJSON;
exports.createControlFormForNode = createControlFormForNode;
exports.visualiseVideoContextGraph = visualiseVideoContextGraph;
exports.createSigmaGraphDataFromRenderGraph = createSigmaGraphDataFromRenderGraph;
exports.importSimpleEDL = importSimpleEDL;
exports.visualiseVideoContextTimeline = visualiseVideoContextTimeline;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _DefinitionsDefinitionsJs = __webpack_require__(4);
var _DefinitionsDefinitionsJs2 = _interopRequireDefault(_DefinitionsDefinitionsJs);
var _SourceNodesSourcenodeJs = __webpack_require__(2);
/*
* Utility function to compile a WebGL Vertex or Fragment shader.
*
* @param {WebGLRenderingContext} gl - the webgl context fo which to build the shader.
* @param {String} shaderSource - A string of shader code to compile.
* @param {number} shaderType - Shader type, either WebGLRenderingContext.VERTEX_SHADER or WebGLRenderingContext.FRAGMENT_SHADER.
*
* @return {WebGLShader} A compiled shader.
*
*/
function compileShader(gl, shaderSource, shaderType) {
var shader = gl.createShader(shaderType);
gl.shaderSource(shader, shaderSource);
gl.compileShader(shader);
var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
if (!success) {
throw "could not compile shader:" + gl.getShaderInfoLog(shader);
}
return shader;
}
/*
* Create a shader program from a passed vertex and fragment shader source string.
*
* @param {WebGLRenderingContext} gl - the webgl context fo which to build the shader.
* @param {String} vertexShaderSource - A string of vertex shader code to compile.
* @param {String} fragmentShaderSource - A string of fragment shader code to compile.
*
* @return {WebGLProgram} A compiled & linkde shader program.
*/
function createShaderProgram(gl, vertexShaderSource, fragmentShaderSource) {
var vertexShader = compileShader(gl, vertexShaderSource, gl.VERTEX_SHADER);
var fragmentShader = compileShader(gl, fragmentShaderSource, gl.FRAGMENT_SHADER);
var program = gl.createProgram();
gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);
gl.linkProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
throw { "error": 4, "msg": "Can't link shader program for track", toString: function toString() {
return this.msg;
} };
}
return program;
}
function createElementTexutre(gl) {
var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
// Set the parameters so we can render any size image.
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
//Initialise the texture untit to clear.
//gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, type);
return texture;
}
function updateTexture(gl, texture, element) {
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, element);
}
function clearTexture(gl, texture) {
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 0, 0]));
}
function exportToJSON(vc) {
function qualifyURL(url) {
var a = document.createElement("a");
a.href = url;
return a.href;
}
function getInputIDs(node, vc) {
var inputs = [];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = node.inputs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var input = _step.value;
if (input === undefined) continue;
var inputID = undefined;
var inputIndex = node.inputs.indexOf(input);
var index = vc._processingNodes.indexOf(input);
if (index > -1) {
inputID = "processor" + index;
} else {
var _index = vc._sourceNodes.indexOf(input);
if (_index > -1) {
inputID = "source" + _index;
} else {
console.log("Warning, can't find input", input);
}
}
inputs.push({ id: inputID, index: inputIndex });
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return inputs;
}
var result = {};
var sourceNodeStateMapping = [];
for (var state in _SourceNodesSourcenodeJs.SOURCENODESTATE) {
sourceNodeStateMapping[_SourceNodesSourcenodeJs.SOURCENODESTATE[state]] = state;
}
for (var index in vc._sourceNodes) {
var source = vc._sourceNodes[index];
var id = "source" + index;
var node_url = "";
if (!source._isResponsibleForElementLifeCycle) {
console.debug("Warning - Trying to export source created from an element not a URL. URL of export will be set to the elements src attribute and may be incorrect", source);
node_url = source.element.src;
} else {
node_url = qualifyURL(source._elementURL);
}
var node = {
type: source.displayName,
url: node_url,
start: source.startTime,
stop: source.stopTime,
state: sourceNodeStateMapping[source.state]
};
if (source._sourceOffset) {
node.sourceOffset = source._sourceOffset;
}
result[id] = node;
}
for (var index in vc._processingNodes) {
var processor = vc._processingNodes[index];
var id = "processor" + index;
var node = {
type: processor.displayName,
definition: processor._definition,
inputs: getInputIDs(processor, vc),
properties: {}
};
for (var property in node.definition.properties) {
node.properties[property] = processor[property];
}
if (node.type === "TransitionNode") {
node.transitions = processor._transitions;
}
result[id] = node;
}
result["destination"] = {
type: "Destination",
inputs: getInputIDs(vc.destination, vc)
};
return JSON.stringify(result);
}
function createControlFormForNode(node, nodeName) {
var rootDiv = document.createElement("div");
if (nodeName !== undefined) {
var title = document.createElement("h2");
title.innerHTML = nodeName;
rootDiv.appendChild(title);
}
var _loop = function (propertyName) {
var propertyParagraph = document.createElement("p");
var propertyTitleHeader = document.createElement("h3");
propertyTitleHeader.innerHTML = propertyName;
propertyParagraph.appendChild(propertyTitleHeader);
var propertyValue = node._properties[propertyName].value;
if (typeof propertyValue === "number") {
(function () {
var range = document.createElement("input");
range.setAttribute("type", "range");
range.setAttribute("min", "0");
range.setAttribute("max", "1");
range.setAttribute("step", "0.01");
range.setAttribute("value", propertyValue, toString());
var number = document.createElement("input");
number.setAttribute("type", "number");
number.setAttribute("min", "0");
number.setAttribute("max", "1");
number.setAttribute("step", "0.01");
number.setAttribute("value", propertyValue, toString());
var mouseDown = false;
range.onmousedown = function () {
mouseDown = true;
};
range.onmouseup = function () {
mouseDown = false;
};
range.onmousemove = function () {
if (mouseDown) {
node[propertyName] = parseFloat(range.value);
number.value = range.value;
}
};
range.onchange = function () {
node[propertyName] = parseFloat(range.value);
number.value = range.value;
};
number.onchange = function () {
node[propertyName] = parseFloat(number.value);
range.value = number.value;
};
propertyParagraph.appendChild(range);
propertyParagraph.appendChild(number);
})();
} else if (Object.prototype.toString.call(propertyValue) === "[object Array]") {
var _loop2 = function () {
var range = document.createElement("input");
range.setAttribute("type", "range");
range.setAttribute("min", "0");
range.setAttribute("max", "1");
range.setAttribute("step", "0.01");
range.setAttribute("value", propertyValue[i], toString());
var number = document.createElement("input");
number.setAttribute("type", "number");
number.setAttribute("min", "0");
number.setAttribute("max", "1");
number.setAttribute("step", "0.01");
number.setAttribute("value", propertyValue, toString());
var index = i;
var mouseDown = false;
range.onmousedown = function () {
mouseDown = true;
};
range.onmouseup = function () {
mouseDown = false;
};
range.onmousemove = function () {
if (mouseDown) {
node[propertyName][index] = parseFloat(range.value);
number.value = range.value;
}
};
range.onchange = function () {
node[propertyName][index] = parseFloat(range.value);
number.value = range.value;
};
number.onchange = function () {
node[propertyName][index] = parseFloat(number.value);
range.value = number.value;
};
propertyParagraph.appendChild(range);
propertyParagraph.appendChild(number);
};
for (i = 0; i < propertyValue.length; i++) {
_loop2();
}
}
rootDiv.appendChild(propertyParagraph);
};
for (var propertyName in node._properties) {
var i;
_loop(propertyName);
}
return rootDiv;
}
function calculateNodeDepthFromDestination(videoContext) {
var destination = videoContext.destination;
var depthMap = new Map();
depthMap.set(destination, 0);
function itterateBackwards(node) {
var depth = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = node.inputs[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var n = _step2.value;
var d = depth + 1;
if (depthMap.has(n)) {
if (d > depthMap.get(n)) {
depthMap.set(n, d);
}
} else {
depthMap.set(n, d);
}
itterateBackwards(n, depthMap.get(n));
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2["return"]) {
_iterator2["return"]();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
}
itterateBackwards(destination);
return depthMap;
}
function visualiseVideoContextGraph(videoContext, canvas) {
var ctx = canvas.getContext("2d");
var w = canvas.width;
var h = canvas.height;
ctx.clearRect(0, 0, w, h);
var nodeDepths = calculateNodeDepthFromDestination(videoContext);
var depths = nodeDepths.values();
depths = Array.from(depths).sort(function (a, b) {
return b - a;
});
var maxDepth = depths[0];
var xStep = w / (maxDepth + 1);
var nodeHeight = h / videoContext._sourceNodes.length / 3;
var nodeWidth = nodeHeight * 1.618;
function calculateNodePos(node, nodeDepths, xStep, nodeHeight) {
var depth = nodeDepths.get(node);
nodeDepths.values();
var count = 0;
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (var _iterator3 = nodeDepths[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var nodeDepth = _step3.value;
if (nodeDepth[0] === node) break;
if (nodeDepth[1] === depth) count += 1;
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3["return"]) {
_iterator3["return"]();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
return { x: xStep * nodeDepths.get(node), y: nodeHeight * 1.5 * count + 50 };
}
// "video":["#572A72", "#3C1255"],
// "image":["#7D9F35", "#577714"],
// "canvas":["#AA9639", "#806D15"]
for (var i = 0; i < videoContext._renderGraph.connections.length; i++) {
var conn = videoContext._renderGraph.connections[i];
var source = calculateNodePos(conn.source, nodeDepths, xStep, nodeHeight);
var destination = calculateNodePos(conn.destination, nodeDepths, xStep, nodeHeight);
if (source !== undefined && destination !== undefined) {
ctx.beginPath();
//ctx.moveTo(source.x + nodeWidth/2, source.y + nodeHeight/2);
var x1 = source.x + nodeWidth / 2;
var y1 = source.y + nodeHeight / 2;
var x2 = destination.x + nodeWidth / 2;
var y2 = destination.y + nodeHeight / 2;
var dx = x2 - x1;
var dy = y2 - y1;
var angle = Math.PI / 2 - Math.atan2(dx, dy);
var distance = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
var midX = Math.min(x1, x2) + (Math.max(x1, x2) - Math.min(x1, x2)) / 2;
var midY = Math.min(y1, y2) + (Math.max(y1, y2) - Math.min(y1, y2)) / 2;
var testX = Math.cos(angle + Math.PI / 2) * distance / 1.5 + midX;
var testY = Math.sin(angle + Math.PI / 2) * distance / 1.5 + midY;
// console.log(testX, testY);
ctx.arc(testX, testY, distance / 1.2, angle - Math.PI + 0.95, angle - 0.95);
//ctx.arcTo(source.x + nodeWidth/2 ,source.y + nodeHeight/2,destination.x + nodeWidth/2,destination.y + nodeHeight/2,100);
//ctx.lineTo(midX, midY);
ctx.stroke();
//ctx.endPath();
}
}
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
try {
for (var _iterator4 = nodeDepths.keys()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var node = _step4.value;
var pos = calculateNodePos(node, nodeDepths, xStep, nodeHeight);
var color = "#AA9639";
var text = "";
if (node.displayName === "CompositingNode") {
color = "#000000";
}
if (node.displayName === "DestinationNode") {
color = "#7D9F35";
text = "Output";
}
if (node.displayName === "VideoNode") {
color = "#572A72";
text = "Video";
}
if (node.displayName === "CanvasNode") {
color = "#572A72";
text = "Canvas";
}
if (node.displayName === "ImageNode") {
color = "#572A72";
text = "Image";
}
ctx.beginPath();
ctx.fillStyle = color;
ctx.fillRect(pos.x, pos.y, nodeWidth, nodeHeight);
ctx.fill();
ctx.fillStyle = "#000";
ctx.textAlign = "center";
ctx.font = "10px Arial";
ctx.fillText(text, pos.x + nodeWidth / 2, pos.y + nodeHeight / 2 + 2.5);
ctx.fill();
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4["return"]) {
_iterator4["return"]();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
return;
}
function createSigmaGraphDataFromRenderGraph(videoContext) {
function idForNode(node) {
if (videoContext._sourceNodes.indexOf(node) !== -1) {
var _id = "source " + node.displayName + " " + videoContext._sourceNodes.indexOf(node);
return _id;
}
var id = "processor " + node.displayName + " " + videoContext._processingNodes.indexOf(node);
return id;
}
var graph = {
nodes: [{
id: idForNode(videoContext.destination),
label: "Destination Node",
x: 2.5,
y: 0.5,
size: 2,
node: videoContext.destination
}],
edges: []
};
for (var i = 0; i < videoContext._sourceNodes.length; i++) {
var sourceNode = videoContext._sourceNodes[i];
var y = i * (1.0 / videoContext._sourceNodes.length);
graph.nodes.push({
id: idForNode(sourceNode),
label: "Source " + i.toString(),
x: 0,
y: y,
size: 2,
color: "#572A72",
node: sourceNode
});
}
for (var i = 0; i < videoContext._processingNodes.length; i++) {
var processingNode = videoContext._processingNodes[i];
graph.nodes.push({
id: idForNode(processingNode),
x: Math.random() * 2.5,
y: Math.random(),
size: 2,
node: processingNode
});
}
for (var i = 0; i < videoContext._renderGraph.connections.length; i++) {
var conn = videoContext._renderGraph.connections[i];
graph.edges.push({
"id": "e" + i.toString(),
"source": idForNode(conn.source),
"target": idForNode(conn.destination)
});
}
return graph;
}
function importSimpleEDL(ctx, playlist) {
// Create a "track" node to connect all the clips to.
var trackNode = ctx.compositor(_DefinitionsDefinitionsJs2["default"].COMBINE);
// Create a source node for each of the clips.
var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false;
var _iteratorError5 = undefined;
try {
for (var _iterator5 = playlist[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var clip = _step5.value;
var node = undefined;
if (clip.type === "video") {
node = ctx.video(clip.src, clip.sourceStart);
} else if (clip.type === "image") {
node = ctx.image(clip.src, clip.sourceStart);
} else {
console.debug("Clip type \"" + clip.type + "\" not recognised, skipping.");
continue;
}
node.startAt(clip.start);
node.stopAt(clip.start + clip.duration);
node.connect(trackNode);
}
} catch (err) {
_didIteratorError5 = true;
_iteratorError5 = err;
} finally {
try {
if (!_iteratorNormalCompletion5 && _iterator5["return"]) {
_iterator5["return"]();
}
} finally {
if (_didIteratorError5) {
throw _iteratorError5;
}
}
}
return trackNode;
}
function visualiseVideoContextTimeline(videoContext, canvas, currentTime) {
var ctx = canvas.getContext("2d");
var w = canvas.width;
var h = canvas.height;
var trackHeight = h / videoContext._sourceNodes.length;
var playlistDuration = videoContext.duration;
if (currentTime > playlistDuration && !videoContext.endOnLastSourceEnd) playlistDuration = currentTime;
if (videoContext.duration === Infinity) {
var total = 0;
for (var i = 0; i < videoContext._sourceNodes.length; i++) {
var sourceNode = videoContext._sourceNodes[i];
if (sourceNode._stopTime !== Infinity) total += sourceNode._stopTime;
}
if (total > videoContext.currentTime) {
playlistDuration = total + 5;
} else {
playlistDuration = videoContext.currentTime + 5;
}
}
var pixelsPerSecond = w / playlistDuration;
var mediaSourceStyle = {
"video": ["#572A72", "#3C1255"],
"image": ["#7D9F35", "#577714"],
"canvas": ["#AA9639", "#806D15"]
};
ctx.clearRect(0, 0, w, h);
ctx.fillStyle = "#999";
var _iteratorNormalCompletion6 = true;
var _didIteratorError6 = false;
var _iteratorError6 = undefined;
try {
for (var _iterator6 = videoContext._processingNodes[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
var node = _step6.value;
if (node.displayName !== "TransitionNode") continue;
for (var propertyName in node._transitions) {
var _iteratorNormalCompletion7 = true;
var _didIteratorError7 = false;
var _iteratorError7 = undefined;
try {
for (var _iterator7 = node._transitions[propertyName][Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
var transition = _step7.value;
var tW = (transition.end - transition.start) * pixelsPerSecond;
var tH = h;
var tX = transition.start * pixelsPerSecond;
var tY = 0;
ctx.fillStyle = "rgba(0,0,0, 0.3)";
ctx.fillRect(tX, tY, tW, tH);
ctx.fill();
}
} catch (err) {
_didIteratorError7 = true;
_iteratorError7 = err;
} finally {
try {
if (!_iteratorNormalCompletion7 && _iterator7["return"]) {
_iterator7["return"]();
}
} finally {
if (_didIteratorError7) {
throw _iteratorError7;
}
}
}
}
}
} catch (err) {
_didIteratorError6 = true;
_iteratorError6 = err;
} finally {
try {
if (!_iteratorNormalCompletion6 && _iterator6["return"]) {
_iterator6["return"]();
}
} finally {
if (_didIteratorError6) {
throw _iteratorError6;
}
}
}
for (var i = 0; i < videoContext._sourceNodes.length; i++) {
var sourceNode = videoContext._sourceNodes[i];
var duration = sourceNode._stopTime - sourceNode._startTime;
if (duration === Infinity) duration = videoContext.currentTime;
var start = sourceNode._startTime;
var msW = duration * pixelsPerSecond;
var msH = trackHeight;
var msX = start * pixelsPerSecond;
var msY = trackHeight * i;
ctx.fillStyle = mediaSourceStyle.video[i % mediaSourceStyle.video.length];
ctx.fillRect(msX, msY, msW, msH);
ctx.fill();
}
if (currentTime !== undefined) {
ctx.fillStyle = "#000";
ctx.fillRect(currentTime * pixelsPerSecond, 0, 1, h);
}
}
var UpdateablesManager = (function () {
function UpdateablesManager() {
_classCallCheck(this, UpdateablesManager);
this._updateables = [];
this._useWebworker = false;
this._active = false;
this._previousRAFTime = undefined;
this._previousWorkerTime = undefined;
this._webWorkerString = "\
var running = false;\
function tick(){\
postMessage(Date.now());\
if (running){\
setTimeout(tick, 1000/20);\
}\
}\
self.addEventListener('message',function(msg){\
var data = msg.data;\
if (data === 'start'){\
running = true;\
tick();\
}\
if (data === 'stop') running = false;\
});";
this._webWorker = undefined;
}
_createClass(UpdateablesManager, [{
key: "_initWebWorker",
value: function _initWebWorker() {
var _this = this;
window.URL = window.URL || window.webkitURL;
var blob = new Blob([this._webWorkerString], { type: "application/javascript" });
this._webWorker = new Worker(URL.createObjectURL(blob));
this._webWorker.onmessage = function (msg) {
var time = msg.data;
_this._updateWorkerTime(time);
};
}
}, {
key: "_lostVisibility",
value: function _lostVisibility() {
this._previousWorkerTime = Date.now();
this._useWebworker = true;
if (!this._webWorker) {
this._initWebWorker();
}
this._webWorker.postMessage("start");
}
}, {
key: "_gainedVisibility",
value: function _gainedVisibility() {
this._useWebworker = false;
this._previousRAFTime = undefined;
if (this._webWorker) this._webWorker.postMessage("stop");
requestAnimationFrame(this._updateRAFTime.bind(this));
}
}, {
key: "_init",
value: function _init() {
var _this2 = this;
if (!window.Worker) return;
//If page visibility API not present fallback to using "focus" and "blur" event listeners.
if (typeof document.hidden === "undefined") {
window.addEventListener("focus", this._gainedVisibility.bind(this));
window.addEventListener("blur", this._lostVisibility.bind(this));
return;
}
//Otherwise we can use the visibility API to do the loose/gain focus properly
document.addEventListener("visibilitychange", function () {
if (document.hidden === true) {
_this2._lostVisibility();
} else {
_this2._gainedVisibility();
}
}, false);
requestAnimationFrame(this._updateRAFTime.bind(this));
}
}, {
key: "_updateWorkerTime",
value: function _updateWorkerTime(time) {
var dt = (time - this._previousWorkerTime) / 1000;
if (dt !== 0) this._update(dt);
this._previousWorkerTime = time;
}
}, {
key: "_updateRAFTime",
value: function _updateRAFTime(time) {
if (this._previousRAFTime === undefined) this._previousRAFTime = time;
var dt = (time - this._previousRAFTime) / 1000;
if (dt !== 0) this._update(dt);
this._previousRAFTime = time;
if (!this._useWebworker) requestAnimationFrame(this._updateRAFTime.bind(this));
}
}, {
key: "_update",
value: function _update(dt) {
for (var i = 0; i < this._updateables.length; i++) {
this._updateables[i]._update(parseFloat(dt));
}
}
}, {
key: "register",
value: function register(updateable) {
this._updateables.push(updateable);
if (this._active === false) {
this._active = true;
this._init();
}
}
}]);
return UpdateablesManager;
})();
exports.UpdateablesManager = UpdateablesManager;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _aaf_video_scaleJs = __webpack_require__(5);
var _aaf_video_scaleJs2 = _interopRequireDefault(_aaf_video_scaleJs);
var _crossfadeJs = __webpack_require__(6);
var _crossfadeJs2 = _interopRequireDefault(_crossfadeJs);
var _horizontalWipeJs = __webpack_require__(7);
var _horizontalWipeJs2 = _interopRequireDefault(_horizontalWipeJs);
var _verticalWipeJs = __webpack_require__(8);
var _verticalWipeJs2 = _interopRequireDefault(_verticalWipeJs);
var _randomDissolveJs = __webpack_require__(9);
var _randomDissolveJs2 = _interopRequireDefault(_randomDissolveJs);
var _toColorAndBackFadeJs = __webpack_require__(10);
var _toColorAndBackFadeJs2 = _interopRequireDefault(_toColorAndBackFadeJs);
var _starWipeJs = __webpack_require__(11);
var _starWipeJs2 = _interopRequireDefault(_starWipeJs);
var _combineJs = __webpack_require__(12);
var _combineJs2 = _interopRequireDefault(_combineJs);
var _colorThresholdJs = __webpack_require__(13);
var _colorThresholdJs2 = _interopRequireDefault(_colorThresholdJs);
var _monochromeJs = __webpack_require__(14);
var _monochromeJs2 = _interopRequireDefault(_monochromeJs);
var _horizontalBlurJs = __webpack_require__(15);
var _horizontalBlurJs2 = _interopRequireDefault(_horizontalBlurJs);
var _verticalBlurJs = __webpack_require__(16);
var _verticalBlurJs2 = _interopRequireDefault(_verticalBlurJs);
var _aaf_video_flopJs = __webpack_require__(17);
var _aaf_video_flopJs2 = _interopRequireDefault(_aaf_video_flopJs);
var _aaf_video_flipJs = __webpack_require__(18);
var _aaf_video_flipJs2 = _interopRequireDefault(_aaf_video_flipJs);
var _aaf_video_positionJs = __webpack_require__(19);
var _aaf_video_positionJs2 = _interopRequireDefault(_aaf_video_positionJs);
var _aaf_video_cropJs = __webpack_require__(20);
var _aaf_video_cropJs2 = _interopRequireDefault(_aaf_video_cropJs);
var _staticDissolveJs = __webpack_require__(21);
var _staticDissolveJs2 = _interopRequireDefault(_staticDissolveJs);
var _staticEffectJs = __webpack_require__(22);
var _staticEffectJs2 = _interopRequireDefault(_staticEffectJs);
var _dreamfadeJs = __webpack_require__(23);
var _dreamfadeJs2 = _interopRequireDefault(_dreamfadeJs);
var _cubeJs = __webpack_require__(24);
var _cubeJs2 = _interopRequireDefault(_cubeJs);
var _morphJs = __webpack_require__(25);
var _morphJs2 = _interopRequireDefault(_morphJs);
var _crosszoomJs = __webpack_require__(26);
var _crosszoomJs2 = _interopRequireDefault(_crosszoomJs);
var _swapJs = __webpack_require__(27);
var _swapJs2 = _interopRequireDefault(_swapJs);
var _squareswipeJs = __webpack_require__(28);
var _squareswipeJs2 = _interopRequireDefault(_squareswipeJs);
var _slideJs = __webpack_require__(29);
var _slideJs2 = _interopRequireDefault(_slideJs);
var _simpleflipJs = __webpack_require__(30);
var _simpleflipJs2 = _interopRequireDefault(_simpleflipJs);
var _pinwheelJs = __webpack_require__(31);
var _pinwheelJs2 = _interopRequireDefault(_pinwheelJs);
var _powerDisformationJs = __webpack_require__(32);
var _powerDisformationJs2 = _interopRequireDefault(_powerDisformationJs);
var _polkaDotsCurtainJs = __webpack_require__(33);
var _polkaDotsCurtainJs2 = _interopRequireDefault(_polkaDotsCurtainJs);
var _kalerdoscopeJs = __webpack_require__(34);
var _kalerdoscopeJs2 = _interopRequireDefault(_kalerdoscopeJs);
var _doomscreenJs = __webpack_require__(35);
var _doomscreenJs2 = _interopRequireDefault(_doomscreenJs);
var _star_wipeJs = __webpack_require__(36);
var _star_wipeJs2 = _interopRequireDefault(_star_wipeJs);
var _potleafJs = __webpack_require__(37);
var _potleafJs2 = _interopRequireDefault(_potleafJs);
var _glitchJs = __webpack_require__(38);
var _glitchJs2 = _interopRequireDefault(_glitchJs);
var _dreamyzoomJs = __webpack_require__(39);
var _dreamyzoomJs2 = _interopRequireDefault(_dreamyzoomJs);
var _tilewaveBottomToTopJs = __webpack_require__(40);
var _tilewaveBottomToTopJs2 = _interopRequireDefault(_tilewaveBottomToTopJs);
var _tilescanlineJs = __webpack_require__(41);
var _tilescanlineJs2 = _interopRequireDefault(_tilescanlineJs);
var _dreamyJs = __webpack_require__(42);
var _dreamyJs2 = _interopRequireDefault(_dreamyJs);
var _advancedmosaicJs = __webpack_require__(43);
var _advancedmosaicJs2 = _interopRequireDefault(_advancedmosaicJs);
var _swirlJs = __webpack_require__(44);
var _swirlJs2 = _interopRequireDefault(_swirlJs);
var _defocusBlurJs = __webpack_require__(45);
var _defocusBlurJs2 = _interopRequireDefault(_defocusBlurJs);
var _colourDistanceJs = __webpack_require__(46);
var _colourDistanceJs2 = _interopRequireDefault(_colourDistanceJs);
var _dissolveJs = __webpack_require__(47);
var _dissolveJs2 = _interopRequireDefault(_dissolveJs);
var _hsvfadeJs = __webpack_require__(48);
var _hsvfadeJs2 = _interopRequireDefault(_hsvfadeJs);
var _foldJs = __webpack_require__(49);
var _foldJs2 = _interopRequireDefault(_foldJs);
var _linearblurJs = __webpack_require__(50);
var _linearblurJs2 = _interopRequireDefault(_linearblurJs);
var _pixelizeJs = __webpack_require__(51);
var _pixelizeJs2 = _interopRequireDefault(_pixelizeJs);
var _randomsquaresJs = __webpack_require__(52);
var _randomsquaresJs2 = _interopRequireDefault(_randomsquaresJs);
var _pagecurlJs = __webpack_require__(53);
var _pagecurlJs2 = _interopRequireDefault(_pagecurlJs);
var _polkadotsJs = __webpack_require__(54);
var _polkadotsJs2 = _interopRequireDefault(_polkadotsJs);
var _burnJs = __webpack_require__(55);
var _burnJs2 = _interopRequireDefault(_burnJs);
var _finalGaussianNoiseJs = __webpack_require__(56);
var _finalGaussianNoiseJs2 = _interopRequireDefault(_finalGaussianNoiseJs);
var _mosaiczoomJs = __webpack_require__(57);
var _mosaiczoomJs2 = _interopRequireDefault(_mosaiczoomJs);
var _radialJs = __webpack_require__(58);
var _radialJs2 = _interopRequireDefault(_radialJs);
var _butterflyWaveScrawlerJs = __webpack_require__(59);
var _butterflyWaveScrawlerJs2 = _interopRequireDefault(_butterflyWaveScrawlerJs);
var _crazyparametricfunJs = __webpack_require__(60);
var _crazyparametricfunJs2 = _interopRequireDefault(_crazyparametricfunJs);
var _rippleJs = __webpack_require__(61);
var _rippleJs2 = _interopRequireDefault(_rippleJs);
var _flashJs = __webpack_require__(62);
var _flashJs2 = _interopRequireDefault(_flashJs);
var _flyeyeJs = __webpack_require__(63);
var _flyeyeJs2 = _interopRequireDefault(_flyeyeJs);
var _doorwayJs = __webpack_require__(64);
var _doorwayJs2 = _interopRequireDefault(_doorwayJs);
var _circleopenJs = __webpack_require__(65);
var _circleopenJs2 = _interopRequireDefault(_circleopenJs);
var _fadecolorJs = __webpack_require__(66);
var _fadecolorJs2 = _interopRequireDefault(_fadecolorJs);
var _heartwipeJs = __webpack_require__(67);
var _heartwipeJs2 = _interopRequireDefault(_heartwipeJs);
var _dispersionblurJs = __webpack_require__(68);
var _dispersionblurJs2 = _interopRequireDefault(_dispersionblurJs);
var _invertedPagecurlJs = __webpack_require__(69);
var _invertedPagecurlJs2 = _interopRequireDefault(_invertedPagecurlJs);
var _waterdropJs = __webpack_require__(70);
var _waterdropJs2 = _interopRequireDefault(_waterdropJs);
var _stereoViewerToyJs = __webpack_require__(71);
var _stereoViewerToyJs2 = _interopRequireDefault(_stereoViewerToyJs);
var _wipeupJs = __webpack_require__(72);
var _wipeupJs2 = _interopRequireDefault(_wipeupJs);
var _circlecropJs = __webpack_require__(73);
var _circlecropJs2 = _interopRequireDefault(_circlecropJs);
var _revealJs = __webpack_require__(74);
var _revealJs2 = _interopRequireDefault(_revealJs);
var _puzzlerightJs = __webpack_require__(75);
var _puzzlerightJs2 = _interopRequireDefault(_puzzlerightJs);
var _warpfadeJs = __webpack_require__(76);
var _warpfadeJs2 = _interopRequireDefault(_warpfadeJs);
var _bounceJs = __webpack_require__(77);
var _bounceJs2 = _interopRequireDefault(_bounceJs);
var _atmosphericSlidershowJs = __webpack_require__(78);
var _atmosphericSlidershowJs2 = _interopRequireDefault(_atmosphericSlidershowJs);
var _luminancemeltJs = __webpack_require__(79);
var _luminancemeltJs2 = _interopRequireDefault(_luminancemeltJs);
var _crosshatchJs = __webpack_require__(80);
var _crosshatchJs2 = _interopRequireDefault(_crosshatchJs);
var _saturationJs = __webpack_require__(81);
var _saturationJs2 = _interopRequireDefault(_saturationJs);
var _gaussianHBlurJs = __webpack_require__(82);
var _gaussianHBlurJs2 = _interopRequireDefault(_gaussianHBlurJs);
var _gaussianVBlurJs = __webpack_require__(83);
var _gaussianVBlurJs2 = _interopRequireDefault(_gaussianVBlurJs);
var _luminanceJs = __webpack_require__(84);
var _luminanceJs2 = _interopRequireDefault(_luminanceJs);
var _glassblurJs = __webpack_require__(85);
var _glassblurJs2 = _interopRequireDefault(_glassblurJs);
var _radiusGaussianHBlurJs = __webpack_require__(86);
var _radiusGaussianHBlurJs2 = _interopRequireDefault(_radiusGaussianHBlurJs);
var _radiusGaussianVBlurJs = __webpack_require__(87);
var _radiusGaussianVBlurJs2 = _interopRequireDefault(_radiusGaussianVBlurJs);
var _cropWidthJs = __webpack_require__(88);
var _cropWidthJs2 = _interopRequireDefault(_cropWidthJs);
var _opacityJs = __webpack_require__(89);
var _opacityJs2 = _interopRequireDefault(_opacityJs);
var _lookupJs = __webpack_require__(90);
var _lookupJs2 = _interopRequireDefault(_lookupJs);
var _drawimageJs = __webpack_require__(91);
var _drawimageJs2 = _interopRequireDefault(_drawimageJs);
var _blackpadJs = __webpack_require__(92);
var _blackpadJs2 = _interopRequireDefault(_blackpadJs);
var _regionmosaicJs = __webpack_require__(93);
var _regionmosaicJs2 = _interopRequireDefault(_regionmosaicJs);
var _croprectJs = __webpack_require__(94);
var _croprectJs2 = _interopRequireDefault(_croprectJs);
var _gaussianConstHBlurJs = __webpack_require__(95);
var _gaussianConstHBlurJs2 = _interopRequireDefault(_gaussianConstHBlurJs);
var _gaussianConstVBlurJs = __webpack_require__(96);
var _gaussianConstVBlurJs2 = _interopRequireDefault(_gaussianConstVBlurJs);
var _meanHBlurJs = __webpack_require__(97);
var _meanHBlurJs2 = _interopRequireDefault(_meanHBlurJs);
var _meanVBlurJs = __webpack_require__(98);
var _meanVBlurJs2 = _interopRequireDefault(_meanVBlurJs);
var _cropblackJs = __webpack_require__(99);
var _cropblackJs2 = _interopRequireDefault(_cropblackJs);
var DEFINITIONS = {
CUBE: _cubeJs2["default"],
MORPH: _morphJs2["default"],
CROSS_ZOOM: _crosszoomJs2["default"],
SWAP: _swapJs2["default"],
SQUARE_SWIPE: _squareswipeJs2["default"],
SLIDE: _slideJs2["default"],
SIMPLE_FLIP: _simpleflipJs2["default"],
PIN_WHEEL: _pinwheelJs2["default"],
POWER_DISFORMATION: _powerDisformationJs2["default"],
POLKADOTS_CURTAIN: _polkaDotsCurtainJs2["default"],
KALERDO_SCOPE: _kalerdoscopeJs2["default"],
DOOM_SCREEN: _doomscreenJs2["default"],
STARWIPE: _star_wipeJs2["default"],
POTLEAF: _potleafJs2["default"],
GLITCH: _glitchJs2["default"],
DREAMY_ZOOM: _dreamyzoomJs2["default"],
TILE_WAVE_BOTTOM_TO_TOP: _tilewaveBottomToTopJs2["default"],
TILE_SCAN_LINE: _tilescanlineJs2["default"],
DREAMY: _dreamyJs2["default"],
ADVANCED_MOSAIC: _advancedmosaicJs2["default"],
SWIRL: _swirlJs2["default"],
DEFOCUS_BLUR: _defocusBlurJs2["default"],
COLOUR_DISTANCE: _colourDistanceJs2["default"],
DISSOLVE: _dissolveJs2["default"],
HSVFADE: _hsvfadeJs2["default"],
FOLD: _foldJs2["default"],
LINEAR_BLUR: _linearblurJs2["default"],
PIXELIZE: _pixelizeJs2["default"],
RANDOM_SQUARES: _randomsquaresJs2["default"],
PAGE_CURL: _pagecurlJs2["default"],
POLKADOTS: _polkadotsJs2["default"],
BURN: _burnJs2["default"],
FINAL_GAUSSIAN_NOISE: _finalGaussianNoiseJs2["default"],
MOSAIC_ZOOM: _mosaiczoomJs2["default"],
RADIAL: _radialJs2["default"],
BUTTERFLY_WAVE_SCRAWLER: _butterflyWaveScrawlerJs2["default"],
CRAZY_PARAMETRIC_FUN: _crazyparametricfunJs2["default"],
RIPPLE: _rippleJs2["default"],
FLASH: _flashJs2["default"],
FLYEYE: _flyeyeJs2["default"],
DOORWAY: _doorwayJs2["default"],
CIRCLE_OPEN: _circleopenJs2["default"],
FADE_COLOR: _fadecolorJs2["default"],
HEART_WIPE: _heartwipeJs2["default"],
DISPERSION_BLUR: _dispersionblurJs2["default"],
INVERTED_PAGECURL: _invertedPagecurlJs2["default"],
WATER_DROP: _waterdropJs2["default"],
STEREO_VIEWER_TOY: _stereoViewerToyJs2["default"],
WIPE_UP: _wipeupJs2["default"],
CIRCLE_CROP: _circlecropJs2["default"],
REVEAL: _revealJs2["default"],
PUZZLE_RIGHT: _puzzlerightJs2["default"],
WARP_FADE: _warpfadeJs2["default"],
BOUNCE: _bounceJs2["default"],
ATMOSPHERIC_SLIDERSHOW: _atmosphericSlidershowJs2["default"],
LUMINANCEMELT: _luminancemeltJs2["default"],
CROSSHATCH: _crosshatchJs2["default"],
SATURATION: _saturationJs2["default"],
GAUSSIAN_HBLUR: _gaussianHBlurJs2["default"],
GAUSSIAN_VBLUR: _gaussianVBlurJs2["default"],
LUMINANCE: _luminanceJs2["default"],
GLASSBLUR: _glassblurJs2["default"],
RADIUS_GAUSSIAN_HBLUR: _radiusGaussianHBlurJs2["default"],
RADIUS_GAUSSIAN_VBLUR: _radiusGaussianVBlurJs2["default"],
CROP_WIDTH: _cropWidthJs2["default"],
LOOKUP: _lookupJs2["default"],
DRAWIMAGE: _drawimageJs2["default"],
BLACKPAD: _blackpadJs2["default"],
REGIONMOSAIC: _regionmosaicJs2["default"],
CROPRECT: _croprectJs2["default"],
GAUSSIAN_CONST_HBLUR: _gaussianConstHBlurJs2["default"],
GAUSSIAN_CONST_VBLUR: _gaussianConstVBlurJs2["default"],
MEAN_HBLUR: _meanHBlurJs2["default"],
MEAN_VBLUR: _meanVBlurJs2["default"],
CROPBLACK: _cropblackJs2["default"],
AAF_VIDEO_SCALE: _aaf_video_scaleJs2["default"],
CROSSFADE: _crossfadeJs2["default"],
DREAMFADE: _dreamfadeJs2["default"],
HORIZONTAL_WIPE: _horizontalWipeJs2["default"],
VERTICAL_WIPE: _verticalWipeJs2["default"],
RANDOM_DISSOLVE: _randomDissolveJs2["default"],
STATIC_DISSOLVE: _staticDissolveJs2["default"],
STATIC_EFFECT: _staticEffectJs2["default"],
TO_COLOR_AND_BACK: _toColorAndBackFadeJs2["default"],
STAR_WIPE: _starWipeJs2["default"],
COMBINE: _combineJs2["default"],
COLORTHRESHOLD: _colorThresholdJs2["default"],
MONOCHROME: _monochromeJs2["default"],
HORIZONTAL_BLUR: _horizontalBlurJs2["default"],
VERTICAL_BLUR: _verticalBlurJs2["default"],
AAF_VIDEO_CROP: _aaf_video_cropJs2["default"],
AAF_VIDEO_POSITION: _aaf_video_positionJs2["default"],
AAF_VIDEO_FLIP: _aaf_video_flipJs2["default"],
AAF_VIDEO_FLOP: _aaf_video_flopJs2["default"],
OPACITY: _opacityJs2["default"]
};
exports["default"] = DEFINITIONS;
module.exports = exports["default"];
/***/ }),
/* 5 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var aaf_video_scale = {
"title": "AAF Video Scale Effect",
"description": "A scale effect based on the AAF spec.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
uniform float scaleX;\
uniform float scaleY;\
varying vec2 v_texCoord;\
varying float v_progress;\
void main(){\
vec2 pos = vec2(v_texCoord[0]*1.0/scaleX - (1.0/scaleX/2.0 -0.5), v_texCoord[1]*1.0/scaleY - (1.0/scaleY/2.0 -0.5));\
vec4 color = texture2D(u_image, pos);\
if (pos[0] < 0.0 || pos[0] > 1.0 || pos[1] < 0.0 || pos[1] > 1.0){\
color = vec4(0.0,0.0,0.0,0.0);\
}\
gl_FragColor = color;\
}",
"properties": {
"scaleX": { "type": "uniform", "value": 1.0 },
"scaleY": { "type": "uniform", "value": 1.0 }
},
"inputs": ["u_image"]
};
exports["default"] = aaf_video_scale;
module.exports = exports["default"];
/***/ }),
/* 6 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var crossfade = {
"title": "Cross-Fade",
"description": "A cross-fade effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform float mix;\
varying vec2 v_texCoord;\
varying float v_mix;\
void main(){\
vec4 color_a = texture2D(u_image_a, v_texCoord);\
vec4 color_b = texture2D(u_image_b, v_texCoord);\
color_a[0] *= (1.0 - mix);\
color_a[1] *= (1.0 - mix);\
color_a[2] *= (1.0 - mix);\
color_a[3] *= (1.0 - mix);\
color_b[0] *= mix;\
color_b[1] *= mix;\
color_b[2] *= mix;\
color_b[3] *= mix;\
gl_FragColor = color_a + color_b;\
}",
"properties": {
"mix": { "type": "uniform", "value": 0.0 }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = crossfade;
module.exports = exports["default"];
/***/ }),
/* 7 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var horizontal_wipe = {
"title": "Horizontal Wipe",
"description": "A horizontal wipe effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform float mix;\
varying vec2 v_texCoord;\
varying float v_mix;\
void main(){\
vec4 color_a = texture2D(u_image_a, v_texCoord);\
vec4 color_b = texture2D(u_image_b, v_texCoord);\
if (v_texCoord[0] > mix){\
gl_FragColor = color_a;\
} else {\
gl_FragColor = color_b;\
}\
}",
"properties": {
"mix": { "type": "uniform", "value": 0.0 }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = horizontal_wipe;
module.exports = exports["default"];
/***/ }),
/* 8 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var verticalWipe = {
"title": "vertical Wipe",
"description": "A vertical wipe effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform float mix;\
varying vec2 v_texCoord;\
varying float v_mix;\
void main(){\
vec4 color_a = texture2D(u_image_a, v_texCoord);\
vec4 color_b = texture2D(u_image_b, v_texCoord);\
if (v_texCoord[1] > mix){\
gl_FragColor = color_a;\
} else {\
gl_FragColor = color_b;\
}\
}",
"properties": {
"mix": { "type": "uniform", "value": 0.0 }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = verticalWipe;
module.exports = exports["default"];
/***/ }),
/* 9 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var randomDissolve = {
"title": "Random Dissolve",
"description": "A random dissolve effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform float mix;\
varying vec2 v_texCoord;\
varying float v_mix;\
float rand(vec2 co){\
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\
}\
void main(){\
vec4 color_a = texture2D(u_image_a, v_texCoord);\
vec4 color_b = texture2D(u_image_b, v_texCoord);\
if (clamp(rand(v_texCoord), 0.01, 1.001) > mix){\
gl_FragColor = color_a;\
} else {\
gl_FragColor = color_b;\
}\
}",
"properties": {
"mix": { "type": "uniform", "value": 0.0 }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = randomDissolve;
module.exports = exports["default"];
/***/ }),
/* 10 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var toColorAndBackFade = {
"title": "To Color And Back Fade",
"description": "A fade to black and back effect. Setting mix to 0.5 is a fully solid color frame. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform float mix;\
uniform vec4 color;\
varying vec2 v_texCoord;\
varying float v_mix;\
void main(){\
vec4 color_a = texture2D(u_image_a, v_texCoord);\
vec4 color_b = texture2D(u_image_b, v_texCoord);\
float mix_amount = (mix *2.0) - 1.0;\
if(mix_amount < 0.0){\
gl_FragColor = abs(mix_amount) * color_a + (1.0 - abs(mix_amount)) * color;\
} else {\
gl_FragColor = mix_amount * color_b + (1.0 - mix_amount) * color;\
}\
}",
"properties": {
"mix": { "type": "uniform", "value": 0.0 },
"color": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = toColorAndBackFade;
module.exports = exports["default"];
/***/ }),
/* 11 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var starWipe = {
"title": "Star Wipe Fade",
"description": "A classic star wipe transistion. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform float mix;\
varying vec2 v_texCoord;\
varying float v_mix;\
float sign (vec2 p1, vec2 p2, vec2 p3){\
return (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1]);\
}\
bool pointInTriangle(vec2 pt, vec2 v1, vec2 v2, vec2 v3){\
bool b1, b2, b3;\
b1 = sign(pt, v1, v2) < 0.0;\
b2 = sign(pt, v2, v3) < 0.0;\
b3 = sign(pt, v3, v1) < 0.0;\
return ((b1 == b2) && (b2 == b3));\
}\
vec2 rotatePointAboutPoint(vec2 point, vec2 pivot, float angle){\
float s = sin(angle);\
float c = cos(angle);\
float x = point[0] - pivot[0];\
float y = point[1] - pivot[1];\
float new_x = x * c - y * s;\
float new_y = x * s + y * c;\
return vec2(new_x + pivot[0], new_y+pivot[1]);\
}\
\
void main(){\
vec4 color_a = texture2D(u_image_b, v_texCoord);\
vec4 color_b = texture2D(u_image_a, v_texCoord);\
vec2 t0_p0,t0_p1,t0_p2,t1_p0,t1_p1,t1_p2,t2_p0,t2_p1,t2_p2,t3_p0,t3_p1,t3_p2;\
vec2 t4_p0,t4_p1,t4_p2,t5_p0,t5_p1,t5_p2,t6_p0,t6_p1,t6_p2,t7_p0,t7_p1,t7_p2;\
\
\
t0_p0 = vec2(0.0, 0.25) * clamp(mix,0.0,1.0) * 2.0 + vec2(0.5,0.5);\
t0_p1 = vec2(0.0, -0.25) * clamp(mix,0.0,1.0) * 2.0 + vec2(0.5,0.5);\
t0_p2 = vec2(1.0, 0.0) * clamp(mix,0.0,1.0) * 2.0 + vec2(0.5,0.5);\
\
t1_p0 = rotatePointAboutPoint(t0_p0, vec2(0.5,0.5), 0.7854);\
t1_p1 = rotatePointAboutPoint(t0_p1, vec2(0.5,0.5), 0.7854);\
t1_p2 = rotatePointAboutPoint(t0_p2, vec2(0.5,0.5), 0.7854);\
\
t2_p0 = rotatePointAboutPoint(t0_p0, vec2(0.5,0.5), 0.7854 * 2.0);\
t2_p1 = rotatePointAboutPoint(t0_p1, vec2(0.5,0.5), 0.7854 * 2.0);\
t2_p2 = rotatePointAboutPoint(t0_p2, vec2(0.5,0.5), 0.7854 * 2.0);\
\
t3_p0 = rotatePointAboutPoint(t0_p0, vec2(0.5,0.5), 0.7854 * 3.0);\
t3_p1 = rotatePointAboutPoint(t0_p1, vec2(0.5,0.5), 0.7854 * 3.0);\
t3_p2 = rotatePointAboutPoint(t0_p2, vec2(0.5,0.5), 0.7854 * 3.0);\
\
t4_p0 = rotatePointAboutPoint(t0_p0, vec2(0.5,0.5), 0.7854 * 4.0);\
t4_p1 = rotatePointAboutPoint(t0_p1, vec2(0.5,0.5), 0.7854 * 4.0);\
t4_p2 = rotatePointAboutPoint(t0_p2, vec2(0.5,0.5), 0.7854 * 4.0);\
\
t5_p0 = rotatePointAboutPoint(t0_p0, vec2(0.5,0.5), 0.7854 * 5.0);\
t5_p1 = rotatePointAboutPoint(t0_p1, vec2(0.5,0.5), 0.7854 * 5.0);\
t5_p2 = rotatePointAboutPoint(t0_p2, vec2(0.5,0.5), 0.7854 * 5.0);\
\
t6_p0 = rotatePointAboutPoint(t0_p0, vec2(0.5,0.5), 0.7854 * 6.0);\
t6_p1 = rotatePointAboutPoint(t0_p1, vec2(0.5,0.5), 0.7854 * 6.0);\
t6_p2 = rotatePointAboutPoint(t0_p2, vec2(0.5,0.5), 0.7854 * 6.0);\
\
t7_p0 = rotatePointAboutPoint(t0_p0, vec2(0.5,0.5), 0.7854 * 7.0);\
t7_p1 = rotatePointAboutPoint(t0_p1, vec2(0.5,0.5), 0.7854 * 7.0);\
t7_p2 = rotatePointAboutPoint(t0_p2, vec2(0.5,0.5), 0.7854 * 7.0);\
\
if(mix > 0.99){\
gl_FragColor = color_a;\
return;\
}\
if(mix < 0.01){\
gl_FragColor = color_b;\
return;\
}\
if(pointInTriangle(v_texCoord, t0_p0, t0_p1, t0_p2) || pointInTriangle(v_texCoord, t1_p0, t1_p1, t1_p2) || pointInTriangle(v_texCoord, t2_p0, t2_p1, t2_p2) || pointInTriangle(v_texCoord, t3_p0, t3_p1, t3_p2) || pointInTriangle(v_texCoord, t4_p0, t4_p1, t4_p2) || pointInTriangle(v_texCoord, t5_p0, t5_p1, t5_p2) || pointInTriangle(v_texCoord, t6_p0, t6_p1, t6_p2) || pointInTriangle(v_texCoord, t7_p0, t7_p1, t7_p2)){\
gl_FragColor = color_a;\
} else {\
gl_FragColor = color_b;\
}\
}",
"properties": {
"mix": { "type": "uniform", "value": 1.0 }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = starWipe;
module.exports = exports["default"];
/***/ }),
/* 12 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var combine = {
"title": "Combine",
"description": "A basic effect which renders the input to the output, Typically used as a combine node for layering up media with alpha transparency.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
uniform float a;\
varying vec2 v_texCoord;\
varying float v_mix;\
void main(){\
vec4 color = texture2D(u_image, v_texCoord);\
gl_FragColor = color;\
}",
"properties": {
"a": { "type": "uniform", "value": 0.0 }
},
"inputs": ["u_image"]
};
exports["default"] = combine;
module.exports = exports["default"];
/***/ }),
/* 13 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var colorThreshold = {
"title": "Color Threshold",
"description": "Turns all pixels with a greater value than the specified threshold transparent.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
uniform float a;\
uniform vec3 colorAlphaThreshold;\
varying vec2 v_texCoord;\
varying float v_mix;\
void main(){\
vec4 color = texture2D(u_image, v_texCoord);\
if (color[0] > colorAlphaThreshold[0] && color[1]> colorAlphaThreshold[1] && color[2]> colorAlphaThreshold[2]){\
color = vec4(0.0,0.0,0.0,0.0);\
}\
gl_FragColor = color;\
}",
"properties": {
"a": { "type": "uniform", "value": 0.0 },
"colorAlphaThreshold": { "type": "uniform", "value": [0.0, 0.55, 0.0] }
},
"inputs": ["u_image"]
};
exports["default"] = colorThreshold;
module.exports = exports["default"];
/***/ }),
/* 14 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var monochrome = {
"title": "Monochrome",
"description": "Change images to a single chroma (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
uniform vec3 inputMix;\
uniform vec3 outputMix;\
varying vec2 v_texCoord;\
varying float v_mix;\
void main(){\
vec4 color = texture2D(u_image, v_texCoord);\
float mono = color[0]*inputMix[0] + color[1]*inputMix[1] + color[2]*inputMix[2];\
color[0] = mono * outputMix[0];\
color[1] = mono * outputMix[1];\
color[2] = mono * outputMix[2];\
gl_FragColor = color;\
}",
"properties": {
"inputMix": { "type": "uniform", "value": [0.4, 0.6, 0.2] },
"outputMix": { "type": "uniform", "value": [1.0, 1.0, 1.0] }
},
"inputs": ["u_image"]
};
exports["default"] = monochrome;
module.exports = exports["default"];
/***/ }),
/* 15 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var horizontal_blur = {
"title": "Horizontal Blur",
"description": "A horizontal blur effect. Adpated from http://xissburg.com/faster-gaussian-blur-in-glsl/",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
uniform float blurAmount;\
varying vec2 v_texCoord;\
varying vec2 v_blurTexCoords[14];\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
v_blurTexCoords[ 0] = v_texCoord + vec2(-0.028 * blurAmount, 0.0);\
v_blurTexCoords[ 1] = v_texCoord + vec2(-0.024 * blurAmount, 0.0);\
v_blurTexCoords[ 2] = v_texCoord + vec2(-0.020 * blurAmount, 0.0);\
v_blurTexCoords[ 3] = v_texCoord + vec2(-0.016 * blurAmount, 0.0);\
v_blurTexCoords[ 4] = v_texCoord + vec2(-0.012 * blurAmount, 0.0);\
v_blurTexCoords[ 5] = v_texCoord + vec2(-0.008 * blurAmount, 0.0);\
v_blurTexCoords[ 6] = v_texCoord + vec2(-0.004 * blurAmount, 0.0);\
v_blurTexCoords[ 7] = v_texCoord + vec2( 0.004 * blurAmount, 0.0);\
v_blurTexCoords[ 8] = v_texCoord + vec2( 0.008 * blurAmount, 0.0);\
v_blurTexCoords[ 9] = v_texCoord + vec2( 0.012 * blurAmount, 0.0);\
v_blurTexCoords[10] = v_texCoord + vec2( 0.016 * blurAmount, 0.0);\
v_blurTexCoords[11] = v_texCoord + vec2( 0.020 * blurAmount, 0.0);\
v_blurTexCoords[12] = v_texCoord + vec2( 0.024 * blurAmount, 0.0);\
v_blurTexCoords[13] = v_texCoord + vec2( 0.028 * blurAmount, 0.0);\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying vec2 v_texCoord;\
varying vec2 v_blurTexCoords[14];\
void main(){\
gl_FragColor = vec4(0.0);\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 0])*0.0044299121055113265;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 1])*0.00895781211794;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 2])*0.0215963866053;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 3])*0.0443683338718;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 4])*0.0776744219933;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 5])*0.115876621105;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 6])*0.147308056121;\
gl_FragColor += texture2D(u_image, v_texCoord )*0.159576912161;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 7])*0.147308056121;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 8])*0.115876621105;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 9])*0.0776744219933;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[10])*0.0443683338718;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[11])*0.0215963866053;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[12])*0.00895781211794;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[13])*0.0044299121055113265;\
}",
"properties": {
"blurAmount": { "type": "uniform", "value": 1.0 }
},
"inputs": ["u_image"]
};
exports["default"] = horizontal_blur;
module.exports = exports["default"];
/***/ }),
/* 16 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var verticalBlur = {
"title": "Vertical Blur",
"description": "A vertical blur effect. Adpated from http://xissburg.com/faster-gaussian-blur-in-glsl/",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
uniform float blurAmount;\
varying vec2 v_blurTexCoords[14];\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
v_blurTexCoords[ 0] = v_texCoord + vec2(0.0,-0.028 * blurAmount);\
v_blurTexCoords[ 1] = v_texCoord + vec2(0.0,-0.024 * blurAmount);\
v_blurTexCoords[ 2] = v_texCoord + vec2(0.0,-0.020 * blurAmount);\
v_blurTexCoords[ 3] = v_texCoord + vec2(0.0,-0.016 * blurAmount);\
v_blurTexCoords[ 4] = v_texCoord + vec2(0.0,-0.012 * blurAmount);\
v_blurTexCoords[ 5] = v_texCoord + vec2(0.0,-0.008 * blurAmount);\
v_blurTexCoords[ 6] = v_texCoord + vec2(0.0,-0.004 * blurAmount);\
v_blurTexCoords[ 7] = v_texCoord + vec2(0.0, 0.004 * blurAmount);\
v_blurTexCoords[ 8] = v_texCoord + vec2(0.0, 0.008 * blurAmount);\
v_blurTexCoords[ 9] = v_texCoord + vec2(0.0, 0.012 * blurAmount);\
v_blurTexCoords[10] = v_texCoord + vec2(0.0, 0.016 * blurAmount);\
v_blurTexCoords[11] = v_texCoord + vec2(0.0, 0.020 * blurAmount);\
v_blurTexCoords[12] = v_texCoord + vec2(0.0, 0.024 * blurAmount);\
v_blurTexCoords[13] = v_texCoord + vec2(0.0, 0.028 * blurAmount);\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying vec2 v_texCoord;\
varying vec2 v_blurTexCoords[14];\
void main(){\
gl_FragColor = vec4(0.0);\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 0])*0.0044299121055113265;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 1])*0.00895781211794;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 2])*0.0215963866053;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 3])*0.0443683338718;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 4])*0.0776744219933;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 5])*0.115876621105;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 6])*0.147308056121;\
gl_FragColor += texture2D(u_image, v_texCoord )*0.159576912161;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 7])*0.147308056121;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 8])*0.115876621105;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[ 9])*0.0776744219933;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[10])*0.0443683338718;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[11])*0.0215963866053;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[12])*0.00895781211794;\
gl_FragColor += texture2D(u_image, v_blurTexCoords[13])*0.0044299121055113265;\
}",
"properties": {
"blurAmount": { "type": "uniform", "value": 1.0 }
},
"inputs": ["u_image"]
};
exports["default"] = verticalBlur;
module.exports = exports["default"];
/***/ }),
/* 17 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var aaf_video_flop = {
"title": "AAF Video Flop Effect",
"description": "A flop effect based on the AAF spec. Mirrors the image in the y-axis",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying vec2 v_texCoord;\
void main(){\
vec2 coord = vec2(1.0 - v_texCoord[0] ,v_texCoord[1]);\
vec4 color = texture2D(u_image, coord);\
gl_FragColor = color;\
}",
"properties": {},
"inputs": ["u_image"]
};
exports["default"] = aaf_video_flop;
module.exports = exports["default"];
/***/ }),
/* 18 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var aaf_video_flip = {
"title": "AAF Video Scale Effect",
"description": "A flip effect based on the AAF spec. Mirrors the image in the x-axis",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying vec2 v_texCoord;\
void main(){\
vec2 coord = vec2(v_texCoord[0] ,1.0 - v_texCoord[1]);\
vec4 color = texture2D(u_image, coord);\
gl_FragColor = color;\
}",
"properties": {},
"inputs": ["u_image"]
};
exports["default"] = aaf_video_flip;
module.exports = exports["default"];
/***/ }),
/* 19 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var aaf_video_position = {
"title": "AAF Video Position Effect",
"description": "A position effect based on the AAF spec.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
uniform float positionOffsetX;\
uniform float positionOffsetY;\
varying vec2 v_texCoord;\
varying float v_progress;\
void main(){\
vec2 pos = vec2(v_texCoord[0] - positionOffsetX/2.0, v_texCoord[1] - positionOffsetY/2.0);\
vec4 color = texture2D(u_image, pos);\
if (pos[0] < 0.0 || pos[0] > 1.0 || pos[1] < 0.0 || pos[1] > 1.0){\
color = vec4(0.0,0.0,0.0,0.0);\
}\
gl_FragColor = color;\
}",
"properties": {
"positionOffsetX": { "type": "uniform", "value": 0.0 },
"positionOffsetY": { "type": "uniform", "value": 0.0 }
},
"inputs": ["u_image"]
};
exports["default"] = aaf_video_position;
module.exports = exports["default"];
/***/ }),
/* 20 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var aaf_video_crop = {
"title": "AAF Video Crop Effect",
"description": "A crop effect based on the AAF spec.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
uniform float cropLeft;\
uniform float cropRight;\
uniform float cropTop;\
uniform float cropBottom;\
varying vec2 v_texCoord;\
void main(){\
vec4 color = texture2D(u_image, v_texCoord);\
if (v_texCoord[0] < (cropLeft+1.0)/2.0) color = vec4(0.0,0.0,0.0,0.0);\
if (v_texCoord[0] > (cropRight+1.0)/2.0) color = vec4(0.0,0.0,0.0,0.0);\
if (v_texCoord[1] < (-cropBottom+1.0)/2.0) color = vec4(0.0,0.0,0.0,0.0);\
if (v_texCoord[1] > (-cropTop+1.0)/2.0) color = vec4(0.0,0.0,0.0,0.0);\
gl_FragColor = color;\
}",
"properties": {
"cropLeft": { "type": "uniform", "value": -1.0 },
"cropRight": { "type": "uniform", "value": 1.0 },
"cropTop": { "type": "uniform", "value": -1.0 },
"cropBottom": { "type": "uniform", "value": 1.0 }
},
"inputs": ["u_image"]
};
exports["default"] = aaf_video_crop;
module.exports = exports["default"];
/***/ }),
/* 21 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var staticDissolve = {
"title": "Static Dissolve",
"description": "A static dissolve effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform float mix;\
uniform float currentTime;\
varying vec2 v_texCoord;\
varying float v_mix;\
float rand(vec2 co, float currentTime){\
return fract(sin(dot(co.xy,vec2(12.9898,78.233))+currentTime) * 43758.5453);\
}\
void main(){\
vec4 color_a = texture2D(u_image_a, v_texCoord);\
vec4 color_b = texture2D(u_image_b, v_texCoord);\
if (clamp(rand(v_texCoord, currentTime), 0.01, 1.001) > mix){\
gl_FragColor = color_a;\
} else {\
gl_FragColor = color_b;\
}\
}",
"properties": {
"mix": { "type": "uniform", "value": 0.0 }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = staticDissolve;
module.exports = exports["default"];
/***/ }),
/* 22 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var staticEffect = {
"title": "Static",
"description": "A static effect to add pseudo random noise to a video",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
uniform float currentTime;\
uniform float amount;\
varying vec2 v_texCoord;\
uniform vec3 weight;\
float rand(vec2 co, float currentTime){\
return fract(sin(dot(co.xy,vec2(12.9898,78.233))+currentTime) * 43758.5453);\
}\
void main(){\
vec4 color = texture2D(u_image, v_texCoord);\
color[0] = color[0] + (2.0*(clamp(rand(v_texCoord, currentTime), 0.01, 1.001)-0.5)) * weight[0] * amount;\
color[1] = color[1] + (2.0*(clamp(rand(v_texCoord, currentTime), 0.01, 1.001)-0.5)) * weight[1] * amount;\
color[2] = color[2] + (2.0*(clamp(rand(v_texCoord, currentTime), 0.01, 1.001)-0.5)) * weight[2] *amount;\
gl_FragColor = color;\
}",
"properties": {
"weight": { "type": "uniform", "value": [1.0, 1.0, 1.0] },
"amount": { "type": "uniform", "value": 1.0 }
},
"inputs": ["u_image"]
};
exports["default"] = staticEffect;
module.exports = exports["default"];
/***/ }),
/* 23 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var dreamfade = {
"title": "Dream-Fade",
"description": "A wobbly dream effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform float mix;\
varying vec2 v_texCoord;\
varying float v_mix;\
void main(){\
float wobble = 1.0 - abs((mix*2.0)-1.0);\
vec2 pos = vec2(v_texCoord[0] + ((sin(v_texCoord[1]*(10.0*wobble*3.14) + wobble*10.0)/13.0)), v_texCoord[1]);\
vec4 color_a = texture2D(u_image_a, pos);\
vec4 color_b = texture2D(u_image_b, pos);\
color_a[0] *= (1.0 - mix);\
color_a[1] *= (1.0 - mix);\
color_a[2] *= (1.0 - mix);\
color_a[3] *= (1.0 - mix);\
color_b[0] *= mix;\
color_b[1] *= mix;\
color_b[2] *= mix;\
color_b[3] *= mix;\
gl_FragColor = color_a + color_b;\
}",
"properties": {
"mix": { "type": "uniform", "value": 0.0 }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = dreamfade;
module.exports = exports["default"];
/***/ }),
/* 24 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var cube = {
"title": "Cube",
"description": "A cross-fade effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
uniform float persp;\
uniform float unzoom;\
uniform float reflection;\
uniform float floating;\
\
vec2 project (vec2 p) {\
return p * vec2(1.0, -1.2) + vec2(0.0, -floating/100.);\
}\
\
bool inBounds (vec2 p) {\
return all(lessThan(vec2(0.0), p)) && all(lessThan(p, vec2(1.0)));\
}\
\
vec4 bgColor (vec2 p, vec2 pfr, vec2 pto) {\
vec4 c = vec4(0.0, 0.0, 0.0, 1.0);\
pfr = project(pfr);\
if (inBounds(pfr)) {\
c += mix(vec4(0.0), texture2D(from, pfr), reflection * mix(1.0, 0.0, pfr.y));\
}\
pto = project(pto);\
if (inBounds(pto)) {\
c += mix(vec4(0.0), texture2D(to, pto), reflection * mix(1.0, 0.0, pto.y));\
}\
return c;\
}\
\
vec2 xskew (vec2 p, float persp, float center) {\
float x = mix(p.x, 1.0-p.x, center);\
return (\
(\
vec2( x, (p.y - 0.5*(1.0-persp) * x) / (1.0+(persp-1.0)*x) )\
- vec2(0.5-distance(center, 0.5), 0.0)\
)\
* vec2(0.5 / distance(center, 0.5) * (center<0.5 ? 1.0 : -1.0), 1.0)\
+ vec2(center<0.5 ? 0.0 : 1.0, 0.0)\
);\
}\
\
void main() {\
vec2 op = gl_FragCoord.xy / resolution.xy;\
float uz = unzoom * 2.0*(0.5-distance(0.5, progress));\
vec2 p = -uz*0.5+(1.0+uz) * op;\
vec2 fromP = xskew(\
(p - vec2(progress, 0.0)) / vec2(1.0-progress, 1.0),\
1.0-mix(progress, 0.0, persp),\
0.0\
);\
vec2 toP = xskew(\
p / vec2(progress, 1.0),\
mix(pow(progress, 2.0), 1.0, persp),\
1.0\
);\
float fromAlpha = 1.0;\
float toAlpha = 1.0;\
const float radius = 6.0;\
vec2 step = vec2(1.0)/resolution.xy;\
if (progress < 1.0 && progress > 0.0) {\
if (fromP.y < step.y*radius && fromP.y > 0.0) {\
fromAlpha = fromP.y/(step.y*radius);\
}\
else if (fromP.y < 1.0 && fromP.y > 1.0-step.y*radius) {\
fromAlpha = (1.0-fromP.y)/(step.y*radius);\
}\
\
if (toP.y < step.y*radius && toP.y > 0.0) {\
toAlpha = toP.y/(step.y*radius);\
}\
else if (toP.y < 1.0 && toP.y > 1.0-step.y*radius) {\
toAlpha = (1.0-toP.y)/(step.y*radius);\
}\
}\
if (inBounds(fromP)) {\
gl_FragColor = texture2D(from, fromP)*fromAlpha;\
}\
else if (inBounds(toP)) {\
gl_FragColor = texture2D(to, toP)*toAlpha;\
}\
else {\
gl_FragColor = bgColor(op, fromP, toP);\
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"persp": { "type": "uniform", "value": 0.7 },
"unzoom": { "type": "uniform", "value": 0.3 },
"reflection": { "type": "uniform", "value": 0.4 },
"floating": { "type": "uniform", "value": 3.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = cube;
module.exports = exports["default"];
/***/ }),
/* 25 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var morph = {
"title": "Morph",
"description": "A morph effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
const float strength=0.1;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec4 ca = texture2D(from, p);\
vec4 cb = texture2D(to, p);\
\
vec2 oa = (((ca.rg+ca.b)*0.5)*2.0-1.0);\
vec2 ob = (((cb.rg+cb.b)*0.5)*2.0-1.0);\
vec2 oc = mix(oa,ob,0.5)*strength;\
\
float w0 = progress;\
float w1 = 1.0-w0;\
gl_FragColor = mix(texture2D(from, p+oc*w0), texture2D(to, p-oc*w1), progress);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = morph;
module.exports = exports["default"];
/***/ }),
/* 26 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var crosszoom = {
"title": "CrossZoom",
"description": "A crosszoom effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
uniform float strength;\
\
const float PI = 3.141592653589793;\
\
float Linear_ease(in float begin, in float change, in float duration, in float time) {\
return change * time / duration + begin;\
}\
\
float Exponential_easeInOut(in float begin, in float change, in float duration, in float time) {\
if (time == 0.0)\
return begin;\
else if (time == duration)\
return begin + change;\
time = time / (duration / 2.0);\
if (time < 1.0)\
return change / 2.0 * pow(2.0, 10.0 * (time - 1.0)) + begin;\
return change / 2.0 * (-pow(2.0, -10.0 * (time - 1.0)) + 2.0) + begin;\
}\
\
float Sinusoidal_easeInOut(in float begin, in float change, in float duration, in float time) {\
return -change / 2.0 * (cos(PI * time / duration) - 1.0) + begin;\
}\
\
float random(in vec3 scale, in float seed) {\
return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\
}\
\
vec3 crossFade(in vec2 uv, in float dissolve) {\
return mix(texture2D(from, uv).rgb, texture2D(to, uv).rgb, dissolve);\
}\
\
void main() {\
vec2 texCoord = gl_FragCoord.xy / resolution.xy;\
\
vec2 center = vec2(Linear_ease(0.25, 0.5, 1.0, progress), 0.5);\
float dissolve = Exponential_easeInOut(0.0, 1.0, 1.0, progress);\
\
float strength = Sinusoidal_easeInOut(0.0, strength, 0.5, progress);\
\
vec3 color = vec3(0.0);\
float total = 0.0;\
vec2 toCenter = center - texCoord;\
\
float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\
\
for (float t = 0.0; t <= 40.0; t++) {\
float percent = (t + offset) / 40.0;\
float weight = 4.0 * (percent - percent * percent);\
color += crossFade(texCoord + toCenter * percent * strength, dissolve) * weight;\
total += weight;\
}\
gl_FragColor = vec4(color / total, 1.0);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"strength": { "type": "uniform", "value": 0.4 }
},
"inputs": ["from", "to"]
};
exports["default"] = crosszoom;
module.exports = exports["default"];
/***/ }),
/* 27 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var swap = {
"title": "Swap",
"description": "A swap effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
\
uniform float reflection;\
uniform float perspective;\
uniform float depth;\
\
const vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\
const vec2 boundMin = vec2(0.0, 0.0);\
const vec2 boundMax = vec2(1.0, 1.0);\
\
bool inBounds (vec2 p) {\
return all(lessThan(boundMin, p)) && all(lessThan(p, boundMax));\
}\
\
vec2 project (vec2 p) {\
return p * vec2(1.0, -1.2) + vec2(0.0, -0.02);\
}\
\
vec4 bgColor (vec2 p, vec2 pfr, vec2 pto) {\
const float radius = 3.0;\
vec2 step = vec2(1.0)/resolution.xy;\
\
vec4 c = black;\
pfr = project(pfr);\
if (inBounds(pfr)) {\
float fromAlpha = 1.0;\
if (progress < 1.0 && progress > 0.0) {\
if (pfr.y < step.y*radius && pfr.y > 0.0) {\
fromAlpha = pfr.y/(step.y*radius);\
}\
else if (pfr.y < 1.0 && pfr.y > 1.0-step.y*radius) {\
fromAlpha = (1.0-pfr.y)/(step.y*radius);\
}\
}\
c += mix(black, texture2D(from, pfr)*fromAlpha, reflection * mix(1.0, 0.0, pfr.y));\
}\
pto = project(pto);\
if (inBounds(pto)) {\
float toAlpha = 1.0;\
if (progress < 1.0 && progress > 0.0) {\
if (pto.y < step.y*radius && pto.y > 0.0) {\
toAlpha = pto.y/(step.y*radius);\
}\
else if (pto.y < 1.0 && pto.y > 1.0-step.y*radius) {\
toAlpha = (1.0-pto.y)/(step.y*radius);\
}\
}\
c += mix(black, texture2D(to, pto)*toAlpha, reflection * mix(1.0, 0.0, pto.y));\
}\
return c;\
}\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
\
vec2 pfr, pto = vec2(-1.);\
\
float size = mix(1.0, depth, progress);\
float persp = perspective * progress;\
pfr = (p + vec2(-0.0, -0.5)) * vec2(size/(1.0-perspective*progress), size/(1.0-size*persp*p.x)) + vec2(0.0, 0.5);\
\
size = mix(1.0, depth, 1.-progress);\
persp = perspective * (1.-progress);\
pto = (p + vec2(-1.0, -0.5)) * vec2(size/(1.0-perspective*(1.0-progress)), size/(1.0-size*persp*(0.5-p.x))) + vec2(1.0, 0.5);\
\
bool fromOver = progress < 0.5;\
\
float fromAlpha = 1.0;\
float toAlpha = 1.0;\
const float radius = 6.0;\
vec2 step = vec2(1.0)/resolution.xy;\
if (progress < 1.0 && progress > 0.0) {\
if (pfr.y < step.y*radius && pfr.y > 0.0) {\
fromAlpha = pfr.y/(step.y*radius);\
}\
else if (pfr.y < 1.0 && pfr.y > 1.0-step.y*radius) {\
fromAlpha = (1.0-pfr.y)/(step.y*radius);\
}\
\
if (pto.y < step.y*radius && pto.y > 0.0) {\
toAlpha = pto.y/(step.y*radius);\
}\
else if (pto.y < 1.0 && pto.y > 1.0-step.y*radius) {\
toAlpha = (1.0-pto.y)/(step.y*radius);\
}\
}\
\
if (fromOver) {\
if (inBounds(pfr)) {\
gl_FragColor = texture2D(from, pfr)*fromAlpha;\
}\
else if (inBounds(pto)) {\
gl_FragColor = texture2D(to, pto)*toAlpha;\
}\
else {\
gl_FragColor = bgColor(p, pfr, pto);\
}\
}\
else {\
if (inBounds(pto)) {\
gl_FragColor = texture2D(to, pto)*toAlpha;\
}\
else if (inBounds(pfr)) {\
gl_FragColor = texture2D(from, pfr)*fromAlpha;\
}\
else {\
gl_FragColor = bgColor(p, pfr, pto);\
}\
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"reflection": { "type": "uniform", "value": 0.4 },
"perspective": { "type": "uniform", "value": 0.2 },
"depth": { "type": "uniform", "value": 3.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = swap;
module.exports = exports["default"];
/***/ }),
/* 28 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var squareswipe = {
"title": "SquareSwipe",
"description": "A squareswipe effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
uniform vec2 squares;\
uniform vec2 direction;\
uniform float smoothness;\
\
const vec2 center = vec2(0.5, 0.5);\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec2 v = normalize(direction);\
if (v != vec2(0.0))\
v /= abs(v.x)+abs(v.y);\
float d = v.x * center.x + v.y * center.y;\
float offset = smoothness;\
float pr = smoothstep(-offset, 0.0, v.x * p.x + v.y * p.y - (d-0.5+progress*(1.+offset)));\
vec2 squarep = fract(p*squares);\
vec2 squaremin = vec2(pr/2.0);\
vec2 squaremax = vec2(1.0 - pr/2.0);\
float a = all(lessThan(squaremin, squarep)) && all(lessThan(squarep, squaremax)) ? 1.0 : 0.0;\
\
const float radius = 3.0;\
vec2 step = vec2(1.0)/resolution.xy;\
float alpha = 1.0;\
if (progress > 0.0 && progress < 1.0) {\
float max_pr = smoothstep(-offset, 0.0, v.x * p.x + v.y * p.y - (d-0.5+1.0*(1.+offset)));\
vec2 max_squaremin = vec2(max_pr/2.0);\
vec2 max_squaremax = vec2(1.0 - max_pr/2.0);\
\
if ( squaremax.x < max_squaremax.x ) {\
if (squarep.x > squaremin.x && squarep.x < squaremin.x+step.x*radius) {\
alpha = 1.0-(squaremin.x+step.x*radius - squarep.x)/(step.x*radius);\
}\
else if (squarep.x > (squaremax.x-step.x*radius) && squarep.x < squaremax.x) {\
alpha = (squaremax.x - squarep.x)/(step.x*radius);\
}\
}\
\
if ( squaremax.y < max_squaremax.y ) {\
if (squarep.y > squaremin.y && squarep.y < squaremin.y+step.y*radius) {\
alpha = 1.0-(squaremin.y+step.y*radius - squarep.y)/(step.y*radius);\
}\
else if (squarep.y > (squaremax.y-step.y*radius) && squarep.y < squaremax.y) {\
alpha = (squaremax.y - squarep.y)/(step.y*radius);\
}\
}\
}\
gl_FragColor = mix(texture2D(from, p), texture2D(to, p), a*alpha);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"squares": { "type": "uniform", "value": [10.0, 10.0] },
"direction": { "type": "uniform", "value": [1.0, -0.4] },
"smoothness": { "type": "uniform", "value": 1.6 }
},
"inputs": ["from", "to"]
};
exports["default"] = squareswipe;
module.exports = exports["default"];
/***/ }),
/* 29 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var slide = {
"title": "Slide",
"description": "A slide effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float translateX;\
uniform float translateY;\
\
void main() {\
vec2 texCoord = gl_FragCoord.xy / resolution.xy;\
float x = progress * translateX;\
float y = progress * translateY;\
\
if (x >= 0.0 && y >= 0.0) {\
if (texCoord.x >= x && texCoord.y >= y) {\
gl_FragColor = texture2D(from, texCoord - vec2(x, y));\
}\
else {\
vec2 uv;\
if (x > 0.0)\
uv = vec2(x - 1.0, y);\
else if (y > 0.0)\
uv = vec2(x, y - 1.0);\
gl_FragColor = texture2D(to, texCoord - uv);\
}\
}\
else if (x <= 0.0 && y <= 0.0) {\
if (texCoord.x <= (1.0 + x) && texCoord.y <= (1.0 + y))\
gl_FragColor = texture2D(from, texCoord - vec2(x, y));\
else {\
vec2 uv;\
if (x < 0.0)\
uv = vec2(x + 1.0, y);\
else if (y < 0.0)\
uv = vec2(x, y + 1.0);\
gl_FragColor = texture2D(to, texCoord - uv);\
}\
}\
else\
gl_FragColor = vec4(0.0);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"translateX": { "type": "uniform", "value": 1.0 },
"translateY": { "type": "uniform", "value": 0.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = slide;
module.exports = exports["default"];
/***/ }),
/* 30 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var simpleflip = {
"title": "SimpleFlip",
"description": "A simpleflip effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec2 q = p;\
p.x = (p.x - 0.5)/abs(progress - 0.5)*0.5 + 0.5;\
vec4 a = texture2D(from, p);\
vec4 b = texture2D(to, p);\
gl_FragColor = vec4(mix(a, b, step(0.5, progress)).rgb * step(abs(q.x - 0.5), abs(progress - 0.5)), 1.0);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = simpleflip;
module.exports = exports["default"];
/***/ }),
/* 31 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var pinwheel = {
"title": "Pinwheel",
"description": "A pinwheel effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
const float PI = 3.14159265358979323846;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
\
float angle = atan(p.y - 0.5, p.x - 0.5);\
if (angle < 0.0) {\
angle = PI*2.0 + angle;\
}\
\
float circPos = angle + progress;\
float modPos = mod(circPos, PI / 4.);\
float signed = sign(progress - modPos);\
float smoothed = smoothstep(0., 1., signed);\
\
float alpha = 1.0;\
if (progress > 0.0 && progress < PI/4.) {\
const float radius = 2.0;\
vec2 step = vec2(1.0)/resolution.xy;\
\
float dis = sqrt(pow(p.x-0.5,2.0)+pow(p.y-0.5,2.0));\
float r = sin(modPos)*dis;\
float sradius = radius*min(step.x,step.y);\
if (r < sradius) {\
alpha = r/sradius;\
}\
\
float kmodPos = PI / 4. - mod(angle, PI / 4.);\
r = sin(kmodPos)*dis;\
if (r < sradius) {\
alpha = r/sradius;\
}\
}\
gl_FragColor = mix(texture2D(from, p), texture2D(to, p), smoothed*alpha);\
\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = pinwheel;
module.exports = exports["default"];
/***/ }),
/* 32 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var powerdisformation = {
"title": "PowerDisformation",
"description": "A powerdisformation effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
uniform float power;\
const bool powerDest = true;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
\
vec2 p2 = mix(\
p, \
vec2(pow(p.x, power), pow(p.y, power)), \
(powerDest ? 0.5 : 1.0)-distance(progress, powerDest ? 0.5 : 1.0));\
\
gl_FragColor = mix(\
texture2D(from, p2), \
texture2D(to, powerDest ? p2: p), \
progress);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"power": { "type": "uniform", "value": 3.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = powerdisformation;
module.exports = exports["default"];
/***/ }),
/* 33 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var polkaDotsCurtain = {
"title": "PolkaDotsCurtain",
"description": "A polkaDotsCurtain effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
const float SQRT_2 = 1.414213562373;\
uniform float dots;\
uniform vec2 center;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
float x = progress /2.0;\
\
const float radius = 2.0;\
vec2 step = vec2(1.0)/resolution.xy;\
float c = distance(fract(p * dots), vec2(0.5, 0.5));\
float r1 = (2.0 * x / distance(p, center));\
float r2 = r1 + sqrt(min(step.x,step.y))*radius;\
\
bool nextImage = c < r1; \
\
float a = nextImage?0.0:1.0;\
float alpha = 1.0;\
if (progress > 0.0 && progress < 1.0) {\
if (r1 < c && c < r2) {\
alpha = (c-r1)/(r2-r1);\
}\
}\
gl_FragColor = mix(texture2D(to, p), texture2D(from, p), a*alpha);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"dots": { "type": "uniform", "value": 20.0 },
"center": { "type": "uniform", "value": [1.0, 1.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = polkaDotsCurtain;
module.exports = exports["default"];
/***/ }),
/* 34 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var kalerdoscope = {
"title": "Kalerdoscope",
"description": "A kalerdoscope effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
uniform float speed;\
uniform float angle;\
uniform float power;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec2 q = p;\
float t = pow(progress, power)*speed;\
p = p -0.5;\
for (int i = 0; i < 7; i++) {\
p = vec2(sin(t)*p.x + cos(t)*p.y, sin(t)*p.y - cos(t)*p.x);\
t += angle;\
p = abs(mod(p, 2.0) - 1.0);\
}\
abs(mod(p, 1.0));\
gl_FragColor = mix(\
mix(texture2D(from, q), texture2D(to, q), progress),\
mix(texture2D(from, p), texture2D(to, p), progress), 1.0 - 2.0*abs(progress - 0.5));\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"speed": { "type": "uniform", "value": 1.0 },
"angle": { "type": "uniform", "value": 2.0 },
"power": { "type": "uniform", "value": 2.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = kalerdoscope;
module.exports = exports["default"];
/***/ }),
/* 35 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var doomscreen = {
"title": "DoomScreen",
"description": "A doomscreen effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float barWidth;\
uniform float amplitude;\
uniform float noise;\
uniform float frequency;\
\
float rand(int num) {\
return fract(mod(float(num) * 67123.313, 12.0) * sin(float(num) * 10.3) * cos(float(num)));\
}\
\
float wave(int num) {\
float fn = float(num) * frequency * 0.1 * float(barWidth);\
return cos(fn * 0.5) * cos(fn * 0.13) * sin((fn+10.0) * 0.3) / 2.0 + 0.5;\
}\
\
float pos(int num) {\
return noise == 0.0 ? wave(num) : mix(wave(num), rand(num), noise);\
}\
\
\
void main() {\
int barw = int(barWidth);\
int bar = int(gl_FragCoord.x)/barw;\
float scale = 1.0 + pos(bar) * amplitude;\
float phase = progress * scale;\
float posY = gl_FragCoord.y / resolution.y;\
vec2 p;\
vec4 c;\
if (phase + posY < 1.0) {\
p = vec2(gl_FragCoord.x, gl_FragCoord.y - mix(0.0, resolution.y, phase)) / resolution;\
c = texture2D(from, p);\
} else {\
p = gl_FragCoord.xy / resolution.xy;\
c = texture2D(to, p);\
}\
\
gl_FragColor = c;\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"barWidth": { "type": "uniform", "value": 10.0 },
"amplitude": { "type": "uniform", "value": 2.0 },
"noise": { "type": "uniform", "value": 0.2 },
"frequency": { "type": "uniform", "value": 1.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = doomscreen;
module.exports = exports["default"];
/***/ }),
/* 36 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var starwipe = {
"title": "Starwipe",
"description": "A starwipe effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
vec2 circlePoint( float ang )\
{\
ang += 6.28318 * 0.15;\
return vec2( cos(ang), sin(ang) ); \
}\
\
float cross2d( vec2 a, vec2 b )\
{\
return ( a.x * b.y - a.y * b.x );\
}\
\
float star( vec2 p, float size )\
{\
if( size <= 0.0 )\
{\
return 0.0;\
}\
p /= size;\
\
vec2 p0 = circlePoint( 0.0 );\
vec2 p1 = circlePoint( 6.28318 * 1.0 / 5.0 );\
vec2 p2 = circlePoint( 6.28318 * 2.0 / 5.0 );\
vec2 p3 = circlePoint( 6.28318 * 3.0 / 5.0 );\
vec2 p4 = circlePoint( 6.28318 * 4.0 / 5.0 );\
\
float s0 = ( cross2d( p1 - p0, p - p0 ) );\
float s1 = ( cross2d( p2 - p1, p - p1 ) );\
float s2 = ( cross2d( p3 - p2, p - p2 ) );\
float s3 = ( cross2d( p4 - p3, p - p3 ) );\
float s4 = ( cross2d( p0 - p4, p - p4 ) );\
\
float s5 = min( min( min( s0, s1 ), min( s2, s3 ) ), s4 );\
float s = max( 1.0 - sign( s0 * s1 * s2 * s3 * s4 ) + sign(s5), 0.0 );\
s = sign( 2.6 - length(p) ) * s;\
\
return max( s, 0.0 );\
}\
\
float smoothAliase(vec2 p, float t)\
{\
const float radius = 4.0;\
vec2 step = vec2(1.0)/resolution.xy;\
float alpha = 1.0;\
\
if (t > 0.0) {\
vec2 v = p/t;\
\
vec2 pt[5];\
pt[0] = circlePoint( 0.0 );\
pt[1] = circlePoint( 6.28318 * 1.0 / 5.0 );\
pt[2] = circlePoint( 6.28318 * 2.0 / 5.0 );\
pt[3] = circlePoint( 6.28318 * 3.0 / 5.0 );\
pt[4] = circlePoint( 6.28318 * 4.0 / 5.0 );\
float sm = 0.0;\
float sn = 0.0;\
vec2 vm;\
vec2 vn;\
float st[5];\
for (int i = 0; i < 5; i++) {\
st[i] = dot( pt[i], v);\
if (sm < st[i]) {\
sm = st[i];\
vm = pt[i];\
}\
}\
\
for (int i = 0; i < 5; i++) {\
if (sn < st[i] && sm != st[i]) {\
sn = st[i];\
vn = pt[i];\
}\
}\
\
vec2 vt = vm+vn;\
vt *= 2.6/length(vt);\
vt = vt - vm;\
\
float BR = min(step.x, step.y)*radius;\
vec2 pVt = vt+vm;\
float a = -vt.y/vt.x;\
float b = -(pVt.y + a*pVt.x);\
float angle = atan(1.0, abs(a));\
if (b < 0.0) {\
b -= (BR/2.0)/sin(angle);\
}\
else {\
b += (BR/2.0)/sin(angle);\
}\
\
\
float dis = abs(v.y + a*v.x + b)/sqrt(1.0+a*a) * t;\
\
if (dis < BR) {\
alpha = dis/BR;\
}\
}\
\
return alpha;\
}\
\
void main() \
{\
vec2 p = ( gl_FragCoord.xy / resolution.xy );\
vec2 o = p * 2.0 - 1.0;\
\
float t = progress * 1.4;\
\
float c1 = star( o, t );\
float c2 = star( o, t - 0.1 );\
\
float border = max( c1 - c2, 0.0 );\
\
float alpha1 = 1.0;\
float alpha2 = 1.0;\
\
if (border > 0.0) {\
alpha1 = smoothAliase(o, t);\
}\
\
if (border == 0.0) {\
alpha2 = smoothAliase(o, t-0.1);\
}\
\
if (alpha1 < 1.0) {\
vec4 color = mix( texture2D(to, p), texture2D(from, p), c1);\
vec4 bcolor = mix(texture2D(from, p), texture2D(to, p), c1) + vec4( border, border, border, 0.0 );\
gl_FragColor = mix(color, bcolor, alpha1);\
}\
else {\
vec4 color = mix( texture2D(from, p), texture2D(to, p), c1);\
vec4 bcolor = mix(texture2D(from, p), texture2D(to, p), c1) + vec4( border, border, border, 0.0 );\
if (alpha2 < 1.0) {\
gl_FragColor = mix(color, vec4(1.0), 1.0-alpha2);\
}\
else {\
gl_FragColor = mix(color, bcolor, alpha2);\
}\
\
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = starwipe;
module.exports = exports["default"];
/***/ }),
/* 37 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var potleaf = {
"title": "Potleaf",
"description": "A potleaf effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
void main() {\
vec2 uv = gl_FragCoord.xy / resolution.xy;\
vec2 leaf_uv = (uv - vec2(0.5))/10./pow(progress,3.5);\
leaf_uv.y += 0.35;\
float r = 0.18;\
float o = atan(leaf_uv.y, leaf_uv.x);\
gl_FragColor = mix(texture2D(from, uv), texture2D(to, uv), 1.-step(1. - length(leaf_uv)+r*(1.+sin(o))*(1.+0.9 * cos(8.*o))*(1.+0.1*cos(24.*o))*(0.9+0.05*cos(200.*o)), 1.));\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = potleaf;
module.exports = exports["default"];
/***/ }),
/* 38 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var glitch = {
"title": "Glitch",
"description": "A glitch effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
void glitch_memories(sampler2D pic) {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec2 block = floor(gl_FragCoord.xy / vec2(16));\
vec2 uv_noise = block / vec2(64);\
uv_noise += floor(vec2(progress) * vec2(1200.0, 3500.0)) / vec2(64);\
\
float block_thresh = pow(fract(progress * 1200.0), 2.0) * 0.2;\
float line_thresh = pow(fract(progress * 2200.0), 3.0) * 0.7;\
vec2 red = p, green = p, blue = p, o = p;\
vec2 dist = (fract(uv_noise) - 0.5) * 0.3;\
red += dist * 0.1;\
green += dist * 0.2;\
blue += dist * 0.125;\
\
gl_FragColor.r = texture2D(pic, red).r;\
gl_FragColor.g = texture2D(pic, green).g;\
gl_FragColor.b = texture2D(pic, blue).b;\
gl_FragColor.a = 1.0;\
\
}\
\
void main(void)\
{\
float smoothed = smoothstep(0., 1., progress);\
if( ( smoothed < 0.4 && smoothed > 0.1) ) {\
glitch_memories(from);\
} else if ((smoothed > 0.6 && smoothed < 0.9) ) {\
glitch_memories(to);\
} else {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
gl_FragColor = mix(texture2D(from, p), texture2D(to, p), progress);\
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = glitch;
module.exports = exports["default"];
/***/ }),
/* 39 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var dreamyzoom = {
"title": "DreamyZoom",
"description": "A dreamyzoom effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
const float DEG2RAD = 0.03926990816987241548078304229099;\
\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float rotation;\
uniform float scale;\
\
void main() {\
float phase = progress < 0.5 ? progress * 2.0 : (progress - 0.5) * 2.0;\
float angleOffset = progress < 0.5 ? mix(0.0, rotation * DEG2RAD, phase) : mix(-rotation * DEG2RAD, 0.0, phase);\
float newScale = progress < 0.5 ? mix(1.0, scale, phase) : mix(scale, 1.0, phase);\
\
vec2 center = vec2(0, 0);\
vec2 maxRes = resolution;\
float resX = 0.5;\
float resY = 0.5;\
vec2 p = (gl_FragCoord.xy / maxRes - vec2(resX, resY)) / newScale;\
\
float angle = atan(p.y, p.x) + angleOffset;\
float dist = distance(center, p);\
p.x = cos(angle) * dist + resX;\
p.y = sin(angle) * dist + resY;\
vec4 c = progress < 0.5 ? texture2D(from, p) : texture2D(to, p);\
\
gl_FragColor = c + (progress < 0.5 ? mix(0.0, 1.0, phase) : mix(1.0, 0.0, phase));\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"rotation": { "type": "uniform", "value": 6.0 },
"scale": { "type": "uniform", "value": 1.2 }
},
"inputs": ["from", "to"]
};
exports["default"] = dreamyzoom;
module.exports = exports["default"];
/***/ }),
/* 40 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var tilewaveBottomToTop = {
"title": "TileWaveBottomToTop",
"description": "A tilewaveBottomToTop effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform vec2 tileSize;\
uniform float checkerDistance;\
\
const bool flipX = false;\
const bool flipY = false;\
const bool preTileSingleColor = false;\
const bool postTileSingleColor = false;\
\
vec2 tile2Global(vec2 tex, vec2 tileNum, bool tileSingleColor) {\
vec2 perTile = tileSize / resolution.xy;\
return tileNum * perTile + (tileSingleColor ? vec2(0) : tex*perTile);\
}\
\
void main(void)\
{\
vec2 uv = gl_FragCoord.xy / resolution.xy;\
vec4 fragColor = vec4(1, 1, 0, 1);\
\
vec2 posInTile = mod(vec2(gl_FragCoord), tileSize);\
vec2 tileNum = floor(vec2(gl_FragCoord)/ tileSize);\
int num = int(tileNum.x);\
vec2 totalTiles = ceil(resolution.xy / tileSize);\
float countTiles = totalTiles.x * totalTiles.y;\
\
vec2 perTile = ceil(tileSize / resolution.xy);\
float offset = 0.0;\
offset = (tileNum.y + tileNum.x * perTile.y) / (sqrt(countTiles) * 2.0);\
\
float timeOffset = (progress - offset) * countTiles;\
timeOffset = clamp(timeOffset, 0.0, 0.5);\
\
float sinTime = 1.0 - abs(cos(fract(timeOffset) * 3.1415926));\
\
fragColor.rg = uv;\
fragColor.b = sinTime;\
\
vec2 texC = posInTile / tileSize;\
\
if (sinTime <= 0.5){\
\
\
if (flipX) {\
if ((texC.x < sinTime) || (texC.x > 1.0 - sinTime)){\
discard;\
}\
if (texC.x < 0.5) {\
texC.x = (texC.x - sinTime) * 0.5 / (0.5 - sinTime);\
} else {\
texC.x = (texC.x - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;\
}\
}\
\
if (flipY) {\
if ((texC.y < sinTime) || (texC.y > 1.0 - sinTime)){\
discard;\
}\
if (texC.y < 0.5) {\
texC.y = (texC.y - sinTime) * 0.5 / (0.5 - sinTime);\
} else {\
texC.y = (texC.y - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;\
}\
}\
\
fragColor = texture2D(from, tile2Global(texC, tileNum, preTileSingleColor));\
\
} else {\
if (flipX) {\
if ((texC.x > sinTime) || (texC.x < 1.0 - sinTime)){\
discard;\
}\
if (texC.x < 0.5) {\
texC.x = (texC.x - sinTime) * 0.5 / (0.5 - sinTime);\
} else {\
texC.x = (texC.x - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;\
}\
texC.x = 1.0 - texC.x;\
}\
\
if (flipY) {\
if ((texC.y > sinTime) || (texC.y < 1.0 - sinTime)){\
discard;\
}\
if (texC.y < 0.5) {\
texC.y = (texC.y - sinTime) * 0.5 / (0.5 - sinTime);\
} else {\
texC.y = (texC.y - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;\
}\
texC.y = 1.0 - texC.y;\
}\
\
fragColor.rgb = texture2D(to, tile2Global(texC, tileNum, postTileSingleColor)).rgb;\
\
}\
gl_FragColor = fragColor;\
\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"tileSize": { "type": "uniform", "value": [64.0, 64.0] },
"checkerDistance": { "type": "uniform", "value": 0.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = tilewaveBottomToTop;
module.exports = exports["default"];
/***/ }),
/* 41 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var tilescanline = {
"title": "TileScanline",
"description": "A tilescanline effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
const vec2 tileSize = vec2(32, 32);\
const float checkerDistance = 0.015;\
const bool flipX = true;\
const bool flipY = false;\
const bool preTileSingleColor = false; \
const bool postTileSingleColor = false; \
\
vec2 tile2Global(vec2 tex, vec2 tileNum, bool tileSingleColor) {\
vec2 perTile = tileSize / resolution.xy;\
return tileNum * perTile + (tileSingleColor ? vec2(0) : tex*perTile);\
}\
\
void main(void)\
{\
vec2 uv = gl_FragCoord.xy / resolution.xy;\
\
vec4 fragColor = vec4(1, 1, 0, 1);\
\
vec2 posInTile = mod(vec2(gl_FragCoord), tileSize);\
vec2 tileNum = floor(vec2(gl_FragCoord)/ tileSize);\
int num = int(tileNum.x);\
vec2 totalTiles = ceil(resolution.xy / tileSize);\
float countTiles = totalTiles.x * totalTiles.y;\
\
vec2 perTile = ceil(tileSize / resolution.xy);\
float offset = 0.0;\
offset = (tileNum.x + tileNum.y * totalTiles.x) / countTiles;\
\
float timeOffset = (progress - offset) * countTiles;\
timeOffset = clamp(timeOffset, 0.0, 0.5);\
\
float sinTime = 1.0 - abs(cos(fract(timeOffset) * 3.1415926));\
\
fragColor.rg = uv;\
fragColor.b = sinTime;\
\
vec2 texC = posInTile / tileSize;\
\
if (sinTime <= 0.5){\
\
\
if (flipX) {\
if ((texC.x < sinTime) || (texC.x > 1.0 - sinTime)){\
discard;\
}\
if (texC.x < 0.5) {\
texC.x = (texC.x - sinTime) * 0.5 / (0.5 - sinTime);\
} else {\
texC.x = (texC.x - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;\
}\
}\
\
if (flipY) {\
if ((texC.y < sinTime) || (texC.y > 1.0 - sinTime)){\
discard;\
}\
if (texC.y < 0.5) {\
texC.y = (texC.y - sinTime) * 0.5 / (0.5 - sinTime);\
} else {\
texC.y = (texC.y - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;\
}\
}\
\
fragColor = texture2D(from, tile2Global(texC, tileNum, preTileSingleColor));\
\
} else {\
if (flipX) {\
if ((texC.x > sinTime) || (texC.x < 1.0 - sinTime)){\
discard;\
}\
if (texC.x < 0.5) {\
texC.x = (texC.x - sinTime) * 0.5 / (0.5 - sinTime);\
} else {\
texC.x = (texC.x - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;\
}\
texC.x = 1.0 - texC.x;\
}\
\
if (flipY) {\
if ((texC.y > sinTime) || (texC.y < 1.0 - sinTime)){\
discard;\
}\
if (texC.y < 0.5) {\
texC.y = (texC.y - sinTime) * 0.5 / (0.5 - sinTime);\
} else {\
texC.y = (texC.y - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;\
}\
texC.y = 1.0 - texC.y;\
}\
\
fragColor.rgb = texture2D(to, tile2Global(texC, tileNum, postTileSingleColor)).rgb;\
\
}\
gl_FragColor = fragColor;\
\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = tilescanline;
module.exports = exports["default"];
/***/ }),
/* 42 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var dreamy = {
"title": "Dreamy",
"description": "A dreamy effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
vec2 offset(float progress, float x, float theta) {\
float phase = progress*progress + progress + theta;\
float shifty = 0.03*progress*cos(10.0*(progress+x));\
return vec2(0, shifty);\
}\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
gl_FragColor = mix(texture2D(from, p + offset(progress, p.x, 0.0)), texture2D(to, p + offset(1.0-progress, p.x, 3.14)), progress);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = dreamy;
module.exports = exports["default"];
/***/ }),
/* 43 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var advancedmosaic = {
"title": "Advancedmosaic",
"description": "A advancedmosaic effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
void main(void)\
{\
vec2 p = gl_FragCoord.xy / resolution.xy;\
\
float T = progress;\
float S0 = 1.0;\
float S1 = 50.0;\
float S2 = 1.0;\
float Half = 0.5;\
\
float PixelSize = ( T < Half ) ? mix( S0, S1, T / Half ) : mix( S1, S2, (T-Half) / Half );\
vec2 D = PixelSize / resolution.xy;\
vec2 UV = ( p + vec2( -0.5 ) ) / D;\
vec2 Coord = clamp( D * ( ceil( UV + vec2( -0.5 ) ) ) + vec2( 0.5 ), vec2( 0.0 ), vec2( 1.0 ) );\
vec4 C0 = texture2D( from, Coord );\
vec4 C1 = texture2D( to, Coord );\
\
gl_FragColor = mix( C0, C1, T );\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = advancedmosaic;
module.exports = exports["default"];
/***/ }),
/* 44 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var swirl = {
"title": "Swirl",
"description": "A swirl effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
void main(void)\
{\
float Radius = 1.0;\
float T = progress;\
vec2 UV = gl_FragCoord.xy / resolution.xy;\
UV -= vec2( 0.5, 0.5 );\
float Dist = length(UV);\
if ( Dist < Radius )\
{\
float Percent = (Radius - Dist) / Radius;\
float A = ( T <= 0.5 ) ? mix( 0.0, 1.0, T/0.5 ) : mix( 1.0, 0.0, (T-0.5)/0.5 );\
float Theta = Percent * Percent * A * 8.0 * 3.14159;\
float S = sin( Theta );\
float C = cos( Theta );\
UV = vec2( dot(UV, vec2(C, -S)), dot(UV, vec2(S, C)) );\
}\
UV += vec2( 0.5, 0.5 );\
\
vec4 C0 = texture2D( from, UV );\
vec4 C1 = texture2D( to, UV );\
\
gl_FragColor = mix( C0, C1, T );\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = swirl;
module.exports = exports["default"];
/***/ }),
/* 45 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var defocusBlur = {
"title": "DefocusBlur",
"description": "A defocusBlur effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform float progress;\
uniform vec2 resolution;\
uniform sampler2D from;\
uniform sampler2D to;\
\
void main(void)\
{\
vec2 p = gl_FragCoord.xy / resolution.xy;\
\
float T = progress;\
float S0 = 1.0;\
float S1 = 50.0;\
float S2 = 1.0;\
float Half = 0.5;\
float PixelSize = ( T < Half ) ? mix( S0, S1, T / Half ) : mix( S1, S2, (T-Half) / Half );\
vec2 D = PixelSize / resolution.xy;\
vec2 UV = (gl_FragCoord.xy / resolution.xy);\
const int NumTaps = 12;\
vec2 Disk[NumTaps];\
Disk[0] = vec2(-.326,-.406);\
Disk[1] = vec2(-.840,-.074);\
Disk[2] = vec2(-.696, .457);\
Disk[3] = vec2(-.203, .621);\
Disk[4] = vec2( .962,-.195);\
Disk[5] = vec2( .473,-.480);\
Disk[6] = vec2( .519, .767);\
Disk[7] = vec2( .185,-.893);\
Disk[8] = vec2( .507, .064);\
Disk[9] = vec2( .896, .412);\
Disk[10] = vec2(-.322,-.933);\
Disk[11] = vec2(-.792,-.598);\
\
vec4 C0 = texture2D( from, UV );\
vec4 C1 = texture2D( to, UV );\
\
for ( int i = 0; i != NumTaps; i++ )\
{\
C0 += texture2D( from, Disk[i] * D + UV );\
C1 += texture2D( to, Disk[i] * D + UV );\
}\
C0 /= float(NumTaps+1);\
C1 /= float(NumTaps+1);\
\
gl_FragColor = mix( C0, C1, T );\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = defocusBlur;
module.exports = exports["default"];
/***/ }),
/* 46 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var colourDistance = {
"title": "ColourDistance",
"description": "A colourDistance effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
uniform float interpolationPower;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec4 fTex = texture2D(from,p);\
vec4 tTex = texture2D(to,p);\
gl_FragColor = mix(distance(fTex,tTex)>progress?fTex:tTex,\
tTex,\
pow(progress,interpolationPower));\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"interpolationPower": { "type": "uniform", "value": 5.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = colourDistance;
module.exports = exports["default"];
/***/ }),
/* 47 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var dissolve = {
"title": "Dissolve",
"description": "A dissolve effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
uniform float blocksize;\
\
float rand(vec2 co) {\
return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);\
}\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
if (progress == 0.0) {\
gl_FragColor = texture2D(from, p);\
return;\
}\
gl_FragColor = mix(texture2D(from, p), texture2D(to, p), step(rand(floor(gl_FragCoord.xy/blocksize)), progress));\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"blocksize": { "type": "uniform", "value": 1.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = dissolve;
module.exports = exports["default"];
/***/ }),
/* 48 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var hsvfade = {
"title": "Hsvfade",
"description": "A hsvfade effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
vec3 hsv2rgb(vec3 c) {\
const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\
}\
\
vec3 rgb2hsv(vec3 c) {\
const vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\
\
float d = q.x - min(q.w, q.y);\
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + 0.001)), d / (q.x + 0.001), q.x);\
}\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec3 a = rgb2hsv(texture2D(from, p).rgb);\
vec3 b = rgb2hsv(texture2D(to, p).rgb);\
vec3 m = mix(a, b, progress);\
gl_FragColor = vec4(hsv2rgb(m), 1.0);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = hsvfade;
module.exports = exports["default"];
/***/ }),
/* 49 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var fold = {
"title": "Fold",
"description": "A fold effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec4 a = texture2D(from, (p - vec2(progress, 0.0)) / vec2(1.0-progress, 1.0));\
vec4 b = texture2D(to, p / vec2(progress, 1.0));\
gl_FragColor = mix(a, b, step(p.x, progress));\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = fold;
module.exports = exports["default"];
/***/ }),
/* 50 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var linearblur = {
"title": "Linearblur",
"description": "A linearblur effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
uniform float intensity;\
\
const int PASSES = 8;\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec4 c1 = vec4(0.0), c2 = vec4(0.0);\
float disp = intensity*(0.5-distance(0.5, progress));\
for (int xi=0; xi<PASSES; ++xi) {\
float x = float(xi) / float(PASSES) - 0.5;\
for (int yi=0; yi<PASSES; ++yi) {\
float y = float(yi) / float(PASSES) - 0.5;\
vec2 v = vec2(x,y);\
float d = disp;\
c1 += texture2D(from, p + d*v);\
c2 += texture2D(to, p + d*v);\
}\
}\
c1 /= float(PASSES*PASSES);\
c2 /= float(PASSES*PASSES);\
gl_FragColor = mix(c1, c2, progress);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = linearblur;
module.exports = exports["default"];
/***/ }),
/* 51 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var pixelize = {
"title": "Pixelize",
"description": "A pixelize effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
float rand(vec2 co){\
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\
}\
\
void main() {\
float revProgress = (1.0 - progress);\
float distFromEdges = min(progress, revProgress);\
float squareSize = (50.0 * distFromEdges) + 1.0; \
\
vec2 p = (floor((gl_FragCoord.xy + squareSize * 0.5) / squareSize) * squareSize) / resolution.xy;\
vec4 fromColor = texture2D(from, p);\
vec4 toColor = texture2D(to, p);\
\
gl_FragColor = mix(fromColor, toColor, progress);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = pixelize;
module.exports = exports["default"];
/***/ }),
/* 52 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var randomsquares = {
"title": "Randomsquares",
"description": "A randomsquares effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
float rand(vec2 co){\
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\
}\
\
void main() {\
float revProgress = (1.0 - progress);\
float distFromEdges = min(progress, revProgress);\
\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec4 fromColor = texture2D(from, p);\
vec4 toColor = texture2D(to, p);\
float squareSize = 20.0;\
float flickerSpeed = 60.0;\
\
vec2 seed = floor(gl_FragCoord.xy / squareSize) * floor(distFromEdges * flickerSpeed);\
gl_FragColor = mix(fromColor, toColor, progress) + rand(seed) * distFromEdges * 0.5;\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = randomsquares;
module.exports = exports["default"];
/***/ }),
/* 53 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var pagecurl = {
"title": "Pagecurl",
"description": "A pagecurl effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
const float MIN_AMOUNT = -0.16;\
const float MAX_AMOUNT = 1.3;\
const float PI = 3.141592653589793;\
const float scale = 512.0;\
const float sharpness = 3.0;\
const float cylinderRadius = 1.0 / PI / 2.0;\
\
vec3 hitPoint(float hitAngle, float yc, vec3 point, mat3 rrotation)\
{\
float hitPoint = hitAngle / (2.0 * PI);\
point.y = hitPoint;\
return rrotation * point;\
}\
\
vec4 antiAlias(vec4 color1, vec4 color2, float distanc)\
{\
distanc *= scale;\
if (distanc < 0.0) return color2;\
if (distanc > 2.0) return color1;\
float dd = pow(1.0 - distanc / 2.0, sharpness);\
return ((color2 - color1) * dd) + color1;\
}\
\
float distanceToEdge(vec3 point)\
{\
float dx = abs(point.x > 0.5 ? 1.0 - point.x : point.x);\
float dy = abs(point.y > 0.5 ? 1.0 - point.y : point.y);\
if (point.x < 0.0) dx = -point.x;\
if (point.x > 1.0) dx = point.x - 1.0;\
if (point.y < 0.0) dy = -point.y;\
if (point.y > 1.0) dy = point.y - 1.0;\
if ((point.x < 0.0 || point.x > 1.0) && (point.y < 0.0 || point.y > 1.0)) return sqrt(dx * dx + dy * dy);\
return min(dx, dy);\
}\
\
vec4 seeThrough(float yc, vec2 p, mat3 rotation, mat3 rrotation)\
{\
float amount = progress * (MAX_AMOUNT - MIN_AMOUNT) + MIN_AMOUNT;\
float cylinderAngle = 2.0 * PI * amount;\
\
float hitAngle = PI - (acos(yc / cylinderRadius) - cylinderAngle);\
vec3 point = hitPoint(hitAngle, yc, rotation * vec3(p, 1.0), rrotation);\
if (yc <= 0.0 && (point.x < 0.0 || point.y < 0.0 || point.x > 1.0 || point.y > 1.0))\
{\
vec2 texCoord = gl_FragCoord.xy / resolution.xy;\
return texture2D(to, texCoord);\
}\
\
if (yc > 0.0) return texture2D(from, p);\
\
vec4 color = texture2D(from, point.xy);\
vec4 tcolor = vec4(0.0);\
\
return antiAlias(color, tcolor, distanceToEdge(point));\
}\
\
vec4 seeThroughWithShadow(float yc, vec2 p, vec3 point, mat3 rotation, mat3 rrotation)\
{\
float amount = progress * (MAX_AMOUNT - MIN_AMOUNT) + MIN_AMOUNT;\
float shadow = distanceToEdge(point) * 30.0;\
shadow = (1.0 - shadow) / 3.0;\
\
if (shadow < 0.0) shadow = 0.0; else shadow *= amount;\
\
vec4 shadowColor = seeThrough(yc, p, rotation, rrotation);\
shadowColor.r -= shadow;\
shadowColor.g -= shadow;\
shadowColor.b -= shadow;\
\
return shadowColor;\
}\
\
vec4 backside(float yc, vec3 point)\
{\
vec4 color = texture2D(from, point.xy);\
float gray = (color.r + color.b + color.g) / 15.0;\
gray += (8.0 / 10.0) * (pow(1.0 - abs(yc / cylinderRadius), 2.0 / 10.0) / 2.0 + (5.0 / 10.0));\
color.rgb = vec3(gray);\
return color;\
}\
\
vec4 behindSurface(float yc, vec3 point, mat3 rrotation)\
{\
float amount = progress * (MAX_AMOUNT - MIN_AMOUNT) + MIN_AMOUNT;\
float cylinderAngle = 2.0 * PI * amount;\
float shado = (1.0 - ((-cylinderRadius - yc) / amount * 7.0)) / 6.0;\
shado *= 1.0 - abs(point.x - 0.5);\
\
yc = (-cylinderRadius - cylinderRadius - yc);\
\
float hitAngle = (acos(yc / cylinderRadius) + cylinderAngle) - PI;\
point = hitPoint(hitAngle, yc, point, rrotation);\
\
if (yc < 0.0 && point.x >= 0.0 && point.y >= 0.0 && point.x <= 1.0 && point.y <= 1.0 && (hitAngle < PI || amount > 0.5))\
{\
shado = 1.0 - (sqrt(pow(point.x - 0.5, 2.0) + pow(point.y - 0.5, 2.0)) / (71.0 / 100.0));\
shado *= pow(-yc / cylinderRadius, 3.0);\
shado *= 0.5;\
}\
else\
{\
shado = 0.0;\
}\
\
vec2 texCoord = gl_FragCoord.xy / resolution.xy;\
\
return vec4(texture2D(to, texCoord).rgb - shado, 1.0);\
}\
\
void main()\
{\
float amount = progress * (MAX_AMOUNT - MIN_AMOUNT) + MIN_AMOUNT;\
float cylinderCenter = amount;\
float cylinderAngle = 2.0 * PI * amount;\
vec2 texCoord = gl_FragCoord.xy / resolution.xy;\
if (progress == 0.0) {\
gl_FragColor = texture2D(from, texCoord);\
return;\
}\
\
const float angle = 30.0 * PI / 180.0;\
float c = cos(-angle);\
float s = sin(-angle);\
\
mat3 rotation = mat3( c, s, 0,\
-s, c, 0,\
0.12, 0.258, 1\
);\
c = cos(angle);\
s = sin(angle);\
\
mat3 rrotation = mat3( c, s, 0,\
-s, c, 0,\
0.15, -0.5, 1\
);\
\
vec3 point = rotation * vec3(texCoord, 1.0);\
\
float yc = point.y - cylinderCenter;\
\
if (yc < -cylinderRadius)\
{\
gl_FragColor = behindSurface(yc, point, rrotation);\
return;\
}\
\
if (yc > cylinderRadius)\
{\
gl_FragColor = texture2D(from, texCoord);\
return;\
}\
\
float hitAngle = (acos(yc / cylinderRadius) + cylinderAngle) - PI;\
\
float hitAngleMod = mod(hitAngle, 2.0 * PI);\
if ((hitAngleMod > PI && amount < 0.5) || (hitAngleMod > PI/2.0 && amount < 0.0))\
{\
gl_FragColor = seeThrough(yc, texCoord, rotation, rrotation);\
return;\
}\
\
point = hitPoint(hitAngle, yc, point, rrotation);\
\
if (point.x < 0.0 || point.y < 0.0 || point.x > 1.0 || point.y > 1.0)\
{\
gl_FragColor = seeThroughWithShadow(yc, texCoord, point, rotation, rrotation);\
return;\
}\
\
vec4 color = backside(yc, point);\
\
vec4 otherColor;\
if (yc < 0.0)\
{\
float shado = 1.0 - (sqrt(pow(point.x - 0.5, 2.0) + pow(point.y - 0.5, 2.0)) / 0.71);\
shado *= pow(-yc / cylinderRadius, 3.0);\
shado *= 0.5;\
otherColor = vec4(0.0, 0.0, 0.0, shado);\
}\
else\
{\
otherColor = texture2D(from, texCoord);\
}\
\
color = antiAlias(color, otherColor, cylinderRadius - abs(yc));\
\
vec4 cl = seeThroughWithShadow(yc, texCoord, point, rotation, rrotation);\
float dist = distanceToEdge(point);\
\
gl_FragColor = antiAlias(color, cl, dist);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = pagecurl;
module.exports = exports["default"];
/***/ }),
/* 54 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var polkadots = {
"title": "Polkadots",
"description": "A polkadots effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float dots;\
\
float smoothAliase(vec2 p, float progress)\
{\
const float radius = 6.0;\
vec2 step = vec2(1.0)/resolution.xy;\
float c = distance(fract(p * dots), vec2(0.5, 0.5));\
float r1 = progress;\
float r2 = r1 + min(step.x,step.y)*radius;\
bool nextImage = c < r1;\
float a = nextImage?0.0:1.0;\
float alpha = 1.0;\
if (progress > 0.0 && progress < 1.0) {\
if (r1 < c && c < r2) {\
alpha = (c-r1)/(r2-r1);\
}\
}\
\
a *= alpha;\
\
return a;\
}\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
float a = smoothAliase(p, progress);\
gl_FragColor = mix(texture2D(to, p), texture2D(from, p), a);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"dots": { "type": "uniform", "value": 5.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = polkadots;
module.exports = exports["default"];
/***/ }),
/* 55 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var burn = {
"title": "Burn",
"description": "A burn effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform vec3 color;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
gl_FragColor = mix(\
texture2D(from, p) + vec4(progress*color, 1.0),\
texture2D(to, p) + vec4((1.0-progress)*color, 1.0),\
progress);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"color": { "type": "uniform", "value": [0.9, 0.4, 0.2] }
},
"inputs": ["from", "to"]
};
exports["default"] = burn;
module.exports = exports["default"];
/***/ }),
/* 56 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var finalGaussianNoise = {
"title": "FinalGaussianNoise",
"description": "A finalGaussianNoise effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
float Rand(vec2 v) {\
return fract(sin(dot(v.xy ,vec2(12.9898,78.233))) * 43758.5453);\
}\
\
float Gaussian(float p, float center, float c) {\
return 0.75 * exp(- pow((p - center) / c, 2.));\
}\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
float c = cos(Gaussian(progress * (1. + Gaussian(progress * Rand(p), 0.5, 0.5)), 0.5, 0.25));\
vec2 d = p * c;\
\
gl_FragColor = mix(texture2D(from, d), texture2D(to, d), progress);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = finalGaussianNoise;
module.exports = exports["default"];
/***/ }),
/* 57 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var mosaiczoom = {
"title": "Mosaiczoom",
"description": "A mosaiczoom effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
const float PI = 3.14159265358979323;\
float POW2(float X){return X*X;}\
float POW3(float X) {return X*X*X;}\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float endx;\
uniform float endy;\
\
float Rand(vec2 v) {\
return fract(sin(dot(v.xy ,vec2(12.9898,78.233))) * 43758.5453);\
}\
vec2 Rotate(vec2 v, float a) {\
mat2 rm = mat2(cos(a), -sin(a),\
sin(a), cos(a));\
return rm*v;\
}\
float CosInterpolation(float x) {\
return -cos(x*PI)/2.+.5;\
}\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy - .5;\
vec2 rp = p;\
float rpr = (progress*2.-1.);\
float z = -(rpr*rpr*2.) + 3.;\
float az = abs(z);\
rp *= az;\
rp += mix(vec2(.5, .5), vec2(float(endx) + .5, float(endy) + .5), POW2(CosInterpolation(progress)));\
vec2 mrp = mod(rp, 1.);\
vec2 crp = rp;\
bool onEnd = int(floor(crp.x))==int(endx)&&int(floor(crp.y))==int(endy);\
if(!onEnd) {\
float ang = float(int(Rand(floor(crp))*4.))*.5*PI;\
mrp = vec2(.5) + Rotate(mrp-vec2(.5), ang);\
}\
if(onEnd || Rand(floor(crp))>.5) {\
gl_FragColor = texture2D(to, mrp);\
} else {\
gl_FragColor = texture2D(from, mrp);\
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"endx": { "type": "uniform", "value": 0.0 },
"endy": { "type": "uniform", "value": -1.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = mosaiczoom;
module.exports = exports["default"];
/***/ }),
/* 58 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var radial = {
"title": "Radial",
"description": "A radial effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
const float PI = 3.141592653589;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
if (progress == 0.0) {\
gl_FragColor = texture2D(from, p);\
return;\
}\
vec2 rp = p*2.-1.;\
float a = atan(rp.y, rp.x);\
float pa = progress*PI*2.5-PI*1.25;\
vec4 fromc = texture2D(from, p);\
vec4 toc = texture2D(to, p);\
if(a>pa) {\
gl_FragColor = mix(toc, fromc, smoothstep(0., 1., (a-pa)));\
} else {\
gl_FragColor = toc;\
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = radial;
module.exports = exports["default"];
/***/ }),
/* 59 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var butterflyWaveScrawler = {
"title": "ButterflyWaveScrawler",
"description": "A butterflyWaveScrawler effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float amplitude;\
uniform float waves;\
uniform float colorSeparation;\
\
const float PI = 3.14159265358979323846264;\
float compute(vec2 p, float progress, vec2 center) {\
vec2 o = p*sin(progress * amplitude)-center;\
vec2 h = vec2(1., 0.);\
float theta = acos(dot(o, h)) * waves;\
return (exp(cos(theta)) - 2.*cos(4.*theta) + pow(sin((2.*theta - PI) / 24.), 5.)) / 10.;\
}\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
float inv = 1. - progress;\
vec2 dir = p - vec2(.5);\
float dist = length(dir);\
float disp = compute(p, progress, vec2(0.5, 0.5)) ;\
vec4 texTo = texture2D(to, p + inv*disp);\
vec4 texFrom = vec4(\
texture2D(from, p + progress*disp*(1.0 - colorSeparation)).r,\
texture2D(from, p + progress*disp).g,\
texture2D(from, p + progress*disp*(1.0 + colorSeparation)).b,\
1.0);\
gl_FragColor = texTo*progress + texFrom*inv;\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"amplitude": { "type": "uniform", "value": 1.0 },
"waves": { "type": "uniform", "value": 30.0 },
"colorSeparation": { "type": "uniform", "value": 0.3 }
},
"inputs": ["from", "to"]
};
exports["default"] = butterflyWaveScrawler;
module.exports = exports["default"];
/***/ }),
/* 60 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var crazyparametricfun = {
"title": "Crazyparametricfun",
"description": "A crazyparametricfun effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float a;\
uniform float b;\
uniform float amplitude;\
uniform float smoothness;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec2 dir = p - vec2(.5);\
float dist = length(dir);\
float x = (a - b) * cos(progress) + b * cos(progress * ((a / b) - 1.) );\
float y = (a - b) * sin(progress) - b * sin(progress * ((a / b) - 1.));\
vec2 offset = dir * vec2(sin(progress * dist * amplitude * x), sin(progress * dist * amplitude * y)) / smoothness;\
gl_FragColor = mix(texture2D(from, p + offset), texture2D(to, p), smoothstep(0.2, 1.0, progress));\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"a": { "type": "uniform", "value": 4.0 },
"b": { "type": "uniform", "value": 1.0 },
"amplitude": { "type": "uniform", "value": 120.0 },
"smoothness": { "type": "uniform", "value": 0.1 }
},
"inputs": ["from", "to"]
};
exports["default"] = crazyparametricfun;
module.exports = exports["default"];
/***/ }),
/* 61 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var ripple = {
"title": "Ripple",
"description": "A ripple effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float amplitude;\
uniform float speed;\
\
void main()\
{\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec2 dir = p - vec2(.5);\
float dist = length(dir);\
vec2 offset = dir * (sin(progress * dist * amplitude - progress * speed) + .5) / 30.;\
gl_FragColor = mix(texture2D(from, p + offset), texture2D(to, p), smoothstep(0.2, 1.0, progress));\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"amplitude": { "type": "uniform", "value": 100.0 },
"speed": { "type": "uniform", "value": 50.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = ripple;
module.exports = exports["default"];
/***/ }),
/* 62 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var flash = {
"title": "Flash",
"description": "A flash effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float flashPhase;\
uniform float flashIntensity;\
uniform float flashZoomEffect;\
\
const vec3 flashColor = vec3(1.0, 0.8, 0.3);\
const float flashVelocity = 3.0;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec4 fc = texture2D(from, p);\
vec4 tc = texture2D(to, p);\
float intensity = mix(1.0, 2.0*distance(p, vec2(0.5, 0.5)), flashZoomEffect) * flashIntensity * pow(smoothstep(flashPhase, 0.0, distance(0.5, progress)), flashVelocity);\
vec4 c = mix(texture2D(from, p), texture2D(to, p), smoothstep(0.5*(1.0-flashPhase), 0.5*(1.0+flashPhase), progress));\
c += intensity * vec4(flashColor, 1.0);\
gl_FragColor = c;\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"flashPhase": { "type": "uniform", "value": 0.3 },
"flashIntensity": { "type": "uniform", "value": 3.0 },
"flashZoomEffect": { "type": "uniform", "value": 0.5 }
},
"inputs": ["from", "to"]
};
exports["default"] = flash;
module.exports = exports["default"];
/***/ }),
/* 63 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var flyeye = {
"title": "Flyeye",
"description": "A flyeye effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float size;\
uniform float zoom;\
uniform float colorSeparation;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
float inv = 1. - progress;\
vec2 disp = size*vec2(cos(zoom*p.x), sin(zoom*p.y));\
vec4 texTo = texture2D(to, p + inv*disp);\
vec4 texFrom = vec4(\
texture2D(from, p + progress*disp*(1.0 - colorSeparation)).r,\
texture2D(from, p + progress*disp).g,\
texture2D(from, p + progress*disp*(1.0 + colorSeparation)).b,\
1.0);\
gl_FragColor = texTo*progress + texFrom*inv;\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"size": { "type": "uniform", "value": 0.4 },
"zoom": { "type": "uniform", "value": 30.0 },
"colorSeparation": { "type": "uniform", "value": 0.3 }
},
"inputs": ["from", "to"]
};
exports["default"] = flyeye;
module.exports = exports["default"];
/***/ }),
/* 64 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var morph = {
"title": "Morph",
"description": "A morph effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float reflection;\
uniform float perspective;\
uniform float depth;\
\
const vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\
const vec2 boundMin = vec2(0.0, 0.0);\
const vec2 boundMax = vec2(1.0, 1.0);\
\
bool inBounds (vec2 p) {\
return all(lessThan(boundMin, p)) && all(lessThan(p, boundMax));\
}\
\
vec2 project (vec2 p) {\
return p * vec2(1.0, -1.2) + vec2(0.0, -0.02);\
}\
\
vec4 bgColor (vec2 p, vec2 pto) {\
vec4 c = black;\
pto = project(pto);\
if (inBounds(pto)) {\
c += mix(black, texture2D(to, pto), reflection * mix(1.0, 0.0, pto.y));\
}\
return c;\
}\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
\
vec2 pfr = vec2(-1.), pto = vec2(-1.);\
\
float middleSlit = 2.0 * abs(p.x-0.5) - progress;\
if (middleSlit > 0.0) {\
pfr = p + (p.x > 0.5 ? -1.0 : 1.0) * vec2(0.5*progress, 0.0);\
float d = 1.0/(1.0+perspective*progress*(1.0-middleSlit));\
pfr.y -= d/2.;\
pfr.y *= d;\
pfr.y += d/2.;\
}\
\
float size = mix(1.0, depth, 1.-progress);\
pto = (p + vec2(-0.5, -0.5)) * vec2(size, size) + vec2(0.5, 0.5);\
\
if (inBounds(pfr)) {\
gl_FragColor = texture2D(from, pfr);\
}\
else if (inBounds(pto)) {\
gl_FragColor = texture2D(to, pto);\
}\
else {\
gl_FragColor = bgColor(p, pto);\
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"reflection": { "type": "uniform", "value": 0.4 },
"perspective": { "type": "uniform", "value": 0.4 },
"depth": { "type": "uniform", "value": 3.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = morph;
module.exports = exports["default"];
/***/ }),
/* 65 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var circleopen = {
"title": "Circleopen",
"description": "A mocircleopenrph effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float smoothness;\
uniform bool opening;\
\
const vec2 center = vec2(0.5, 0.5);\
const float SQRT_2 = 1.414213562373;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
float x = opening ? progress : (1.0-progress);\
float m = smoothstep(-smoothness, 0.0, SQRT_2*distance(center, p) - x*(1.+smoothness));\
gl_FragColor = mix(texture2D(from, p), texture2D(to, p), opening ? 1.-m : m);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"smoothness": { "type": "uniform", "value": 0.3 },
"opening": { "type": "uniform", "value": 1.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = circleopen;
module.exports = exports["default"];
/***/ }),
/* 66 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var fadecolor = {
"title": "Fadecolor",
"description": "A fadecolor effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
uniform vec3 color;\
uniform float colorPhase; \
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
gl_FragColor = mix(\
mix(vec4(color, 1.0), texture2D(from, p), smoothstep(1.0-colorPhase, 0.0, progress)),\
mix(vec4(color, 1.0), texture2D(to, p), smoothstep( colorPhase, 1.0, progress)),\
progress);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"color": { "type": "uniform", "value": [0.0, 0.0, 0.0] },
"colorPhase": { "type": "uniform", "value": 0.4 }
},
"inputs": ["from", "to"]
};
exports["default"] = fadecolor;
module.exports = exports["default"];
/***/ }),
/* 67 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var heartwipe = {
"title": "Heartwipe",
"description": "A heartwipe effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
\
bool inHeart (vec2 p, vec2 center, float size) {\
if (size == 0.0) return false;\
vec2 o = (p-center)/(1.6*size);\
return pow(o.x*o.x+o.y*o.y-0.3, 3.0) < o.x*o.x*pow(o.y, 3.0);\
}\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
float m = inHeart(p, vec2(0.5, 0.4), progress) ? 1.0 : 0.0;\
gl_FragColor = mix(texture2D(from, p), texture2D(to, p), m);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = heartwipe;
module.exports = exports["default"];
/***/ }),
/* 68 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var dispersionblur = {
"title": "Dispersionblur",
"description": "A dispersionblur effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float size;\
\
const float GOLDEN_ANGLE = 2.399963229728653;\
const int QUALITY = 32;\
\
vec4 blur(sampler2D t, vec2 c, float radius) {\
vec4 sum = vec4(0.0);\
float q = float(QUALITY);\
\
for (int i=0; i<QUALITY; ++i) {\
float fi = float(i);\
float a = fi * GOLDEN_ANGLE;\
float r = sqrt(fi / q) * radius;\
vec2 p = c + r * vec2(cos(a), sin(a));\
sum += texture2D(t, p);\
}\
return sum / q;\
}\
\
void main()\
{\
vec2 p = gl_FragCoord.xy / resolution.xy;\
float inv = 1.-progress;\
gl_FragColor = inv*blur(from, p, progress*size) + progress*blur(to, p, inv*size);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"size": { "type": "uniform", "value": 0.6 }
},
"inputs": ["from", "to"]
};
exports["default"] = dispersionblur;
module.exports = exports["default"];
/***/ }),
/* 69 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var invertedPagecurl = {
"title": "InvertedPagecurl",
"description": "A invertedPagecurl effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
const float MIN_AMOUNT = -0.16;\
const float MAX_AMOUNT = 1.5;\
const float PI = 3.141592653589793;\
const float scale = 512.0;\
const float sharpness = 3.0;\
const float cylinderRadius = 1.0 / PI / 2.0;\
\
vec3 hitPoint(float hitAngle, float yc, vec3 point, mat3 rrotation)\
{\
float hitPoint = hitAngle / (2.0 * PI);\
point.y = hitPoint;\
return rrotation * point;\
}\
\
vec4 antiAlias(vec4 color1, vec4 color2, float distanc)\
{\
distanc *= scale;\
if (distanc < 0.0) return color2;\
if (distanc > 2.0) return color1;\
float dd = pow(1.0 - distanc / 2.0, sharpness);\
return ((color2 - color1) * dd) + color1;\
}\
\
float distanceToEdge(vec3 point)\
{\
float dx = abs(point.x > 0.5 ? 1.0 - point.x : point.x);\
float dy = abs(point.y > 0.5 ? 1.0 - point.y : point.y);\
if (point.x < 0.0) dx = -point.x;\
if (point.x > 1.0) dx = point.x - 1.0;\
if (point.y < 0.0) dy = -point.y;\
if (point.y > 1.0) dy = point.y - 1.0;\
if ((point.x < 0.0 || point.x > 1.0) && (point.y < 0.0 || point.y > 1.0)) return sqrt(dx * dx + dy * dy);\
return min(dx, dy);\
}\
\
vec4 seeThrough(float yc, vec2 p, mat3 rotation, mat3 rrotation)\
{\
float amount = progress * (MAX_AMOUNT - MIN_AMOUNT) + MIN_AMOUNT;\
float cylinderAngle = 2.0 * PI * amount;\
float hitAngle = PI - (acos(yc / cylinderRadius) - cylinderAngle);\
vec3 point = hitPoint(hitAngle, yc, rotation * vec3(p, 1.0), rrotation);\
if (yc <= 0.0 && (point.x < 0.0 || point.y < 0.0 || point.x > 1.0 || point.y > 1.0))\
{\
vec2 texCoord = gl_FragCoord.xy / resolution.xy;\
return texture2D(to, texCoord);\
}\
\
if (yc > 0.0) return texture2D(from, p);\
\
vec4 color = texture2D(from, point.xy);\
vec4 tcolor = vec4(0.0);\
\
return antiAlias(color, tcolor, distanceToEdge(point));\
}\
\
vec4 seeThroughWithShadow(float yc, vec2 p, vec3 point, mat3 rotation, mat3 rrotation)\
{\
float amount = progress * (MAX_AMOUNT - MIN_AMOUNT) + MIN_AMOUNT;\
float shadow = distanceToEdge(point) * 30.0;\
shadow = (1.0 - shadow) / 3.0;\
\
if (shadow < 0.0) shadow = 0.0; else shadow *= amount;\
\
vec4 shadowColor = seeThrough(yc, p, rotation, rrotation);\
shadowColor.r -= shadow;\
shadowColor.g -= shadow;\
shadowColor.b -= shadow;\
\
return shadowColor;\
}\
\
vec4 backside(float yc, vec3 point)\
{\
vec4 color = texture2D(from, point.xy);\
float gray = (color.r + color.b + color.g) / 15.0;\
gray += (8.0 / 10.0) * (pow(1.0 - abs(yc / cylinderRadius), 2.0 / 10.0) / 2.0 + (5.0 / 10.0));\
color.rgb = vec3(gray);\
return color;\
}\
\
vec4 behindSurface(float yc, vec3 point, mat3 rrotation)\
{\
float amount = progress * (MAX_AMOUNT - MIN_AMOUNT) + MIN_AMOUNT;\
float cylinderAngle = 2.0 * PI * amount;\
float shado = (1.0 - ((-cylinderRadius - yc) / amount * 7.0)) / 6.0;\
shado *= 1.0 - abs(point.x - 0.5);\
\
yc = (-cylinderRadius - cylinderRadius - yc);\
\
float hitAngle = (acos(yc / cylinderRadius) + cylinderAngle) - PI;\
point = hitPoint(hitAngle, yc, point, rrotation);\
\
if (yc < 0.0 && point.x >= 0.0 && point.y >= 0.0 && point.x <= 1.0 && point.y <= 1.0 && (hitAngle < PI || amount > 0.5))\
{\
shado = 1.0 - (sqrt(pow(point.x - 0.5, 2.0) + pow(point.y - 0.5, 2.0)) / (71.0 / 100.0));\
shado *= pow(-yc / cylinderRadius, 3.0);\
shado *= 0.5;\
}\
else\
{\
shado = 0.0;\
}\
\
vec2 texCoord = gl_FragCoord.xy / resolution.xy;\
\
return vec4(texture2D(to, texCoord).rgb - shado, 1.0);\
}\
\
void main()\
{\
float amount = progress * (MAX_AMOUNT - MIN_AMOUNT) + MIN_AMOUNT;\
float cylinderCenter = amount;\
float cylinderAngle = 2.0 * PI * amount;\
vec2 texCoord = gl_FragCoord.xy / resolution.xy;\
if (progress == 0.0) {\
gl_FragColor = texture2D(from, texCoord);\
return;\
}\
\
const float angle = 100.0 * PI / 180.0;\
float c = cos(-angle);\
float s = sin(-angle);\
\
mat3 rotation = mat3( c, s, 0,\
-s, c, 0,\
-0.801, 0.8900, 1\
);\
c = cos(angle);\
s = sin(angle);\
\
mat3 rrotation = mat3( c, s, 0,\
-s, c, 0,\
0.98500, 0.985, 1\
);\
\
vec3 point = rotation * vec3(texCoord, 1.0);\
\
float yc = point.y - cylinderCenter;\
\
if (yc < -cylinderRadius)\
{\
gl_FragColor = behindSurface(yc, point, rrotation);\
return;\
}\
\
if (yc > cylinderRadius)\
{\
gl_FragColor = texture2D(from, texCoord);\
return;\
}\
\
float hitAngle = (acos(yc / cylinderRadius) + cylinderAngle) - PI;\
\
float hitAngleMod = mod(hitAngle, 2.0 * PI);\
if ((hitAngleMod > PI && amount < 0.5) || (hitAngleMod > PI/2.0 && amount < 0.0))\
{\
gl_FragColor = seeThrough(yc, texCoord, rotation, rrotation);\
return;\
}\
\
point = hitPoint(hitAngle, yc, point, rrotation);\
\
if (point.x < 0.0 || point.y < 0.0 || point.x > 1.0 || point.y > 1.0)\
{\
gl_FragColor = seeThroughWithShadow(yc, texCoord, point, rotation, rrotation);\
return;\
}\
\
vec4 color = backside(yc, point);\
\
vec4 otherColor;\
if (yc < 0.0)\
{\
float shado = 1.0 - (sqrt(pow(point.x - 0.5, 2.0) + pow(point.y - 0.5, 2.0)) / 0.71);\
shado *= pow(-yc / cylinderRadius, 3.0);\
shado *= 0.5;\
otherColor = vec4(0.0, 0.0, 0.0, shado);\
}\
else\
{\
otherColor = texture2D(from, texCoord);\
}\
\
color = antiAlias(color, otherColor, cylinderRadius - abs(yc));\
\
vec4 cl = seeThroughWithShadow(yc, texCoord, point, rotation, rrotation);\
float dist = distanceToEdge(point);\
\
gl_FragColor = antiAlias(color, cl, dist);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = invertedPagecurl;
module.exports = exports["default"];
/***/ }),
/* 70 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var waterdrop = {
"title": "Waterdrop",
"description": "A waterdrop effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float amplitude;\
uniform float speed;\
\
void main()\
{\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec2 dir = p - vec2(.5);\
float dist = length(dir);\
\
if (dist > progress) {\
gl_FragColor = mix(texture2D(from, p), texture2D(to, p), progress);\
} else {\
vec2 offset = dir * sin(dist * amplitude - progress * speed);\
gl_FragColor = mix(texture2D(from, p + offset), texture2D(to, p), progress);\
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"amplitude": { "type": "uniform", "value": 30.0 },
"speed": { "type": "uniform", "value": 30.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = waterdrop;
module.exports = exports["default"];
/***/ }),
/* 71 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var stereoViewerToy = {
"title": "StereoViewerToy",
"description": "A stereoViewerToy effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float zoom;\
uniform float corner_radius;\
\
const vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\
const vec2 c00 = vec2(0.0, 0.0);\
const vec2 c01 = vec2(0.0, 1.0);\
const vec2 c11 = vec2(1.0, 1.0);\
const vec2 c10 = vec2(1.0, 0.0);\
\
bool in_corner(vec2 p, vec2 corner, vec2 radius) {\
vec2 axis = (c11 - corner) - corner;\
p = p - (corner + axis * radius);\
p *= axis / radius;\
return (p.x > 0.0 && p.y > -1.0) || (p.y > 0.0 && p.x > -1.0) || dot(p, p) < 1.0;\
}\
\
bool test_rounded_mask(vec2 p, vec2 corner_size) {\
return\
in_corner(p, c00, corner_size) &&\
in_corner(p, c01, corner_size) &&\
in_corner(p, c10, corner_size) &&\
in_corner(p, c11, corner_size);\
}\
\
float dis_corner(vec2 p, vec2 corner, vec2 radius) {\
vec2 axis = (c11 - corner) - corner;\
p = p - (corner + axis * radius);\
p *= axis / radius;\
\
const float blur = 16.0;\
vec2 step = vec2(1.0)/resolution;\
float sblur = min(step.x, step.y)*blur;\
float alpha = ((p.x > 0.0 && p.y > -1.0) || (p.y > 0.0 && p.x > -1.0) || dot(p, p) < 1.0)?1.0:-1.0;\
if (p.x > 0.0 && p.y > -1.0 && p.y < -(1.0-sblur)) {\
alpha = (1.0 + p.y)/sblur;\
}\
\
if (p.y > 0.0 && p.x > -1.0 && p.x < -(1.0-sblur)) {\
alpha = (1.0 + p.x)/(sblur);\
}\
\
const float PI = 3.14159265358979323846;\
\
float d = dot(p, p);\
float m = sblur/1.41421356;\
float angle = atan(p.y, p.x);\
if (d < 1.0 && d > (1.0-m) && angle < -PI/2.0) {\
alpha = (1.0-d)/m;\
}\
\
return alpha;\
}\
\
float test_rounded(vec2 p, vec2 corner_size) {\
float alpha0 = dis_corner(p, c00, corner_size);\
float alpha1 = dis_corner(p, c01, corner_size);\
float alpha2 = dis_corner(p, c10, corner_size);\
float alpha3 = dis_corner(p, c11, corner_size);\
if (alpha0 < 0.0 || alpha1 < 0.0 || alpha2 < 0.0 || alpha3 < 0.0) {\
return -1.0;\
}\
\
return alpha0*alpha1*alpha2*alpha3;\
}\
\
vec4 screen(vec4 a, vec4 b) {\
return 1.0 - (1.0 - a) * (1.0 -b);\
}\
\
vec4 unscreen(vec4 c) {\
return 1.0 - sqrt(1.0 - c);\
}\
\
vec4 sample_with_corners(sampler2D tex, vec2 p, vec2 corner_size) {\
p = (p - 0.5) / zoom + 0.5;\
\
float alpha = test_rounded(p, corner_size);\
if (alpha < 0.0) {\
return black;\
}\
vec4 color = mix(black, texture2D(tex, p), alpha);\
return unscreen(color);\
}\
\
vec4 simple_sample_with_corners(sampler2D tex, vec2 p, vec2 corner_size, float zoom_amt) {\
p = (p - 0.5) / (1.0 - zoom_amt + zoom * zoom_amt) + 0.5;\
\
float alpha = test_rounded(p, corner_size);\
if (alpha < 0.0) {\
return black;\
}\
return mix(black, texture2D(tex, p), alpha);\
}\
\
mat3 rotate2d(float angle, float aspect) {\
float s = sin(angle);\
float c = cos(angle);\
return mat3(\
c, s ,0.0,\
-s, c, 0.0,\
0.0, 0.0, 1.0);\
}\
\
mat3 translate2d(float x, float y) {\
return mat3(\
1.0, 0.0, 0,\
0.0, 1.0, 0,\
-x, -y, 1.0);\
}\
\
mat3 scale2d(float x, float y) {\
return mat3(\
x, 0.0, 0,\
0.0, y, 0,\
0, 0, 1.0);\
}\
\
vec4 get_cross_rotated(vec3 p3, float angle, vec2 corner_size, float aspect) {\
angle = angle * angle;\
angle /= 2.4;\
\
mat3 center_and_scale = translate2d(-0.5, -0.5) * scale2d(1.0, aspect);\
mat3 unscale_and_uncenter = scale2d(1.0, 1.0/aspect) * translate2d(0.5,0.5);\
mat3 slide_left = translate2d(-2.0,0.0);\
mat3 slide_right = translate2d(2.0,0.0);\
mat3 rotate = rotate2d(angle, aspect);\
\
mat3 op_a = center_and_scale * slide_right * rotate * slide_left * unscale_and_uncenter;\
mat3 op_b = center_and_scale * slide_left * rotate * slide_right * unscale_and_uncenter;\
\
vec4 a = sample_with_corners(from, (op_a * p3).xy, corner_size);\
vec4 b = sample_with_corners(from, (op_b * p3).xy, corner_size);\
\
return screen(a, b);\
}\
\
vec4 get_cross_masked(vec3 p3, float angle, vec2 corner_size, float aspect) {\
angle = 1.0 - angle;\
angle = angle * angle;\
angle /= 2.4;\
\
vec4 img;\
\
mat3 center_and_scale = translate2d(-0.5, -0.5) * scale2d(1.0, aspect);\
mat3 unscale_and_uncenter = scale2d(1.0 / zoom, 1.0 / (zoom * aspect)) * translate2d(0.5,0.5);\
mat3 slide_left = translate2d(-2.0,0.0);\
mat3 slide_right = translate2d(2.0,0.0);\
mat3 rotate = rotate2d(angle, aspect);\
\
mat3 op_a = center_and_scale * slide_right * rotate * slide_left * unscale_and_uncenter;\
mat3 op_b = center_and_scale * slide_left * rotate * slide_right * unscale_and_uncenter;\
\
float alpha_a = test_rounded((op_a * p3).xy, corner_size);\
float alpha_b = test_rounded((op_b * p3).xy, corner_size);\
if (alpha_a > 0.0 || alpha_b > 0.0) {\
img = sample_with_corners(to, p3.xy, corner_size);\
vec4 color = screen(alpha_a > 0.0 ? mix(black, img, alpha_a) : black, alpha_b > 0.0 ? mix(black, img, alpha_b) : black);\
return color;\
}\
else {\
return black;\
}\
}\
\
void main() {\
float a;\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec3 p3 = vec3(p.xy, 1.0); \
\
float aspect = resolution.x / resolution.y;\
vec2 corner_size = vec2(corner_radius / aspect, corner_radius);\
\
if (progress <= 0.0) {\
gl_FragColor = texture2D(from, p);\
} else if (progress < 0.1) {\
a = progress / 0.1;\
gl_FragColor = simple_sample_with_corners(from, p, corner_size * a, a);\
} else if (progress < 0.48) {\
a = (progress - 0.1)/0.38;\
gl_FragColor = get_cross_rotated(p3, a, corner_size, aspect);\
} else if (progress < 0.9) {\
gl_FragColor = get_cross_masked(p3, (progress - 0.52)/0.38, corner_size, aspect);\
} else if (progress < 1.0) {\
a = (1.0 - progress) / 0.1;\
gl_FragColor = simple_sample_with_corners(to, p, corner_size * a, a);\
} else {\
gl_FragColor = texture2D(to, p);\
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"zoom": { "type": "uniform", "value": 0.88 },
"corner_radius": { "type": "uniform", "value": 0.22 }
},
"inputs": ["from", "to"]
};
exports["default"] = stereoViewerToy;
module.exports = exports["default"];
/***/ }),
/* 72 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var wipeup = {
"title": "Wipeup",
"description": "A wipeup effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec4 a = texture2D(from, p);\
vec4 b = texture2D(to, p);\
gl_FragColor = mix(a, b, step(0.0 + p.y, progress));\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = wipeup;
module.exports = exports["default"];
/***/ }),
/* 73 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var circlecrop = {
"title": "Circlecrop",
"description": "A v effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
float maxRadius = resolution.x + resolution.y;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
\
float distX = gl_FragCoord.x - resolution.x / 2.0;\
float distY = gl_FragCoord.y - resolution.y / 2.0;\
float dist = sqrt(distX * distX + distY * distY);\
\
float step = 2.0 * abs(progress - 0.5);\
step = step * step * step;\
\
if (dist < step * maxRadius)\
{\
const float blurRadius = 8.0; \
float alpha = 1.0;\
float bStep = max(step, pow(0.6,3.0));\
if (dist > step * maxRadius - bStep*blurRadius ) {\
alpha = (step * maxRadius - dist)/(bStep*blurRadius);\
}\
\
if (progress < 0.5)\
gl_FragColor = mix(vec4(0.0, 0.0, 0.0, 1.0),texture2D(from, p), alpha);\
else\
gl_FragColor = texture2D(to, p);\
}\
else\
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = circlecrop;
module.exports = exports["default"];
/***/ }),
/* 74 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var reveal = {
"title": "Reveal",
"description": "A reveal effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D to, from;\
uniform float progress;\
uniform vec2 resolution;\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
vec4 a = texture2D(from, p);\
vec4 b = texture2D(to, p);\
gl_FragColor = mix(a, b, step(1.0 - p.x, progress));\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = reveal;
module.exports = exports["default"];
/***/ }),
/* 75 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var puzzleright = {
"title": "Puzzleright",
"description": "A puzzleright effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
uniform vec2 size;\
uniform float pause;\
uniform float dividerSize;\
\
const vec4 dividerColor = vec4(0.0, 0.0, 0.0, 1.0);\
const float randomOffset = 0.1;\
\
float rand (vec2 co) {\
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\
}\
\
float getDelta(vec2 p) {\
vec2 rectanglePos = floor(vec2(size) * p);\
vec2 rectangleSize = vec2(1.0 / vec2(size).x, 1.0 / vec2(size).y);\
\
float top = rectangleSize.y * (rectanglePos.y + 1.0);\
float bottom = rectangleSize.y * rectanglePos.y;\
float left = rectangleSize.x * rectanglePos.x;\
float right = rectangleSize.x * (rectanglePos.x + 1.0);\
\
float minX = min(abs(p.x - left), abs(p.x - right));\
float minY = min(abs(p.y - top), abs(p.y - bottom));\
return min(minX, minY);\
}\
\
float getDividerSize() {\
vec2 rectangleSize = vec2(1.0 / vec2(size).x, 1.0 / vec2(size).y);\
return min(rectangleSize.x, rectangleSize.y) * dividerSize;\
}\
\
void showDivider (vec2 p) {\
float currentProg = progress / pause;\
\
float a = 1.0;\
if(getDelta(p) < getDividerSize()) {\
a = 1.0 - currentProg;\
}\
\
gl_FragColor = mix(dividerColor, texture2D(from, p), a);\
}\
\
void hideDivider (vec2 p) {\
float currentProg = (progress - 1.0 + pause) / pause;\
\
float a = 1.0;\
if(getDelta(p) < getDividerSize()) {\
a = currentProg;\
}\
\
gl_FragColor = mix(dividerColor, texture2D(to, p), a);\
}\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
\
if(progress < pause) {\
showDivider(p);\
} else if(progress < 1.0 - pause){\
if(getDelta(p) < getDividerSize()) {\
gl_FragColor = dividerColor;\
} else {\
float currentProg = (progress - pause) / (1.0 - pause * 2.0);\
vec2 q = p;\
vec2 rectanglePos = floor(vec2(size) * q);\
\
float r = rand(rectanglePos) - randomOffset;\
float cp = smoothstep(0.0, 1.0 - r, currentProg);\
\
float rectangleSize = 1.0 / vec2(size).x;\
float delta = rectanglePos.x * rectangleSize;\
float offset = rectangleSize / 2.0 + delta;\
\
p.x = (p.x - offset)/abs(cp - 0.5)*0.5 + offset;\
vec4 a = texture2D(from, p);\
vec4 b = texture2D(to, p);\
\
float s = step(abs(vec2(size).x * (q.x - delta) - 0.5), abs(cp - 0.5));\
gl_FragColor = vec4(mix(b, a, step(cp, 0.5)).rgb * s, 1.0);\
}\
} else {\
hideDivider(p);\
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"size": { "type": "uniform", "value": [4.0, 4.0] },
"pause": { "type": "uniform", "value": 0.1 },
"dividerSize": { "type": "uniform", "value": 0.05 }
},
"inputs": ["from", "to"]
};
exports["default"] = puzzleright;
module.exports = exports["default"];
/***/ }),
/* 76 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var warpfade = {
"title": "Warpfade",
"description": "A warpfade effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
void main() {\
float x = progress;\
vec2 p = gl_FragCoord.xy / resolution.xy;\
x=smoothstep(.0,1.0,(x*2.0+p.x-1.0));\
gl_FragColor = mix(texture2D(from, (p-.5)*(1.-x)+.5), texture2D(to, (p-.5)*x+.5), progress);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = warpfade;
module.exports = exports["default"];
/***/ }),
/* 77 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var bounce = {
"title": "Bounce",
"description": "A bounce effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform float bounce;\
uniform float shadow;\
uniform vec4 shadow_colour;\
\
void main() \
{\
vec2 p = gl_FragCoord.xy / resolution.xy;\
float phase = progress * 3.14159265358 * bounce;\
float y = (abs(cos(phase))) * (1.0-sin(progress * (3.14159265358/2.0)));\
\
if(progress == 0.0) {\
gl_FragColor = texture2D(from,p);\
}\
else if(p.y < y)\
{\
float d = y - p.y;\
if(d>shadow) {\
gl_FragColor = texture2D(from,p);\
}\
else\
{\
float a = ((d/shadow)*shadow_colour.a) + (1.0-shadow_colour.a);\
gl_FragColor = mix(shadow_colour,texture2D(from,p),a);\
}\
}\
else\
gl_FragColor = texture2D(to,vec2(p.x,p.y-y));\
\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"bounce": { "type": "uniform", "value": 2.5 },
"shadow": { "type": "uniform", "value": 0.075 },
"shadow_colour": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.8] }
},
"inputs": ["from", "to"]
};
exports["default"] = bounce;
module.exports = exports["default"];
/***/ }),
/* 78 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var atmosphericSlidershow = {
"title": "AtmosphericSlidershow",
"description": "A atmosphericSlidershow effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
\
vec2 zoom(vec2 uv, float amount)\
{\
return 0.5 + ((uv - 0.5) * amount); \
}\
\
void main() {\
vec2 uv = gl_FragCoord.xy / resolution.xy;\
vec2 r = 2.0*vec2(gl_FragCoord.xy - 0.5*resolution.xy)/resolution.y;\
float pro = progress / 0.8;\
float z = (pro) * 0.2;\
float t = 0.0;\
\
if (progress <= 0.0 ) {\
gl_FragColor = texture2D(from, uv);\
return;\
}\
if (progress >= 1.0 ) {\
gl_FragColor = texture2D(to, uv);\
return;\
}\
\
const float blurRadius = 6.0;\
vec2 step = vec2(1.0)/resolution.xy;\
float BR = min(step.x, step.y)*blurRadius;\
float alpha = 1.0;\
float lengthR = length(r);\
\
if (pro > 1.0)\
{\
z = 0.2 + (pro - 1.0) * 5.;\
t = clamp((progress - 0.8) / 0.07,0.0,1.0);\
}\
if (lengthR < 0.5+z)\
{\
}\
else if (lengthR < 0.8+z*1.5)\
{\
vec2 bgUV = uv;\
uv = zoom(uv, 1.0 - 0.15 * pro);\
float t1 = t;\
float t2 = t * 0.5;\
t = t * 0.5;\
\
if (lengthR < 0.5+z + BR){\
alpha = (0.5+z + BR - lengthR)/BR;\
if (t > 0.0) {\
vec4 bgcolor = mix(texture2D(from, bgUV), texture2D(to, bgUV), t1);\
vec4 fgcolor = mix(texture2D(from, uv), texture2D(to, uv), t2);\
gl_FragColor = mix(fgcolor, bgcolor, alpha);\
return;\
}\
\
vec4 bgcolor = mix(texture2D(from, bgUV), texture2D(to, bgUV), t);\
vec4 fgcolor = mix(texture2D(from, uv), texture2D(to, uv), t);\
gl_FragColor = mix(fgcolor, bgcolor, alpha);\
return;\
}\
}\
else if (lengthR < 1.2+z*2.5)\
{\
vec2 bgUV = zoom(uv, 1.0 - 0.15 * pro);\
uv = zoom(uv, 1.0 - 0.2 * pro);\
float t1 = t*0.5;\
float t2 = t * 0.2;\
t = t * 0.2;\
\
if (lengthR < 0.8+z*1.5 + BR) {\
alpha = (0.8+z*1.5 + BR - lengthR)/BR;\
if (t > 0.0) {\
vec4 bgcolor = mix(texture2D(from, bgUV), texture2D(to, bgUV), t1);\
vec4 fgcolor = mix(texture2D(from, uv), texture2D(to, uv), t2);\
gl_FragColor = mix(fgcolor, bgcolor, alpha);\
return;\
}\
vec4 bgcolor = mix(texture2D(from, bgUV), texture2D(to, bgUV), t);\
vec4 fgcolor = mix(texture2D(from, uv), texture2D(to, uv), t);\
gl_FragColor = mix(fgcolor, bgcolor, alpha);\
return;\
}\
}\
else {\
vec2 bgUV = zoom(uv, 1.0 - 0.2 * pro);\
uv = zoom(uv, 1.0 - 0.25 * pro);\
\
if (lengthR < 1.2+z*2.5 + BR) {\
alpha = (1.2+z*2.5 + BR - lengthR)/BR;\
vec4 bgcolor = mix(texture2D(from, bgUV), texture2D(to, bgUV), t);\
vec4 fgcolor = mix(texture2D(from, uv), texture2D(to, uv), t);\
gl_FragColor = mix(fgcolor, bgcolor, alpha);\
return;\
}\
}\
\
gl_FragColor = mix(texture2D(from, uv), texture2D(to, uv), t);\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = atmosphericSlidershow;
module.exports = exports["default"];
/***/ }),
/* 79 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var luminancemelt = {
"title": "Luminancemelt",
"description": "A luminancemelt effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from, to;\
uniform float progress;\
uniform vec2 resolution;\
uniform bool direction;\
uniform float l_threshold;\
uniform bool above;\
\
float rand(vec2 co){\
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\
}\
\
vec3 mod289(vec3 x) {\
return x - floor(x * (1.0 / 289.0)) * 289.0;\
}\
\
vec2 mod289(vec2 x) {\
return x - floor(x * (1.0 / 289.0)) * 289.0;\
}\
\
vec3 permute(vec3 x) {\
return mod289(((x*34.0)+1.0)*x);\
}\
\
float snoise(vec2 v)\
{\
const vec4 C = vec4(0.211324865405187,\
0.366025403784439,\
-0.577350269189626,\
0.024390243902439);\
\
vec2 i = floor(v + dot(v, C.yy) );\
vec2 x0 = v - i + dot(i, C.xx);\
\
vec2 i1;\
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\
vec4 x12 = x0.xyxy + C.xxzz;\
x12.xy -= i1;\
\
i = mod289(i);\
vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))\
+ i.x + vec3(0.0, i1.x, 1.0 ));\
\
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\
m = m*m ;\
m = m*m ;\
\
vec3 x = 2.0 * fract(p * C.www) - 1.0;\
vec3 h = abs(x) - 0.5;\
vec3 ox = floor(x + 0.5);\
vec3 a0 = x - ox;\
\
m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\
vec3 g;\
g.x = a0.x * x0.x + h.x * x0.y;\
g.yz = a0.yz * x12.xz + h.yz * x12.yw;\
return 130.0 * dot(m, g);\
}\
\
float luminance(vec4 color){\
return color.r*0.299+color.g*0.587+color.b*0.114;\
}\
\
vec2 center = vec2(1.0, direction);\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
if (progress == 0.0) {\
gl_FragColor = texture2D(from, p);\
} else if (progress == 1.0) {\
gl_FragColor = texture2D(to, p);\
} else {\
float x = progress;\
float dist = distance(center, p)- progress*exp(snoise(vec2(p.x, 0.0)));\
float r = x - rand(vec2(p.x, 0.1));\
float m;\
if(above){\
m = dist <= r && luminance(texture2D(from, p))>l_threshold ? 1.0 : (progress*progress*progress);\
}\
else{\
m = dist <= r && luminance(texture2D(from, p))<l_threshold ? 1.0 : (progress*progress*progress); \
}\
gl_FragColor = mix(texture2D(from, p), texture2D(to, p), m); \
}\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] },
"direction": { "type": "uniform", "value": 1.0 },
"l_threshold": { "type": "uniform", "value": 0.5 },
"above": { "type": "uniform", "value": 0.0 }
},
"inputs": ["from", "to"]
};
exports["default"] = luminancemelt;
module.exports = exports["default"];
/***/ }),
/* 80 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var crosshatch = {
"title": "Crosshatch",
"description": "A crosshatch effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D from;\
uniform sampler2D to;\
uniform float progress;\
uniform vec2 resolution;\
\
const vec2 center = vec2(0.5, 0.5);\
\
float quadraticInOut(float t) {\
float p = 2.0 * t * t;\
return t < 0.5 ? p : -p + (4.0 * t) - 1.0;\
}\
\
float rand(vec2 co) {\
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\
}\
\
\
void main() {\
vec2 p = gl_FragCoord.xy / resolution.xy;\
\
if (progress == 0.0) {\
gl_FragColor = texture2D(from, p);\
} else if (progress == 1.0) {\
gl_FragColor = texture2D(to, p);\
} else {\
float x = progress;\
float dist = distance(center, p);\
float r = x - min(rand(vec2(p.y, 0.0)), rand(vec2(0.0, p.x)));\
float m = dist <= r ? 1.0 : 0.0;\
gl_FragColor = mix(texture2D(from, p), texture2D(to, p), m); \
}\
\
}",
"properties": {
"progress": { "type": "uniform", "value": 0.0 },
"resolution": { "type": "uniform", "value": [480.0, 270.0] }
},
"inputs": ["from", "to"]
};
exports["default"] = crosshatch;
module.exports = exports["default"];
/***/ }),
/* 81 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var saturation = {
"title": "Saturation",
"description": "Change images's saturation (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinate;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinate = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
varying highp vec2 textureCoordinate;\
uniform sampler2D u_image;\
uniform lowp float saturation;\
const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);\
void main()\
{\
lowp vec4 textureColor = texture2D(u_image, textureCoordinate);\
lowp float luminance = dot(textureColor.rgb, luminanceWeighting);\
lowp vec3 greyScaleColor = vec3(luminance);\
\
gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);\
}",
"properties": {
"saturation": { "type": "uniform", "value": 0.65 }
},
"inputs": ["u_image"]
};
exports["default"] = saturation;
module.exports = exports["default"];
/***/ }),
/* 82 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var gaussianHBlur = {
"title": "GaussianHBlur",
"description": "images horizontal gaussian blur (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
uniform float texelWidthOffset;\
uniform float texelHeightOffset;\
varying vec2 blurCoordinates[29];\
\
void main()\
{\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
vec2 singleStepOffset = vec2(texelWidthOffset, texelHeightOffset);\
blurCoordinates[0] = a_texCoord.xy - singleStepOffset * 14.000000;\
blurCoordinates[1] = a_texCoord.xy - singleStepOffset * 13.000000;\
blurCoordinates[2] = a_texCoord.xy - singleStepOffset * 12.000000;\
blurCoordinates[3] = a_texCoord.xy - singleStepOffset * 11.000000;\
blurCoordinates[4] = a_texCoord.xy - singleStepOffset * 10.000000;\
blurCoordinates[5] = a_texCoord.xy - singleStepOffset * 9.000000;\
blurCoordinates[6] = a_texCoord.xy - singleStepOffset * 8.000000;\
blurCoordinates[7] = a_texCoord.xy - singleStepOffset * 7.000000;\
blurCoordinates[8] = a_texCoord.xy - singleStepOffset * 6.000000;\
blurCoordinates[9] = a_texCoord.xy - singleStepOffset * 5.000000;\
blurCoordinates[10] = a_texCoord.xy - singleStepOffset * 4.000000;\
blurCoordinates[11] = a_texCoord.xy - singleStepOffset * 3.000000;\
blurCoordinates[12] = a_texCoord.xy - singleStepOffset * 2.000000;\
blurCoordinates[13] = a_texCoord.xy - singleStepOffset * 1.000000;\
blurCoordinates[14] = a_texCoord.xy;\
blurCoordinates[15] = a_texCoord.xy + singleStepOffset * 1.000000;\
blurCoordinates[16] = a_texCoord.xy + singleStepOffset * 2.000000;\
blurCoordinates[17] = a_texCoord.xy + singleStepOffset * 3.000000;\
blurCoordinates[18] = a_texCoord.xy + singleStepOffset * 4.000000;\
blurCoordinates[19] = a_texCoord.xy + singleStepOffset * 5.000000;\
blurCoordinates[20] = a_texCoord.xy + singleStepOffset * 6.000000;\
blurCoordinates[21] = a_texCoord.xy + singleStepOffset * 7.000000;\
blurCoordinates[22] = a_texCoord.xy + singleStepOffset * 8.000000;\
blurCoordinates[23] = a_texCoord.xy + singleStepOffset * 9.000000;\
blurCoordinates[24] = a_texCoord.xy + singleStepOffset * 10.000000;\
blurCoordinates[25] = a_texCoord.xy + singleStepOffset * 11.000000;\
blurCoordinates[26] = a_texCoord.xy + singleStepOffset * 12.000000;\
blurCoordinates[27] = a_texCoord.xy + singleStepOffset * 13.000000;\
blurCoordinates[28] = a_texCoord.xy + singleStepOffset * 14.000000;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying highp vec2 blurCoordinates[29];\
\
void main()\
{\
lowp vec4 sum = vec4(0.0);\
sum += texture2D(u_image, blurCoordinates[0]) * 0.000772;\
sum += texture2D(u_image, blurCoordinates[1]) * 0.001482;\
sum += texture2D(u_image, blurCoordinates[2]) * 0.002711;\
sum += texture2D(u_image, blurCoordinates[3]) * 0.004724;\
sum += texture2D(u_image, blurCoordinates[4]) * 0.007845;\
sum += texture2D(u_image, blurCoordinates[5]) * 0.012414;\
sum += texture2D(u_image, blurCoordinates[6]) * 0.018716;\
sum += texture2D(u_image, blurCoordinates[7]) * 0.026888;\
sum += texture2D(u_image, blurCoordinates[8]) * 0.036805;\
sum += texture2D(u_image, blurCoordinates[9]) * 0.048005;\
sum += texture2D(u_image, blurCoordinates[10]) * 0.059661;\
sum += texture2D(u_image, blurCoordinates[11]) * 0.070650;\
sum += texture2D(u_image, blurCoordinates[12]) * 0.079718;\
sum += texture2D(u_image, blurCoordinates[13]) * 0.085708;\
sum += texture2D(u_image, blurCoordinates[14]) * 0.087803;\
sum += texture2D(u_image, blurCoordinates[15]) * 0.085708;\
sum += texture2D(u_image, blurCoordinates[16]) * 0.079718;\
sum += texture2D(u_image, blurCoordinates[17]) * 0.070650;\
sum += texture2D(u_image, blurCoordinates[18]) * 0.059661;\
sum += texture2D(u_image, blurCoordinates[19]) * 0.048005;\
sum += texture2D(u_image, blurCoordinates[20]) * 0.036805;\
sum += texture2D(u_image, blurCoordinates[21]) * 0.026888;\
sum += texture2D(u_image, blurCoordinates[22]) * 0.018716;\
sum += texture2D(u_image, blurCoordinates[23]) * 0.012414;\
sum += texture2D(u_image, blurCoordinates[24]) * 0.007845;\
sum += texture2D(u_image, blurCoordinates[25]) * 0.004724;\
sum += texture2D(u_image, blurCoordinates[26]) * 0.002711;\
sum += texture2D(u_image, blurCoordinates[27]) * 0.001482;\
sum += texture2D(u_image, blurCoordinates[28]) * 0.000772;\
gl_FragColor = sum;\
}",
"properties": {
"texelWidthOffset": { "type": "uniform", "value": 0.002 },
"texelHeightOffset": { "type": "uniform", "value": 0.002 }
},
"inputs": ["u_image"]
};
exports["default"] = gaussianHBlur;
module.exports = exports["default"];
/***/ }),
/* 83 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var gaussianVBlur = {
"title": "GaussianVBlur",
"description": "images vertical gaussian blur (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
uniform float texelWidthOffset;\
uniform float texelHeightOffset;\
varying vec2 blurCoordinates[29];\
void main()\
{\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
vec2 singleStepOffset = vec2(texelWidthOffset, -texelHeightOffset);\
blurCoordinates[0] = a_texCoord.xy - singleStepOffset * 14.000000;\
blurCoordinates[1] = a_texCoord.xy - singleStepOffset * 13.000000;\
blurCoordinates[2] = a_texCoord.xy - singleStepOffset * 12.000000;\
blurCoordinates[3] = a_texCoord.xy - singleStepOffset * 11.000000;\
blurCoordinates[4] = a_texCoord.xy - singleStepOffset * 10.000000;\
blurCoordinates[5] = a_texCoord.xy - singleStepOffset * 9.000000;\
blurCoordinates[6] = a_texCoord.xy - singleStepOffset * 8.000000;\
blurCoordinates[7] = a_texCoord.xy - singleStepOffset * 7.000000;\
blurCoordinates[8] = a_texCoord.xy - singleStepOffset * 6.000000;\
blurCoordinates[9] = a_texCoord.xy - singleStepOffset * 5.000000;\
blurCoordinates[10] = a_texCoord.xy - singleStepOffset * 4.000000;\
blurCoordinates[11] = a_texCoord.xy - singleStepOffset * 3.000000;\
blurCoordinates[12] = a_texCoord.xy - singleStepOffset * 2.000000;\
blurCoordinates[13] = a_texCoord.xy - singleStepOffset * 1.000000;\
blurCoordinates[14] = a_texCoord.xy;\
blurCoordinates[15] = a_texCoord.xy + singleStepOffset * 1.000000;\
blurCoordinates[16] = a_texCoord.xy + singleStepOffset * 2.000000;\
blurCoordinates[17] = a_texCoord.xy + singleStepOffset * 3.000000;\
blurCoordinates[18] = a_texCoord.xy + singleStepOffset * 4.000000;\
blurCoordinates[19] = a_texCoord.xy + singleStepOffset * 5.000000;\
blurCoordinates[20] = a_texCoord.xy + singleStepOffset * 6.000000;\
blurCoordinates[21] = a_texCoord.xy + singleStepOffset * 7.000000;\
blurCoordinates[22] = a_texCoord.xy + singleStepOffset * 8.000000;\
blurCoordinates[23] = a_texCoord.xy + singleStepOffset * 9.000000;\
blurCoordinates[24] = a_texCoord.xy + singleStepOffset * 10.000000;\
blurCoordinates[25] = a_texCoord.xy + singleStepOffset * 11.000000;\
blurCoordinates[26] = a_texCoord.xy + singleStepOffset * 12.000000;\
blurCoordinates[27] = a_texCoord.xy + singleStepOffset * 13.000000;\
blurCoordinates[28] = a_texCoord.xy + singleStepOffset * 14.000000;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying highp vec2 blurCoordinates[29];\
\
void main()\
{\
lowp vec4 sum = vec4(0.0);\
sum += texture2D(u_image, blurCoordinates[0]) * 0.000772;\
sum += texture2D(u_image, blurCoordinates[1]) * 0.001482;\
sum += texture2D(u_image, blurCoordinates[2]) * 0.002711;\
sum += texture2D(u_image, blurCoordinates[3]) * 0.004724;\
sum += texture2D(u_image, blurCoordinates[4]) * 0.007845;\
sum += texture2D(u_image, blurCoordinates[5]) * 0.012414;\
sum += texture2D(u_image, blurCoordinates[6]) * 0.018716;\
sum += texture2D(u_image, blurCoordinates[7]) * 0.026888;\
sum += texture2D(u_image, blurCoordinates[8]) * 0.036805;\
sum += texture2D(u_image, blurCoordinates[9]) * 0.048005;\
sum += texture2D(u_image, blurCoordinates[10]) * 0.059661;\
sum += texture2D(u_image, blurCoordinates[11]) * 0.070650;\
sum += texture2D(u_image, blurCoordinates[12]) * 0.079718;\
sum += texture2D(u_image, blurCoordinates[13]) * 0.085708;\
sum += texture2D(u_image, blurCoordinates[14]) * 0.087803;\
sum += texture2D(u_image, blurCoordinates[15]) * 0.085708;\
sum += texture2D(u_image, blurCoordinates[16]) * 0.079718;\
sum += texture2D(u_image, blurCoordinates[17]) * 0.070650;\
sum += texture2D(u_image, blurCoordinates[18]) * 0.059661;\
sum += texture2D(u_image, blurCoordinates[19]) * 0.048005;\
sum += texture2D(u_image, blurCoordinates[20]) * 0.036805;\
sum += texture2D(u_image, blurCoordinates[21]) * 0.026888;\
sum += texture2D(u_image, blurCoordinates[22]) * 0.018716;\
sum += texture2D(u_image, blurCoordinates[23]) * 0.012414;\
sum += texture2D(u_image, blurCoordinates[24]) * 0.007845;\
sum += texture2D(u_image, blurCoordinates[25]) * 0.004724;\
sum += texture2D(u_image, blurCoordinates[26]) * 0.002711;\
sum += texture2D(u_image, blurCoordinates[27]) * 0.001482;\
sum += texture2D(u_image, blurCoordinates[28]) * 0.000772;\
gl_FragColor = sum;\
}",
"properties": {
"texelWidthOffset": { "type": "uniform", "value": 0.002 },
"texelHeightOffset": { "type": "uniform", "value": 0.002 }
},
"inputs": ["u_image"]
};
exports["default"] = gaussianVBlur;
module.exports = exports["default"];
/***/ }),
/* 84 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var luminance = {
"title": "Luminance",
"description": "Change images's luminance (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinate;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinate = a_texCoord;\
}",
"fragmentShader": "\
precision mediump float;\
varying highp vec2 textureCoordinate;\
uniform sampler2D u_image;\
uniform lowp float rangeReduction;\
const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);\
void main()\
{\
lowp vec4 textureColor = texture2D(u_image, textureCoordinate);\
mediump float luminance = dot(textureColor.rgb, luminanceWeighting);\
mediump float luminanceRatio = ((0.5 - luminance) * rangeReduction);\
\
gl_FragColor = vec4((textureColor.rgb) + (luminanceRatio), textureColor.w);\
}",
"properties": {
"rangeReduction": { "type": "uniform", "value": 0.5 }
},
"inputs": ["u_image"]
};
exports["default"] = luminance;
module.exports = exports["default"];
/***/ }),
/* 85 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var glassblur = {
"title": "Mosaic Glassblur",
"description": "Change images's Mosaic Glassblur (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinate;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinate = a_texCoord;\
}",
"fragmentShader": "\
precision highp float;\
varying highp vec2 textureCoordinate;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform highp vec4 left;\
uniform highp vec4 right;\
uniform highp vec4 leftCropRect;\
uniform highp vec4 rightCropRect;\
uniform highp vec4 centerRect;\
uniform highp vec4 mosaicRect;\
uniform float texelWidthOffset;\
uniform float texelHeightOffset;\
uniform lowp float mosaicStrength;\
\
bool inLeftBounds(vec2 p)\
{\
return ((p.x >= left.x) && (p.x <= left.x+left.z) && (p.y >= left.y) && (p.y <= left.y+left.w));\
}\
\
bool inRightBounds(vec2 p)\
{\
return ((p.x >= right.x) && (p.x <= right.x+right.z) && (p.y >= right.y) && (p.y <= right.y+right.w));\
}\
bool inMosaicBounds(vec2 p)\
{\
return ((p.x >= mosaicRect.x) && (p.x <= mosaicRect.x+mosaicRect.z) && (p.y <= 1.0-mosaicRect.y) && (p.y >= 1.0-mosaicRect.y-mosaicRect.w));\
}\
vec4 blurAtPoint(vec2 texCoord)\
{\
vec4 color;\
if (inLeftBounds(texCoord)) {\
vec2 p = (texCoord.xy - left.xy)/left.zw * leftCropRect.zw + leftCropRect.xy;\
color = texture2D(u_image_b, p);\
}\
else if (inRightBounds(texCoord)) {\
vec2 p = (texCoord.xy - right.xy)/right.zw * rightCropRect.zw + rightCropRect.xy;\
color = texture2D(u_image_b, p);\
}\
else {\
vec2 p = (texCoord.xy-centerRect.xy)/centerRect.zw;\
color = texture2D(u_image_b, p);\
}\
return color;\
}\
vec4 outputAtPoint(vec2 texCoord)\
{\
vec4 color;\
if (inLeftBounds(texCoord)) {\
vec2 p = (texCoord.xy - left.xy)/left.zw * leftCropRect.zw + leftCropRect.xy;\
color = texture2D(u_image_b, p);\
}\
else if (inRightBounds(texCoord)) {\
vec2 p = (texCoord.xy - right.xy)/right.zw * rightCropRect.zw + rightCropRect.xy;\
color = texture2D(u_image_b, p);\
}\
else {\
vec2 p = (texCoord.xy-centerRect.xy)/centerRect.zw;\
color = texture2D(u_image_a, p);\
}\
return color;\
}\
\
void main()\
{\
gl_FragColor = outputAtPoint(textureCoordinate);\
\
if (inMosaicBounds(textureCoordinate)) {\
if (mosaicStrength < 0.5) {\
float strength = mosaicStrength*0.3/0.5+0.7;\
gl_FragColor = outputAtPoint(textureCoordinate)*(1.0-strength) + blurAtPoint(textureCoordinate)*strength;\
}\
else {\
vec2 hStep = vec2(texelWidthOffset, texelHeightOffset);\
vec2 vStep = vec2(texelWidthOffset, -texelHeightOffset);\
float strength = (mosaicStrength-0.5)/0.5;\
vec4 sum = blurAtPoint(textureCoordinate);\
float sumweight = 1.0;\
for (float step = -14.0;step <= 14.0; step += 1.0) {\
vec2 hCoord = sign(step)*(abs(step)+1.0)*hStep;\
vec2 vCoord = sign(step)*(abs(step)+1.0)*vStep;\
sum += blurAtPoint(textureCoordinate+hCoord);\
sum += blurAtPoint(textureCoordinate+vCoord);\
sumweight += 2.0;\
}\
sum /= sumweight;\
gl_FragColor = blurAtPoint(textureCoordinate)*(1.0-strength) + sum*strength;\
}\
}\
}",
"properties": {
"left": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] },
"right": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] },
"leftCropRect": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] },
"rightCropRect": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] },
"centerRect": { "type": "uniform", "value": [0.0, 0.0, 1.0, 1.0] },
"mosaicRect": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] },
"texelWidthOffset": { "type": "uniform", "value": 0.002 },
"texelHeightOffset": { "type": "uniform", "value": 0.002 },
"mosaicStrength": { "type": "uniform", "value": 1.0 }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = glassblur;
module.exports = exports["default"];
/***/ }),
/* 86 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var radiusGaussianHBlur = {
"title": "RadiusGaussianHBlur",
"description": "images horizontal radius gaussian blur (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinate;\
\
void main()\
{\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinate = a_texCoord.xy;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying highp vec2 textureCoordinate;\
uniform float blurRadius;\
uniform highp float texelWidthOffset;\
uniform highp float texelHeightOffset;\
\
const float PI = 3.14159265358979323846;\
\
void main()\
{\
lowp vec4 sum = vec4(0.0);\
vec2 step = vec2(texelWidthOffset, texelHeightOffset);\
float sumWeight = 0.0;\
float sigma = 0.3*((blurRadius*2.0-1.0)*0.5 - 1.0) + 0.8;\
for (float i = 0.0; i < 100.0; i+=1.0) {\
float r = -blurRadius + i;\
if (r > blurRadius) {\
break;\
}\
vec2 pos = textureCoordinate + step*r;\
float weight = (1.0 / sqrt(2.0 * PI * pow(sigma, 2.0))) * exp(-pow(abs(r), 2.0) / (2.0 * pow(sigma, 2.0)));\
sum += texture2D(u_image, pos)*weight;\
sumWeight += weight;\
}\
\
gl_FragColor = sum/sumWeight;\
}",
"properties": {
"blurRadius": { "type": "uniform", "value": 7.0 },
"texelWidthOffset": { "type": "uniform", "value": 0.002 },
"texelHeightOffset": { "type": "uniform", "value": 0.002 }
},
"inputs": ["u_image"]
};
exports["default"] = radiusGaussianHBlur;
module.exports = exports["default"];
/***/ }),
/* 87 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var radiusGaussianVBlur = {
"title": "RadiusGaussianVBlur",
"description": "images horizontal radius gaussian blur (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinate;\
\
void main()\
{\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinate = a_texCoord.xy;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying highp vec2 textureCoordinate;\
uniform float blurRadius;\
uniform highp float texelWidthOffset;\
uniform highp float texelHeightOffset;\
\
const float PI = 3.14159265358979323846;\
\
void main()\
{\
lowp vec4 sum = vec4(0.0);\
vec2 step = vec2(texelWidthOffset, -texelHeightOffset);\
float sumWeight = 0.0;\
float sigma = 0.3*((blurRadius*2.0-1.0)*0.5 - 1.0) + 0.8;\
for (float i = 0.0; i < 100.0; i+=1.0) {\
float r = -blurRadius + i;\
if (r > blurRadius) {\
break;\
}\
vec2 pos = textureCoordinate + step*r;\
float weight = (1.0 / sqrt(2.0 * PI * pow(sigma, 2.0))) * exp(-pow(abs(r), 2.0) / (2.0 * pow(sigma, 2.0)));\
sum += texture2D(u_image, pos)*weight;\
sumWeight += weight;\
}\
\
gl_FragColor = sum/sumWeight;\
}",
"properties": {
"blurRadius": { "type": "uniform", "value": 7.0 },
"texelWidthOffset": { "type": "uniform", "value": 0.002 },
"texelHeightOffset": { "type": "uniform", "value": 0.002 }
},
"inputs": ["u_image"]
};
exports["default"] = radiusGaussianVBlur;
module.exports = exports["default"];
/***/ }),
/* 88 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var cropWidth = {
"title": "Crop",
"description": "Crop images width (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinate;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinate = a_texCoord;\
}",
"fragmentShader": "\
precision highp float;\
varying highp vec2 textureCoordinate;\
uniform sampler2D u_image;\
uniform highp vec4 cropRect;\
uniform highp vec4 dstRect;\
\
bool inBounds(vec2 p)\
{\
return ((p.x >= dstRect.x) && (p.x <= dstRect.x+dstRect.z) && (p.y >= dstRect.y) && (p.y <= dstRect.y+dstRect.w));\
}\
\
void main()\
{\
if (inBounds(textureCoordinate)) {\
vec2 p = (textureCoordinate.xy - dstRect.xy)/dstRect.zw * cropRect.zw + cropRect.xy;\
gl_FragColor= texture2D(u_image, p);\
}\
else {\
gl_FragColor = vec4(0.0,0.0,0.0,1.0);\
}\
}",
"properties": {
"cropRect": { "type": "uniform", "value": [0.0, 0.0, 1.0, 1.0] },
"dstRect": { "type": "uniform", "value": [0.0, 0.0, 1.0, 1.0] }
},
"inputs": ["u_image"]
};
exports["default"] = cropWidth;
module.exports = exports["default"];
/***/ }),
/* 89 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var opacity = {
"title": "Opacity",
"description": "Sets the opacity of an input.",
"vertexShader": "\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n void main() {\n gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\n v_texCoord = a_texCoord;\n }",
"fragmentShader": "\n precision mediump float;\n uniform sampler2D u_image;\n uniform float opacity;\n varying vec2 v_texCoord;\n varying float v_opacity;\n void main(){\n vec4 color = texture2D(u_image, v_texCoord);\n color[3] *= opacity;\n gl_FragColor = color;\n }",
"properties": {
"opacity": { "type": "uniform", "value": 0.7 }
},
"inputs": ["u_image"]
};
exports["default"] = opacity;
module.exports = exports["default"];
/***/ }),
/* 90 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var lookup = {
"title": "Lookup",
"description": "A lookup effect. Typically used as a transistion.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision highp float;\
varying highp vec2 v_texCoord;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform lowp float intensity;\
void main()\
{\
highp vec4 textureColor = texture2D(u_image_a, v_texCoord);\
highp float blueColor = textureColor.b * 63.0;\
\
highp vec2 quad1;\
quad1.y = floor(floor(blueColor) / 8.0);\
quad1.x = floor(blueColor) - (quad1.y * 8.0);\
\
highp vec2 quad2;\
quad2.y = floor(ceil(blueColor) / 8.0);\
quad2.x = ceil(blueColor) - (quad2.y * 8.0);\
\
highp vec2 texPos1;\
texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\
texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\
\
highp vec2 texPos2;\
texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);\
texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);\
\
lowp vec4 newColor1 = texture2D(u_image_b, texPos1);\
lowp vec4 newColor2 = texture2D(u_image_b, texPos2);\
\
lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\
gl_FragColor = mix(textureColor, vec4(newColor.rgb, textureColor.w), intensity);\
}",
"properties": {
"intensity": { "type": "uniform", "value": 1.0 }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = lookup;
module.exports = exports["default"];
/***/ }),
/* 91 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var drawimage = {
"title": "drawimage",
"description": "A drawimage node shader. Typically used as a transistion.",
"vertexShader": "\
uniform mat4 modelViewProjectionMatrix;\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = modelViewProjectionMatrix*vec4(a_position, 0.0, 1.0);\
v_texCoord = a_texCoord;\
}",
"fragmentShader": "\
precision highp float;\
varying highp vec2 v_texCoord;\
uniform sampler2D u_image_a;\
void main()\
{\
gl_FragColor = texture2D(u_image_a, v_texCoord);\
}",
"properties": {
"modelViewProjectionMatrix": { "type": "uniform", "value": [0.004166667, 0.0, 0.0, 0.0, 0.0, 0.00740741, 0.0, 0.0, 0.0, 0.0, -2.0, 0.0, -1.0, -1.0, 0.0, 1.0] }
},
"inputs": ["u_image_a"]
};
exports["default"] = drawimage;
module.exports = exports["default"];
/***/ }),
/* 92 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var blackpad = {
"title": "Black Pad",
"description": "Black Pad (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinate;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinate = a_texCoord;\
}",
"fragmentShader": "\
precision highp float;\
varying highp vec2 textureCoordinate;\
uniform sampler2D u_image_a;\
uniform highp vec4 cropRect;\
uniform highp vec4 centerRect;\
bool inCenterBounds(vec2 p)\
{\
return ((p.x >= centerRect.x) && (p.x <= centerRect.x+centerRect.z) && (p.y <= 1.0 - centerRect.y) && (p.y >= 1.0 -(centerRect.y+centerRect.w)));\
}\
void main()\
{\
if (inCenterBounds(textureCoordinate)) {\
vec2 centerTexcoord = vec2((textureCoordinate.x-centerRect.x)/centerRect.z, (textureCoordinate.y-(1.0 -(centerRect.y+centerRect.w)))/centerRect.w);\
vec2 cropTexcoord = vec2(centerTexcoord.x*cropRect.z + cropRect.x, centerTexcoord.y*cropRect.w + 1.0 -(cropRect.y+cropRect.w));\
gl_FragColor = texture2D(u_image_a, cropTexcoord);\
}\
else {\
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\
}\
}",
"properties": {
"cropRect": { "type": "uniform", "value": [0.0, 0.0, 1.0, 1.0] },
"centerRect": { "type": "uniform", "value": [0.0, 0.0, 1.0, 1.0] }
},
"inputs": ["u_image_a"]
};
exports["default"] = blackpad;
module.exports = exports["default"];
/***/ }),
/* 93 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var regionmosaic = {
"title": "Region Mosaic",
"description": "Region Mosaic (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinate;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinate = a_texCoord;\
}",
"fragmentShader": "\
precision highp float;\
varying highp vec2 textureCoordinate;\
uniform sampler2D u_image_a;\
uniform sampler2D u_image_b;\
uniform highp vec4 mosaicRect;\
uniform highp vec4 mosaicRect2;\
uniform highp vec4 mosaicRect3;\
uniform highp vec4 mosaicRect4;\
uniform highp vec4 mosaicRect5;\
uniform highp vec4 mosaicRect6;\
bool inMosaicBounds(vec2 p)\
{\
return ((p.x >= mosaicRect.x) && (p.x <= mosaicRect.x+mosaicRect.z) && (p.y <= 1.0 - mosaicRect.y) && (p.y >= 1.0 - (mosaicRect.y+mosaicRect.w))) || \
((p.x >= mosaicRect2.x) && (p.x <= mosaicRect2.x+mosaicRect2.z) && (p.y <= 1.0 - mosaicRect2.y) && (p.y >= 1.0 - (mosaicRect2.y+mosaicRect2.w))) || \
((p.x >= mosaicRect3.x) && (p.x <= mosaicRect3.x+mosaicRect3.z) && (p.y <= 1.0 - mosaicRect3.y) && (p.y >= 1.0 - (mosaicRect3.y+mosaicRect3.w))) || \
((p.x >= mosaicRect4.x) && (p.x <= mosaicRect4.x+mosaicRect4.z) && (p.y <= 1.0 - mosaicRect4.y) && (p.y >= 1.0 - (mosaicRect4.y+mosaicRect4.w))) || \
((p.x >= mosaicRect5.x) && (p.x <= mosaicRect5.x+mosaicRect5.z) && (p.y <= 1.0 - mosaicRect5.y) && (p.y >= 1.0 - (mosaicRect5.y+mosaicRect5.w))) || \
((p.x >= mosaicRect6.x) && (p.x <= mosaicRect6.x+mosaicRect6.z) && (p.y <= 1.0 - mosaicRect6.y) && (p.y >= 1.0 - (mosaicRect6.y+mosaicRect6.w)));\
}\
\
void main()\
{\
if (inMosaicBounds(textureCoordinate)) {\
gl_FragColor = texture2D(u_image_b, textureCoordinate);\
}\
else {\
gl_FragColor = texture2D(u_image_a, textureCoordinate);\
}\
}",
"properties": {
"mosaicRect": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] },
"mosaicRect2": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] },
"mosaicRect3": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] },
"mosaicRect4": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] },
"mosaicRect5": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] },
"mosaicRect6": { "type": "uniform", "value": [0.0, 0.0, 0.0, 0.0] }
},
"inputs": ["u_image_a", "u_image_b"]
};
exports["default"] = regionmosaic;
module.exports = exports["default"];
/***/ }),
/* 94 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var croprect = {
"title": "Crop Rect",
"description": "Crop Rect (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinate;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinate = a_texCoord;\
}",
"fragmentShader": "\
precision highp float;\
varying highp vec2 textureCoordinate;\
uniform sampler2D u_image_a;\
uniform highp vec4 cropRect;\
void main()\
{\
vec2 cropTexcoord = vec2(textureCoordinate.x*cropRect.z + cropRect.x, textureCoordinate.y*cropRect.w + 1.0 -(cropRect.y+cropRect.w));\
gl_FragColor = texture2D(u_image_a, cropTexcoord);\
}",
"properties": {
"cropRect": { "type": "uniform", "value": [0.0, 0.0, 1.0, 1.0] }
},
"inputs": ["u_image_a"]
};
exports["default"] = croprect;
module.exports = exports["default"];
/***/ }),
/* 95 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var gaussianConstHBlur = {
"title": "GaussianConstHBlur",
"description": "images const horizontal gaussian blur (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
uniform float texelWidthOffset;\
uniform float texelHeightOffset;\
varying vec2 blurCoordinates[9];\
void main()\
{\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
vec2 singleStepOffset = vec2(texelWidthOffset, texelHeightOffset);\
blurCoordinates[0] = a_texCoord.xy - singleStepOffset * 4.000000;\
blurCoordinates[1] = a_texCoord.xy - singleStepOffset * 3.000000;\
blurCoordinates[2] = a_texCoord.xy - singleStepOffset * 2.000000;\
blurCoordinates[3] = a_texCoord.xy - singleStepOffset;\
blurCoordinates[4] = a_texCoord.xy;\
blurCoordinates[5] = a_texCoord.xy + singleStepOffset;\
blurCoordinates[6] = a_texCoord.xy + singleStepOffset * 2.000000;\
blurCoordinates[7] = a_texCoord.xy + singleStepOffset * 3.000000;\
blurCoordinates[8] = a_texCoord.xy + singleStepOffset * 4.000000;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying highp vec2 blurCoordinates[9];\
void main()\
{\
lowp vec4 sum = vec4(0.0);\
sum += texture2D(u_image, blurCoordinates[0]) * 0.009214;\
sum += texture2D(u_image, blurCoordinates[1]) * 0.039548;\
sum += texture2D(u_image, blurCoordinates[2]) * 0.111955;\
sum += texture2D(u_image, blurCoordinates[3]) * 0.209023;\
sum += texture2D(u_image, blurCoordinates[4]) * 0.257382;\
sum += texture2D(u_image, blurCoordinates[5]) * 0.209023;\
sum += texture2D(u_image, blurCoordinates[6]) * 0.111955;\
sum += texture2D(u_image, blurCoordinates[7]) * 0.039548;\
sum += texture2D(u_image, blurCoordinates[8]) * 0.009214;\
gl_FragColor = sum;\
}",
"properties": {
"texelWidthOffset": { "type": "uniform", "value": 0.002 },
"texelHeightOffset": { "type": "uniform", "value": 0.002 }
},
"inputs": ["u_image"]
};
exports["default"] = gaussianConstHBlur;
module.exports = exports["default"];
/***/ }),
/* 96 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var gaussianConstVBlur = {
"title": "GaussianConstVBlur",
"description": "images const vertical gaussian blur (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
uniform float texelWidthOffset;\
uniform float texelHeightOffset;\
varying vec2 blurCoordinates[9];\
void main()\
{\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
vec2 singleStepOffset = vec2(texelWidthOffset, -texelHeightOffset);\
blurCoordinates[0] = a_texCoord.xy - singleStepOffset * 4.000000;\
blurCoordinates[1] = a_texCoord.xy - singleStepOffset * 3.000000;\
blurCoordinates[2] = a_texCoord.xy - singleStepOffset * 2.000000;\
blurCoordinates[3] = a_texCoord.xy - singleStepOffset;\
blurCoordinates[4] = a_texCoord.xy;\
blurCoordinates[5] = a_texCoord.xy + singleStepOffset;\
blurCoordinates[6] = a_texCoord.xy + singleStepOffset * 2.000000;\
blurCoordinates[7] = a_texCoord.xy + singleStepOffset * 3.000000;\
blurCoordinates[8] = a_texCoord.xy + singleStepOffset * 4.000000;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying highp vec2 blurCoordinates[9];\
\
void main()\
{\
lowp vec4 sum = vec4(0.0);\
sum += texture2D(u_image, blurCoordinates[0]) * 0.009214;\
sum += texture2D(u_image, blurCoordinates[1]) * 0.039548;\
sum += texture2D(u_image, blurCoordinates[2]) * 0.111955;\
sum += texture2D(u_image, blurCoordinates[3]) * 0.209023;\
sum += texture2D(u_image, blurCoordinates[4]) * 0.257382;\
sum += texture2D(u_image, blurCoordinates[5]) * 0.209023;\
sum += texture2D(u_image, blurCoordinates[6]) * 0.111955;\
sum += texture2D(u_image, blurCoordinates[7]) * 0.039548;\
sum += texture2D(u_image, blurCoordinates[8]) * 0.009214;\
gl_FragColor = sum;\
}",
"properties": {
"texelWidthOffset": { "type": "uniform", "value": 0.002 },
"texelHeightOffset": { "type": "uniform", "value": 0.002 }
},
"inputs": ["u_image"]
};
exports["default"] = gaussianConstVBlur;
module.exports = exports["default"];
/***/ }),
/* 97 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var meanHBlur = {
"title": "meanHBlur",
"description": "images horizontal mean blur (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinates;\
void main()\
{\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinates = a_texCoord.xy;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying highp vec2 textureCoordinates;\
uniform float texelWidthOffset;\
uniform float texelHeightOffset;\
uniform float blurRadius;\
void main()\
{\
lowp vec4 sum = vec4(0.0);\
vec2 step = vec2(texelWidthOffset, texelHeightOffset);\
float sumWeight = 0.0;\
float r = 0.0;\
for (float i = 0.0; i <= 36.0; i+=1.0) {\
r = -blurRadius + i;\
vec2 pos = textureCoordinates + step*r;\
sum += vec4(texture2D(u_image, pos).rgb, 1.0);\
sumWeight += 1.0;\
}\
\
gl_FragColor = sum/sumWeight;\
}",
"properties": {
"texelWidthOffset": { "type": "uniform", "value": 0.002 },
"texelHeightOffset": { "type": "uniform", "value": 0.002 },
"blurRadius": { "type": "uniform", "value": 1 }
},
"inputs": ["u_image"]
};
exports["default"] = meanHBlur;
module.exports = exports["default"];
/***/ }),
/* 98 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var meanVBlur = {
"title": "MeanVBlur",
"description": "images vertical mean blur (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinates;\
void main()\
{\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinates = a_texCoord.xy;\
}",
"fragmentShader": "\
precision mediump float;\
uniform sampler2D u_image;\
varying highp vec2 textureCoordinates;\
uniform float texelWidthOffset;\
uniform float texelHeightOffset;\
uniform float blurRadius;\
void main()\
{\
lowp vec4 sum = vec4(0.0);\
vec2 step = vec2(texelWidthOffset, -texelHeightOffset);\
float sumWeight = 0.0;\
float r = 0.0;\
for (float i = 0.0; i <= 36.0; i+=1.0) {\
r = -blurRadius + i;\
vec2 pos = textureCoordinates + step*r;\
sum += vec4(texture2D(u_image, pos).rgb, 1.0);\
sumWeight += 1.0;\
}\
\
gl_FragColor = sum/sumWeight;\
}",
"properties": {
"texelWidthOffset": { "type": "uniform", "value": 0.002 },
"texelHeightOffset": { "type": "uniform", "value": 0.002 },
"blurRadius": { "type": "uniform", "value": 18.0 }
},
"inputs": ["u_image"]
};
exports["default"] = meanVBlur;
module.exports = exports["default"];
/***/ }),
/* 99 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var cropblack = {
"title": "Crop Black",
"description": "Crop Black Pad (e.g can be used to make a black & white filter). Input color mix and output color mix can be adjusted.",
"vertexShader": "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 textureCoordinate;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
textureCoordinate = a_texCoord;\
}",
"fragmentShader": "\
precision highp float;\
varying highp vec2 textureCoordinate;\
uniform sampler2D u_image_a;\
uniform highp vec4 cropRect;\
uniform highp vec4 centerRect;\
bool inCenterBounds(vec2 p)\
{\
return ((p.x >= centerRect.x) && (p.x <= centerRect.x+centerRect.z) && (p.y >= 1.0 - (centerRect.y+centerRect.w)) && (p.y <= 1.0 - centerRect.y));\
}\
void main()\
{\
if (inCenterBounds(textureCoordinate)) {\
vec2 centerTexcoord = vec2((textureCoordinate.x-centerRect.x)/centerRect.z, (textureCoordinate.y-(1.0 - (centerRect.y+centerRect.w)))/centerRect.w);\
vec2 texcoord = vec2(cropRect.x + cropRect.z*centerTexcoord.x, 1.0 - (cropRect.y+cropRect.w) + cropRect.w*centerTexcoord.y);\
gl_FragColor = texture2D(u_image_a, texcoord);\
}\
else {\
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\
}\
}",
"properties": {
"cropRect": { "type": "uniform", "value": [0.0, 0.0, 1.0, 1.0] },
"centerRect": { "type": "uniform", "value": [0.0, 0.0, 1.0, 1.0] }
},
"inputs": ["u_image_a"]
};
exports["default"] = cropblack;
module.exports = exports["default"];
/***/ }),
/* 100 */
/***/ (function(module, exports) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var GraphNode = (function () {
/**
* Base class from which all processing and source nodes are derrived.
*/
function GraphNode(gl, renderGraph, inputNames) {
var limitConnections = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
_classCallCheck(this, GraphNode);
this._renderGraph = renderGraph;
this._limitConnections = limitConnections;
this._inputNames = inputNames;
this._destroyed = false;
//Setup WebGL output texture
this._gl = gl;
this._renderGraph = renderGraph;
this._rendered = false;
this._displayName = "GraphNode";
this._scale = 1.0;
this._inputWidth = 0;
this._inputHeight = 0;
this._outputWidth = 0;
this._outputHeight = 0;
this._drawRect = [0.0, 0.0, 1.0, 1.0];
}
/**
* Get a string representation of the class name.
*
* @return String A string of the class name.
*/
_createClass(GraphNode, [{
key: "connect",
/**
* Connect this node to the targetNode
*
* @param {GraphNode} targetNode - the node to connect.
* @param {(number| String)} [targetPort] - the port on the targetNode to connect to, this can be an index, a string identifier, or undefined (in which case the next available port will be connected to).
*
*/
value: function connect(targetNode, targetPort) {
return this._renderGraph.registerConnection(this, targetNode, targetPort);
}
/**
* Disconnect this node from the targetNode. If targetNode is undefind remove all out-bound connections.
*
* @param {GraphNode} [targetNode] - the node to disconnect from. If undefined, disconnect from all nodes.
*
*/
}, {
key: "disconnect",
value: function disconnect(targetNode) {
var _this = this;
if (targetNode === undefined) {
var toRemove = this._renderGraph.getOutputsForNode(this);
toRemove.forEach(function (target) {
return _this._renderGraph.unregisterConnection(_this, target);
});
if (toRemove.length > 0) return true;
return false;
}
return this._renderGraph.unregisterConnection(this, targetNode);
}
/**
* Destory this node, removing it from the graph.
*/
}, {
key: "destroy",
value: function destroy() {
this.disconnect();
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = this.inputs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var input = _step.value;
input.disconnect(this);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
this._destroyed = true;
}
}, {
key: "displayName",
get: function get() {
return this._displayName;
}
/**
* Get the names of the inputs to this node.
*
* @return {String[]} An array of the names of the inputs ot the node.
*/
}, {
key: "inputNames",
get: function get() {
return this._inputNames.slice();
}
/**
* The maximum number of connections that can be made to this node. If there is not limit this will return Infinity.
*
* @return {number} The number of connections which can be made to this node.
*/
}, {
key: "maximumConnections",
get: function get() {
if (this._limitConnections === false) return Infinity;
return this._inputNames.length;
}
/**
* Get an array of all the nodes which connect to this node.
*
* @return {GraphNode[]} An array of nodes which connect to this node.
*/
}, {
key: "inputs",
get: function get() {
var result = this._renderGraph.getInputsForNode(this);
result = result.filter(function (n) {
return n !== undefined;
});
return result;
}
/**
* Get an array of all the nodes which this node outputs to.
*
* @return {GraphNode[]} An array of nodes which this node connects to.
*/
}, {
key: "outputs",
get: function get() {
return this._renderGraph.getOutputsForNode(this);
}
/**
* Get whether the node has been destroyed or not.
*
* @return {boolean} A true/false value of whather the node has been destoryed or not.
*/
}, {
key: "destroyed",
get: function get() {
return this._destroyed;
}
}]);
return GraphNode;
})();
exports["default"] = GraphNode;
module.exports = exports["default"];
/***/ }),
/* 101 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x3, _x4, _x5) { var _again = true; _function: while (_again) { var object = _x3, property = _x4, receiver = _x5; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x3 = parent; _x4 = property; _x5 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _sourcenode = __webpack_require__(2);
var _sourcenode2 = _interopRequireDefault(_sourcenode);
var ImageNode = (function (_SourceNode) {
_inherits(ImageNode, _SourceNode);
/**
* Initialise an instance of an ImageNode.
* This should not be called directly, but created through a call to videoContext.createImageNode();
*/
function ImageNode(src, gl, renderGraph, currentTime) {
var preloadTime = arguments.length <= 4 || arguments[4] === undefined ? 4 : arguments[4];
var attributes = arguments.length <= 5 || arguments[5] === undefined ? {} : arguments[5];
_classCallCheck(this, ImageNode);
_get(Object.getPrototypeOf(ImageNode.prototype), "constructor", this).call(this, src, gl, renderGraph, currentTime);
this._preloadTime = preloadTime;
this._attributes = attributes;
this._textureUploaded = false;
this._displayName = "ImageNode";
}
_createClass(ImageNode, [{
key: "_load",
value: function _load() {
var _this = this;
if (this._element !== undefined) {
for (var key in this._attributes) {
this._element[key] = this._attributes[key];
}
return;
}
if (this._isResponsibleForElementLifeCycle) {
_get(Object.getPrototypeOf(ImageNode.prototype), "_load", this).call(this);
this._element = new Image();
this._element.setAttribute("crossorigin", "anonymous");
this._element.src = this._elementURL;
this._element.onload = function () {
console.log("image loaded!!");
_this._ready = true;
_this._triggerCallbacks("loaded");
};
this._element.onerror = function () {
console.error("ImageNode failed to load. url:", _this._elementURL);
};
for (var _key in this._attributes) {
this._element[_key] = this._attributes[_key];
}
}
this._element.onerror = function () {
console.debug("Error with element", _this._element);
_this._state = _sourcenode.SOURCENODESTATE.error;
//Event though there's an error ready should be set to true so the node can output transparenn
_this._ready = true;
_this._triggerCallbacks("error");
};
}
}, {
key: "_destroy",
value: function _destroy() {
_get(Object.getPrototypeOf(ImageNode.prototype), "_destroy", this).call(this);
if (this._isResponsibleForElementLifeCycle) {
this._element.src = "";
this._element.onerror = undefined;
this._element = undefined;
delete this._element;
}
this._ready = false;
}
}, {
key: "_seek",
value: function _seek(time) {
_get(Object.getPrototypeOf(ImageNode.prototype), "_seek", this).call(this, time);
if (this.state === _sourcenode.SOURCENODESTATE.playing || this.state === _sourcenode.SOURCENODESTATE.paused) {
if (this._element === undefined) this._load();
}
if ((this._state === _sourcenode.SOURCENODESTATE.sequenced || this._state === _sourcenode.SOURCENODESTATE.ended) && this._element !== undefined) {
this._destroy();
}
}
}, {
key: "_update",
value: function _update(currentTime) {
//if (!super._update(currentTime)) return false;
if (this._textureUploaded) {
_get(Object.getPrototypeOf(ImageNode.prototype), "_update", this).call(this, currentTime, false);
} else {
_get(Object.getPrototypeOf(ImageNode.prototype), "_update", this).call(this, currentTime);
}
if (this._startTime - this._currentTime < this._preloadTime && this._state !== _sourcenode.SOURCENODESTATE.waiting && this._state !== _sourcenode.SOURCENODESTATE.ended) this._load();
if (this._state === _sourcenode.SOURCENODESTATE.playing) {
return true;
} else if (this._state === _sourcenode.SOURCENODESTATE.paused) {
return true;
} else if (this._state === _sourcenode.SOURCENODESTATE.ended && this._element !== undefined) {
this._destroy();
return false;
}
}
}, {
key: "elementURL",
get: function get() {
return this._elementURL;
}
}]);
return ImageNode;
})(_sourcenode2["default"]);
exports["default"] = ImageNode;
module.exports = exports["default"];
/***/ }),
/* 102 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _sourcenode = __webpack_require__(2);
var _sourcenode2 = _interopRequireDefault(_sourcenode);
var CanvasNode = (function (_SourceNode) {
_inherits(CanvasNode, _SourceNode);
/**
* Initialise an instance of a CanvasNode.
* This should not be called directly, but created through a call to videoContext.createCanvasNode();
*/
function CanvasNode(canvas, gl, renderGraph, currentTime) {
var preloadTime = arguments.length <= 4 || arguments[4] === undefined ? 4 : arguments[4];
_classCallCheck(this, CanvasNode);
_get(Object.getPrototypeOf(CanvasNode.prototype), "constructor", this).call(this, canvas, gl, renderGraph, currentTime);
this._preloadTime = preloadTime;
this._displayName = "CanvasNode";
}
_createClass(CanvasNode, [{
key: "_load",
value: function _load() {
_get(Object.getPrototypeOf(CanvasNode.prototype), "_load", this).call(this);
this._ready = true;
this._triggerCallbacks("loaded");
}
}, {
key: "_destroy",
value: function _destroy() {
_get(Object.getPrototypeOf(CanvasNode.prototype), "_destroy", this).call(this);
this._ready = false;
}
}, {
key: "_seek",
value: function _seek(time) {
_get(Object.getPrototypeOf(CanvasNode.prototype), "_seek", this).call(this, time);
if (this.state === _sourcenode.SOURCENODESTATE.playing || this.state === _sourcenode.SOURCENODESTATE.paused) {
if (this._element === undefined) this._load();
this._ready = false;
}
if ((this._state === _sourcenode.SOURCENODESTATE.sequenced || this._state === _sourcenode.SOURCENODESTATE.ended) && this._element !== undefined) {
this._destroy();
}
}
}, {
key: "_update",
value: function _update(currentTime) {
//if (!super._update(currentTime)) return false;
_get(Object.getPrototypeOf(CanvasNode.prototype), "_update", this).call(this, currentTime);
if (this._startTime - this._currentTime < this._preloadTime && this._state !== _sourcenode.SOURCENODESTATE.waiting && this._state !== _sourcenode.SOURCENODESTATE.ended) this._load();
if (this._state === _sourcenode.SOURCENODESTATE.playing) {
return true;
} else if (this._state === _sourcenode.SOURCENODESTATE.paused) {
return true;
} else if (this._state === _sourcenode.SOURCENODESTATE.ended && this._element !== undefined) {
this._destroy();
return false;
}
}
}]);
return CanvasNode;
})(_sourcenode2["default"]);
exports["default"] = CanvasNode;
module.exports = exports["default"];
/***/ }),
/* 103 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _processingnode = __webpack_require__(104);
var _processingnode2 = _interopRequireDefault(_processingnode);
var _utilsJs = __webpack_require__(3);
var CompositingNode = (function (_ProcessingNode) {
_inherits(CompositingNode, _ProcessingNode);
/**
* Initialise an instance of a Compositing Node. You should not instantiate this directly, but use VideoContest.createCompositingNode().
*/
function CompositingNode(gl, renderGraph, definition) {
_classCallCheck(this, CompositingNode);
var placeholderTexture = (0, _utilsJs.createElementTexutre)(gl);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 0, 0]));
_get(Object.getPrototypeOf(CompositingNode.prototype), "constructor", this).call(this, gl, renderGraph, definition, definition.inputs, false);
this._placeholderTexture = placeholderTexture;
this._displayName = "CompositingNode";
}
_createClass(CompositingNode, [{
key: "_render",
value: function _render() {
var _this = this;
var gl = this._gl;
_get(Object.getPrototypeOf(CompositingNode.prototype), "_updateOutput", this).call(this, gl);
gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._texture, 0);
gl.clearColor(0, 0, 0, 0); // green;
gl.clear(gl.COLOR_BUFFER_BIT);
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
this.inputs.forEach(function (node) {
if (node === undefined) return;
_get(Object.getPrototypeOf(CompositingNode.prototype), "_render", _this).call(_this);
//map the input textures input the node
var texture = node._texture;
var textureOffset = 0;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = _this._inputTextureUnitMapping[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var mapping = _step.value;
gl.activeTexture(mapping.textureUnit);
var textureLocation = gl.getUniformLocation(_this._program, mapping.name);
gl.uniform1i(textureLocation, _this._parameterTextureCount + textureOffset);
textureOffset += 1;
gl.bindTexture(gl.TEXTURE_2D, texture);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
gl.drawArrays(gl.TRIANGLES, 0, 6);
});
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
}
}]);
return CompositingNode;
})(_processingnode2["default"]);
exports["default"] = CompositingNode;
module.exports = exports["default"];
/***/ }),
/* 104 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _graphnode = __webpack_require__(100);
var _graphnode2 = _interopRequireDefault(_graphnode);
var _utilsJs = __webpack_require__(3);
var _exceptionsJs = __webpack_require__(105);
var ProcessingNode = (function (_GraphNode) {
_inherits(ProcessingNode, _GraphNode);
/**
* Initialise an instance of a ProcessingNode.
*
* This class is not used directly, but is extended to create CompositingNodes, TransitionNodes, and EffectNodes.
*/
function ProcessingNode(gl, renderGraph, definition, inputNames, limitConnections) {
var _this = this;
_classCallCheck(this, ProcessingNode);
_get(Object.getPrototypeOf(ProcessingNode.prototype), "constructor", this).call(this, gl, renderGraph, inputNames, limitConnections);
this._vertexShader = definition.vertexShader;
this._fragmentShader = definition.fragmentShader;
this._definition = definition;
this._properties = {}; //definition.properties;
//copy definition properties
for (var propertyName in definition.properties) {
var propertyValue = definition.properties[propertyName].value;
//if an array then shallow copy it
if (Object.prototype.toString.call(propertyValue) === "[object Array]") {
propertyValue = definition.properties[propertyName].value.slice();
}
var propertyType = definition.properties[propertyName].type;
this._properties[propertyName] = { type: propertyType, value: propertyValue };
}
this._inputTextureUnitMapping = [];
this._maxTextureUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
this._boundTextureUnits = 0;
this._parameterTextureCount = 0;
this._inputTextureCount = 0;
this._texture = (0, _utilsJs.createElementTexutre)(gl);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.canvas.width, gl.canvas.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
//compile the shader
this._program = (0, _utilsJs.createShaderProgram)(gl, this._vertexShader, this._fragmentShader);
//create and setup the framebuffer
this._framebuffer = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._texture, 0);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
//create properties on this object for the passed properties
var _loop = function (propertyName) {
Object.defineProperty(_this, propertyName, {
get: function get() {
return this._properties[propertyName].value;
},
set: function set(passedValue) {
this._properties[propertyName].value = passedValue;
}
});
};
for (var propertyName in this._properties) {
_loop(propertyName);
}
//create texutres for any texture properties
for (var propertyName in this._properties) {
var propertyValue = this._properties[propertyName].value;
if (propertyValue instanceof Image) {
this._properties[propertyName].texture = (0, _utilsJs.createElementTexutre)(gl);
this._properties[propertyName].texutreUnit = gl.TEXTURE0 + this._boundTextureUnits;
this._boundTextureUnits += 1;
this._parameterTextureCount += 1;
if (this._boundTextureUnits > this._maxTextureUnits) {
throw new _exceptionsJs.RenderException("Trying to bind more than available textures units to shader");
}
}
}
//calculate texutre units for input textures
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = definition.inputs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var inputName = _step.value;
this._inputTextureUnitMapping.push({ name: inputName, textureUnit: gl.TEXTURE0 + this._boundTextureUnits });
this._boundTextureUnits += 1;
this._inputTextureCount += 1;
if (this._boundTextureUnits > this._maxTextureUnits) {
throw new _exceptionsJs.RenderException("Trying to bind more than available textures units to shader");
}
}
//find the locations of the properties in the compiled shader
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
for (var propertyName in this._properties) {
if (this._properties[propertyName].type === "uniform") {
this._properties[propertyName].location = this._gl.getUniformLocation(this._program, propertyName);
}
}
this._currentTimeLocation = this._gl.getUniformLocation(this._program, "currentTime");
this._currentTime = 0;
//Other setup
this._positionLocation = gl.getAttribLocation(this._program, "a_position");
this._vbuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, this._vbuffer);
gl.enableVertexAttribArray(this._positionLocation);
/*
gl.vertexAttribPointer(this._positionLocation, 2, gl.FLOAT, false, 0, 0);
gl.bufferData(
gl.ARRAY_BUFFER,
new Float32Array([
1.0, 1.0,
0.0, 1.0,
1.0, 0.0,
1.0, 0.0,
0.0, 1.0,
0.0, 0.0]),
gl.STATIC_DRAW);
*/
gl.vertexAttribPointer(this._positionLocation, 2, gl.FLOAT, false, 0, 0);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0]), gl.DYNAMIC_DRAW);
this._texCoordLocation = gl.getAttribLocation(this._program, "a_texCoord");
gl.enableVertexAttribArray(this._texCoordLocation);
//gl.vertexAttribPointer(this._texCoordLocation, 2, gl.FLOAT, false, 0, 0);
gl.vertexAttribPointer(this._texCoordLocation, 2, gl.FLOAT, false, 0, 12 * 4);
this._displayName = "ProcessingNode";
this._scale = 1.0;
this._inputWidth = gl.canvas.width;
this._inputHeight = gl.canvas.height;
this._outputWidth = gl.canvas.width;
this._outputHeight = gl.canvas.height;
}
/**
* Sets the passed processing node property to the passed value.
* @param {string} name - The name of the processing node parameter to modify.
* @param {Object} value - The value to set it to.
*
* @example
* var ctx = new VideoContext();
* var monoNode = ctx.effect(VideoContext.DEFINITIONS.MONOCHROME);
* monoNode.setProperty("inputMix", [1.0,0.0,0.0]); //Just use red channel
*/
_createClass(ProcessingNode, [{
key: "setProperty",
value: function setProperty(name, value) {
this._properties[name].value = value;
}
/**
* Sets the passed processing node property to the passed value.
* @param {string} name - The name of the processing node parameter to get.
*
* @example
* var ctx = new VideoContext();
* var monoNode = ctx.effect(VideoContext.DEFINITIONS.MONOCHROME);
* console.log(monoNode.getProperty("inputMix")); //Will output [0.4,0.6,0.2], the default value from the effect definition.
*
*/
}, {
key: "getProperty",
value: function getProperty(name) {
return this._properties[name].value;
}
}, {
key: "_update",
value: function _update(currentTime) {
this._currentTime = currentTime;
}
}, {
key: "_seek",
value: function _seek(currentTime) {
this._currentTime = currentTime;
}
}, {
key: "_setScale",
value: function _setScale(scale) {
this._scale = scale;
}
}, {
key: "_updateOutput",
value: function _updateOutput(gl) {
if (this._scale != 1.0 || this._inputWidth != gl.canvas.width || this._inputHeight != gl.canvas.height) {
this._inputWidth = gl.canvas.width;
this._inputHeight = gl.canvas.height;
gl.deleteTexture(this._texture);
this._texture = (0, _utilsJs.createElementTexutre)(gl);
this._outputWidth = gl.canvas.width * this._scale;
this._outputHeight = gl.canvas.height * this._scale;
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this._outputWidth, this._outputHeight, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
this._scale = 1.0;
}
}
}, {
key: "_render",
value: function _render() {
this._rendered = true;
var gl = this._gl;
gl.viewport(0, 0, this._outputWidth, this._outputHeight);
gl.useProgram(this._program);
//upload the default uniforms
gl.uniform1f(this._currentTimeLocation, parseFloat(this._currentTime));
//upload/update the custom uniforms
var textureOffset = 0;
for (var propertyName in this._properties) {
var propertyValue = this._properties[propertyName].value;
var propertyType = this._properties[propertyName].type;
var propertyLocation = this._properties[propertyName].location;
if (propertyType !== "uniform") continue;
if (typeof propertyValue === "number") {
gl.uniform1f(propertyLocation, propertyValue);
} else if (Object.prototype.toString.call(propertyValue) === "[object Array]") {
if (propertyValue.length === 1) {
gl.uniform1fv(propertyLocation, propertyValue);
} else if (propertyValue.length === 2) {
gl.uniform2fv(propertyLocation, propertyValue);
} else if (propertyValue.length === 3) {
gl.uniform3fv(propertyLocation, propertyValue);
} else if (propertyValue.length === 4) {
gl.uniform4fv(propertyLocation, propertyValue);
} else if (propertyValue.length === 9) {
gl.uniformMatrix3fv(propertyLocation, gl.FALSE, propertyValue);
} else if (propertyValue.length === 16) {
gl.uniformMatrix4fv(propertyLocation, gl.FALSE, propertyValue);
} else {
console.debug("Shader parameter", propertyName, "is too long an array:", propertyValue);
}
} else if (propertyValue instanceof Image) {
var texture = this._properties[propertyName].texture;
var textureUnit = this._properties[propertyName].texutreUnit;
(0, _utilsJs.updateTexture)(gl, texture, propertyValue);
gl.activeTexture(textureUnit);
gl.uniform1i(propertyLocation, textureOffset);
textureOffset += 1;
gl.bindTexture(gl.TEXTURE_2D, texture);
} else {
//TODO - add tests for textures
/*gl.activeTexture(gl.TEXTURE0 + textureOffset);
gl.uniform1i(parameterLoctation, textureOffset);
gl.bindTexture(gl.TEXTURE_2D, textures[textureOffset-1]);*/
}
}
}
}]);
return ProcessingNode;
})(_graphnode2["default"]);
exports["default"] = ProcessingNode;
module.exports = exports["default"];
/***/ }),
/* 105 */
/***/ (function(module, exports) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ConnectException = ConnectException;
exports.RenderException = RenderException;
function ConnectException(message) {
this.message = message;
this.name = "ConnectionException";
}
function RenderException(message) {
this.message = message;
this.name = "RenderException";
}
/***/ }),
/* 106 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _ProcessingNodesProcessingnode = __webpack_require__(104);
var _ProcessingNodesProcessingnode2 = _interopRequireDefault(_ProcessingNodesProcessingnode);
var DestinationNode = (function (_ProcessingNode) {
_inherits(DestinationNode, _ProcessingNode);
/**
* Initialise an instance of a DestinationNode.
*
* There should only be a single instance of a DestinationNode per VideoContext instance. An VideoContext's destination can be accessed like so: videoContext.desitnation.
*
* You should not instantiate this directly.
*/
function DestinationNode(gl, renderGraph) {
_classCallCheck(this, DestinationNode);
var vertexShader = "\
attribute vec2 a_position;\
attribute vec2 a_texCoord;\
varying vec2 v_texCoord;\
void main() {\
gl_Position = vec4(vec2(2.0,2.0)*a_position-vec2(1.0, 1.0), 0.0, 1.0);\
v_texCoord = a_texCoord;\
}";
var fragmentShader = "\
precision mediump float;\
uniform sampler2D u_image;\
varying vec2 v_texCoord;\
varying float v_progress;\
void main(){\
gl_FragColor = texture2D(u_image, v_texCoord);\
}";
var deffinition = { fragmentShader: fragmentShader, vertexShader: vertexShader, properties: {}, inputs: ["u_image"] };
_get(Object.getPrototypeOf(DestinationNode.prototype), "constructor", this).call(this, gl, renderGraph, deffinition, deffinition.inputs, false);
this._displayName = "DestinationNode";
}
_createClass(DestinationNode, [{
key: "_render",
value: function _render() {
var _this = this;
var gl = this._gl;
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
gl.enable(gl.BLEND);
gl.clearColor(0, 0, 0, 0.0); // green;
gl.clear(gl.COLOR_BUFFER_BIT);
this.inputs.forEach(function (node) {
_get(Object.getPrototypeOf(DestinationNode.prototype), "_render", _this).call(_this);
//map the input textures input the node
var texture = node._texture;
var textureOffset = 0;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = _this._inputTextureUnitMapping[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var mapping = _step.value;
gl.activeTexture(mapping.textureUnit);
var textureLocation = gl.getUniformLocation(_this._program, mapping.name);
gl.uniform1i(textureLocation, _this._parameterTextureCount + textureOffset);
textureOffset += 1;
gl.bindTexture(gl.TEXTURE_2D, texture);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
gl.drawArrays(gl.TRIANGLES, 0, 6);
});
}
}]);
return DestinationNode;
})(_ProcessingNodesProcessingnode2["default"]);
exports["default"] = DestinationNode;
module.exports = exports["default"];
/***/ }),
/* 107 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _processingnode = __webpack_require__(104);
var _processingnode2 = _interopRequireDefault(_processingnode);
var _utilsJs = __webpack_require__(3);
var EffectNode = (function (_ProcessingNode) {
_inherits(EffectNode, _ProcessingNode);
/**
* Initialise an instance of an EffectNode. You should not instantiate this directly, but use VideoContest.createEffectNode().
*/
function EffectNode(gl, renderGraph, definition) {
_classCallCheck(this, EffectNode);
var placeholderTexture = (0, _utilsJs.createElementTexutre)(gl);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 0, 0]));
_get(Object.getPrototypeOf(EffectNode.prototype), "constructor", this).call(this, gl, renderGraph, definition, definition.inputs, true);
this._placeholderTexture = placeholderTexture;
this._displayName = "EffectNode";
}
_createClass(EffectNode, [{
key: "_render",
value: function _render() {
var gl = this._gl;
_get(Object.getPrototypeOf(EffectNode.prototype), "_updateOutput", this).call(this, gl);
gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._texture, 0);
gl.clearColor(0, 0, 0, 0); // green;
gl.clear(gl.COLOR_BUFFER_BIT);
_get(Object.getPrototypeOf(EffectNode.prototype), "_render", this).call(this);
var inputs = this._renderGraph.getInputsForNode(this);
var textureOffset = 0;
for (var i = 0; i < this._inputTextureUnitMapping.length; i++) {
var inputTexture = this._placeholderTexture;
var textureUnit = this._inputTextureUnitMapping[i].textureUnit;
var textureName = this._inputTextureUnitMapping[i].name;
if (i < inputs.length && inputs[i] !== undefined) {
inputTexture = inputs[i]._texture;
}
gl.activeTexture(textureUnit);
var textureLocation = gl.getUniformLocation(this._program, textureName);
gl.uniform1i(textureLocation, this._parameterTextureCount + textureOffset);
textureOffset += 1;
gl.bindTexture(gl.TEXTURE_2D, inputTexture);
}
gl.drawArrays(gl.TRIANGLES, 0, 6);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
}
}]);
return EffectNode;
})(_processingnode2["default"]);
exports["default"] = EffectNode;
module.exports = exports["default"];
/***/ }),
/* 108 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _processingnode = __webpack_require__(104);
var _processingnode2 = _interopRequireDefault(_processingnode);
var _utilsJs = __webpack_require__(3);
var DrawingNode = (function (_ProcessingNode) {
_inherits(DrawingNode, _ProcessingNode);
/**
* Initialise an instance of a Compositing Node. You should not instantiate this directly, but use VideoContest.createCompositingNode().
*/
function DrawingNode(gl, renderGraph, definition) {
_classCallCheck(this, DrawingNode);
var placeholderTexture = (0, _utilsJs.createElementTexutre)(gl);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 0, 0]));
_get(Object.getPrototypeOf(DrawingNode.prototype), "constructor", this).call(this, gl, renderGraph, definition, definition.inputs, false);
this._placeholderTexture = placeholderTexture;
this._displayName = "DrawingNode";
this.drawings = [];
/*
this._drawVBuf = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, this._drawVBuf);
gl.bufferData(
gl.ARRAY_BUFFER,
new Float32Array([
-1.0, -1.0,
1.0, -1.0,
-1.0, 1.0,
1.0, 1.0,
0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
1.0, 1.0]),
gl.DYNAMIC_DRAW);
gl.bindBuffer(gl.ARRAY_BUFFER, this._vbuffer);
*/
}
_createClass(DrawingNode, [{
key: "drawNode",
value: function drawNode(drawnode) {
if (drawnode === undefined) {
return;
}
this.drawings.forEach(function (node) {
if (drawnode === node) {
return;
}
});
this.drawings.push(drawnode);
}
}, {
key: "removeDrawNode",
value: function removeDrawNode(drawnode) {
var _this = this;
var toRemove = [];
if (drawnode === undefined) {
return false;
}
this.drawings.forEach(function (node) {
if (drawnode === node) {
toRemove.push(node);
}
});
if (toRemove.length === 0) return false;
toRemove.forEach(function (removeNode) {
var index = _this.drawings.indexOf(removeNode);
_this.drawings.splice(index, 1);
});
return true;
}
}, {
key: "_render",
value: function _render() {
var _this2 = this;
var gl = this._gl;
_get(Object.getPrototypeOf(DrawingNode.prototype), "_updateOutput", this).call(this, gl);
gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._texture, 0);
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
gl.useProgram(this._program);
var projection_ = new Float32Array(16);
var r_l = gl.canvas.width;
var t_b = gl.canvas.height;
var f_n = 2.0;
var tx = -1.0;
var ty = -1.0;
var tz = 0.0;
projection_[0] = 2.0 / r_l;
projection_[1] = 0.0;
projection_[2] = 0.0;
projection_[3] = 0.0;
projection_[4] = 0.0;
projection_[5] = 2.0 / t_b;
projection_[6] = 0.0;
projection_[7] = 0.0;
projection_[8] = 0.0;
projection_[9] = 0.0;
projection_[10] = -2.0 / f_n;
projection_[11] = 0.0;
projection_[12] = tx;
projection_[13] = ty;
projection_[14] = tz;
projection_[15] = 1.0;
var modelMatrixLocation = gl.getUniformLocation(this._program, "modelViewProjectionMatrix");
gl.uniformMatrix4fv(modelMatrixLocation, gl.FALSE, projection_);
this.inputs.forEach(function (node) {
//var inputNode = this.inputs[0];
var texture = node._texture;
var textureOffset = 0;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = _this2._inputTextureUnitMapping[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var mapping = _step.value;
gl.activeTexture(mapping.textureUnit);
var textureLocation = gl.getUniformLocation(_this2._program, mapping.name);
gl.uniform1i(textureLocation, _this2._parameterTextureCount + textureOffset);
textureOffset += 1;
gl.bindTexture(gl.TEXTURE_2D, texture);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
var ax = 0.0;
var ay = 0.0;
var bx = gl.canvas.width;
var by = 0.0;
var cx = 0.0;
var cy = gl.canvas.height;
var dx = gl.canvas.width;
var dy = gl.canvas.height;
gl.bindBuffer(gl.ARRAY_BUFFER, _this2._vbuffer);
gl.bufferSubData(gl.ARRAY_BUFFER, 0, new Float32Array([ax, ay, bx, by, cx, cy, dx, dy, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0]));
gl.enableVertexAttribArray(_this2._positionLocation);
gl.vertexAttribPointer(_this2._positionLocation, 2, gl.FLOAT, false, 0, 0);
gl.enableVertexAttribArray(_this2._texCoordLocation);
gl.vertexAttribPointer(_this2._texCoordLocation, 2, gl.FLOAT, false, 0, 12 * 4);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
});
this.drawings.forEach(function (node) {
var texture = node._texture;
var textureOffset = 0;
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = _this2._inputTextureUnitMapping[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var mapping = _step2.value;
gl.activeTexture(mapping.textureUnit);
var textureLocation = gl.getUniformLocation(_this2._program, mapping.name);
gl.uniform1i(textureLocation, _this2._parameterTextureCount + textureOffset);
textureOffset += 1;
gl.bindTexture(gl.TEXTURE_2D, texture);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2["return"]) {
_iterator2["return"]();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
var ax = node._drawRect[0];
var ay = gl.canvas.height - (node._drawRect[1] + node._drawRect[3]);
var bx = node._drawRect[0] + node._drawRect[2];
var by = gl.canvas.height - (node._drawRect[1] + node._drawRect[3]);
var cx = node._drawRect[0];
var cy = gl.canvas.height - node._drawRect[1];
var dx = node._drawRect[0] + node._drawRect[2];
var dy = gl.canvas.height - node._drawRect[1];
gl.bindBuffer(gl.ARRAY_BUFFER, _this2._vbuffer);
gl.bufferSubData(gl.ARRAY_BUFFER, 0, new Float32Array([ax, ay, bx, by, cx, cy, dx, dy, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0]));
gl.enableVertexAttribArray(_this2._positionLocation);
gl.vertexAttribPointer(_this2._positionLocation, 2, gl.FLOAT, false, 0, 0);
gl.enableVertexAttribArray(_this2._texCoordLocation);
gl.vertexAttribPointer(_this2._texCoordLocation, 2, gl.FLOAT, false, 0, 12 * 4);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
});
gl.bindBuffer(gl.ARRAY_BUFFER, this._vbuffer);
gl.bufferSubData(gl.ARRAY_BUFFER, 0, new Float32Array([1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0]));
//gl.enableVertexAttribArray(this._positionLocation);
//gl.vertexAttribPointer(this._positionLocation, 2, gl.FLOAT, false, 0, 0);
//gl.enableVertexAttribArray(this._texCoordLocation);
//gl.vertexAttribPointer(this._texCoordLocation, 2, gl.FLOAT, false, 0, 12*4);
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
}
}]);
return DrawingNode;
})(_processingnode2["default"]);
exports["default"] = DrawingNode;
module.exports = exports["default"];
/***/ }),
/* 109 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x3, _x4, _x5) { var _again = true; _function: while (_again) { var object = _x3, property = _x4, receiver = _x5; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x3 = parent; _x4 = property; _x5 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _effectnode = __webpack_require__(107);
var _effectnode2 = _interopRequireDefault(_effectnode);
var TransitionNode = (function (_EffectNode) {
_inherits(TransitionNode, _EffectNode);
/**
* Initialise an instance of a TransitionNode. You should not instantiate this directly, but use VideoContest.createTransitonNode().
*/
function TransitionNode(gl, renderGraph, definition) {
_classCallCheck(this, TransitionNode);
_get(Object.getPrototypeOf(TransitionNode.prototype), "constructor", this).call(this, gl, renderGraph, definition);
this._transitions = {};
//save a version of the original property values
this._initialPropertyValues = {};
for (var propertyName in this._properties) {
this._initialPropertyValues[propertyName] = this._properties[propertyName].value;
}
this._displayName = "TransitionNode";
}
_createClass(TransitionNode, [{
key: "_doesTransitionFitOnTimeline",
value: function _doesTransitionFitOnTimeline(testTransition) {
if (this._transitions[testTransition.property] === undefined) return true;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = this._transitions[testTransition.property][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var transition = _step.value;
if (testTransition.start > transition.start && testTransition.start < transition.end) return false;
if (testTransition.end > transition.start && testTransition.end < transition.end) return false;
if (transition.start > testTransition.start && transition.start < testTransition.end) return false;
if (transition.end > testTransition.start && transition.end < testTransition.end) return false;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return true;
}
}, {
key: "_insertTransitionInTimeline",
value: function _insertTransitionInTimeline(transition) {
if (this._transitions[transition.property] === undefined) this._transitions[transition.property] = [];
this._transitions[transition.property].push(transition);
this._transitions[transition.property].sort(function (a, b) {
return a.start - b.start;
});
}
/**
* Create a transition on the timeline.
*
* @param {number} startTime - The time at which the transition should start (relative to currentTime of video context).
* @param {number} endTime - The time at which the transition should be completed by (relative to currentTime of video context).
* @param {number} currentValue - The value to start the transition at.
* @param {number} targetValue - The value to transition to by endTime.
* @param {String} propertyName - The name of the property to clear transitions on, if undefined default to "mix".
*
* @return {Boolean} returns True if a transition is successfully added, false otherwise.
*/
}, {
key: "transition",
value: function transition(startTime, endTime, currentValue, targetValue) {
var propertyName = arguments.length <= 4 || arguments[4] === undefined ? "mix" : arguments[4];
var transition = { start: startTime + this._currentTime, end: endTime + this._currentTime, current: currentValue, target: targetValue, property: propertyName };
if (!this._doesTransitionFitOnTimeline(transition)) return false;
this._insertTransitionInTimeline(transition);
return true;
}
/**
* Create a transition on the timeline at an absolute time.
*
* @param {number} startTime - The time at which the transition should start (relative to time 0).
* @param {number} endTime - The time at which the transition should be completed by (relative to time 0).
* @param {number} currentValue - The value to start the transition at.
* @param {number} targetValue - The value to transition to by endTime.
* @param {String} propertyName - The name of the property to clear transitions on, if undefined default to "mix".
*
* @return {Boolean} returns True if a transition is successfully added, false otherwise.
*/
}, {
key: "transitionAt",
value: function transitionAt(startTime, endTime, currentValue, targetValue) {
var propertyName = arguments.length <= 4 || arguments[4] === undefined ? "mix" : arguments[4];
var transition = { start: startTime, end: endTime, current: currentValue, target: targetValue, property: propertyName };
if (!this._doesTransitionFitOnTimeline(transition)) return false;
this._insertTransitionInTimeline(transition);
return true;
}
/**
* Clear all transistions on the passed property. If no property is defined clear all transitions on the node.
*
* @param {String} propertyName - The name of the property to clear transitions on, if undefined clear all transitions on the node.
*/
}, {
key: "clearTransitions",
value: function clearTransitions(propertyName) {
if (propertyName === undefined) {
this._transitions = {};
} else {
this._transitions[propertyName] = [];
}
}
/**
* Clear a transistion on the passed property that the specified time lies within.
*
* @param {String} propertyName - The name of the property to clear a transition on.
* @param {number} time - A time which lies within the property you're trying to clear.
*
* @return {Boolean} returns True if a transition is removed, false otherwise.
*/
}, {
key: "clearTransition",
value: function clearTransition(propertyName, time) {
var transitionIndex = undefined;
for (var i = 0; i < this._transitions[propertyName].length; i++) {
var transition = this._transitions[propertyName][i];
if (time > transition.start && time < transition.end) {
transitionIndex = i;
}
}
if (transitionIndex !== undefined) {
this._transitions[propertyName].splice(transitionIndex, 1);
return true;
}
return false;
}
}, {
key: "_update",
value: function _update(currentTime) {
_get(Object.getPrototypeOf(TransitionNode.prototype), "_update", this).call(this, currentTime);
for (var propertyName in this._transitions) {
var value = this[propertyName];
if (this._transitions[propertyName].length > 0) {
value = this._transitions[propertyName][0].current;
}
var transitionActive = false;
for (var i = 0; i < this._transitions[propertyName].length; i++) {
var transition = this._transitions[propertyName][i];
if (currentTime > transition.end) {
value = transition.target;
continue;
}
if (currentTime > transition.start && currentTime < transition.end) {
var difference = transition.target - transition.current;
var progress = (this._currentTime - transition.start) / (transition.end - transition.start);
transitionActive = true;
this[propertyName] = transition.current + difference * progress;
break;
}
}
if (!transitionActive) this[propertyName] = value;
}
}
}]);
return TransitionNode;
})(_effectnode2["default"]);
exports["default"] = TransitionNode;
module.exports = exports["default"];
/***/ }),
/* 110 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _exceptionsJs = __webpack_require__(105);
var _PadNodesPadnodeJs = __webpack_require__(111);
var _PadNodesPadnodeJs2 = _interopRequireDefault(_PadNodesPadnodeJs);
var RenderGraph = (function () {
/**
* Manages the rendering graph.
*/
function RenderGraph() {
_classCallCheck(this, RenderGraph);
this.connections = [];
}
/**
* Get a list of nodes which are connected to the output of the passed node.
*
* @param {GraphNode} node - the node to get the outputs for.
* @return {GraphNode[]} An array of the nodes which are connected to the output.
*/
_createClass(RenderGraph, [{
key: "getOutputsForNode",
value: function getOutputsForNode(node) {
var results = [];
this.connections.forEach(function (connection) {
if (connection.source === node) {
results.push(connection.destination);
}
});
return results;
}
/**
* Get a list of nodes which are connected, by input name, to the given node. Array contains objects of the form: {"source":sourceNode, "type":"name", "name":inputName, "destination":destinationNode}.
*
* @param {GraphNode} node - the node to get the named inputs for.
* @return {Object[]} An array of objects representing the nodes and connection type, which are connected to the named inputs for the node.
*/
}, {
key: "getNamedInputsForNode",
value: function getNamedInputsForNode(node) {
var results = [];
this.connections.forEach(function (connection) {
if (connection.destination === node && connection.type === "name") {
results.push(connection);
}
});
return results;
}
/**
* Get a list of nodes which are connected, by z-index name, to the given node. Array contains objects of the form: {"source":sourceNode, "type":"zIndex", "zIndex":0, "destination":destinationNode}.
*
* @param {GraphNode} node - the node to get the z-index refernced inputs for.
* @return {Object[]} An array of objects representing the nodes and connection type, which are connected by z-Index for the node.
*/
}, {
key: "getZIndexInputsForNode",
value: function getZIndexInputsForNode(node) {
var results = [];
this.connections.forEach(function (connection) {
if (connection.destination === node && connection.type === "zIndex") {
results.push(connection);
}
});
results.sort(function (a, b) {
return a.zIndex - b.zIndex;
});
return results;
}
/**
* Get a list of nodes which are connected as inputs to the given node. The length of the return array is always equal to the number of inputs for the node, with undefined taking the place of any inputs not connected.
*
* @param {GraphNode} node - the node to get the inputs for.
* @return {GraphNode[]} An array of GraphNodes which are connected to the node.
*/
}, {
key: "getInputsForNode",
value: function getInputsForNode(node) {
var inputNames = node.inputNames;
var results = [];
var namedInputs = this.getNamedInputsForNode(node);
var indexedInputs = this.getZIndexInputsForNode(node);
if (node._limitConnections === true) {
for (var i = 0; i < inputNames.length; i++) {
results[i] = undefined;
}
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = namedInputs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var connection = _step.value;
var index = inputNames.indexOf(connection.name);
results[index] = connection.source;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
var indexedInputsIndex = 0;
for (var i = 0; i < results.length; i++) {
if (results[i] === undefined && indexedInputs[indexedInputsIndex] !== undefined) {
results[i] = indexedInputs[indexedInputsIndex].source;
indexedInputsIndex += 1;
}
}
} else {
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = namedInputs[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var connection = _step2.value;
results.push(connection.source);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2["return"]) {
_iterator2["return"]();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (var _iterator3 = indexedInputs[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var connection = _step3.value;
results.push(connection.source);
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3["return"]) {
_iterator3["return"]();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
}
return results;
}
/**
* Check if a named input on a node is available to connect too.
* @param {GraphNode} node - the node to check.
* @param {String} inputName - the named input to check.
*/
}, {
key: "isInputAvailable",
value: function isInputAvailable(node, inputName) {
if (node._inputNames.indexOf(inputName) === -1) return false;
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
try {
for (var _iterator4 = this.connections[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var connection = _step4.value;
if (connection.type === "name") {
if (connection.destination === node && connection.name === inputName) {
return false;
}
}
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4["return"]) {
_iterator4["return"]();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
return true;
}
/**
* Register a connection between two nodes.
*
* @param {GraphNode} sourceNode - the node to connect from.
* @param {GraphNode} destinationNode - the node to connect to.
* @param {(String | number)} [target] - the target port of the conenction, this could be a string to specfiy a specific named port, a number to specify a port by index, or undefined, in which case the next available port will be connected to.
* @return {boolean} Will return true if connection succeeds otherwise will throw a ConnectException.
*/
}, {
key: "registerConnection",
value: function registerConnection(sourceNode, destinationNode, target) {
if (destinationNode.inputs.length >= destinationNode.inputNames.length && destinationNode._limitConnections === true) {
throw new _exceptionsJs.ConnectException("Node has reached max number of inputs, can't connect");
}
if (typeof target === "number") {
//target is a specific
this.connections.push({ "source": sourceNode, "type": "zIndex", "zIndex": target, "destination": destinationNode });
} else if (typeof target === "string" && destinationNode._limitConnections) {
//target is a named port
//make sure named port is free
if (this.isInputAvailable(destinationNode, target)) {
this.connections.push({ "source": sourceNode, "type": "name", "name": target, "destination": destinationNode });
} else {
throw new _exceptionsJs.ConnectException("Port " + target + " is already connected to");
}
} else {
//target is undefined so just make it a high zIndex
if (destinationNode instanceof _PadNodesPadnodeJs2["default"]) {
destinationNode = destinationNode._inputNode;
}
var indexedConns = this.getZIndexInputsForNode(destinationNode);
var index = 0;
if (indexedConns.length > 0) index = indexedConns[indexedConns.length - 1].zIndex + 1;
this.connections.push({ "source": sourceNode, "type": "zIndex", "zIndex": index, "destination": destinationNode });
}
return true;
}
/**
* Remove a connection between two nodes.
* @param {GraphNode} sourceNode - the node to unregsiter connection from.
* @param {GraphNode} destinationNode - the node to register connection to.
* @return {boolean} Will return true if removing connection succeeds, or false if there was no connectionsction to remove.
*/
}, {
key: "unregisterConnection",
value: function unregisterConnection(sourceNode, destinationNode) {
var _this = this;
var toRemove = [];
if (destinationNode instanceof _PadNodesPadnodeJs2["default"]) {
destinationNode = destinationNode._inputNode;
}
this.connections.forEach(function (connection) {
if (connection.source === sourceNode && connection.destination === destinationNode) {
toRemove.push(connection);
}
});
if (toRemove.length === 0) return false;
toRemove.forEach(function (removeNode) {
var index = _this.connections.indexOf(removeNode);
_this.connections.splice(index, 1);
});
return true;
}
}], [{
key: "outputEdgesFor",
value: function outputEdgesFor(node, connections) {
var results = [];
var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false;
var _iteratorError5 = undefined;
try {
for (var _iterator5 = connections[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var conn = _step5.value;
if (conn.source === node) {
results.push(conn);
}
}
} catch (err) {
_didIteratorError5 = true;
_iteratorError5 = err;
} finally {
try {
if (!_iteratorNormalCompletion5 && _iterator5["return"]) {
_iterator5["return"]();
}
} finally {
if (_didIteratorError5) {
throw _iteratorError5;
}
}
}
return results;
}
}, {
key: "inputEdgesFor",
value: function inputEdgesFor(node, connections) {
var results = [];
var _iteratorNormalCompletion6 = true;
var _didIteratorError6 = false;
var _iteratorError6 = undefined;
try {
for (var _iterator6 = connections[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
var conn = _step6.value;
if (conn.destination === node) {
results.push(conn);
}
}
} catch (err) {
_didIteratorError6 = true;
_iteratorError6 = err;
} finally {
try {
if (!_iteratorNormalCompletion6 && _iterator6["return"]) {
_iterator6["return"]();
}
} finally {
if (_didIteratorError6) {
throw _iteratorError6;
}
}
}
return results;
}
}, {
key: "getInputlessNodes",
value: function getInputlessNodes(connections) {
var inputLess = [];
var _iteratorNormalCompletion7 = true;
var _didIteratorError7 = false;
var _iteratorError7 = undefined;
try {
for (var _iterator7 = connections[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
var conn = _step7.value;
inputLess.push(conn.source);
}
} catch (err) {
_didIteratorError7 = true;
_iteratorError7 = err;
} finally {
try {
if (!_iteratorNormalCompletion7 && _iterator7["return"]) {
_iterator7["return"]();
}
} finally {
if (_didIteratorError7) {
throw _iteratorError7;
}
}
}
var _iteratorNormalCompletion8 = true;
var _didIteratorError8 = false;
var _iteratorError8 = undefined;
try {
for (var _iterator8 = connections[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
var conn = _step8.value;
var index = inputLess.indexOf(conn.destination);
if (index !== -1) {
inputLess.splice(index, 1);
}
}
} catch (err) {
_didIteratorError8 = true;
_iteratorError8 = err;
} finally {
try {
if (!_iteratorNormalCompletion8 && _iterator8["return"]) {
_iterator8["return"]();
}
} finally {
if (_didIteratorError8) {
throw _iteratorError8;
}
}
}
return inputLess;
}
}]);
return RenderGraph;
})();
exports["default"] = RenderGraph;
module.exports = exports["default"];
/***/ }),
/* 111 */
/***/ (function(module, exports, __webpack_require__) {
//Matthew Shotton, R&D User Experience,© BBC 2015
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _graphnode = __webpack_require__(100);
var _graphnode2 = _interopRequireDefault(_graphnode);
var _DefinitionsDefinitionsJs = __webpack_require__(4);
var _DefinitionsDefinitionsJs2 = _interopRequireDefault(_DefinitionsDefinitionsJs);
/* read me
* @params {Array(2)}
* cavasSize - exactly the video process output size (to display or save)
* @params {Array(2)}
* videoSize - exactly the video input size (video media information)
* @params {int}
* paddingMode - 0- glassblur, 1- blackpad, 2- meanblur
* @func
* .setCropRect(cropRect) - the cropRect of input video (not canvas), [x, y, w, h] value 0.0~1.0,
* cropRect = [cropX/videoSize[0], cropY/videoSize[1], cropW/videoSize[0], cropH/videoSize[1]].
* default cropRect = [0.0, 0.0, 1.0, 1.0] - crop whole video screen
* @property {Array(4)}
* ._centerRect - the center rect of the video in the canvas that without padding area.
* _centerRect is the ratio for canvasSize: [x, y, w, h] - value 0.0~1.0.
* real rect: [ _centerRect[0]*canvasSize[0], _centerRect[1]*canvasSize[1], _centerRect[2]*canvasSize[0], _centerRect[3]*canvasSize[1] ]
* after setCropRect() you can get it to see video's center rect.
*
*/
var PadNode = (function (_GraphNode) {
_inherits(PadNode, _GraphNode);
/**
* Manages the rendering graph.
*/
function PadNode(gl, renderGraph, ctx, canvasSize, videoSize, padMode) {
_classCallCheck(this, PadNode);
_get(Object.getPrototypeOf(PadNode.prototype), "constructor", this).call(this, gl, renderGraph);
//check canvas size
if (canvasSize[0] < 1.0) {
canvasSize[0] = 1.0;
}
if (canvasSize[1] < 1.0) {
canvasSize[1] = 1.0;
}
//check video size
if (videoSize[0] < 1.0) {
videoSize[0] = 1.0;
}
if (videoSize[1] < 1.0) {
videoSize[1] = 1.0;
}
var t_inputNode = undefined;
var t_saturationNode = undefined;
var t_hBlurNode = undefined;
var t_vBlurNode = undefined;
var t_luminanceNode = undefined;
var t_meanHBlurNode = undefined;
var t_meanVBlurNode = undefined;
var t_glassNode = undefined;
var t_outputNode = undefined;
var cropRect = [0.0, 0.0, 1.0, 1.0];
var t_videoSize = videoSize;
var t_canvasSize = canvasSize;
var t_padMode = padMode;
var t_inputsNames = undefined;
var displayName = "dd";
var centerRect = [0.0, 0.0, 1.0, 1.0];
var nodes = [];
if (padMode == 2) {
var cropWidth = cropRect[2] * videoSize[0]; //crop width of video
var cropHeight = cropRect[3] * videoSize[1]; //crop height of video
var croprectNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].CROPRECT);
croprectNode.cropRect = cropRect;
//after crop, videoSize = [cropWidth, cropHeight]
videoSize = [cropWidth, cropHeight];
var cropInside = false;
//calc
var left = [0.0, 0.0, 0.0, 0.0];
var right = [0.0, 0.0, 0.0, 0.0];
var leftCropRect = [0.0, 0.0, 0.0, 0.0];
var rightCropRect = [0.0, 0.0, 0.0, 0.0];
var inRatio = videoSize[0] / videoSize[1];
var forceRatio = canvasSize[0] / canvasSize[1];
if (forceRatio > inRatio) {
var _scale = canvasSize[1] / videoSize[1];
var scaleWidth = videoSize[0] * _scale;
var padw = (canvasSize[0] - scaleWidth) / 2.0;
left[0] = 0.0;
left[1] = 0.0;
left[2] = padw / canvasSize[0];
left[3] = 1.0;
right[0] = (canvasSize[0] - padw) / canvasSize[0];
right[1] = 0.0;
right[2] = padw / canvasSize[0];
right[3] = 1.0;
centerRect[0] = padw / canvasSize[0];
centerRect[1] = 0.0;
centerRect[2] = scaleWidth / canvasSize[0];
centerRect[3] = 1.0;
if (scaleWidth / 2.0 <= padw) {
var cropScale = scaleWidth / 2.0 / padw;
var cropH = canvasSize[1] * cropScale;
var cropy = (canvasSize[1] - cropH) / 2.0;
//let cropx = 0.0;
leftCropRect[0] = 0.0;
leftCropRect[1] = cropy / canvasSize[1];
leftCropRect[2] = 0.5;
leftCropRect[3] = cropScale;
rightCropRect[0] = 0.5;
rightCropRect[1] = cropy / canvasSize[1];
rightCropRect[2] = 0.5;
rightCropRect[3] = cropScale;
} else {
if (cropInside) {
leftCropRect[0] = (scaleWidth / 2.0 - padw) / scaleWidth;
leftCropRect[1] = 0.0;
leftCropRect[2] = padw / scaleWidth;
leftCropRect[3] = 1.0;
rightCropRect[0] = 0.5;
rightCropRect[1] = 0.0;
rightCropRect[2] = padw / scaleWidth;
rightCropRect[3] = 1.0;
} else {
leftCropRect[0] = 0.0;
leftCropRect[1] = 0.0;
leftCropRect[2] = padw / scaleWidth;
leftCropRect[3] = 1.0;
rightCropRect[0] = 1.0 - padw / scaleWidth;
rightCropRect[1] = 0.0;
rightCropRect[2] = padw / scaleWidth;
rightCropRect[3] = 1.0;
}
}
} //endif forceRatio > inRatio
else {
var _scale2 = canvasSize[0] / videoSize[0];
var scaleHeight = videoSize[1] * _scale2;
var padh = (canvasSize[1] - scaleHeight) / 2.0;
left[0] = 0.0;
left[1] = 0.0;
left[2] = 1.0;
left[3] = padh / canvasSize[1];
right[0] = 0.0;
right[1] = 1.0 - padh / canvasSize[1];
right[2] = 1.0;
right[3] = padh / canvasSize[1];
centerRect[0] = 0.0;
centerRect[1] = padh / canvasSize[1];
centerRect[2] = 1.0;
centerRect[3] = scaleHeight / canvasSize[1];
if (scaleHeight / 2.0 <= padh) {
var cropScale = scaleHeight / 2.0 / padh;
var cropw = canvasSize[0] * cropScale;
var cropx = (canvasSize[0] - cropw) / 2.0;
//let cropy = 0.0;
leftCropRect.one = cropx / canvasSize[0];
leftCropRect.two = 0.0;
leftCropRect.three = cropScale;
leftCropRect.four = 0.5;
rightCropRect.one = cropx / canvasSize[0];
rightCropRect.two = 0.5;
rightCropRect.three = cropScale;
rightCropRect.four = 0.5;
} else {
if (cropInside) {
leftCropRect.one = 0.0;
leftCropRect.two = (scaleHeight / 2.0 - padh) / scaleHeight;
leftCropRect.three = 1.0;
leftCropRect.four = padh / scaleHeight;
rightCropRect.one = 0.0;
rightCropRect.two = 0.5;
rightCropRect.three = 1.0;
rightCropRect.four = padh / scaleHeight;
} else {
leftCropRect.one = 0.0;
leftCropRect.two = 0.0;
leftCropRect.three = 1.0;
leftCropRect.four = padh / scaleHeight;
rightCropRect.one = 0.0;
rightCropRect.two = 1.0 - padh / scaleHeight;
rightCropRect.three = 1.0;
rightCropRect.four = padh / scaleHeight;
}
}
}
var scale = 0.3;
var meanBlurRadius = 18.0;
var saturationNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].SATURATION);
var hBlurNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].GAUSSIAN_CONST_HBLUR);
var vBlurNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].GAUSSIAN_CONST_VBLUR);
var luminanceNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].LUMINANCE);
var hMeanBlurNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].MEAN_HBLUR);
var vMeanBlurNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].MEAN_VBLUR);
var glassNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].GLASSBLUR);
saturationNode.saturation = 0.65;
luminanceNode.rangeReduction = 0.5;
hBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
hBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
vBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
vBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
hMeanBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
hMeanBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
hMeanBlurNode.blurRadius = meanBlurRadius;
vMeanBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
vMeanBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
vMeanBlurNode.blurRadius = meanBlurRadius;
saturationNode._setScale(scale);
hBlurNode._setScale(scale);
vBlurNode._setScale(scale);
luminanceNode._setScale(scale);
glassNode.left = left;
glassNode.right = right;
glassNode.leftCropRect = leftCropRect;
glassNode.rightCropRect = rightCropRect;
glassNode.centerRect = centerRect;
croprectNode.connect(saturationNode);
croprectNode.connect(glassNode);
saturationNode.connect(hBlurNode);
hBlurNode.connect(vBlurNode);
vBlurNode.connect(luminanceNode);
luminanceNode.connect(hMeanBlurNode);
hMeanBlurNode.connect(vMeanBlurNode);
vMeanBlurNode.connect(glassNode);
t_inputNode = croprectNode; //input node
t_outputNode = glassNode; //output node
t_saturationNode = saturationNode;
t_hBlurNode = hBlurNode;
t_vBlurNode = vBlurNode;
t_luminanceNode = luminanceNode;
t_meanHBlurNode = hMeanBlurNode;
t_meanVBlurNode = vMeanBlurNode;
t_glassNode = glassNode;
nodes.push(croprectNode);
nodes.push(saturationNode);
nodes.push(hBlurNode);
nodes.push(vBlurNode);
nodes.push(luminanceNode);
nodes.push(hMeanBlurNode);
nodes.push(vMeanBlurNode);
nodes.push(glassNode);
t_inputsNames = _DefinitionsDefinitionsJs2["default"].CROPRECT.inputs;
displayName = "CropMeanBlurNode";
} else if (padMode == 1) {
//crop black pad
//cropblack pad
var cropWidth = cropRect[2] * videoSize[0]; //crop width of video
var cropHeight = cropRect[3] * videoSize[1]; //crop height of video
if (cropWidth >= 1.0 && cropHeight >= 1.0) {
if (cropWidth / cropHeight > canvasSize[0] / canvasSize[1]) {
var h = canvasSize[0] / cropWidth * cropHeight;
var y = (canvasSize[1] - h) / 2.0 / canvasSize[1];
var sh = h / canvasSize[1];
centerRect = [0.0, y, 1.0, sh];
} else {
var w = canvasSize[1] / cropHeight * cropWidth;
var x = (canvasSize[0] - w) / 2.0 / canvasSize[0];
var sw = w / canvasSize[0];
centerRect = [x, 0.0, sw, 1.0];
}
}
var cropblackNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].CROPBLACK);
cropblackNode.cropRect = cropRect;
cropblackNode.centerRect = centerRect;
t_inputNode = cropblackNode;
t_outputNode = cropblackNode;
nodes.push(cropblackNode);
t_inputsNames = _DefinitionsDefinitionsJs2["default"].CROPBLACK.inputs;
displayName = "CropBlackPadNode";
} else {
//crop glassblur pad
//crop
//saturation
//horiz gaussian blur
//vertical gaussian blur
//luminance
//glass blur
var cropWidth = cropRect[2] * videoSize[0]; //crop width of video
var cropHeight = cropRect[3] * videoSize[1]; //crop height of video
var cropNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].CROPRECT);
cropNode.cropRect = cropRect;
//after crop, videoSize = [cropWidth, cropHeight]
videoSize = [cropWidth, cropHeight];
var cropInside = false;
//calc
var left = [0.0, 0.0, 0.0, 0.0];
var right = [0.0, 0.0, 0.0, 0.0];
var leftCropRect = [0.0, 0.0, 0.0, 0.0];
var rightCropRect = [0.0, 0.0, 0.0, 0.0];
var inRatio = videoSize[0] / videoSize[1];
var forceRatio = canvasSize[0] / canvasSize[1];
if (forceRatio > inRatio) {
var _scale3 = canvasSize[1] / videoSize[1];
var scaleWidth = videoSize[0] * _scale3;
var padw = (canvasSize[0] - scaleWidth) / 2.0;
left[0] = 0.0;
left[1] = 0.0;
left[2] = padw / canvasSize[0];
left[3] = 1.0;
right[0] = (canvasSize[0] - padw) / canvasSize[0];
right[1] = 0.0;
right[2] = padw / canvasSize[0];
right[3] = 1.0;
centerRect[0] = padw / canvasSize[0];
centerRect[1] = 0.0;
centerRect[2] = scaleWidth / canvasSize[0];
centerRect[3] = 1.0;
if (scaleWidth / 2.0 <= padw) {
var cropScale = scaleWidth / 2.0 / padw;
var cropH = canvasSize[1] * cropScale;
var cropy = (canvasSize[1] - cropH) / 2.0;
//let cropx = 0.0;
leftCropRect[0] = 0.0;
leftCropRect[1] = cropy / canvasSize[1];
leftCropRect[2] = 0.5;
leftCropRect[3] = cropScale;
rightCropRect[0] = 0.5;
rightCropRect[1] = cropy / canvasSize[1];
rightCropRect[2] = 0.5;
rightCropRect[3] = cropScale;
} else {
if (cropInside) {
leftCropRect[0] = (scaleWidth / 2.0 - padw) / scaleWidth;
leftCropRect[1] = 0.0;
leftCropRect[2] = padw / scaleWidth;
leftCropRect[3] = 1.0;
rightCropRect[0] = 0.5;
rightCropRect[1] = 0.0;
rightCropRect[2] = padw / scaleWidth;
rightCropRect[3] = 1.0;
} else {
leftCropRect[0] = 0.0;
leftCropRect[1] = 0.0;
leftCropRect[2] = padw / scaleWidth;
leftCropRect[3] = 1.0;
rightCropRect[0] = 1.0 - padw / scaleWidth;
rightCropRect[1] = 0.0;
rightCropRect[2] = padw / scaleWidth;
rightCropRect[3] = 1.0;
}
}
} //endif forceRatio > inRatio
else {
var _scale4 = canvasSize[0] / videoSize[0];
var scaleHeight = videoSize[1] * _scale4;
var padh = (canvasSize[1] - scaleHeight) / 2.0;
left[0] = 0.0;
left[1] = 0.0;
left[2] = 1.0;
left[3] = padh / canvasSize[1];
right[0] = 0.0;
right[1] = 1.0 - padh / canvasSize[1];
right[2] = 1.0;
right[3] = padh / canvasSize[1];
centerRect[1] = padh / canvasSize[1];
centerRect[2] = 1.0;
centerRect[3] = scaleHeight / canvasSize[1];
if (scaleHeight / 2.0 <= padh) {
var cropScale = scaleHeight / 2.0 / padh;
var cropw = canvasSize[0] * cropScale;
var cropx = (canvasSize[0] - cropw) / 2.0;
//let cropy = 0.0;
leftCropRect.one = cropx / canvasSize[0];
leftCropRect.two = 0.0;
leftCropRect.three = cropScale;
leftCropRect.four = 0.5;
rightCropRect.one = cropx / canvasSize[0];
rightCropRect.two = 0.5;
rightCropRect.three = cropScale;
rightCropRect.four = 0.5;
} else {
if (cropInside) {
leftCropRect.one = 0.0;
leftCropRect.two = (scaleHeight / 2.0 - padh) / scaleHeight;
leftCropRect.three = 1.0;
leftCropRect.four = padh / scaleHeight;
rightCropRect.one = 0.0;
rightCropRect.two = 0.5;
rightCropRect.three = 1.0;
rightCropRect.four = padh / scaleHeight;
} else {
leftCropRect.one = 0.0;
leftCropRect.two = 0.0;
leftCropRect.three = 1.0;
leftCropRect.four = padh / scaleHeight;
rightCropRect.one = 0.0;
rightCropRect.two = 1.0 - padh / scaleHeight;
rightCropRect.three = 1.0;
rightCropRect.four = padh / scaleHeight;
}
}
}
var scale = 0.3;
var saturationNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].SATURATION);
var hBlurNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].GAUSSIAN_CONST_HBLUR);
var vBlurNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].GAUSSIAN_CONST_VBLUR);
var luminanceNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].LUMINANCE);
var glassNode = ctx.effect(_DefinitionsDefinitionsJs2["default"].GLASSBLUR);
saturationNode.saturation = 0.65;
luminanceNode.rangeReduction = 0.5;
hBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
hBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
vBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
vBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
saturationNode._setScale(scale);
hBlurNode._setScale(scale);
vBlurNode._setScale(scale);
luminanceNode._setScale(scale);
glassNode.left = left;
glassNode.right = right;
glassNode.leftCropRect = leftCropRect;
glassNode.centerRect = centerRect;
cropNode.connect(saturationNode);
saturationNode.connect(hBlurNode);
hBlurNode.connect(vBlurNode);
vBlurNode.connect(luminanceNode);
cropNode.connect(glassNode);
luminanceNode.connect(glassNode);
t_inputNode = cropNode; //input node
t_outputNode = glassNode; //output node
t_saturationNode = saturationNode;
t_hBlurNode = hBlurNode;
t_vBlurNode = vBlurNode;
t_luminanceNode = luminanceNode;
t_glassNode = glassNode;
nodes.push(cropNode);
nodes.push(saturationNode);
nodes.push(hBlurNode);
nodes.push(vBlurNode);
nodes.push(luminanceNode);
nodes.push(glassNode);
t_inputsNames = _DefinitionsDefinitionsJs2["default"].CROPRECT.inputs;
displayName = "CropGlassBlurNode";
}
this._nodes = nodes;
this._inputNode = t_inputNode;
this._saturationNode = t_saturationNode;
this._hBlurNode = t_hBlurNode;
this._vBlurNode = t_vBlurNode;
this._luminanceNode = t_luminanceNode;
this._meanHBlurNode = t_meanHBlurNode;
this._meanVBlurNode = t_meanVBlurNode;
this._glassNode = t_glassNode;
this._outputNode = t_outputNode;
this._cropRect = cropRect;
this._videoSize = t_videoSize;
this._canvasSize = t_canvasSize;
this._centerRect = centerRect;
this._padMode = t_padMode;
this._inputsNames = t_inputsNames;
this._displayName = displayName;
}
_createClass(PadNode, [{
key: "_updateParams",
value: function _updateParams(canvasSize, videoSize, cropRect) {
var centerRect = [0.0, 0.0, 1.0, 1.0];
if (this._padMode == 2) {
//crop meanblur pad
var cropWidth = cropRect[2] * videoSize[0]; //crop width of video
var cropHeight = cropRect[3] * videoSize[1]; //crop height of video
//after crop, videoSize = [cropWidth, cropHeight]
videoSize = [cropWidth, cropHeight];
var cropInside = false;
//calc
var left = [0.0, 0.0, 0.0, 0.0];
var right = [0.0, 0.0, 0.0, 0.0];
var leftCropRect = [0.0, 0.0, 0.0, 0.0];
var rightCropRect = [0.0, 0.0, 0.0, 0.0];
var inRatio = videoSize[0] / videoSize[1];
var forceRatio = canvasSize[0] / canvasSize[1];
if (forceRatio > inRatio) {
var _scale5 = canvasSize[1] / videoSize[1];
var scaleWidth = videoSize[0] * _scale5;
var padw = (canvasSize[0] - scaleWidth) / 2.0;
left[0] = 0.0;
left[1] = 0.0;
left[2] = padw / canvasSize[0];
left[3] = 1.0;
right[0] = (canvasSize[0] - padw) / canvasSize[0];
right[1] = 0.0;
right[2] = padw / canvasSize[0];
right[3] = 1.0;
centerRect[0] = padw / canvasSize[0];
centerRect[1] = 0.0;
centerRect[2] = scaleWidth / canvasSize[0];
centerRect[3] = 1.0;
if (scaleWidth / 2.0 <= padw) {
var cropScale = scaleWidth / 2.0 / padw;
var cropH = canvasSize[1] * cropScale;
var cropy = (canvasSize[1] - cropH) / 2.0;
//let cropx = 0.0;
leftCropRect[0] = 0.0;
leftCropRect[1] = cropy / canvasSize[1];
leftCropRect[2] = 0.5;
leftCropRect[3] = cropScale;
rightCropRect[0] = 0.5;
rightCropRect[1] = cropy / canvasSize[1];
rightCropRect[2] = 0.5;
rightCropRect[3] = cropScale;
} else {
if (cropInside) {
leftCropRect[0] = (scaleWidth / 2.0 - padw) / scaleWidth;
leftCropRect[1] = 0.0;
leftCropRect[2] = padw / scaleWidth;
leftCropRect[3] = 1.0;
rightCropRect[0] = 0.5;
rightCropRect[1] = 0.0;
rightCropRect[2] = padw / scaleWidth;
rightCropRect[3] = 1.0;
} else {
leftCropRect[0] = 0.0;
leftCropRect[1] = 0.0;
leftCropRect[2] = padw / scaleWidth;
leftCropRect[3] = 1.0;
rightCropRect[0] = 1.0 - padw / scaleWidth;
rightCropRect[1] = 0.0;
rightCropRect[2] = padw / scaleWidth;
rightCropRect[3] = 1.0;
}
}
} //endif forceRatio > inRatio
else {
var _scale6 = canvasSize[0] / videoSize[0];
var scaleHeight = videoSize[1] * _scale6;
var padh = (canvasSize[1] - scaleHeight) / 2.0;
left[0] = 0.0;
left[1] = 0.0;
left[2] = 1.0;
left[3] = padh / canvasSize[1];
right[0] = 0.0;
right[1] = 1.0 - padh / canvasSize[1];
right[2] = 1.0;
right[3] = padh / canvasSize[1];
centerRect[0] = 0.0;
centerRect[1] = padh / canvasSize[1];
centerRect[2] = 1.0;
centerRect[3] = scaleHeight / canvasSize[1];
if (scaleHeight / 2.0 <= padh) {
var cropScale = scaleHeight / 2.0 / padh;
var cropw = canvasSize[0] * cropScale;
var cropx = (canvasSize[0] - cropw) / 2.0;
//let cropy = 0.0;
leftCropRect.one = cropx / canvasSize[0];
leftCropRect.two = 0.0;
leftCropRect.three = cropScale;
leftCropRect.four = 0.5;
rightCropRect.one = cropx / canvasSize[0];
rightCropRect.two = 0.5;
rightCropRect.three = cropScale;
rightCropRect.four = 0.5;
} else {
if (cropInside) {
leftCropRect.one = 0.0;
leftCropRect.two = (scaleHeight / 2.0 - padh) / scaleHeight;
leftCropRect.three = 1.0;
leftCropRect.four = padh / scaleHeight;
rightCropRect.one = 0.0;
rightCropRect.two = 0.5;
rightCropRect.three = 1.0;
rightCropRect.four = padh / scaleHeight;
} else {
leftCropRect.one = 0.0;
leftCropRect.two = 0.0;
leftCropRect.three = 1.0;
leftCropRect.four = padh / scaleHeight;
rightCropRect.one = 0.0;
rightCropRect.two = 1.0 - padh / scaleHeight;
rightCropRect.three = 1.0;
rightCropRect.four = padh / scaleHeight;
}
}
}
var scale = 0.3;
var meanBlurRadius = 18.0;
this._inputNode.cropRect = cropRect;
this._hBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
this._hBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
this._vBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
this._vBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
this._meanHBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
this._meanHBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
this._meanHBlurNode.blurRadius = meanBlurRadius;
this._meanVBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
this._meanVBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
this._meanVBlurNode.blurRadius = meanBlurRadius;
this._glassNode.left = left;
this._glassNode.right = right;
this._glassNode.leftCropRect = leftCropRect;
this._glassNode.rightCropRect = rightCropRect;
this._glassNode.centerRect = centerRect;
} else if (this._padMode == 1) {
//crop black pad
//cropblack pad
var cropWidth = cropRect[2] * videoSize[0]; //crop width of video
var cropHeight = cropRect[3] * videoSize[1]; //crop height of video
if (cropWidth >= 1.0 && cropHeight >= 1.0) {
if (cropWidth / cropHeight > canvasSize[0] / canvasSize[1]) {
var h = canvasSize[0] / cropWidth * cropHeight;
var y = (canvasSize[1] - h) / 2.0 / canvasSize[1];
var sh = h / canvasSize[1];
centerRect = [0.0, y, 1.0, sh];
} else {
var w = canvasSize[1] / cropHeight * cropWidth;
var x = (canvasSize[0] - w) / 2.0 / canvasSize[0];
var sw = w / canvasSize[0];
centerRect = [x, 0.0, sw, 1.0];
}
}
this._inputNode.cropRect = cropRect;
this._inputNode.centerRect = centerRect;
} else {
//crop glassblur pad
//crop
//saturation
//horiz gaussian blur
//vertical gaussian blur
//luminance
//glass blur
var cropWidth = cropRect[2] * videoSize[0]; //crop width of video
var cropHeight = cropRect[3] * videoSize[1]; //crop height of video
//after crop, videoSize = [cropWidth, cropHeight]
videoSize = [cropWidth, cropHeight];
var cropInside = false;
//calc
var left = [0.0, 0.0, 0.0, 0.0];
var right = [0.0, 0.0, 0.0, 0.0];
var leftCropRect = [0.0, 0.0, 0.0, 0.0];
var rightCropRect = [0.0, 0.0, 0.0, 0.0];
var inRatio = videoSize[0] / videoSize[1];
var forceRatio = canvasSize[0] / canvasSize[1];
if (forceRatio > inRatio) {
var _scale7 = canvasSize[1] / videoSize[1];
var scaleWidth = videoSize[0] * _scale7;
var padw = (canvasSize[0] - scaleWidth) / 2.0;
left[0] = 0.0;
left[1] = 0.0;
left[2] = padw / canvasSize[0];
left[3] = 1.0;
right[0] = (canvasSize[0] - padw) / canvasSize[0];
right[1] = 0.0;
right[2] = padw / canvasSize[0];
right[3] = 1.0;
centerRect[0] = padw / canvasSize[0];
centerRect[1] = 0.0;
centerRect[2] = scaleWidth / canvasSize[0];
centerRect[3] = 1.0;
if (scaleWidth / 2.0 <= padw) {
var cropScale = scaleWidth / 2.0 / padw;
var cropH = canvasSize[1] * cropScale;
var cropy = (canvasSize[1] - cropH) / 2.0;
//let cropx = 0.0;
leftCropRect[0] = 0.0;
leftCropRect[1] = cropy / canvasSize[1];
leftCropRect[2] = 0.5;
leftCropRect[3] = cropScale;
rightCropRect[0] = 0.5;
rightCropRect[1] = cropy / canvasSize[1];
rightCropRect[2] = 0.5;
rightCropRect[3] = cropScale;
} else {
if (cropInside) {
leftCropRect[0] = (scaleWidth / 2.0 - padw) / scaleWidth;
leftCropRect[1] = 0.0;
leftCropRect[2] = padw / scaleWidth;
leftCropRect[3] = 1.0;
rightCropRect[0] = 0.5;
rightCropRect[1] = 0.0;
rightCropRect[2] = padw / scaleWidth;
rightCropRect[3] = 1.0;
} else {
leftCropRect[0] = 0.0;
leftCropRect[1] = 0.0;
leftCropRect[2] = padw / scaleWidth;
leftCropRect[3] = 1.0;
rightCropRect[0] = 1.0 - padw / scaleWidth;
rightCropRect[1] = 0.0;
rightCropRect[2] = padw / scaleWidth;
rightCropRect[3] = 1.0;
}
}
} //endif forceRatio > inRatio
else {
var _scale8 = canvasSize[0] / videoSize[0];
var scaleHeight = videoSize[1] * _scale8;
var padh = (canvasSize[1] - scaleHeight) / 2.0;
left[0] = 0.0;
left[1] = 0.0;
left[2] = 1.0;
left[3] = padh / canvasSize[1];
right[0] = 0.0;
right[1] = 1.0 - padh / canvasSize[1];
right[2] = 1.0;
right[3] = padh / canvasSize[1];
centerRect[0] = 0.0;
centerRect[1] = padh / canvasSize[1];
centerRect[2] = 1.0;
centerRect[3] = scaleHeight / canvasSize[1];
if (scaleHeight / 2.0 <= padh) {
var cropScale = scaleHeight / 2.0 / padh;
var cropw = canvasSize[0] * cropScale;
var cropx = (canvasSize[0] - cropw) / 2.0;
//let cropy = 0.0;
leftCropRect.one = cropx / canvasSize[0];
leftCropRect.two = 0.0;
leftCropRect.three = cropScale;
leftCropRect.four = 0.5;
rightCropRect.one = cropx / canvasSize[0];
rightCropRect.two = 0.5;
rightCropRect.three = cropScale;
rightCropRect.four = 0.5;
} else {
if (cropInside) {
leftCropRect.one = 0.0;
leftCropRect.two = (scaleHeight / 2.0 - padh) / scaleHeight;
leftCropRect.three = 1.0;
leftCropRect.four = padh / scaleHeight;
rightCropRect.one = 0.0;
rightCropRect.two = 0.5;
rightCropRect.three = 1.0;
rightCropRect.four = padh / scaleHeight;
} else {
leftCropRect.one = 0.0;
leftCropRect.two = 0.0;
leftCropRect.three = 1.0;
leftCropRect.four = padh / scaleHeight;
rightCropRect.one = 0.0;
rightCropRect.two = 1.0 - padh / scaleHeight;
rightCropRect.three = 1.0;
rightCropRect.four = padh / scaleHeight;
}
}
}
var scale = 0.3;
this._inputNode.cropRect = cropRect;
this._saturationNode.saturation = 0.65;
this._luminanceNode.rangeReduction = 0.5;
this._hBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
this._hBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
this._vBlurNode.texelWidthOffset = 1.0 / (videoSize[0] * scale);
this._vBlurNode.texelHeightOffset = 1.0 / (videoSize[1] * scale);
this._glassNode.left = left;
this._glassNode.right = right;
this._glassNode.leftCropRect = leftCropRect;
this._glassNode.rightCropRect = rightCropRect;
this._glassNode.centerRect = centerRect;
}
this._cropRect = cropRect;
this._videoSize = videoSize;
this._canvasSize = canvasSize;
this._centerRect = centerRect;
}
}, {
key: "setCanvasSize",
value: function setCanvasSize(size) {
if (size[0] < 1.0) {
size[0] = 1.0;
}
if (size[1] < 1.0) {
size[1] = 1.0;
}
this._canvasSize = size;
this._updateParams(this._canvasSize, this._videoSize, this._cropRect);
}
}, {
key: "setVideoSize",
value: function setVideoSize(size) {
if (size[0] < 1.0) {
size[0] = 1.0;
}
if (size[1] < 1.0) {
size[1] = 1.0;
}
this._videoSize = size;
this._updateParams(this._canvasSize, this._videoSize, this._cropRect);
}
}, {
key: "setCropRect",
value: function setCropRect(rect) {
if (rect == undefined) {
rect = [0.0, 0.0, 1.0, 1.0];
} else {
if (rect[0] < 0.0) {
rect[0] = 0.0;
}
if (rect[1] < 0.0) {
rect[1] = 0.0;
}
if (rect[2] < 0.0) {
rect[2] = 0.0;
}
if (rect[3] < 0.0) {
rect[3] = 0.0;
}
if (rect[2] + rect[0] > 1.0) {
rect[2] = 1.0 - rect[0];
}
if (rect[4] + rect[1] > 1.0) {
rect[4] = 1.0 - rect[1];
}
}
this._cropRect = rect;
this._updateParams(this._canvasSize, this._videoSize, this._cropRect);
}
/**
* Get a string representation of the class name.
*
* @return String A string of the class name.
*/
}, {
key: "connect",
/**
* Connect this node to the targetNode
*
* @param {GraphNode} targetNode - the node to connect.
* @param {(number| String)} [targetPort] - the port on the targetNode to connect to, this can be an index, a string identifier, or undefined (in which case the next available port will be connected to).
*
*/
value: function connect(targetNode, targetPort) {
if (this instanceof PadNode) {
return this._renderGraph.registerConnection(this._outputNode, targetNode, targetPort);
} else {
return this._renderGraph.registerConnection(this, targetNode, targetPort);
}
}
/**
* Disconnect this node from the targetNode. If targetNode is undefind remove all out-bound connections.
*
* @param {GraphNode} [targetNode] - the node to disconnect from. If undefined, disconnect from all nodes.
*
*/
}, {
key: "disconnect",
value: function disconnect(targetNode) {
var _this = this;
if (this instanceof PadNode) {
if (targetNode === undefined) {
var toRemove = this._renderGraph.getOutputsForNode(this._outputNode);
toRemove.forEach(function (target) {
return _this._renderGraph.unregisterConnection(_this._outputNode, target);
});
if (toRemove.length > 0) return true;
return false;
}
return this._renderGraph.unregisterConnection(this._outputNode, targetNode);
} else {
if (targetNode === undefined) {
var toRemove = this._renderGraph.getOutputsForNode(this);
toRemove.forEach(function (target) {
return _this._renderGraph.unregisterConnection(_this, target);
});
if (toRemove.length > 0) return true;
return false;
}
return this._renderGraph.unregisterConnection(this, targetNode);
}
}
/**
* Destory this node, removing it from the graph.
*/
}, {
key: "destroy",
value: function destroy() {
if (this instanceof PadNode) {
this.disconnect();
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = this.inputs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var input = _step.value;
input.disconnect(this._inputNode);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
this._destroyed = true;
} else {
this.disconnect();
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = this.inputs[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var input = _step2.value;
input.disconnect(this);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2["return"]) {
_iterator2["return"]();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
this._destroyed = true;
}
}
//processing
/**
* Sets the passed processing node property to the passed value.
* @param {string} name - The name of the processing node parameter to modify.
* @param {Object} value - The value to set it to.
*
* @example
* var ctx = new VideoContext();
* var monoNode = ctx.effect(VideoContext.DEFINITIONS.MONOCHROME);
* monoNode.setProperty("inputMix", [1.0,0.0,0.0]); //Just use red channel
*/
}, {
key: "setProperty",
value: function setProperty(name, value) {
if (this instanceof PadNode) {
this._inputNode._properties[name].value = value;
} else {
this._properties[name].value = value;
}
}
/**
* Sets the passed processing node property to the passed value.
* @param {string} name - The name of the processing node parameter to get.
*
* @example
* var ctx = new VideoContext();
* var monoNode = ctx.effect(VideoContext.DEFINITIONS.MONOCHROME);
* console.log(monoNode.getProperty("inputMix")); //Will output [0.4,0.6,0.2], the default value from the effect definition.
*
*/
}, {
key: "getProperty",
value: function getProperty(name) {
if (this instanceof PadNode) {
return this._inputNode._properties[name].value;
} else {
return this._properties[name].value;
}
}
}, {
key: "_update",
value: function _update(currentTime) {
if (this instanceof PadNode) {
this._inputNode._currentTime = currentTime;
this._nodes.forEach(function (node) {
node._currentTime = currentTime;
});
} else {
this._currentTime = currentTime;
}
}
}, {
key: "_seek",
value: function _seek(currentTime) {
if (this instanceof PadNode) {
this._inputNode._currentTime = currentTime;
this._nodes.forEach(function (node) {
node._currentTime = currentTime;
});
} else {
this._currentTime = currentTime;
}
}
}, {
key: "_setScale",
value: function _setScale(scale) {
if (this instanceof PadNode) {
this._inputNode._scale = scale;
} else {
this._scale = scale;
}
}
}, {
key: "_render",
value: function _render() {
this._nodes.forEach(function (node) {
node._render();
});
}
}, {
key: "displayName",
get: function get() {
return this._displayName;
}
/**
* Get the names of the inputs to this node.
*
* @return {String[]} An array of the names of the inputs ot the node.
*/
}, {
key: "inputNames",
get: function get() {
if (this instanceof PadNode) {
return this._inputNode._inputNames.slice();
} else {
return this._inputNames.slice();
}
}
/**
* The maximum number of connections that can be made to this node. If there is not limit this will return Infinity.
*
* @return {number} The number of connections which can be made to this node.
*/
}, {
key: "maximumConnections",
get: function get() {
if (this._limitConnections === false) return Infinity;
if (this instanceof PadNode) {
return this._inputNode._inputNames.length;
}
return this._inputNames.length;
}
/**
* Get an array of all the nodes which connect to this node.
*
* @return {GraphNode[]} An array of nodes which connect to this node.
*/
}, {
key: "inputs",
get: function get() {
var result = undefined;
if (this instanceof PadNode) {
result = this._renderGraph.getInputsForNode(this._inputNode);
} else {
result = this._renderGraph.getInputsForNode(this);
}
result = result.filter(function (n) {
return n !== undefined;
});
return result;
}
/**
* Get an array of all the nodes which this node outputs to.
*
* @return {GraphNode[]} An array of nodes which this node connects to.
*/
}, {
key: "outputs",
get: function get() {
if (this instanceof PadNode) {
return this._renderGraph.getOutputsForNode(this._outputNode);
} else {
return this._renderGraph.getOutputsForNode(this);
}
}
/**
* Get whether the node has been destroyed or not.
*
* @return {boolean} A true/false value of whather the node has been destoryed or not.
*/
}, {
key: "destroyed",
get: function get() {
return this._destroyed;
}
}, {
key: "_texture",
get: function get() {
if (this instanceof PadNode) {
return this._outputNode._texture;
} else {
return this._texture;
}
}
}]);
return PadNode;
})(_graphnode2["default"]);
exports["default"] = PadNode;
module.exports = exports["default"];
/***/ }),
/* 112 */
/***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var VideoElementCache = (function () {
function VideoElementCache() {
var cache_size = arguments.length <= 0 || arguments[0] === undefined ? 3 : arguments[0];
_classCallCheck(this, VideoElementCache);
this._elements = [];
this._elementsInitialised = false;
for (var i = 0; i < cache_size; i++) {
var element = this._createElement();
this._elements.push(element);
}
}
_createClass(VideoElementCache, [{
key: "_createElement",
value: function _createElement() {
var videoElement = document.createElement("video");
videoElement.setAttribute("crossorigin", "anonymous");
videoElement.setAttribute("webkit-playsinline", "");
videoElement.src = "";
return videoElement;
}
}, {
key: "init",
value: function init() {
if (!this._elementsInitialised) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
var _loop = function () {
var element = _step.value;
try {
element.play().then(function () {
element.pause();
}, function (e) {
if (e.name !== "NotSupportedError") throw e;
});
} catch (e) {
//console.log(e.name);
}
};
for (var _iterator = this._elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
_loop();
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
this._elementsInitialised = true;
}
}, {
key: "get",
value: function get() {
//Try and get an already intialised element.
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = this._elements[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var _element = _step2.value;
// For some reason an uninitialised videoElement has its sr attribute set to the windows href. Hence the below check.
if (_element.src === "" || _element.src === undefined || _element.src === window.location.href) return _element;
}
//Fallback to creating a new element if non exists.
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2["return"]) {
_iterator2["return"]();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
console.debug("No available video element in the cache, creating a new one. This may break mobile, make your initial cache larger.");
var element = this._createElement();
this._elements.push(element);
this._elementsInitialised = false;
return element;
}
}, {
key: "length",
get: function get() {
return this._elements.length;
}
}, {
key: "unused",
get: function get() {
var count = 0;
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (var _iterator3 = this._elements[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var element = _step3.value;
// For some reason an uninitialised videoElement has its sr attribute set to the windows href. Hence the below check.
if (element.src === "" || element.src === undefined || element.src === window.location.href) count += 1;
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3["return"]) {
_iterator3["return"]();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
return count;
}
}]);
return VideoElementCache;
})();
exports["default"] = VideoElementCache;
module.exports = exports["default"];
/***/ })
/******/ ]);
//# sourceMappingURL=videocontext.commonjs2.js.map
/* eslint-enable */
| {
"content_hash": "22fd802a694fd67eaa01223a13f83536",
"timestamp": "",
"source": "github",
"line_count": 13452,
"max_line_length": 662,
"avg_line_length": 37.93421052631579,
"alnum_prop": 0.536201892645569,
"repo_name": "Statfine/reactDemo",
"id": "615955e098c4b020d5c40147b4649da19bc217c2",
"size": "510307",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/tool/videocontextV4/videocontext.commonjs2.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "154"
},
{
"name": "HTML",
"bytes": "10398"
},
{
"name": "JavaScript",
"bytes": "4098111"
}
],
"symlink_target": ""
} |
package org.scalafmt.util
import scala.annotation.tailrec
import scala.meta.Input
import scala.meta.tokens.Token
import scala.meta.tokens.Tokens
class TokenTraverser(tokens: Tokens, input: Input) {
private[this] val (tok2idx, excludedTokens) = {
val map = Map.newBuilder[Token, Int]
val excluded = Set.newBuilder[TokenOps.TokenHash]
var formatOff = false
var i = 0
tokens.foreach { tok =>
if (!formatOff) {
if (TokenOps.isFormatOff(tok)) formatOff = true
} else {
if (TokenOps.isFormatOn(tok)) formatOff = false
else excluded += TokenOps.hash(tok)
}
map += (tok -> i)
i += 1
}
if (input.isInstanceOf[Input.Ammonite]) {
val realTokens = tokens.dropWhile(_.is[Token.BOF])
realTokens.headOption.foreach {
// shebang in .sc files
case t: Token.Ident if t.value.startsWith("#!") =>
realTokens.takeWhile(!_.is[Token.LF]).foreach {
excluded += TokenOps.hash(_)
}
case _ =>
}
}
(map.result(), excluded.result())
}
final def isExcluded(token: Token): Boolean =
excludedTokens.contains(TokenOps.hash(token))
@inline def getIndex(token: Token): Int = tok2idx(token)
@inline def getIndexOpt(token: Token): Option[Int] = tok2idx.get(token)
def nextToken(token: Token): Token = {
tok2idx.get(token) match {
case Some(i) if i < tokens.length - 1 => tokens(i + 1)
case _ => token
}
}
def prevToken(token: Token): Token = {
tok2idx.get(token) match {
case Some(i) if i > 0 => tokens(i - 1)
case _ => token
}
}
def nextNonTrivialToken(token: Token): Option[Token] =
findAfter(token)(TokenTraverser.isTrivialPred)
def prevNonTrivialToken(token: Token): Option[Token] =
findBefore(token)(TokenTraverser.isTrivialPred)
/** Find a token after the given one. The search stops when the predicate
* returns Some value (or the end is reached).
* @return
* Some(token) if the predicate returned Some(true), else None.
*/
def findAfter(
token: Token
)(predicate: Token => Option[Boolean]): Option[Token] =
tok2idx.get(token).flatMap(x => findAtOrAfter(x + 1)(predicate))
/** Find a token before the given one. The search stops when the predicate
* returns Some value (or the end is reached).
* @return
* Some(token) if the predicate returned Some(true), else None.
*/
def findBefore(
token: Token
)(predicate: Token => Option[Boolean]): Option[Token] =
tok2idx.get(token).flatMap(x => findAtOrBefore(x - 1)(predicate))
@tailrec
final def findAtOrAfter(off: Int)(
pred: Token => Option[Boolean]
): Option[Token] =
if (off >= tokens.length) None
else {
val token = tokens(off)
pred(token) match {
case Some(true) => Some(token)
case Some(false) => None
case _ => findAtOrAfter(off + 1)(pred)
}
}
@tailrec
final def findAtOrBefore(off: Int)(
pred: Token => Option[Boolean]
): Option[Token] =
if (off < 0) None
else {
val token = tokens(off)
pred(token) match {
case Some(true) => Some(token)
case Some(false) => None
case _ => findAtOrBefore(off - 1)(pred)
}
}
final def filter(start: Token, end: Token)(
predicate: Token => Boolean
): Seq[Token] = {
if (start == end || nextToken(start) == start) Nil
else {
val tail = filter(nextToken(start), end)(predicate)
if (predicate(start)) start +: tail
else tail
}
}
}
object TokenTraverser {
private def isTrivialPred(token: Token): Option[Boolean] =
if (token.is[Trivia]) None else Some(true)
}
| {
"content_hash": "93fcf293539efda19a5673f08fadaff0",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 76,
"avg_line_length": 28.35114503816794,
"alnum_prop": 0.6173936456650512,
"repo_name": "scalameta/scalafmt",
"id": "94dcfb445f14388a4eb9f6421a7e9bcd1edf1f1d",
"size": "3714",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scalafmt-core/shared/src/main/scala/org/scalafmt/util/TokenTraverser.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "6516"
},
{
"name": "Dockerfile",
"bytes": "122"
},
{
"name": "HTML",
"bytes": "54"
},
{
"name": "Java",
"bytes": "12220"
},
{
"name": "JavaScript",
"bytes": "12331"
},
{
"name": "PowerShell",
"bytes": "32"
},
{
"name": "Scala",
"bytes": "1497094"
},
{
"name": "Shell",
"bytes": "27450"
},
{
"name": "Standard ML",
"bytes": "1765"
}
],
"symlink_target": ""
} |
Date.CultureInfo = {
/* Culture Name */
name: "sv-FI",
englishName: "Swedish (Finland)",
nativeName: "svenska (Finland)",
/* Day Name Strings */
dayNames: ["söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lördag"],
abbreviatedDayNames: ["sö", "må", "ti", "on", "to", "fr", "lö"],
shortestDayNames: ["sö", "må", "ti", "on", "to", "fr", "lö"],
firstLetterDayNames: ["s", "m", "t", "o", "t", "f", "l"],
/* Month Name Strings */
monthNames: ["januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"],
abbreviatedMonthNames: ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"],
/* AM/PM Designators */
amDesignator: "",
pmDesignator: "",
firstDayOfWeek: 1,
twoDigitYearMax: 2029,
/**
* The dateElementOrder is based on the order of the
* format specifiers in the formatPatterns.DatePattern.
*
* Example:
<pre>
shortDatePattern dateElementOrder
------------------ ----------------
"M/d/yyyy" "mdy"
"dd/MM/yyyy" "dmy"
"yyyy-MM-dd" "ymd"
</pre>
*
* The correct dateElementOrder is required by the parser to
* determine the expected order of the date elements in the
* string being parsed.
*/
dateElementOrder: "dmy",
/* Standard date and time format patterns */
formatPatterns: {
shortDate: "d.M.yyyy",
longDate: "'den 'd MMMM yyyy",
shortTime: "HH:mm",
longTime: "HH:mm:ss",
fullDateTime: "'den 'd MMMM yyyy HH:mm:ss",
sortableDateTime: "yyyy-MM-ddTHH:mm:ss",
universalSortableDateTime: "yyyy-MM-dd HH:mm:ssZ",
rfc1123: "ddd, dd MMM yyyy HH:mm:ss GMT",
monthDay: "'den 'd MMMM",
yearMonth: "MMMM yyyy"
},
/**
* NOTE: If a string format is not parsing correctly, but
* you would expect it parse, the problem likely lies below.
*
* The following regex patterns control most of the string matching
* within the parser.
*
* The Month name and Day name patterns were automatically generated
* and in general should be (mostly) correct.
*
* Beyond the month and day name patterns are natural language strings.
* Example: "next", "today", "months"
*
* These natural language string may NOT be correct for this culture.
* If they are not correct, please translate and edit this file
* providing the correct regular expression pattern.
*
* If you modify this file, please post your revised CultureInfo file
* to the Datejs Forum located at http://www.datejs.com/forums/.
*
* Please mark the subject of the post with [CultureInfo]. Example:
* Subject: [CultureInfo] Translated "da-DK" Danish(Denmark)
*
* We will add the modified patterns to the master source files.
*
* As well, please review the list of "Future Strings" section below.
*/
regexPatterns: {
jan: /^jan(uari)?/i,
feb: /^feb(ruari)?/i,
mar: /^mar(s)?/i,
apr: /^apr(il)?/i,
may: /^maj/i,
jun: /^jun(i)?/i,
jul: /^jul(i)?/i,
aug: /^aug(usti)?/i,
sep: /^sep(t(ember)?)?/i,
oct: /^okt(ober)?/i,
nov: /^nov(ember)?/i,
dec: /^dec(ember)?/i,
sun: /^söndag/i,
mon: /^måndag/i,
tue: /^tisdag/i,
wed: /^onsdag/i,
thu: /^torsdag/i,
fri: /^fredag/i,
sat: /^lördag/i,
future: /^next/i,
past: /^last|past|prev(ious)?/i,
add: /^(\+|aft(er)?|from|hence)/i,
subtract: /^(\-|bef(ore)?|ago)/i,
yesterday: /^yes(terday)?/i,
today: /^t(od(ay)?)?/i,
tomorrow: /^tom(orrow)?/i,
now: /^n(ow)?/i,
millisecond: /^ms|milli(second)?s?/i,
second: /^sec(ond)?s?/i,
minute: /^mn|min(ute)?s?/i,
hour: /^h(our)?s?/i,
week: /^w(eek)?s?/i,
month: /^m(onth)?s?/i,
day: /^d(ay)?s?/i,
year: /^y(ear)?s?/i,
shortMeridian: /^(a|p)/i,
longMeridian: /^(a\.?m?\.?|p\.?m?\.?)/i,
timezone: /^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt|utc)/i,
ordinalSuffix: /^\s*(st|nd|rd|th)/i,
timeContext: /^\s*(\:|a(?!u|p)|p)/i
},
timezones: [{name:"UTC", offset:"-000"}, {name:"GMT", offset:"-000"}, {name:"EST", offset:"-0500"}, {name:"EDT", offset:"-0400"}, {name:"CST", offset:"-0600"}, {name:"CDT", offset:"-0500"}, {name:"MST", offset:"-0700"}, {name:"MDT", offset:"-0600"}, {name:"PST", offset:"-0800"}, {name:"PDT", offset:"-0700"}]
};
/********************
** Future Strings **
********************
*
* The following list of strings may not be currently being used, but
* may be incorporated into the Datejs library later.
*
* We would appreciate any help translating the strings below.
*
* If you modify this file, please post your revised CultureInfo file
* to the Datejs Forum located at http://www.datejs.com/forums/.
*
* Please mark the subject of the post with [CultureInfo]. Example:
* Subject: [CultureInfo] Translated "da-DK" Danish(Denmark)b
*
* English Name Translated
* ------------------ -----------------
* about about
* ago ago
* date date
* time time
* calendar calendar
* show show
* hourly hourly
* daily daily
* weekly weekly
* bi-weekly bi-weekly
* fortnight fortnight
* monthly monthly
* bi-monthly bi-monthly
* quarter quarter
* quarterly quarterly
* yearly yearly
* annual annual
* annually annually
* annum annum
* again again
* between between
* after after
* from now from now
* repeat repeat
* times times
* per per
* min (abbrev minute) min
* morning morning
* noon noon
* night night
* midnight midnight
* mid-night mid-night
* evening evening
* final final
* future future
* spring spring
* summer summer
* fall fall
* winter winter
* end of end of
* end end
* long long
* short short
*/ | {
"content_hash": "67ff0b7d66536fd445fbc6796f4fa45f",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 310,
"avg_line_length": 35.14358974358974,
"alnum_prop": 0.49905151028746536,
"repo_name": "KingsleyYu/Chuanmei",
"id": "116d04bf44a813e6fba2fd9ea04431e8e4206d49",
"size": "6865",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "build/js/util/Datejs/src/globalization/sv-FI.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "64"
},
{
"name": "CSS",
"bytes": "3998065"
},
{
"name": "CoffeeScript",
"bytes": "29895"
},
{
"name": "HTML",
"bytes": "4046866"
},
{
"name": "Java",
"bytes": "133959"
},
{
"name": "JavaScript",
"bytes": "14397641"
},
{
"name": "Makefile",
"bytes": "1186"
},
{
"name": "PHP",
"bytes": "8178"
},
{
"name": "Shell",
"bytes": "2074"
}
],
"symlink_target": ""
} |
from heat.common import exception
from heat.common.i18n import _
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine import support
class CinderVolumeType(resource.Resource):
"""A resource for creating cinder volume types.
Volume type resource allows to define, whether volume, which will be use
this type, will public and which projects are allowed to work with it.
Also, there can be some user-defined metadata.
Note that default cinder security policy usage of this resource
is limited to being used by administrators only.
"""
support_status = support.SupportStatus(version='2015.1')
default_client_name = 'cinder'
entity = 'volume_types'
required_service_extension = 'os-types-manage'
PROPERTIES = (
NAME, METADATA, IS_PUBLIC, DESCRIPTION, PROJECTS,
) = (
'name', 'metadata', 'is_public', 'description', 'projects',
)
properties_schema = {
NAME: properties.Schema(
properties.Schema.STRING,
_('Name of the volume type.'),
required=True,
update_allowed=True,
),
METADATA: properties.Schema(
properties.Schema.MAP,
_('The extra specs key and value pairs of the volume type.'),
update_allowed=True
),
IS_PUBLIC: properties.Schema(
properties.Schema.BOOLEAN,
_('Whether the volume type is accessible to the public.'),
default=True,
support_status=support.SupportStatus(version='5.0.0'),
update_allowed=True
),
DESCRIPTION: properties.Schema(
properties.Schema.STRING,
_('Description of the volume type.'),
update_allowed=True,
support_status=support.SupportStatus(version='5.0.0'),
),
PROJECTS: properties.Schema(
properties.Schema.LIST,
_('Projects to add volume type access to. NOTE: This '
'property is only supported since Cinder API V2.'),
support_status=support.SupportStatus(version='5.0.0'),
update_allowed=True,
schema=properties.Schema(
properties.Schema.STRING,
constraints=[
constraints.CustomConstraint('keystone.project')
],
),
default=[],
),
}
def _add_projects_access(self, projects):
for project in projects:
project_id = self.client_plugin('keystone').get_project_id(project)
self.cinder().volume_type_access.add_project_access(
self.resource_id, project_id)
def handle_create(self):
args = {
'name': self.properties[self.NAME],
'is_public': self.properties[self.IS_PUBLIC],
'description': self.properties[self.DESCRIPTION]
}
volume_type = self.client().volume_types.create(**args)
self.resource_id_set(volume_type.id)
vtype_metadata = self.properties[self.METADATA]
if vtype_metadata:
volume_type.set_keys(vtype_metadata)
self._add_projects_access(self.properties[self.PROJECTS])
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
"""Update the name, description and metadata for volume type."""
update_args = {}
# Update the name, description, is_public of cinder volume type
is_public = self.properties[self.IS_PUBLIC]
if self.DESCRIPTION in prop_diff:
update_args['description'] = prop_diff.get(self.DESCRIPTION)
if self.NAME in prop_diff:
update_args['name'] = prop_diff.get(self.NAME)
if self.IS_PUBLIC in prop_diff:
is_public = prop_diff.get(self.IS_PUBLIC)
update_args['is_public'] = is_public
if update_args:
self.client().volume_types.update(self.resource_id, **update_args)
# Update the key-value pairs of cinder volume type.
if self.METADATA in prop_diff:
volume_type = self.client().volume_types.get(self.resource_id)
old_keys = volume_type.get_keys()
volume_type.unset_keys(old_keys)
new_keys = prop_diff.get(self.METADATA)
if new_keys is not None:
volume_type.set_keys(new_keys)
# Update the projects access for volume type
if self.PROJECTS in prop_diff and not is_public:
old_access_list = self.cinder().volume_type_access.list(
self.resource_id)
old_projects = [ac._info['project_id'] for ac in old_access_list]
new_projects = prop_diff.get(self.PROJECTS)
# first remove the old projects access
for project_id in (set(old_projects) - set(new_projects)):
self.cinder().volume_type_access.remove_project_access(
self.resource_id, project_id)
# add the new projects access
self._add_projects_access(set(new_projects) - set(old_projects))
def validate(self):
super(CinderVolumeType, self).validate()
if self.properties[self.PROJECTS]:
if self.cinder().volume_api_version == 1:
raise exception.NotSupported(
feature=_('Using Cinder API V1, volume type access'))
if self.properties[self.IS_PUBLIC]:
msg = (_('Can not specify property "%s" '
'if the volume type is public.') % self.PROJECTS)
raise exception.StackValidationFailed(message=msg)
def resource_mapping():
return {
'OS::Cinder::VolumeType': CinderVolumeType
}
| {
"content_hash": "ced237cf569d533b12602813109a8061",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 79,
"avg_line_length": 39.12244897959184,
"alnum_prop": 0.6019822639540949,
"repo_name": "steveb/heat",
"id": "f7d59707f1061bc0ba78a337e15df186800dd280",
"size": "6326",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "heat/engine/resources/openstack/cinder/volume_type.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "1226938"
},
{
"name": "Shell",
"bytes": "17870"
}
],
"symlink_target": ""
} |
#import "Reachability.h"
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
NSString *const kReachabilityChangedNotification = @"kReachabilityChangedNotification";
@interface TMReachability ()
@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
@property (nonatomic, strong) id reachabilityObject;
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags;
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags;
@end
static NSString *reachabilityFlags(SCNetworkReachabilityFlags flags)
{
return [NSString stringWithFormat:@"%c%c %c%c%c%c%c%c%c",
#if TARGET_OS_IPHONE
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
#else
'X',
#endif
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
}
// Start listening for reachability notifications on the current run loop
static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
{
#pragma unused (target)
TMReachability *reachability = ((__bridge TMReachability*)info);
// We probably don't need an autoreleasepool here, as GCD docs state each queue has its own autorelease pool,
// but what the heck eh?
@autoreleasepool
{
[reachability reachabilityChanged:flags];
}
}
@implementation TMReachability
#pragma mark - Class Constructor Methods
+(instancetype)reachabilityWithHostName:(NSString*)hostname
{
return [TMReachability reachabilityWithHostname:hostname];
}
+(instancetype)reachabilityWithHostname:(NSString*)hostname
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
return reachability;
}
return nil;
}
+(instancetype)reachabilityWithAddress:(void *)hostAddress
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
return reachability;
}
return nil;
}
+(instancetype)reachabilityForInternetConnection
{
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
return [self reachabilityWithAddress:&zeroAddress];
}
+(instancetype)reachabilityForLocalWiFi
{
struct sockaddr_in localWifiAddress;
bzero(&localWifiAddress, sizeof(localWifiAddress));
localWifiAddress.sin_len = sizeof(localWifiAddress);
localWifiAddress.sin_family = AF_INET;
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
return [self reachabilityWithAddress:&localWifiAddress];
}
// Initialization methods
-(instancetype)initWithReachabilityRef:(SCNetworkReachabilityRef)ref
{
self = [super init];
if (self != nil)
{
self.reachableOnWWAN = YES;
self.reachabilityRef = ref;
// We need to create a serial queue.
// We allocate this once for the lifetime of the notifier.
self.reachabilitySerialQueue = dispatch_queue_create("com.tonymillion.reachability", NULL);
}
return self;
}
-(void)dealloc
{
[self stopNotifier];
if(self.reachabilityRef)
{
CFRelease(self.reachabilityRef);
self.reachabilityRef = nil;
}
self.reachableBlock = nil;
self.unreachableBlock = nil;
self.reachabilitySerialQueue = nil;
}
#pragma mark - Notifier Methods
// Notifier
// NOTE: This uses GCD to trigger the blocks - they *WILL NOT* be called on THE MAIN THREAD
// - In other words DO NOT DO ANY UI UPDATES IN THE BLOCKS.
// INSTEAD USE dispatch_async(dispatch_get_main_queue(), ^{UISTUFF}) (or dispatch_sync if you want)
-(BOOL)startNotifier
{
// allow start notifier to be called multiple times
if(self.reachabilityObject && (self.reachabilityObject == self))
{
return YES;
}
SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL };
context.info = (__bridge void *)self;
if(SCNetworkReachabilitySetCallback(self.reachabilityRef, TMReachabilityCallback, &context))
{
// Set it as our reachability queue, which will retain the queue
if(SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, self.reachabilitySerialQueue))
{
// this should do a retain on ourself, so as long as we're in notifier mode we shouldn't disappear out from under ourselves
// woah
self.reachabilityObject = self;
return YES;
}
else
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetDispatchQueue() failed: %s", SCErrorString(SCError()));
#endif
// UH OH - FAILURE - stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
}
}
else
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetCallback() failed: %s", SCErrorString(SCError()));
#endif
}
// if we get here we fail at the internet
self.reachabilityObject = nil;
return NO;
}
-(void)stopNotifier
{
// First stop, any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// Unregister target from the GCD serial dispatch queue.
SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, NULL);
self.reachabilityObject = nil;
}
#pragma mark - reachability tests
// This is for the case where you flick the airplane mode;
// you end up getting something like this:
//Reachability: WR ct-----
//Reachability: -- -------
//Reachability: WR ct-----
//Reachability: -- -------
// We treat this as 4 UNREACHABLE triggers - really apple should do better than this
#define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection)
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags
{
BOOL connectionUP = YES;
if(!(flags & kSCNetworkReachabilityFlagsReachable))
connectionUP = NO;
if( (flags & testcase) == testcase )
connectionUP = NO;
#if TARGET_OS_IPHONE
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
// We're on 3G.
if(!self.reachableOnWWAN)
{
// We don't want to connect when on 3G.
connectionUP = NO;
}
}
#endif
return connectionUP;
}
-(BOOL)isReachable
{
SCNetworkReachabilityFlags flags;
if(!SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
return NO;
return [self isReachableWithFlags:flags];
}
-(BOOL)isReachableViaWWAN
{
#if TARGET_OS_IPHONE
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
{
// Check we're REACHABLE
if(flags & kSCNetworkReachabilityFlagsReachable)
{
// Now, check we're on WWAN
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
return YES;
}
}
}
#endif
return NO;
}
-(BOOL)isReachableViaWiFi
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
{
// Check we're reachable
if((flags & kSCNetworkReachabilityFlagsReachable))
{
#if TARGET_OS_IPHONE
// Check we're NOT on WWAN
if((flags & kSCNetworkReachabilityFlagsIsWWAN))
{
return NO;
}
#endif
return YES;
}
}
return NO;
}
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired
{
return [self connectionRequired];
}
-(BOOL)connectionRequired
{
SCNetworkReachabilityFlags flags;
if(SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
{
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
}
return NO;
}
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand)));
}
return NO;
}
// Is user intervention required?
-(BOOL)isInterventionRequired
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & kSCNetworkReachabilityFlagsInterventionRequired));
}
return NO;
}
#pragma mark - reachability status stuff
-(NetworkStatus)currentReachabilityStatus
{
if([self isReachable])
{
if([self isReachableViaWiFi])
return ReachableViaWiFi;
#if TARGET_OS_IPHONE
return ReachableViaWWAN;
#endif
}
return NotReachable;
}
-(SCNetworkReachabilityFlags)reachabilityFlags
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
{
return flags;
}
return 0;
}
-(NSString*)currentReachabilityString
{
NetworkStatus temp = [self currentReachabilityStatus];
if(temp == ReachableViaWWAN)
{
// Updated for the fact that we have CDMA phones now!
return NSLocalizedString(@"Cellular", @"");
}
if (temp == ReachableViaWiFi)
{
return NSLocalizedString(@"WiFi", @"");
}
return NSLocalizedString(@"No Connection", @"");
}
-(NSString*)currentReachabilityFlags
{
return reachabilityFlags([self reachabilityFlags]);
}
#pragma mark - Callback function calls this method
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags
{
if([self isReachableWithFlags:flags])
{
if(self.reachableBlock)
{
self.reachableBlock(self);
}
}
else
{
if(self.unreachableBlock)
{
self.unreachableBlock(self);
}
}
// this makes sure the change notification happens on the MAIN THREAD
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification
object:self];
});
}
#pragma mark - Debug Description
- (NSString *) description
{
NSString *description = [NSString stringWithFormat:@"<%@: %#x (%@)>",
NSStringFromClass([self class]), (unsigned int) self, [self currentReachabilityFlags]];
return description;
}
@end
| {
"content_hash": "c5e2fb34faeb4f6acb9c996310f2d37d",
"timestamp": "",
"source": "github",
"line_count": 444,
"max_line_length": 135,
"avg_line_length": 26.36036036036036,
"alnum_prop": 0.6699419002050581,
"repo_name": "albertbori/Reachability",
"id": "0c36e7d13196cb1a428c1acc0e745ee02337c2f5",
"size": "13027",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "Reachability.m",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Objective-C",
"bytes": "31455"
},
{
"name": "Ruby",
"bytes": "2053"
}
],
"symlink_target": ""
} |
<?php /* Smarty version Smarty-3.1.7, created on 2016-09-06 15:55:50
compiled from "/home/bj/www/byjcrm/includes/runtime/../../layouts/vlayout/modules/Users/Login.tpl" */ ?>
<?php /*%%SmartyHeaderCode:141050139357cee7069c2a55-78099008%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
'file_dependency' =>
array (
'cbbd947a052f1edba0c1edf7e2423fdd102ca849' =>
array (
0 => '/home/bj/www/byjcrm/includes/runtime/../../layouts/vlayout/modules/Users/Login.tpl',
1 => 1468488064,
2 => 'file',
),
),
'nocache_hash' => '141050139357cee7069c2a55-78099008',
'function' =>
array (
),
'variables' =>
array (
'_CustomLoginTemplateFullPath' => 0,
'_CustomLoginTemplate' => 0,
'_DefaultLoginTemplate' => 0,
),
'has_nocache_code' => false,
'version' => 'Smarty-3.1.7',
'unifunc' => 'content_57cee7069f7b3',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_57cee7069f7b3')) {function content_57cee7069f7b3($_smarty_tpl) {?>
<?php $_smarty_tpl->tpl_vars["_DefaultLoginTemplate"] = new Smarty_variable(vtemplate_path('Login.Default.tpl','Users'), null, 0);?>
<?php $_smarty_tpl->tpl_vars["_CustomLoginTemplate"] = new Smarty_variable(vtemplate_path('Login.Custom.tpl','Users'), null, 0);?>
<?php $_smarty_tpl->tpl_vars["_CustomLoginTemplateFullPath"] = new Smarty_variable("layouts/vlayout/".($_smarty_tpl->tpl_vars['_CustomLoginTemplate']->value), null, 0);?>
<?php if (file_exists($_smarty_tpl->tpl_vars['_CustomLoginTemplateFullPath']->value)){?>
<?php echo $_smarty_tpl->getSubTemplate ($_smarty_tpl->tpl_vars['_CustomLoginTemplate']->value, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>
<?php }else{ ?>
<?php echo $_smarty_tpl->getSubTemplate ($_smarty_tpl->tpl_vars['_DefaultLoginTemplate']->value, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>
<?php }?><?php }} ?> | {
"content_hash": "caba35b3f60e48901c06653feb8b1a8d",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 174,
"avg_line_length": 50.2,
"alnum_prop": 0.6563745019920318,
"repo_name": "basiljose1/byjcrm",
"id": "adf3cec236d84c199934d097be2829b43f6b8483",
"size": "2008",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/templates_c/vlayout/cbbd947a052f1edba0c1edf7e2423fdd102ca849.file.Login.tpl.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "30817"
},
{
"name": "ApacheConf",
"bytes": "1321"
},
{
"name": "Batchfile",
"bytes": "20387"
},
{
"name": "C",
"bytes": "492107"
},
{
"name": "C++",
"bytes": "18023"
},
{
"name": "CSS",
"bytes": "1199491"
},
{
"name": "CoffeeScript",
"bytes": "1232"
},
{
"name": "Groff",
"bytes": "60690"
},
{
"name": "HTML",
"bytes": "1498811"
},
{
"name": "JavaScript",
"bytes": "4770826"
},
{
"name": "Makefile",
"bytes": "8221"
},
{
"name": "PHP",
"bytes": "39287363"
},
{
"name": "Perl",
"bytes": "50950"
},
{
"name": "Ruby",
"bytes": "1074"
},
{
"name": "Shell",
"bytes": "53700"
},
{
"name": "Smarty",
"bytes": "1908263"
},
{
"name": "XSLT",
"bytes": "27654"
},
{
"name": "Yacc",
"bytes": "14820"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?>
<LEOSimulation version="2.5.0">
<STELAVersion>2.5.1</STELAVersion>
<SpaceObject>
<mass unit="kg">3.0</mass>
<dragArea>0.045</dragArea>
<reflectingArea>0.18</reflectingArea>
<reflectivityCoefficient>1.5</reflectivityCoefficient>
<orbitType>LEO</orbitType>
<ConstantDragCoef>
<cstDragCoef>2.1</cstDragCoef>
</ConstantDragCoef>
<name>U6W09186</name>
</SpaceObject>
<EphemerisManager version="2.5.0">
<initState>
<bulletin version="2.5.0">
<date>2014-07-14T14:52:42.000</date>
<Type2PosVel>
<frame>CELESTIAL_MEAN_OF_DATE</frame>
<nature>MEAN</nature>
<semiMajorAxis unit="m">7000000.0</semiMajorAxis>
<eccentricity>0.001</eccentricity>
<inclination unit="rad">1.68424272817</inclination>
<rAAN unit="rad">0.0</rAAN>
<argOfPerigee unit="rad">0.0</argOfPerigee>
<meanAnomaly unit="rad">0.0</meanAnomaly>
</Type2PosVel>
</bulletin>
</initState>
<finalState/>
</EphemerisManager>
<author>CNES</author>
<comment>LEO example simulation</comment>
<simulationDuration unit="years">100.0</simulationDuration>
<ephemerisStep unit="s">86400.0</ephemerisStep>
<ttMinusUT1 unit="s">67.184</ttMinusUT1>
<srpSwitch>true</srpSwitch>
<sunSwitch>true</sunSwitch>
<moonSwitch>true</moonSwitch>
<warningFlag>false</warningFlag>
<iterativeMode>false</iterativeMode>
<modelType>GTO</modelType>
<atmosModel>NRLMSISE-00</atmosModel>
<VariableSolarActivity>
<solActType>VARIABLE</solActType>
</VariableSolarActivity>
<integrationStep unit="s">86400.0</integrationStep>
<dragSwitch>true</dragSwitch>
<dragQuadPoints>33</dragQuadPoints>
<atmosDragRecomputeStep>1</atmosDragRecomputeStep>
<srpQuadPoints>11</srpQuadPoints>
<reentryAltitude unit="m">120000.0</reentryAltitude>
<iterationData>
<funcValueAccuracy unit="days">10</funcValueAccuracy>
<expDuration unit="years">24.75</expDuration>
<simMinusExpDuration unit="years">75.25</simMinusExpDuration>
<iterationMethod>FrozenOrbit</iterationMethod>
</iterationData>
<nbIntegrationStepTesseral>5</nbIntegrationStepTesseral>
<zonalOrder>7</zonalOrder>
</LEOSimulation>
| {
"content_hash": "41be417ac005c847e9281727feab8472",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 65,
"avg_line_length": 36.354838709677416,
"alnum_prop": 0.6987577639751553,
"repo_name": "pouyana/satgen",
"id": "c72969a906d9c25f8dd005339fb8f76cf61d3f0b",
"size": "2254",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sim/U6W09186_a_sim.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "552816"
},
{
"name": "Matlab",
"bytes": "1015"
},
{
"name": "Python",
"bytes": "227028"
}
],
"symlink_target": ""
} |
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
config.filter_run :focus
config.run_all_when_everything_filtered = true
# Limits the available syntax to the non-monkey patched syntax that is recommended.
# For more details, see:
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
config.disable_monkey_patching!
# This setting enables warnings. It's recommended, but in some cases may
# be too noisy due to issues in dependencies.
config.warnings = true
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = 'doc'
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
end
require 'ostruct'
require File.expand_path(File.dirname(__FILE__) + '/../lib/dciablo')
require File.expand_path(File.dirname(__FILE__) + '/../examples/money_transfer')
| {
"content_hash": "9a63fb93d8c80f9d208535be3f1d50cd",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 129,
"avg_line_length": 44.506493506493506,
"alnum_prop": 0.7245404143565801,
"repo_name": "alexei-lexx/dciablo",
"id": "4ef194c693927f7ed31533b34f853a6a5e890283",
"size": "4394",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/spec_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "7859"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Id: OBSERVATION_CONTROL.xml,v 1.1 2010/04/26 16:18:57 utfsm Exp $
$Source: /diskb/tmp/stefano/project2/CVS/ACS/LGPL/CommonSoftware/acsGUIs/alarmsDefGUI/test/CDB/Alarms/AlarmDefinitions/OBSERVATION_CONTROL/OBSERVATION_CONTROL.xml,v $
-->
<fault-family name="OBSERVATION_CONTROL"
xmlns="urn:schemas-cosylab-com:acsalarm-fault-family:1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<alarm-source>ALARM_SYSTEM_SOURCES</alarm-source>
<help-url>http://tempuri.org</help-url>
<contact name="ALMA-B Correlator Team"/>
<fault-code value="1">
<priority>3</priority>
<cause>Delay event was received after its start time.</cause>
<action>NOT DEFINED</action>
<consequence>NOT DEFINED</consequence>
<problem-description>Delay event was received after its start time.</problem-description>
</fault-code>
<fault-code value="2">
<priority>3</priority>
<cause>No antenna delay events in delay event.</cause>
<action>NOT DEFINED</action>
<consequence>NOT DEFINED</consequence>
<problem-description>No antenna delay events in delay event.</problem-description>
</fault-code>
<fault-code value="3">
<priority>3</priority>
<cause>Subarray has not been created,</cause>
<action>NOT DEFINED</action>
<consequence>NOT DEFINED</consequence>
<problem-description>Subarray has not been created,</problem-description>
</fault-code>
<fault-code value="4">
<priority>3</priority>
<cause>Delay event notifcation channel used by CDP Master is not available.</cause>
<action>NOT DEFINED</action>
<consequence>NOT DEFINED</consequence>
<problem-description>Delay event notifcation channel used by CDP Master is not available.</problem-description>
</fault-code>
<fault-code value="5">
<priority>3</priority>
<cause>Antenna in event does not have an associated CAI.</cause>
<action>NOT DEFINED</action>
<consequence>NOT DEFINED</consequence>
<problem-description>Antenna in event does not have an associated CAI.</problem-description>
</fault-code>
<fault-code value="6">
<priority>3</priority>
<cause>Just a test</cause>
<action>NOT DEFINED</action>
<consequence>NOT DEFINED</consequence>
<problem-description>Just a test</problem-description>
</fault-code>
<fault-member-default> </fault-member-default>
<fault-member name="DELAY_EVENTS"> </fault-member>
</fault-family>
| {
"content_hash": "8c11d39a6ff92cbc3f203753e4d9f501",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 166,
"avg_line_length": 46.642857142857146,
"alnum_prop": 0.6749617151607963,
"repo_name": "csrg-utfsm/acscb",
"id": "0064f23a53150067803c01db68b59c82fb409d71",
"size": "2612",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "LGPL/CommonSoftware/acsGUIs/alarmsDefGUI/test/CDB/Alarms/AlarmDefinitions/OBSERVATION_CONTROL/OBSERVATION_CONTROL.xml",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Awk",
"bytes": "633"
},
{
"name": "Batchfile",
"bytes": "2346"
},
{
"name": "C",
"bytes": "751150"
},
{
"name": "C++",
"bytes": "7892598"
},
{
"name": "CSS",
"bytes": "21364"
},
{
"name": "Elixir",
"bytes": "906"
},
{
"name": "Emacs Lisp",
"bytes": "1990066"
},
{
"name": "FreeMarker",
"bytes": "7369"
},
{
"name": "GAP",
"bytes": "14867"
},
{
"name": "Gnuplot",
"bytes": "437"
},
{
"name": "HTML",
"bytes": "1857062"
},
{
"name": "Haskell",
"bytes": "764"
},
{
"name": "Java",
"bytes": "13573740"
},
{
"name": "JavaScript",
"bytes": "19058"
},
{
"name": "Lex",
"bytes": "5101"
},
{
"name": "Makefile",
"bytes": "1624406"
},
{
"name": "Module Management System",
"bytes": "4925"
},
{
"name": "Objective-C",
"bytes": "3223"
},
{
"name": "PLSQL",
"bytes": "9496"
},
{
"name": "Perl",
"bytes": "120411"
},
{
"name": "Python",
"bytes": "4191000"
},
{
"name": "Roff",
"bytes": "9920"
},
{
"name": "Shell",
"bytes": "1198375"
},
{
"name": "Smarty",
"bytes": "21615"
},
{
"name": "Tcl",
"bytes": "227078"
},
{
"name": "XSLT",
"bytes": "100454"
},
{
"name": "Yacc",
"bytes": "5006"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="3c8bfbe1-e895-4151-a725-2e419ac66e55" name="Default" comment="" />
<ignored path="play-rest-api.iws" />
<ignored path=".idea/workspace.xml" />
<ignored path="$PROJECT_DIR$/target/native_libraries/" />
<ignored path="$PROJECT_DIR$/target/resolution-cache/" />
<ignored path="$PROJECT_DIR$/target/streams/" />
<ignored path="$PROJECT_DIR$/target/web/" />
<ignored path="$PROJECT_DIR$/docs/target/" />
<ignored path="$PROJECT_DIR$/project/project/target/" />
<ignored path="$PROJECT_DIR$/project/target/" />
<ignored path="$PROJECT_DIR$/docs/project/project/target/" />
<ignored path="$PROJECT_DIR$/docs/project/target/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExternalProjectsData">
<projectState path="$PROJECT_DIR$">
<ProjectState />
</projectState>
</component>
<component name="FavoritesManager">
<favorites_list name="play-rest-api" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="index.scala.html" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/views/index.scala.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="19" column="8" lean-forward="false" selection-start-line="19" selection-start-column="8" selection-end-line="19" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="application.conf" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/conf/application.conf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="routes" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/conf/routes">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="21" lean-forward="false" selection-start-line="5" selection-start-column="21" selection-end-line="5" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="robots.txt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/public/robots.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="RequestHandler.scala" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/RequestHandler.scala">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="27" column="7" lean-forward="false" selection-start-line="27" selection-start-column="7" selection-end-line="27" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="sbt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="README.md" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="LICENSE" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="build.sbt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/build.sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="3" lean-forward="false" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
<folding>
<marker date="1497384105000" expanded="true" signature="715:732" ph="(...)" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="GradleLocalSettings">
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/public/index.html" />
<option value="$PROJECT_DIR$/conf/routes" />
<option value="$PROJECT_DIR$/app/views/index.scala.html" />
</list>
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="y" value="23" />
<option name="width" value="1280" />
<option name="height" value="773" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane" />
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="AndroidView" />
<pane id="Scratches" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="GoToClass.includeLibraries" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="MemberChooser.sorted" value="false" />
<property name="MemberChooser.showClasses" value="true" />
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="options.lastSelected" value="preferences.pluginManager" />
<property name="options.splitter.main.proportions" value="0.3" />
<property name="options.splitter.details.proportions" value="0.2" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration default="true" type="Applet" factoryName="Applet">
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<module />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="recording" autostart="false" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="recording" autostart="true" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
</configuration>
<configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="recording" autostart="false" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="root" />
<envs />
</configuration>
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<predefined_log_file id="idea.log" enabled="true" />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="recording" autostart="true" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
</configuration>
<configuration default="true" type="AndroidRunConfigurationType" factoryName="Android Application">
<module name="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="MODE" value="default_activity" />
<option name="DEPLOY" value="true" />
<option name="ARTIFACT_NAME" value="" />
<option name="TARGET_SELECTION_MODE" value="EMULATOR" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<option name="USE_COMMAND_LINE" value="true" />
<option name="COMMAND_LINE" value="" />
<option name="WIPE_USER_DATA" value="false" />
<option name="DISABLE_BOOT_ANIMATION" value="false" />
<option name="NETWORK_SPEED" value="full" />
<option name="NETWORK_LATENCY" value="none" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="FILTER_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="0" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="SELECTED_CLOUD_DEVICE_CONFIGURATION_ID" value="0" />
<option name="SELECTED_CLOUD_DEVICE_PROJECT_ID" value="" />
<option name="IS_VALID_CLOUD_MATRIX_SELECTION" value="false" />
<option name="INVALID_CLOUD_MATRIX_SELECTION_ERROR" value="" />
<option name="IS_VALID_CLOUD_DEVICE_SELECTION" value="false" />
<option name="INVALID_CLOUD_DEVICE_SELECTION_ERROR" value="" />
<option name="CLOUD_DEVICE_SERIAL_NUMBER" value="" />
<method />
</configuration>
<configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
<module name="" />
<option name="TESTING_TYPE" value="0" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="METHOD_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="EXTRA_OPTIONS" value="" />
<option name="TARGET_SELECTION_MODE" value="EMULATOR" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="DEBUGGER_TYPE" value="Java" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<Java />
<Profilers>
<option name="ENABLE_ADVANCED_PROFILING" value="true" />
<option name="GAPID_ENABLED" value="false" />
<option name="GAPID_DISABLE_PCS" value="false" />
<option name="SUPPORT_LIB_ENABLED" value="true" />
<option name="INSTRUMENTATION_ENABLED" value="true" />
</Profilers>
<method />
</configuration>
<configuration default="true" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list />
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<method />
</configuration>
<configuration default="true" type="JarApplication" factoryName="JAR Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="recording" autostart="false" />
<envs />
<method />
</configuration>
<configuration default="true" type="Java Scratch" factoryName="Java Scratch">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="recording" autostart="false" />
<option name="SCRATCH_FILE_ID" value="0" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType" factoryName="Kotlin script">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="recording" autostart="false" />
<option name="filePath" />
<option name="vmParameters" />
<option name="alternativeJrePath" />
<option name="programParameters" />
<option name="passParentEnvs" value="true" />
<option name="workingDirectory" />
<option name="isAlternativeJrePathEnabled" value="false" />
<envs />
<method />
</configuration>
<configuration default="true" type="ScalaTestRunConfiguration" factoryName="ScalaTest">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="recording" autostart="false" />
<module name="" />
<setting name="path" value="" />
<setting name="package" value="" />
<setting name="vmparams" value="" />
<setting name="params" value="" />
<setting name="workingDirectory" value="" />
<setting name="searchForTest" value="Across module dependencies" />
<setting name="testName" value="" />
<setting name="testKind" value="Class" />
<setting name="showProgressMessages" value="true" />
<setting name="useSbt" value="false" />
<setting name="useUiWithSbt" value="false" />
<classRegexps />
<testRegexps />
<envs />
<method />
</configuration>
<configuration default="true" type="Specs2RunConfiguration" factoryName="Specs2">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="recording" autostart="false" />
<module name="" />
<setting name="path" value="" />
<setting name="package" value="" />
<setting name="vmparams" value="" />
<setting name="params" value="" />
<setting name="workingDirectory" value="" />
<setting name="searchForTest" value="Across module dependencies" />
<setting name="testName" value="" />
<setting name="testKind" value="Class" />
<setting name="showProgressMessages" value="true" />
<setting name="useSbt" value="false" />
<setting name="useUiWithSbt" value="false" />
<classRegexps />
<testRegexps />
<envs />
<method />
</configuration>
<configuration default="true" type="uTestRunConfiguration" factoryName="utest">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="recording" autostart="false" />
<module name="" />
<setting name="path" value="" />
<setting name="package" value="" />
<setting name="vmparams" value="" />
<setting name="params" value="" />
<setting name="workingDirectory" value="" />
<setting name="searchForTest" value="Across module dependencies" />
<setting name="testName" value="" />
<setting name="testKind" value="Class" />
<setting name="showProgressMessages" value="true" />
<setting name="useSbt" value="false" />
<setting name="useUiWithSbt" value="false" />
<classRegexps />
<testRegexps />
<envs />
<method />
</configuration>
</component>
<component name="SbtLocalSettings">
<option name="lastUpdateTimestamp" value="1494353168080" />
<option name="availableProjects">
<map>
<entry>
<key>
<ExternalProjectPojo>
<option name="name" value="play-rest-api" />
<option name="path" value="$PROJECT_DIR$" />
</ExternalProjectPojo>
</key>
<value>
<list>
<ExternalProjectPojo>
<option name="name" value="root" />
<option name="path" value="$PROJECT_DIR$" />
</ExternalProjectPojo>
<ExternalProjectPojo>
<option name="name" value="docs" />
<option name="path" value="$PROJECT_DIR$/docs" />
</ExternalProjectPojo>
<ExternalProjectPojo>
<option name="name" value="root-build" />
<option name="path" value="$PROJECT_DIR$/project" />
</ExternalProjectPojo>
<ExternalProjectPojo>
<option name="name" value="docs-build" />
<option name="path" value="$PROJECT_DIR$/docs/project" />
</ExternalProjectPojo>
</list>
</value>
</entry>
</map>
</option>
<option name="modificationStamps">
<map>
<entry key="$PROJECT_DIR$/../../TRECify" value="1433856885000" />
</map>
</option>
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="3c8bfbe1-e895-4151-a725-2e419ac66e55" name="Default" comment="" />
<created>1494353055987</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1494353055987</updated>
<workItem from="1497381985317" duration="2898000" />
<workItem from="1497387691465" duration="871000" />
<workItem from="1502178521729" duration="1072000" />
<workItem from="1502183114721" duration="136000" />
<workItem from="1502183367137" duration="311000" />
<workItem from="1502183726313" duration="573000" />
<workItem from="1502429891347" duration="547000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="6408000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1280" height="773" extended-state="6" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="SBT" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.171875" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Palette	" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33636364" sideWeight="0.5" order="9" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39636913" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="13" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.134375" sideWeight="0.49916527" order="0" side_tool="false" content_ui="tabs" />
<window_info id="sbt-shell-toolwindow" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="14" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5008347" order="3" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39788198" sideWeight="0.6375" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
<window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="SBT Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.30711043" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="3" lean-forward="false" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
<folding>
<marker date="1497384105000" expanded="true" signature="715:732" ph="(...)" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/index.scala.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="14" column="53" lean-forward="true" selection-start-line="14" selection-start-column="53" selection-end-line="14" selection-end-column="53" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/conf/application.conf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/conf/routes">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="21" lean-forward="false" selection-start-line="5" selection-start-column="21" selection-end-line="5" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/robots.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/RequestHandler.scala">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="405">
<caret line="27" column="7" lean-forward="false" selection-start-line="27" selection-start-column="7" selection-end-line="27" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="3" lean-forward="false" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
<folding>
<marker date="1497384105000" expanded="true" signature="715:732" ph="(...)" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/index.scala.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="420">
<caret line="28" column="7" lean-forward="false" selection-start-line="28" selection-start-column="7" selection-end-line="28" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/conf/application.conf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/robots.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/RequestHandler.scala">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="405">
<caret line="27" column="7" lean-forward="false" selection-start-line="27" selection-start-column="7" selection-end-line="27" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="3" lean-forward="false" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
<folding>
<marker date="1497384105000" expanded="true" signature="715:732" ph="(...)" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/conf/routes">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="56" lean-forward="false" selection-start-line="5" selection-start-column="56" selection-end-line="5" selection-end-column="56" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/index.scala.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="420">
<caret line="28" column="7" lean-forward="false" selection-start-line="28" selection-start-column="7" selection-end-line="28" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/robots.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/RequestHandler.scala">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="27" column="7" lean-forward="false" selection-start-line="27" selection-start-column="7" selection-end-line="27" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="3" lean-forward="false" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
<folding>
<marker date="1497384105000" expanded="true" signature="715:732" ph="(...)" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/conf/application.conf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="0" lean-forward="true" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/HomeController.scala">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="6" lean-forward="false" selection-start-line="7" selection-start-column="6" selection-end-line="7" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/conf/routes">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="6" column="0" lean-forward="false" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/robots.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="390">
<caret line="26" column="0" lean-forward="false" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/RequestHandler.scala">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="27" column="7" lean-forward="false" selection-start-line="27" selection-start-column="7" selection-end-line="27" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="25" column="37" lean-forward="false" selection-start-line="25" selection-start-column="37" selection-end-line="25" selection-end-column="37" />
<folding>
<marker date="1497384105000" expanded="true" signature="715:732" ph="(...)" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/index.scala.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="14" column="0" lean-forward="false" selection-start-line="14" selection-start-column="0" selection-end-line="14" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/HomeController.scala">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="6" lean-forward="false" selection-start-line="7" selection-start-column="6" selection-end-line="7" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/RequestHandler.scala">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="27" column="7" lean-forward="false" selection-start-line="27" selection-start-column="7" selection-end-line="27" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="50" column="49" lean-forward="false" selection-start-line="50" selection-start-column="48" selection-end-line="50" selection-end-column="49" />
<folding />
</state>
</provider>
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="3" lean-forward="false" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
<folding>
<marker date="1497384105000" expanded="true" signature="715:732" ph="(...)" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="25" column="7" lean-forward="true" selection-start-line="25" selection-start-column="7" selection-end-line="25" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/robots.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="9" lean-forward="false" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/conf/routes">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="21" lean-forward="false" selection-start-line="5" selection-start-column="21" selection-end-line="5" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/index.scala.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="19" column="8" lean-forward="false" selection-start-line="19" selection-start-column="8" selection-end-line="19" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/conf/application.conf">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/sbt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</component>
</project> | {
"content_hash": "39c5405e5203ffd9a8d22a9d43bf7a82",
"timestamp": "",
"source": "github",
"line_count": 1042,
"max_line_length": 253,
"avg_line_length": 53.51343570057582,
"alnum_prop": 0.6269973637488567,
"repo_name": "aldolipani/VisualPool",
"id": "994eacff2172e3e0c330dc12c37897d703550067",
"size": "55761",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "backend/.idea/workspace.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1373"
},
{
"name": "CSS",
"bytes": "179541"
},
{
"name": "HTML",
"bytes": "32195"
},
{
"name": "Java",
"bytes": "833"
},
{
"name": "JavaScript",
"bytes": "5300458"
},
{
"name": "Scala",
"bytes": "28402"
},
{
"name": "Shell",
"bytes": "11894"
},
{
"name": "XSLT",
"bytes": "62979"
}
],
"symlink_target": ""
} |
package org.meteogroup.jbrotli.servlet;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.net.HttpURLConnection;
import java.net.URL;
import static java.lang.Integer.parseInt;
import static org.assertj.core.api.Assertions.assertThat;
import static org.meteogroup.jbrotli.servlet.BrotliServletFilter.BROTLI_HTTP_CONTENT_CODING;
public class BrotliServletFilterIntegrationTest extends AbstractWebAppIntegrationTest {
private String root_url;
@BeforeMethod
public void setUp() throws Exception {
root_url = "http://" + getServerIpAddress() + ":" + getServerPort();
}
@Test
public void brotli_content_encoding_is_set() throws Exception {
// given
URL textFileUrl = new URL(root_url + "/canterbury-corpus/alice29.txt");
// when
HttpURLConnection httpCon = (HttpURLConnection) textFileUrl.openConnection();
httpCon.addRequestProperty("Accept-Encoding", BROTLI_HTTP_CONTENT_CODING);
httpCon.connect();
String contentEncoding = httpCon.getHeaderField("Content-Encoding");
httpCon.disconnect();
// then
assertThat(contentEncoding).isEqualTo(BROTLI_HTTP_CONTENT_CODING);
}
@Test
public void content_length_is_NOT_set__OR_is_zero() throws Exception {
// given
URL textFileUrl = new URL(root_url + "/canterbury-corpus/alice29.txt");
// when
HttpURLConnection httpCon = (HttpURLConnection) textFileUrl.openConnection();
httpCon.addRequestProperty("Accept-Encoding", BROTLI_HTTP_CONTENT_CODING);
httpCon.connect();
String contentEncoding = httpCon.getHeaderField("Content-Length");
// then
if (contentEncoding != null) {
assertThat(parseInt(contentEncoding)).isEqualTo(0);
}
// contentEncoding==null is OK
}
}
| {
"content_hash": "b03916dbce4cc19f3672664f2201b04e",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 92,
"avg_line_length": 30.46551724137931,
"alnum_prop": 0.7357102433503112,
"repo_name": "MeteoGroup/jbrotli",
"id": "0a2018a7669fe9475a7f90b405de7f8cffe56547",
"size": "2390",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jbrotli-examples/simple-web-app/src/test/java/org/meteogroup/jbrotli/servlet/BrotliServletFilterIntegrationTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2182"
},
{
"name": "C",
"bytes": "34247"
},
{
"name": "C++",
"bytes": "36348"
},
{
"name": "CMake",
"bytes": "1864"
},
{
"name": "Common Lisp",
"bytes": "11163"
},
{
"name": "HTML",
"bytes": "160359"
},
{
"name": "Java",
"bytes": "201040"
},
{
"name": "Roff",
"bytes": "12681"
},
{
"name": "Shell",
"bytes": "2456"
}
],
"symlink_target": ""
} |
using FrannHammer.Domain.Contracts;
using static FrannHammer.Domain.FriendlyNameCommonConstants;
using static FrannHammer.Domain.FriendlyNameMoveCommonConstants;
namespace FrannHammer.Domain
{
public class UniqueData : BaseModel, IUniqueData
{
[FriendlyName(OwnerIdName)]
public int OwnerId { get; set; }
[FriendlyName(OwnerName)]
public string Owner { get; set; }
}
}
| {
"content_hash": "424c6e68556858007695e96951afc086",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 64,
"avg_line_length": 27.733333333333334,
"alnum_prop": 0.7235576923076923,
"repo_name": "Frannsoft/FrannHammer",
"id": "6f5774d4b9004cf2302b7bde8f72352de588803f",
"size": "418",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Implementation/FrannHammer.Domain/UniqueData.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "374"
},
{
"name": "C#",
"bytes": "525564"
},
{
"name": "Gherkin",
"bytes": "8476"
}
],
"symlink_target": ""
} |
<html>
<head>
<title>User agent detail - Mozilla/5.0 (Linux; Android 4.0.4; ST26a Build/11.0.A.3.13) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="section">
<h1 class="header center orange-text">User agent detail</h1>
<div class="row center">
<h5 class="header light">
Mozilla/5.0 (Linux; Android 4.0.4; ST26a Build/11.0.A.3.13) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19
</h5>
</div>
</div>
<div class="section">
<table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Source result (test suite)</th></tr><tr><td>ua-parser/uap-core<br /><small>vendor/thadafinser/uap-core/tests/test_device.yaml</small></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">SonyEricsson</td><td>ST26a</td><td></td><td></td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-test">Detail</a>
<!-- Modal Structure -->
<div id="modal-test" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Testsuite result detail</h4>
<p><pre><code class="php">Array
(
[user_agent_string] => Mozilla/5.0 (Linux; Android 4.0.4; ST26a Build/11.0.A.3.13) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19
[family] => ST26a
[brand] => SonyEricsson
[model] => ST26a
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapPhp<br /><small>6012</small></td><td>Chrome 18.0</td><td>WebKit </td><td>Android 4.0</td><td style="border-left: 1px solid #555"></td><td></td><td>Mobile Phone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.047</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-215ac98d-ccf8-4615-916e-5a819d6a59c9">Detail</a>
<!-- Modal Structure -->
<div id="modal-215ac98d-ccf8-4615-916e-5a819d6a59c9" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>BrowscapPhp result detail</h4>
<p><pre><code class="php">stdClass Object
(
[browser_name_regex] => /^mozilla\/5\.0 \(.*linux.*android.4\.0.*\) applewebkit\/.* \(khtml, like gecko\) chrome\/18\..*safari\/.*$/
[browser_name_pattern] => mozilla/5.0 (*linux*android?4.0*) applewebkit/* (khtml, like gecko) chrome/18.*safari/*
[parent] => Chrome 18.0 for Android
[comment] => Chrome 18.0
[browser] => Chrome
[browser_type] => Browser
[browser_bits] => 32
[browser_maker] => Google Inc
[browser_modus] => unknown
[version] => 18.0
[majorver] => 18
[minorver] => 0
[platform] => Android
[platform_version] => 4.0
[platform_description] => Android OS
[platform_bits] => 32
[platform_maker] => Google Inc
[alpha] =>
[beta] =>
[win16] =>
[win32] =>
[win64] =>
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[javascript] => 1
[vbscript] =>
[javaapplets] =>
[activexcontrols] =>
[ismobiledevice] => 1
[istablet] =>
[issyndicationreader] =>
[crawler] =>
[cssversion] => 3
[aolversion] => 0
[device_name] => general Mobile Phone
[device_maker] => unknown
[device_type] => Mobile Phone
[device_pointing_method] => touchscreen
[device_code_name] => general Mobile Phone
[device_brand_name] => unknown
[renderingengine_name] => WebKit
[renderingengine_version] => unknown
[renderingengine_description] => For Google Chrome, iOS (including both mobile Safari, WebViews within third-party apps, and web clips), Safari, Arora, Midori, OmniWeb, Shiira, iCab since version 4, Web, SRWare Iron, Rekonq, and in Maxthon 3.
[renderingengine_maker] => Apple Inc
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>DonatjUAParser<br /><small>v0.5.0</small></td><td>Chrome 18.0.1025.166</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661">Detail</a>
<!-- Modal Structure -->
<div id="modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>DonatjUAParser result detail</h4>
<p><pre><code class="php">Array
(
[platform] => Android
[browser] => Chrome
[version] => 18.0.1025.166
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>NeutrinoApiCom<br /><small></small></td><td>Chrome Mobile 18.0.1025.166</td><td><i class="material-icons">close</i></td><td>Android 4.0.4</td><td style="border-left: 1px solid #555">Sony</td><td>ST26a</td><td>mobile-browser</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.30203</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc">Detail</a>
<!-- Modal Structure -->
<div id="modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>NeutrinoApiCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[mobile_screen_height] => 854
[is_mobile] => 1
[type] => mobile-browser
[mobile_brand] => Sony
[mobile_model] => ST26a
[version] => 18.0.1025.166
[is_android] => 1
[browser_name] => Chrome Mobile
[operating_system_family] => Android
[operating_system_version] => 4.0.4
[is_ios] =>
[producer] => Google Inc.
[operating_system] => Android 4.0.x Ice Cream Sandwich
[mobile_screen_width] => 480
[mobile_browser] => Android Webkit
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>PiwikDeviceDetector<br /><small>3.5.2</small></td><td>Chrome Mobile 18.0</td><td>WebKit </td><td>Android 4.0</td><td style="border-left: 1px solid #555">Sony</td><td>Xperia J</td><td>smartphone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.004</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-21638055-738d-46ba-a1b1-f5114bc26475">Detail</a>
<!-- Modal Structure -->
<div id="modal-21638055-738d-46ba-a1b1-f5114bc26475" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>PiwikDeviceDetector result detail</h4>
<p><pre><code class="php">Array
(
[client] => Array
(
[type] => browser
[name] => Chrome Mobile
[short_name] => CM
[version] => 18.0
[engine] => WebKit
)
[operatingSystem] => Array
(
[name] => Android
[short_name] => AND
[version] => 4.0
[platform] =>
)
[device] => Array
(
[brand] => SO
[brandName] => Sony
[model] => Xperia J
[device] => 1
[deviceName] => smartphone
)
[bot] =>
[extra] => Array
(
[isBot] =>
[isBrowser] => 1
[isFeedReader] =>
[isMobileApp] =>
[isPIM] =>
[isLibrary] =>
[isMediaPlayer] =>
[isCamera] =>
[isCarBrowser] =>
[isConsole] =>
[isFeaturePhone] =>
[isPhablet] =>
[isPortableMediaPlayer] =>
[isSmartDisplay] =>
[isSmartphone] => 1
[isTablet] =>
[isTV] =>
[isDesktop] =>
[isMobile] => 1
[isTouchEnabled] =>
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.0</small></td><td>Chrome 18.0.1025.166</td><td><i class="material-icons">close</i></td><td>Android 4.0.4</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c">Detail</a>
<!-- Modal Structure -->
<div id="modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>SinergiBrowserDetector result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Sinergi\BrowserDetector\Browser Object
(
[userAgent:Sinergi\BrowserDetector\Browser:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 4.0.4; ST26a Build/11.0.A.3.13) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19
)
[name:Sinergi\BrowserDetector\Browser:private] => Chrome
[version:Sinergi\BrowserDetector\Browser:private] => 18.0.1025.166
[isRobot:Sinergi\BrowserDetector\Browser:private] =>
[isChromeFrame:Sinergi\BrowserDetector\Browser:private] =>
)
[operatingSystem] => Sinergi\BrowserDetector\Os Object
(
[name:Sinergi\BrowserDetector\Os:private] => Android
[version:Sinergi\BrowserDetector\Os:private] => 4.0.4
[isMobile:Sinergi\BrowserDetector\Os:private] => 1
[userAgent:Sinergi\BrowserDetector\Os:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 4.0.4; ST26a Build/11.0.A.3.13) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19
)
)
[device] => Sinergi\BrowserDetector\Device Object
(
[name:Sinergi\BrowserDetector\Device:private] => unknown
[userAgent:Sinergi\BrowserDetector\Device:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 4.0.4; ST26a Build/11.0.A.3.13) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19
)
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UAParser<br /><small>v3.4.5</small></td><td>Chrome Mobile 18.0.1025</td><td><i class="material-icons">close</i></td><td>Android 4.0.4</td><td style="border-left: 1px solid #555">SonyEricsson</td><td>ST26a</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.001</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b">Detail</a>
<!-- Modal Structure -->
<div id="modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UAParser result detail</h4>
<p><pre><code class="php">UAParser\Result\Client Object
(
[ua] => UAParser\Result\UserAgent Object
(
[major] => 18
[minor] => 0
[patch] => 1025
[family] => Chrome Mobile
)
[os] => UAParser\Result\OperatingSystem Object
(
[major] => 4
[minor] => 0
[patch] => 4
[patchMinor] =>
[family] => Android
)
[device] => UAParser\Result\Device Object
(
[brand] => SonyEricsson
[model] => ST26a
[family] => ST26a
)
[originalUserAgent] => Mozilla/5.0 (Linux; Android 4.0.4; ST26a Build/11.0.A.3.13) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UserAgentStringCom<br /><small></small></td><td>Android Webkit Browser </td><td><i class="material-icons">close</i></td><td>Android 4.0.4</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.04901</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9cdd8b45-a2eb-406b-bd27-7e48af38ffd4">Detail</a>
<!-- Modal Structure -->
<div id="modal-9cdd8b45-a2eb-406b-bd27-7e48af38ffd4" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UserAgentStringCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[agent_type] => Browser
[agent_name] => Android Webkit Browser
[agent_version] => --
[os_type] => Android
[os_name] => Android
[os_versionName] =>
[os_versionNumber] => 4.0.4
[os_producer] =>
[os_producerURL] =>
[linux_distibution] => Null
[agent_language] =>
[agent_languageTag] =>
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhatIsMyBrowserCom<br /><small></small></td><td>Chrome 18.0.1025.166</td><td>WebKit 535.19</td><td>Android 4.0.4</td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.41704</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9795f66f-7271-430e-973a-a5c0e14dc35a">Detail</a>
<!-- Modal Structure -->
<div id="modal-9795f66f-7271-430e-973a-a5c0e14dc35a" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhatIsMyBrowserCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[operating_system_name] => Android
[simple_sub_description_string] =>
[simple_browser_string] => Chrome 18 on Android (Ice Cream Sandwich)
[browser_version] => 18
[extra_info] => Array
(
)
[operating_platform] =>
[extra_info_table] => stdClass Object
(
[System Build] => 11
)
[layout_engine_name] => WebKit
[detected_addons] => Array
(
)
[operating_system_flavour_code] =>
[hardware_architecture] =>
[operating_system_flavour] =>
[operating_system_frameworks] => Array
(
)
[browser_name_code] => chrome
[operating_system_version] => Ice Cream Sandwich
[simple_operating_platform_string] =>
[is_abusive] =>
[layout_engine_version] => 535.19
[browser_capabilities] => Array
(
)
[operating_platform_vendor_name] =>
[operating_system] => Android (Ice Cream Sandwich)
[operating_system_version_full] => 4.0.4
[operating_platform_code] =>
[browser_name] => Chrome
[operating_system_name_code] => android
[user_agent] => Mozilla/5.0 (Linux; Android 4.0.4; ST26a Build/11.0.A.3.13) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19
[browser_version_full] => 18.0.1025.166
[browser] => Chrome 18
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhichBrowser<br /><small>2.0.10</small></td><td>Chrome 18</td><td>Webkit 535.19</td><td>Android 4.0.4</td><td style="border-left: 1px solid #555">Sony</td><td>Xperia J</td><td>mobile:smart</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.028</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4">Detail</a>
<!-- Modal Structure -->
<div id="modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhichBrowser result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Array
(
[name] => Chrome
[version] => 18
[type] => browser
)
[engine] => Array
(
[name] => Webkit
[version] => 535.19
)
[os] => Array
(
[name] => Android
[version] => 4.0.4
)
[device] => Array
(
[type] => mobile
[subtype] => smart
[manufacturer] => Sony
[model] => Xperia J
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Woothee<br /><small>v1.2.0</small></td><td>Chrome 18.0.1025.166</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>smartphone</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-3f285ff5-314b-4db4-9948-54572e92e7b6">Detail</a>
<!-- Modal Structure -->
<div id="modal-3f285ff5-314b-4db4-9948-54572e92e7b6" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Woothee result detail</h4>
<p><pre><code class="php">Array
(
[name] => Chrome
[vendor] => Google
[version] => 18.0.1025.166
[category] => smartphone
[os] => Android
[os_version] => 4.0.4
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Wurfl<br /><small>1.6.4</small></td><td>Android Webkit 4.0</td><td><i class="material-icons">close</i></td><td>Android 4.0</td><td style="border-left: 1px solid #555">Sony</td><td>ST26a</td><td>Smartphone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.091</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-1a1aee36-7ce7-4111-a391-8e2c501f1532">Detail</a>
<!-- Modal Structure -->
<div id="modal-1a1aee36-7ce7-4111-a391-8e2c501f1532" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Wurfl result detail</h4>
<p><pre><code class="php">Array
(
[virtual] => Array
(
[is_android] => true
[is_ios] => false
[is_windows_phone] => false
[is_app] => false
[is_full_desktop] => false
[is_largescreen] => true
[is_mobile] => true
[is_robot] => false
[is_smartphone] => true
[is_touchscreen] => true
[is_wml_preferred] => false
[is_xhtmlmp_preferred] => false
[is_html_preferred] => true
[advertised_device_os] => Android
[advertised_device_os_version] => 4.0
[advertised_browser] => Android Webkit
[advertised_browser_version] => 4.0
[complete_device_name] => Sony ST26a (Xperia J)
[form_factor] => Smartphone
[is_phone] => true
[is_app_webview] => false
)
[all] => Array
(
[brand_name] => Sony
[model_name] => ST26a
[unique] => true
[ununiqueness_handler] =>
[is_wireless_device] => true
[device_claims_web_support] => true
[has_qwerty_keyboard] => true
[can_skip_aligned_link_row] => true
[uaprof] => http://uaprof.sonymobile.com/ST26aR402.xml
[uaprof2] => http://uaprof.sonymobile.com/ST26iR402.xml
[uaprof3] =>
[nokia_series] => 0
[nokia_edition] => 0
[device_os] => Android
[mobile_browser] => Android Webkit
[mobile_browser_version] =>
[device_os_version] => 4.0
[pointing_method] => touchscreen
[release_date] => 2012_july
[marketing_name] => Xperia J
[model_extra_info] =>
[nokia_feature_pack] => 0
[can_assign_phone_number] => true
[is_tablet] => false
[manufacturer_name] =>
[is_bot] => false
[is_google_glass] => false
[proportional_font] => false
[built_in_back_button_support] => false
[card_title_support] => true
[softkey_support] => false
[table_support] => true
[numbered_menus] => false
[menu_with_select_element_recommended] => false
[menu_with_list_of_links_recommended] => true
[icons_on_menu_items_support] => false
[break_list_of_links_with_br_element_recommended] => true
[access_key_support] => false
[wrap_mode_support] => false
[times_square_mode_support] => false
[deck_prefetch_support] => false
[elective_forms_recommended] => true
[wizards_recommended] => false
[image_as_link_support] => false
[insert_br_element_after_widget_recommended] => false
[wml_can_display_images_and_text_on_same_line] => false
[wml_displays_image_in_center] => false
[opwv_wml_extensions_support] => false
[wml_make_phone_call_string] => wtai://wp/mc;
[chtml_display_accesskey] => false
[emoji] => false
[chtml_can_display_images_and_text_on_same_line] => false
[chtml_displays_image_in_center] => false
[imode_region] => none
[chtml_make_phone_call_string] => tel:
[chtml_table_support] => false
[xhtml_honors_bgcolor] => true
[xhtml_supports_forms_in_table] => true
[xhtml_support_wml2_namespace] => false
[xhtml_autoexpand_select] => false
[xhtml_select_as_dropdown] => false
[xhtml_select_as_radiobutton] => false
[xhtml_select_as_popup] => false
[xhtml_display_accesskey] => false
[xhtml_supports_invisible_text] => false
[xhtml_supports_inline_input] => false
[xhtml_supports_monospace_font] => false
[xhtml_supports_table_for_layout] => true
[xhtml_supports_css_cell_table_coloring] => true
[xhtml_format_as_css_property] => false
[xhtml_format_as_attribute] => false
[xhtml_nowrap_mode] => false
[xhtml_marquee_as_css_property] => false
[xhtml_readable_background_color1] => #FFFFFF
[xhtml_readable_background_color2] => #FFFFFF
[xhtml_allows_disabled_form_elements] => true
[xhtml_document_title_support] => true
[xhtml_preferred_charset] => iso-8859-1
[opwv_xhtml_extensions_support] => false
[xhtml_make_phone_call_string] => tel:
[xhtmlmp_preferred_mime_type] => text/html
[xhtml_table_support] => true
[xhtml_send_sms_string] => sms:
[xhtml_send_mms_string] => mms:
[xhtml_file_upload] => supported
[cookie_support] => true
[accept_third_party_cookie] => true
[xhtml_supports_iframe] => full
[xhtml_avoid_accesskeys] => true
[xhtml_can_embed_video] => none
[ajax_support_javascript] => true
[ajax_manipulate_css] => true
[ajax_support_getelementbyid] => true
[ajax_support_inner_html] => true
[ajax_xhr_type] => standard
[ajax_manipulate_dom] => true
[ajax_support_events] => true
[ajax_support_event_listener] => true
[ajax_preferred_geoloc_api] => w3c_api
[xhtml_support_level] => 4
[preferred_markup] => html_web_4_0
[wml_1_1] => false
[wml_1_2] => false
[wml_1_3] => false
[html_wi_w3_xhtmlbasic] => true
[html_wi_oma_xhtmlmp_1_0] => true
[html_wi_imode_html_1] => false
[html_wi_imode_html_2] => false
[html_wi_imode_html_3] => false
[html_wi_imode_html_4] => false
[html_wi_imode_html_5] => false
[html_wi_imode_htmlx_1] => false
[html_wi_imode_htmlx_1_1] => false
[html_wi_imode_compact_generic] => false
[html_web_3_2] => true
[html_web_4_0] => true
[voicexml] => false
[multipart_support] => false
[total_cache_disable_support] => false
[time_to_live_support] => false
[resolution_width] => 480
[resolution_height] => 854
[columns] => 25
[max_image_width] => 320
[max_image_height] => 480
[rows] => 21
[physical_screen_width] => 50
[physical_screen_height] => 89
[dual_orientation] => true
[density_class] => 1.5
[wbmp] => true
[bmp] => true
[epoc_bmp] => false
[gif_animated] => false
[jpg] => true
[png] => true
[tiff] => false
[transparent_png_alpha] => true
[transparent_png_index] => true
[svgt_1_1] => true
[svgt_1_1_plus] => false
[greyscale] => false
[gif] => true
[colors] => 262144
[webp_lossy_support] => true
[webp_lossless_support] => false
[post_method_support] => true
[basic_authentication_support] => true
[empty_option_value_support] => true
[emptyok] => false
[nokia_voice_call] => false
[wta_voice_call] => false
[wta_phonebook] => false
[wta_misc] => false
[wta_pdc] => false
[https_support] => true
[phone_id_provided] => false
[max_data_rate] => 3600
[wifi] => true
[sdio] => false
[vpn] => false
[has_cellular_radio] => true
[max_deck_size] => 2000000
[max_url_length_in_requests] => 256
[max_url_length_homepage] => 0
[max_url_length_bookmark] => 0
[max_url_length_cached_page] => 0
[max_no_of_connection_settings] => 0
[max_no_of_bookmarks] => 0
[max_length_of_username] => 0
[max_length_of_password] => 0
[max_object_size] => 0
[downloadfun_support] => false
[directdownload_support] => true
[inline_support] => false
[oma_support] => true
[ringtone] => false
[ringtone_3gpp] => false
[ringtone_midi_monophonic] => false
[ringtone_midi_polyphonic] => false
[ringtone_imelody] => false
[ringtone_digiplug] => false
[ringtone_compactmidi] => false
[ringtone_mmf] => false
[ringtone_rmf] => false
[ringtone_xmf] => false
[ringtone_amr] => false
[ringtone_awb] => false
[ringtone_aac] => false
[ringtone_wav] => false
[ringtone_mp3] => false
[ringtone_spmidi] => false
[ringtone_qcelp] => false
[ringtone_voices] => 1
[ringtone_df_size_limit] => 0
[ringtone_directdownload_size_limit] => 0
[ringtone_inline_size_limit] => 0
[ringtone_oma_size_limit] => 0
[wallpaper] => false
[wallpaper_max_width] => 0
[wallpaper_max_height] => 0
[wallpaper_preferred_width] => 0
[wallpaper_preferred_height] => 0
[wallpaper_resize] => none
[wallpaper_wbmp] => false
[wallpaper_bmp] => false
[wallpaper_gif] => false
[wallpaper_jpg] => false
[wallpaper_png] => false
[wallpaper_tiff] => false
[wallpaper_greyscale] => false
[wallpaper_colors] => 2
[wallpaper_df_size_limit] => 0
[wallpaper_directdownload_size_limit] => 0
[wallpaper_inline_size_limit] => 0
[wallpaper_oma_size_limit] => 0
[screensaver] => false
[screensaver_max_width] => 0
[screensaver_max_height] => 0
[screensaver_preferred_width] => 0
[screensaver_preferred_height] => 0
[screensaver_resize] => none
[screensaver_wbmp] => false
[screensaver_bmp] => false
[screensaver_gif] => false
[screensaver_jpg] => false
[screensaver_png] => false
[screensaver_greyscale] => false
[screensaver_colors] => 2
[screensaver_df_size_limit] => 0
[screensaver_directdownload_size_limit] => 0
[screensaver_inline_size_limit] => 0
[screensaver_oma_size_limit] => 0
[picture] => false
[picture_max_width] => 0
[picture_max_height] => 0
[picture_preferred_width] => 0
[picture_preferred_height] => 0
[picture_resize] => none
[picture_wbmp] => false
[picture_bmp] => false
[picture_gif] => false
[picture_jpg] => false
[picture_png] => false
[picture_greyscale] => false
[picture_colors] => 2
[picture_df_size_limit] => 0
[picture_directdownload_size_limit] => 0
[picture_inline_size_limit] => 0
[picture_oma_size_limit] => 0
[video] => false
[oma_v_1_0_forwardlock] => false
[oma_v_1_0_combined_delivery] => false
[oma_v_1_0_separate_delivery] => false
[streaming_video] => true
[streaming_3gpp] => true
[streaming_mp4] => true
[streaming_mov] => false
[streaming_video_size_limit] => 0
[streaming_real_media] => none
[streaming_flv] => false
[streaming_3g2] => false
[streaming_vcodec_h263_0] => 10
[streaming_vcodec_h263_3] => -1
[streaming_vcodec_mpeg4_sp] => 2
[streaming_vcodec_mpeg4_asp] => -1
[streaming_vcodec_h264_bp] => 1
[streaming_acodec_amr] => nb
[streaming_acodec_aac] => lc
[streaming_wmv] => none
[streaming_preferred_protocol] => rtsp
[streaming_preferred_http_protocol] => apple_live_streaming
[wap_push_support] => true
[connectionless_service_indication] => false
[connectionless_service_load] => false
[connectionless_cache_operation] => false
[connectionoriented_unconfirmed_service_indication] => false
[connectionoriented_unconfirmed_service_load] => false
[connectionoriented_unconfirmed_cache_operation] => false
[connectionoriented_confirmed_service_indication] => false
[connectionoriented_confirmed_service_load] => false
[connectionoriented_confirmed_cache_operation] => false
[utf8_support] => true
[ascii_support] => false
[iso8859_support] => false
[expiration_date] => false
[j2me_cldc_1_0] => false
[j2me_cldc_1_1] => false
[j2me_midp_1_0] => false
[j2me_midp_2_0] => false
[doja_1_0] => false
[doja_1_5] => false
[doja_2_0] => false
[doja_2_1] => false
[doja_2_2] => false
[doja_3_0] => false
[doja_3_5] => false
[doja_4_0] => false
[j2me_jtwi] => false
[j2me_mmapi_1_0] => false
[j2me_mmapi_1_1] => false
[j2me_wmapi_1_0] => false
[j2me_wmapi_1_1] => false
[j2me_wmapi_2_0] => false
[j2me_btapi] => false
[j2me_3dapi] => false
[j2me_locapi] => false
[j2me_nokia_ui] => false
[j2me_motorola_lwt] => false
[j2me_siemens_color_game] => false
[j2me_siemens_extension] => false
[j2me_heap_size] => 0
[j2me_max_jar_size] => 0
[j2me_storage_size] => 0
[j2me_max_record_store_size] => 0
[j2me_screen_width] => 0
[j2me_screen_height] => 0
[j2me_canvas_width] => 0
[j2me_canvas_height] => 0
[j2me_bits_per_pixel] => 0
[j2me_audio_capture_enabled] => false
[j2me_video_capture_enabled] => false
[j2me_photo_capture_enabled] => false
[j2me_capture_image_formats] => none
[j2me_http] => false
[j2me_https] => false
[j2me_socket] => false
[j2me_udp] => false
[j2me_serial] => false
[j2me_gif] => false
[j2me_gif89a] => false
[j2me_jpg] => false
[j2me_png] => false
[j2me_bmp] => false
[j2me_bmp3] => false
[j2me_wbmp] => false
[j2me_midi] => false
[j2me_wav] => false
[j2me_amr] => false
[j2me_mp3] => false
[j2me_mp4] => false
[j2me_imelody] => false
[j2me_rmf] => false
[j2me_au] => false
[j2me_aac] => false
[j2me_realaudio] => false
[j2me_xmf] => false
[j2me_wma] => false
[j2me_3gpp] => false
[j2me_h263] => false
[j2me_svgt] => false
[j2me_mpeg4] => false
[j2me_realvideo] => false
[j2me_real8] => false
[j2me_realmedia] => false
[j2me_left_softkey_code] => 0
[j2me_right_softkey_code] => 0
[j2me_middle_softkey_code] => 0
[j2me_select_key_code] => 0
[j2me_return_key_code] => 0
[j2me_clear_key_code] => 0
[j2me_datefield_no_accepts_null_date] => false
[j2me_datefield_broken] => false
[receiver] => true
[sender] => true
[mms_max_size] => 307200
[mms_max_height] => 768
[mms_max_width] => 1024
[built_in_recorder] => false
[built_in_camera] => true
[mms_jpeg_baseline] => true
[mms_jpeg_progressive] => false
[mms_gif_static] => true
[mms_gif_animated] => true
[mms_png] => true
[mms_bmp] => false
[mms_wbmp] => true
[mms_amr] => true
[mms_wav] => true
[mms_midi_monophonic] => true
[mms_midi_polyphonic] => false
[mms_midi_polyphonic_voices] => 0
[mms_spmidi] => false
[mms_mmf] => false
[mms_mp3] => true
[mms_evrc] => false
[mms_qcelp] => false
[mms_ota_bitmap] => false
[mms_nokia_wallpaper] => false
[mms_nokia_operatorlogo] => false
[mms_nokia_3dscreensaver] => false
[mms_nokia_ringingtone] => false
[mms_rmf] => false
[mms_xmf] => false
[mms_symbian_install] => false
[mms_jar] => false
[mms_jad] => false
[mms_vcard] => true
[mms_vcalendar] => true
[mms_wml] => false
[mms_wbxml] => false
[mms_wmlc] => false
[mms_video] => true
[mms_mp4] => true
[mms_3gpp] => true
[mms_3gpp2] => true
[mms_max_frame_rate] => 0
[nokiaring] => false
[picturemessage] => false
[operatorlogo] => false
[largeoperatorlogo] => false
[callericon] => false
[nokiavcard] => false
[nokiavcal] => false
[sckl_ringtone] => false
[sckl_operatorlogo] => false
[sckl_groupgraphic] => false
[sckl_vcard] => false
[sckl_vcalendar] => false
[text_imelody] => false
[ems] => false
[ems_variablesizedpictures] => false
[ems_imelody] => false
[ems_odi] => false
[ems_upi] => false
[ems_version] => 0
[siemens_ota] => false
[siemens_logo_width] => 101
[siemens_logo_height] => 29
[siemens_screensaver_width] => 101
[siemens_screensaver_height] => 50
[gprtf] => false
[sagem_v1] => false
[sagem_v2] => false
[panasonic] => false
[sms_enabled] => true
[wav] => true
[mmf] => false
[smf] => false
[mld] => false
[midi_monophonic] => true
[midi_polyphonic] => true
[sp_midi] => true
[rmf] => false
[xmf] => false
[compactmidi] => false
[digiplug] => false
[nokia_ringtone] => false
[imelody] => true
[au] => false
[amr] => true
[awb] => true
[aac] => true
[mp3] => true
[voices] => 1
[qcelp] => false
[evrc] => false
[flash_lite_version] =>
[fl_wallpaper] => false
[fl_screensaver] => false
[fl_standalone] => false
[fl_browser] => false
[fl_sub_lcd] => false
[full_flash_support] => true
[css_supports_width_as_percentage] => true
[css_border_image] => webkit
[css_rounded_corners] => webkit
[css_gradient] => none
[css_spriting] => true
[css_gradient_linear] => none
[is_transcoder] => false
[transcoder_ua_header] => user-agent
[rss_support] => false
[pdf_support] => true
[progressive_download] => true
[playback_vcodec_h263_0] => 10
[playback_vcodec_h263_3] => -1
[playback_vcodec_mpeg4_sp] => 0
[playback_vcodec_mpeg4_asp] => -1
[playback_vcodec_h264_bp] => 3.0
[playback_real_media] => none
[playback_3gpp] => true
[playback_3g2] => false
[playback_mp4] => true
[playback_mov] => false
[playback_acodec_amr] => nb
[playback_acodec_aac] => none
[playback_df_size_limit] => 0
[playback_directdownload_size_limit] => 0
[playback_inline_size_limit] => 0
[playback_oma_size_limit] => 0
[playback_acodec_qcelp] => false
[playback_wmv] => none
[hinted_progressive_download] => true
[html_preferred_dtd] => html4
[viewport_supported] => true
[viewport_width] => device_width_token
[viewport_userscalable] => no
[viewport_initial_scale] =>
[viewport_maximum_scale] =>
[viewport_minimum_scale] =>
[mobileoptimized] => false
[handheldfriendly] => false
[canvas_support] => full
[image_inlining] => true
[is_smarttv] => false
[is_console] => false
[nfc_support] => false
[ux_full_desktop] => false
[jqm_grade] => A
[is_sencha_touch_ok] => false
[controlcap_is_smartphone] => default
[controlcap_is_ios] => default
[controlcap_is_android] => default
[controlcap_is_robot] => default
[controlcap_is_app] => default
[controlcap_advertised_device_os] => default
[controlcap_advertised_device_os_version] => default
[controlcap_advertised_browser] => default
[controlcap_advertised_browser_version] => default
[controlcap_is_windows_phone] => default
[controlcap_is_full_desktop] => default
[controlcap_is_largescreen] => default
[controlcap_is_mobile] => default
[controlcap_is_touchscreen] => default
[controlcap_is_wml_preferred] => default
[controlcap_is_xhtmlmp_preferred] => default
[controlcap_is_html_preferred] => default
[controlcap_form_factor] => default
[controlcap_complete_device_name] => default
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr></table>
</div>
<div class="section">
<h1 class="header center orange-text">About this comparison</h1>
<div class="row center">
<h5 class="header light">
The primary goal of this project is simple<br />
I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br />
<br />
The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br />
<br />
You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br />
<br />
The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a>
</h5>
</div>
</div>
<div class="card">
<div class="card-content">
Comparison created <i>2016-02-13 13:29:07</i> | by
<a href="https://github.com/ThaDafinser">ThaDafinser</a>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.1.1/list.min.js"></script>
<script>
$(document).ready(function(){
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
$('.modal-trigger').leanModal();
});
</script>
</body>
</html> | {
"content_hash": "2845f670e306d64880133b937fe7da07",
"timestamp": "",
"source": "github",
"line_count": 1124,
"max_line_length": 752,
"avg_line_length": 41.46797153024911,
"alnum_prop": 0.5386183222484445,
"repo_name": "ThaDafinser/UserAgentParserComparison",
"id": "471f3fc72b2b48ccf36b61e26e75abe199530931",
"size": "46611",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "v4/user-agent-detail/36/83/368361a1-06a4-45c7-acbd-b90db1410a28.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2060859160"
}
],
"symlink_target": ""
} |
Handy data structures for elements keyed by string.
## Installing
If you use NPM, `npm install d3-collection`. Otherwise, download the [latest release](https://github.com/d3/d3-collection/releases/latest). The released bundle supports AMD, CommonJS, and vanilla environments. Create a custom build using [Rollup](https://github.com/rollup/rollup) or your preferred bundler. You can also load directly from [d3js.org](https://d3js.org):
```html
<script src="https://d3js.org/d3-collection.v0.1.min.js"></script>
```
In a vanilla environment, a `d3_collection` global is exported. [Try d3-collection in your browser.](https://tonicdev.com/npm/d3-collection)
## API Reference
* [Objects](#objects)
* [Maps](#maps)
* [Sets](#sets)
* [Nests](#nests)
### Objects
A common data type in JavaScript is the *associative array*, or more simply the *object*, which has a set of named properties. The standard mechanism for iterating over the keys (or property names) in an associative array is the [for…in loop](https://developer.mozilla.org/en/JavaScript/Reference/Statements/for...in). However, note that the iteration order is undefined. D3 provides several methods for converting associative arrays to standard arrays with numeric indexes.
A word of caution: it is tempting to use plain objects as maps, but this causes [unexpected behavior](http://www.devthought.com/2012/01/18/an-object-is-not-a-hash/) when built-in property names are used as keys, such as `object["__proto__"] = 42` and `"hasOwnProperty" in object`. If you cannot guarantee that map keys and set values will be safe, use [maps](#maps) and [sets](#sets) (or their ES6 equivalents) instead of plain objects.
<a name="keys" href="#keys">#</a> d3.<b>keys</b>(<i>object</i>)
Returns an array containing the property names of the specified object (an associative array). The order of the returned array is undefined.
<a name="values" href="#values">#</a> d3.<b>values</b>(<i>object</i>)
Returns an array containing the property values of the specified object (an associative array). The order of the returned array is undefined.
<a name="entries" href="#entries">#</a> d3.<b>entries</b>(<i>object</i>)
Returns an array containing the property keys and values of the specified object (an associative array). Each entry is an object with a key and value attribute, such as `{key: "foo", value: 42}`. The order of the returned array is undefined.
```js
d3.entries({foo: 42, bar: true}); // [{key: "foo", value: 42}, {key: "bar", value: true}]
```
### Maps
Like [ES6 Maps](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map), but with a few differences:
* Keys are coerced to strings.
* [map.each](#map_each), not [map.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach). (Also, no *thisArg*.)
* [map.remove](#map_remove), not [map.delete](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete).
* [map.entries](#map_entries) returns an array of {key, value} objects, not an iterator of [key, value].
* [map.size](#map_size) is a method, not a [property](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size); also, there’s [map.empty](#map_empty).
<a name="map" href="#map">#</a> d3.<b>map</b>([<i>object</i>[, <i>key</i>]])
Constructs a new map. If *object* is specified, copies all enumerable properties from the specified object into this map. The specified object may also be an array or another map. An optional *key* function may be specified to compute the key for each value in the array. For example:
```js
var map = d3.map([{name: "foo"}, {name: "bar"}], function(d) { return d.name; });
map.get("foo"); // {"name": "foo"}
map.get("bar"); // {"name": "bar"}
map.get("baz"); // undefined
```
See also [nests](#nests).
<a name="map_has" href="#map_has">#</a> <i>map</i>.<b>has</b>(<i>key</i>)
Returns true if and only if this map has an entry for the specified *key* string. Note: the value may be `null` or `undefined`.
<a name="map_get" href="#map_get">#</a> <i>map</i>.<b>get</b>(<i>key</i>)
Returns the value for the specified *key* string. If the map does not have an entry for the specified *key*, returns `undefined`.
<a name="map_set" href="#map_set">#</a> <i>map</i>.<b>set</b>(<i>key</i>, <i>value</i>)
Sets the *value* for the specified *key* string. If the map previously had an entry for the same *key* string, the old entry is replaced with the new value. Returns the map, allowing chaining. For example:
```js
var map = d3.map()
.set("foo", 1)
.set("bar", 2)
.set("baz", 3);
map.get("foo"); // 1
```
<a name="map_remove" href="#map_remove">#</a> <i>map</i>.<b>remove</b>(<i>key</i>)
If the map has an entry for the specified *key* string, removes the entry and returns true. Otherwise, this method does nothing and returns false.
<a name="map_clear" href="#map_clear">#</a> <i>map</i>.<b>clear</b>()
Removes all entries from this map.
<a name="map_keys" href="#map_keys">#</a> <i>map</i>.<b>keys</b>()
Returns an array of string keys for every entry in this map. The order of the returned keys is arbitrary.
<a name="map_values" href="#map_values">#</a> <i>map</i>.<b>values</b>()
Returns an array of values for every entry in this map. The order of the returned values is arbitrary.
<a name="map_entries" href="#map_entries">#</a> <i>map</i>.<b>entries</b>()
Returns an array of key-value objects for each entry in this map. The order of the returned entries is arbitrary. Each entry’s key is a string, but the value has arbitrary type.
<a name="map_each" href="#map_each">#</a> <i>map</i>.<b>each</b>(<i>function</i>)
Calls the specified *function* for each entry in this map, passing the entry’s value and key as arguments, followed by the map itself. Returns undefined. The iteration order is arbitrary.
<a name="map_empty" href="#map_empty">#</a> <i>map</i>.<b>empty</b>()
Returns true if and only if this map has zero entries.
<a name="map_size" href="#map_size">#</a> <i>map</i>.<b>size</b>()
Returns the number of entries in this map.
### Sets
Like [ES6 Sets](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set), but with a few differences:
* Values are coerced to strings.
* [set.each](#set_each), not [set.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/forEach). (Also, no *thisArg*.)
* [set.remove](#set_remove), not [set.delete](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/delete).
* [set.size](#set_size) is a method, not a [property](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/size); also, there’s [set.empty](#set_empty).
<a name="set" href="#set">#</a> d3.<b>set</b>([<i>array</i>[, <i>accessor</i>]])
Constructs a new set. If *array* is specified, adds the given *array* of string values to the returned set. The specified array may also be another set. An optional *accessor* function may be specified, which is equivalent to calling *array.map(accessor)* before constructing the set.
<a name="set_has" href="#set_has">#</a> <i>set</i>.<b>has</b>(<i>value</i>)
Returns true if and only if this set has an entry for the specified *value* string.
<a name="set_add" href="#set_add">#</a> <i>set</i>.<b>add</b>(<i>value</i>)
Adds the specified *value* string to this set. Returns the set, allowing chaining. For example:
```js
var set = d3.set()
.add("foo")
.add("bar")
.add("baz");
set.has("foo"); // true
```
<a name="set_remove" href="#set_remove">#</a> <i>set</i>.<b>remove</b>(<i>value</i>)
If the set contains the specified *value* string, removes it and returns true. Otherwise, this method does nothing and returns false.
<a name="set_clear" href="#set_clear">#</a> <i>set</i>.<b>clear</b>()
Removes all values from this set.
<a name="set_values" href="#set_values">#</a> <i>set</i>.<b>values</b>()
Returns an array of the string values in this set. The order of the returned values is arbitrary. Can be used as a convenient way of computing the unique values for a set of strings. For example:
```js
d3.set(["foo", "bar", "foo", "baz"]).values(); // "foo", "bar", "baz"
```
<a name="set_each" href="#set_each">#</a> <i>set</i>.<b>each</b>(<i>function</i>)
Calls the specified *function* for each value in this set, passing the value as the first two arguments (for symmetry with [*map*.each](#map_each)), followed by the set itself. Returns undefined. The iteration order is arbitrary.
<a name="set_empty" href="#set_empty">#</a> <i>set</i>.<b>empty</b>()
Returns true if and only if this set has zero values.
<a name="set_size" href="#set_size">#</a> <i>set</i>.<b>size</b>()
Returns the number of values in this set.
### Nests
Nesting allows elements in an array to be grouped into a hierarchical tree structure; think of it like the GROUP BY operator in SQL, except you can have multiple levels of grouping, and the resulting output is a tree rather than a flat table. The levels in the tree are specified by key functions. The leaf nodes of the tree can be sorted by value, while the internal nodes can be sorted by key. An optional rollup function will collapse the elements in each leaf node using a summary function. The nest operator (the object returned by [nest](#nest)) is reusable, and does not retain any references to the data that is nested.
For example, consider the following tabular data structure of Barley yields, from various sites in Minnesota during 1931-2:
```js
var yields = [
{yield: 27.00, variety: "Manchuria", year: 1931, site: "University Farm"},
{yield: 48.87, variety: "Manchuria", year: 1931, site: "Waseca"},
{yield: 27.43, variety: "Manchuria", year: 1931, site: "Morris"},
...
];
```
To facilitate visualization, it may be useful to nest the elements first by year, and then by variety, as follows:
```js
var entries = d3.nest()
.key(function(d) { return d.year; })
.key(function(d) { return d.variety; })
.entries(yields);
```
This returns a nested array. Each element of the outer array is a key-values pair, listing the values for each distinct key:
```js
[{key: "1931", values: [
{key: "Manchuria", values: [
{yield: 27.00, variety: "Manchuria", year: 1931, site: "University Farm"},
{yield: 48.87, variety: "Manchuria", year: 1931, site: "Waseca"},
{yield: 27.43, variety: "Manchuria", year: 1931, site: "Morris"}, ...]},
{key: "Glabron", values: [
{yield: 43.07, variety: "Glabron", year: 1931, site: "University Farm"},
{yield: 55.20, variety: "Glabron", year: 1931, site: "Waseca"}, ...]}, ...]},
{key: "1932", values: ...}]
```
The nested form allows easy iteration and generation of hierarchical structures in SVG or HTML.
For a longer introduction to nesting, see:
* Phoebe Bright’s [D3 Nest Tutorial and examples](http://bl.ocks.org/phoebebright/raw/3176159/)
* Shan Carter’s [Mister Nester](http://bl.ocks.org/shancarter/raw/4748131/)
<a name="nest" href="#nest">#</a> d3.<b>nest</b>()
Creates a new nest operator. The set of keys is initially empty. If the [map](#nest_map) or [entries](#nest_entries) operator is invoked before any key functions are registered, the nest operator simply returns the input array.
<a name="nest_key" href="#nest_key">#</a> <i>nest</i>.<b>key</b>(<i>function</i>)
Registers a new key *function*. The key function will be invoked for each element in the input array, and must return a string identifier that is used to assign the element to its group. Most often, the function is implemented as a simple accessor, such as the year and variety accessors in the example above. The function is _not_ passed the input array index. Each time a key is registered, it is pushed onto the end of an internal keys array, and the resulting map or entries will have an additional hierarchy level. There is not currently a facility to remove or query the registered keys. The most-recently registered key is referred to as the current key in subsequent methods.
<a name="nest_sortKeys" href="#nest_sortKeys">#</a> <i>nest</i>.<b>sortKeys</b>(<i>comparator</i>)
Sorts key values for the current key using the specified *comparator*, such as [descending](https://github.com/d3/d3-array#descending). If no comparator is specified for the current key, the order in which keys will be returned is undefined. Note that this only affects the result of the entries operator; the order of keys returned by the map operator is always undefined, regardless of comparator.
```js
var entries = d3.nest()
.key(function(d) { return d.year; })
.sortKeys(d3.ascending)
.entries(yields);
```
<a name="nest_sortValues" href="#nest_sortValues">#</a> <i>nest</i>.<b>sortValues</b>(<i>comparator</i>)
Sorts leaf elements using the specified *comparator*, such as [descending](https://github.com/d3/d3-array#descending). This is roughly equivalent to sorting the input array before applying the nest operator; however it is typically more efficient as the size of each group is smaller. If no value comparator is specified, elements will be returned in the order they appeared in the input array. This applies to both the map and entries operators.
<a name="nest_rollup" href="#nest_rollup">#</a> <i>nest</i>.<b>rollup</b>(<i>function</i>)
Specifies a rollup *function* to be applied on each group of leaf elements. The return value of the rollup function will replace the array of leaf values in either the associative array returned by the map operator, or the values attribute of each entry returned by the entries operator.
<a name="nest_map" href="#nest_map">#</a> <i>nest</i>.<b>map</b>(<i>array</i>)
Applies the nest operator to the specified *array*, returning a nested [map](#map). Each entry in the returned map corresponds to a distinct key value returned by the first key function. The entry value depends on the number of registered key functions: if there is an additional key, the value is another map; otherwise, the value is the array of elements filtered from the input *array* that have the given key value.
<a name="nest_object" href="#nest_object">#</a> <i>nest</i>.<b>object</b>(<i>array</i>)
Applies the nest operator to the specified *array*, returning a nested object. Each entry in the returned associative array corresponds to a distinct key value returned by the first key function. The entry value depends on the number of registered key functions: if there is an additional key, the value is another associative array; otherwise, the value is the array of elements filtered from the input *array* that have the given key value.
Note: this method is unsafe if any of the keys conflict with built-in JavaScript properties, such as `__proto__`. If you cannot guarantee that the keys will be safe, you should use [nest.map](#nest_map) instead.
<a name="nest_entries" href="#nest_entries">#</a> <i>nest</i>.<b>entries</b>(<i>array</i>)
Applies the nest operator to the specified *array*, returning an array of key-values entries. Conceptually, this is similar to applying [entries](#nest_entries) to the associative array returned by [map](#nest_map), but it applies to every level of the hierarchy rather than just the first (outermost) level. Each entry in the returned array corresponds to a distinct key value returned by the first key function. The entry value depends on the number of registered key functions: if there is an additional key, the value is another nested array of entries; otherwise, the value is the array of elements filtered from the input *array* that have the given key value.
| {
"content_hash": "77e6c7cf967adf61a7e589c6a9ce1c01",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 683,
"avg_line_length": 60.323076923076925,
"alnum_prop": 0.7134021933180311,
"repo_name": "raskolnikova/infomaps",
"id": "478c7de32052bb53b10e10cab6815ff18ed5e8b1",
"size": "15715",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "node_modules/d3-collection/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "166899"
},
{
"name": "HTML",
"bytes": "340"
},
{
"name": "JavaScript",
"bytes": "6660450"
}
],
"symlink_target": ""
} |
<?php
class Login extends F5_Controller{
/**
* Executa tudo que tem aqui antes de inicar QUALQUER action deste controller. O uso deste método é opcional, pois já está sobreescrevendo o método init() de controller do F5 Framework.
*/
public function init() {
$this->trataURL = new removerAcentosURLHelper();
}
/**
* Action index do controller.
*/
public function index_action(){
$dados[rodape] = $this->footer();
$this->view("login/index", $dados);
}
public function meus_dados(){
$this->view("login/meus-dados", $dados);
}
}
| {
"content_hash": "00236dcd4626208650d3cf4ba15021d7",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 189,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.6176470588235294,
"repo_name": "EquipeB/SOSFeevale",
"id": "04bb29059805a9d71883a52fcb96f4b33b6bc8a9",
"size": "825",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/controllers/loginController.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "122"
},
{
"name": "CSS",
"bytes": "67971"
},
{
"name": "HTML",
"bytes": "19012"
},
{
"name": "JavaScript",
"bytes": "147796"
},
{
"name": "PHP",
"bytes": "546404"
},
{
"name": "Shell",
"bytes": "4075"
}
],
"symlink_target": ""
} |
package org.jboss.weld.junit4.ofpackage;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.jboss.weld.junit4.WeldInitiator;
import org.junit.Rule;
import org.junit.Test;
/**
*
* @author Martin Kouba
*/
public class OfPackageTest {
@Rule
public WeldInitiator weld = WeldInitiator.ofTestPackage();
@Test
public void testOfTestPackage() {
assertEquals("alpha", weld.select(Alpha.class).get().getValue());
assertTrue(weld.select(Bravo.class).isResolvable());
}
}
| {
"content_hash": "24c74dbc69f6ef210b8e1da723ee6ba0",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 73,
"avg_line_length": 21.307692307692307,
"alnum_prop": 0.7148014440433214,
"repo_name": "weld/weld-junit",
"id": "b67f1bb1c25b9ff75c74e18498223409e4ba06d8",
"size": "1329",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "junit4/src/test/java/org/jboss/weld/junit4/ofpackage/OfPackageTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "179445"
},
{
"name": "Java",
"bytes": "508798"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.