text
stringlengths 2
1.04M
| meta
dict |
---|---|
#include <linux/types.h>
#include <linux/utsname.h>
#include <linux/kernel.h>
#include <linux/ktime.h>
#include <linux/slab.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/xprtsock.h>
#include <linux/sunrpc/svc.h>
#include <linux/lockd/lockd.h>
#include <asm/unaligned.h>
#define NLMDBG_FACILITY NLMDBG_MONITOR
#define NSM_PROGRAM 100024
#define NSM_VERSION 1
enum {
NSMPROC_NULL,
NSMPROC_STAT,
NSMPROC_MON,
NSMPROC_UNMON,
NSMPROC_UNMON_ALL,
NSMPROC_SIMU_CRASH,
NSMPROC_NOTIFY,
};
struct nsm_args {
struct nsm_private *priv;
u32 prog; /* RPC callback info */
u32 vers;
u32 proc;
char *mon_name;
char *nodename;
};
struct nsm_res {
u32 status;
u32 state;
};
static const struct rpc_program nsm_program;
static LIST_HEAD(nsm_handles);
static DEFINE_SPINLOCK(nsm_lock);
/*
* Local NSM state
*/
u32 __read_mostly nsm_local_state;
bool __read_mostly nsm_use_hostnames;
static inline struct sockaddr *nsm_addr(const struct nsm_handle *nsm)
{
return (struct sockaddr *)&nsm->sm_addr;
}
static struct rpc_clnt *nsm_create(struct net *net)
{
struct sockaddr_in sin = {
.sin_family = AF_INET,
.sin_addr.s_addr = htonl(INADDR_LOOPBACK),
};
struct rpc_create_args args = {
.net = net,
.protocol = XPRT_TRANSPORT_UDP,
.address = (struct sockaddr *)&sin,
.addrsize = sizeof(sin),
.servername = "rpc.statd",
.program = &nsm_program,
.version = NSM_VERSION,
.authflavor = RPC_AUTH_NULL,
.flags = RPC_CLNT_CREATE_NOPING,
};
return rpc_create(&args);
}
static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res,
struct net *net)
{
struct rpc_clnt *clnt;
int status;
struct nsm_args args = {
.priv = &nsm->sm_priv,
.prog = NLM_PROGRAM,
.vers = 3,
.proc = NLMPROC_NSM_NOTIFY,
.mon_name = nsm->sm_mon_name,
.nodename = utsname()->nodename,
};
struct rpc_message msg = {
.rpc_argp = &args,
.rpc_resp = res,
};
clnt = nsm_create(net);
if (IS_ERR(clnt)) {
status = PTR_ERR(clnt);
dprintk("lockd: failed to create NSM upcall transport, "
"status=%d\n", status);
goto out;
}
memset(res, 0, sizeof(*res));
msg.rpc_proc = &clnt->cl_procinfo[proc];
status = rpc_call_sync(clnt, &msg, 0);
if (status < 0)
dprintk("lockd: NSM upcall RPC failed, status=%d\n",
status);
else
status = 0;
rpc_shutdown_client(clnt);
out:
return status;
}
/**
* nsm_monitor - Notify a peer in case we reboot
* @host: pointer to nlm_host of peer to notify
*
* If this peer is not already monitored, this function sends an
* upcall to the local rpc.statd to record the name/address of
* the peer to notify in case we reboot.
*
* Returns zero if the peer is monitored by the local rpc.statd;
* otherwise a negative errno value is returned.
*/
int nsm_monitor(const struct nlm_host *host)
{
struct nsm_handle *nsm = host->h_nsmhandle;
struct nsm_res res;
int status;
dprintk("lockd: nsm_monitor(%s)\n", nsm->sm_name);
if (nsm->sm_monitored)
return 0;
/*
* Choose whether to record the caller_name or IP address of
* this peer in the local rpc.statd's database.
*/
nsm->sm_mon_name = nsm_use_hostnames ? nsm->sm_name : nsm->sm_addrbuf;
status = nsm_mon_unmon(nsm, NSMPROC_MON, &res, host->net);
if (unlikely(res.status != 0))
status = -EIO;
if (unlikely(status < 0)) {
printk(KERN_NOTICE "lockd: cannot monitor %s\n", nsm->sm_name);
return status;
}
nsm->sm_monitored = 1;
if (unlikely(nsm_local_state != res.state)) {
nsm_local_state = res.state;
dprintk("lockd: NSM state changed to %d\n", nsm_local_state);
}
return 0;
}
/**
* nsm_unmonitor - Unregister peer notification
* @host: pointer to nlm_host of peer to stop monitoring
*
* If this peer is monitored, this function sends an upcall to
* tell the local rpc.statd not to send this peer a notification
* when we reboot.
*/
void nsm_unmonitor(const struct nlm_host *host)
{
struct nsm_handle *nsm = host->h_nsmhandle;
struct nsm_res res;
int status;
if (atomic_read(&nsm->sm_count) == 1
&& nsm->sm_monitored && !nsm->sm_sticky) {
dprintk("lockd: nsm_unmonitor(%s)\n", nsm->sm_name);
status = nsm_mon_unmon(nsm, NSMPROC_UNMON, &res, host->net);
if (res.status != 0)
status = -EIO;
if (status < 0)
printk(KERN_NOTICE "lockd: cannot unmonitor %s\n",
nsm->sm_name);
else
nsm->sm_monitored = 0;
}
}
static struct nsm_handle *nsm_lookup_hostname(const char *hostname,
const size_t len)
{
struct nsm_handle *nsm;
list_for_each_entry(nsm, &nsm_handles, sm_link)
if (strlen(nsm->sm_name) == len &&
memcmp(nsm->sm_name, hostname, len) == 0)
return nsm;
return NULL;
}
static struct nsm_handle *nsm_lookup_addr(const struct sockaddr *sap)
{
struct nsm_handle *nsm;
list_for_each_entry(nsm, &nsm_handles, sm_link)
if (rpc_cmp_addr(nsm_addr(nsm), sap))
return nsm;
return NULL;
}
static struct nsm_handle *nsm_lookup_priv(const struct nsm_private *priv)
{
struct nsm_handle *nsm;
list_for_each_entry(nsm, &nsm_handles, sm_link)
if (memcmp(nsm->sm_priv.data, priv->data,
sizeof(priv->data)) == 0)
return nsm;
return NULL;
}
/*
* Construct a unique cookie to match this nsm_handle to this monitored
* host. It is passed to the local rpc.statd via NSMPROC_MON, and
* returned via NLMPROC_SM_NOTIFY, in the "priv" field of these
* requests.
*
* The NSM protocol requires that these cookies be unique while the
* system is running. We prefer a stronger requirement of making them
* unique across reboots. If user space bugs cause a stale cookie to
* be sent to the kernel, it could cause the wrong host to lose its
* lock state if cookies were not unique across reboots.
*
* The cookies are exposed only to local user space via loopback. They
* do not appear on the physical network. If we want greater security
* for some reason, nsm_init_private() could perform a one-way hash to
* obscure the contents of the cookie.
*/
static void nsm_init_private(struct nsm_handle *nsm)
{
u64 *p = (u64 *)&nsm->sm_priv.data;
struct timespec ts;
s64 ns;
ktime_get_ts(&ts);
ns = timespec_to_ns(&ts);
put_unaligned(ns, p);
put_unaligned((unsigned long)nsm, p + 1);
}
static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap,
const size_t salen,
const char *hostname,
const size_t hostname_len)
{
struct nsm_handle *new;
new = kzalloc(sizeof(*new) + hostname_len + 1, GFP_KERNEL);
if (unlikely(new == NULL))
return NULL;
atomic_set(&new->sm_count, 1);
new->sm_name = (char *)(new + 1);
memcpy(nsm_addr(new), sap, salen);
new->sm_addrlen = salen;
nsm_init_private(new);
if (rpc_ntop(nsm_addr(new), new->sm_addrbuf,
sizeof(new->sm_addrbuf)) == 0)
(void)snprintf(new->sm_addrbuf, sizeof(new->sm_addrbuf),
"unsupported address family");
memcpy(new->sm_name, hostname, hostname_len);
new->sm_name[hostname_len] = '\0';
return new;
}
/**
* nsm_get_handle - Find or create a cached nsm_handle
* @sap: pointer to socket address of handle to find
* @salen: length of socket address
* @hostname: pointer to C string containing hostname to find
* @hostname_len: length of C string
*
* Behavior is modulated by the global nsm_use_hostnames variable.
*
* Returns a cached nsm_handle after bumping its ref count, or
* returns a fresh nsm_handle if a handle that matches @sap and/or
* @hostname cannot be found in the handle cache. Returns NULL if
* an error occurs.
*/
struct nsm_handle *nsm_get_handle(const struct sockaddr *sap,
const size_t salen, const char *hostname,
const size_t hostname_len)
{
struct nsm_handle *cached, *new = NULL;
if (hostname && memchr(hostname, '/', hostname_len) != NULL) {
if (printk_ratelimit()) {
printk(KERN_WARNING "Invalid hostname \"%.*s\" "
"in NFS lock request\n",
(int)hostname_len, hostname);
}
return NULL;
}
retry:
spin_lock(&nsm_lock);
if (nsm_use_hostnames && hostname != NULL)
cached = nsm_lookup_hostname(hostname, hostname_len);
else
cached = nsm_lookup_addr(sap);
if (cached != NULL) {
atomic_inc(&cached->sm_count);
spin_unlock(&nsm_lock);
kfree(new);
dprintk("lockd: found nsm_handle for %s (%s), "
"cnt %d\n", cached->sm_name,
cached->sm_addrbuf,
atomic_read(&cached->sm_count));
return cached;
}
if (new != NULL) {
list_add(&new->sm_link, &nsm_handles);
spin_unlock(&nsm_lock);
dprintk("lockd: created nsm_handle for %s (%s)\n",
new->sm_name, new->sm_addrbuf);
return new;
}
spin_unlock(&nsm_lock);
new = nsm_create_handle(sap, salen, hostname, hostname_len);
if (unlikely(new == NULL))
return NULL;
goto retry;
}
/**
* nsm_reboot_lookup - match NLMPROC_SM_NOTIFY arguments to an nsm_handle
* @info: pointer to NLMPROC_SM_NOTIFY arguments
*
* Returns a matching nsm_handle if found in the nsm cache. The returned
* nsm_handle's reference count is bumped. Otherwise returns NULL if some
* error occurred.
*/
struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info)
{
struct nsm_handle *cached;
spin_lock(&nsm_lock);
cached = nsm_lookup_priv(&info->priv);
if (unlikely(cached == NULL)) {
spin_unlock(&nsm_lock);
dprintk("lockd: never saw rebooted peer '%.*s' before\n",
info->len, info->mon);
return cached;
}
atomic_inc(&cached->sm_count);
spin_unlock(&nsm_lock);
dprintk("lockd: host %s (%s) rebooted, cnt %d\n",
cached->sm_name, cached->sm_addrbuf,
atomic_read(&cached->sm_count));
return cached;
}
/**
* nsm_release - Release an NSM handle
* @nsm: pointer to handle to be released
*
*/
void nsm_release(struct nsm_handle *nsm)
{
if (atomic_dec_and_lock(&nsm->sm_count, &nsm_lock)) {
list_del(&nsm->sm_link);
spin_unlock(&nsm_lock);
dprintk("lockd: destroyed nsm_handle for %s (%s)\n",
nsm->sm_name, nsm->sm_addrbuf);
kfree(nsm);
}
}
/*
* XDR functions for NSM.
*
* See http://www.opengroup.org/ for details on the Network
* Status Monitor wire protocol.
*/
static void encode_nsm_string(struct xdr_stream *xdr, const char *string)
{
const u32 len = strlen(string);
__be32 *p;
BUG_ON(len > SM_MAXSTRLEN);
p = xdr_reserve_space(xdr, 4 + len);
xdr_encode_opaque(p, string, len);
}
/*
* "mon_name" specifies the host to be monitored.
*/
static void encode_mon_name(struct xdr_stream *xdr, const struct nsm_args *argp)
{
encode_nsm_string(xdr, argp->mon_name);
}
/*
* The "my_id" argument specifies the hostname and RPC procedure
* to be called when the status manager receives notification
* (via the NLMPROC_SM_NOTIFY call) that the state of host "mon_name"
* has changed.
*/
static void encode_my_id(struct xdr_stream *xdr, const struct nsm_args *argp)
{
__be32 *p;
encode_nsm_string(xdr, argp->nodename);
p = xdr_reserve_space(xdr, 4 + 4 + 4);
*p++ = cpu_to_be32(argp->prog);
*p++ = cpu_to_be32(argp->vers);
*p = cpu_to_be32(argp->proc);
}
/*
* The "mon_id" argument specifies the non-private arguments
* of an NSMPROC_MON or NSMPROC_UNMON call.
*/
static void encode_mon_id(struct xdr_stream *xdr, const struct nsm_args *argp)
{
encode_mon_name(xdr, argp);
encode_my_id(xdr, argp);
}
/*
* The "priv" argument may contain private information required
* by the NSMPROC_MON call. This information will be supplied in the
* NLMPROC_SM_NOTIFY call.
*/
static void encode_priv(struct xdr_stream *xdr, const struct nsm_args *argp)
{
__be32 *p;
p = xdr_reserve_space(xdr, SM_PRIV_SIZE);
xdr_encode_opaque_fixed(p, argp->priv->data, SM_PRIV_SIZE);
}
static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nsm_args *argp)
{
encode_mon_id(xdr, argp);
encode_priv(xdr, argp);
}
static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nsm_args *argp)
{
encode_mon_id(xdr, argp);
}
static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,
struct xdr_stream *xdr,
struct nsm_res *resp)
{
__be32 *p;
p = xdr_inline_decode(xdr, 4 + 4);
if (unlikely(p == NULL))
return -EIO;
resp->status = be32_to_cpup(p++);
resp->state = be32_to_cpup(p);
dprintk("lockd: %s status %d state %d\n",
__func__, resp->status, resp->state);
return 0;
}
static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp,
struct xdr_stream *xdr,
struct nsm_res *resp)
{
__be32 *p;
p = xdr_inline_decode(xdr, 4);
if (unlikely(p == NULL))
return -EIO;
resp->state = be32_to_cpup(p);
dprintk("lockd: %s state %d\n", __func__, resp->state);
return 0;
}
#define SM_my_name_sz (1+XDR_QUADLEN(SM_MAXSTRLEN))
#define SM_my_id_sz (SM_my_name_sz+3)
#define SM_mon_name_sz (1+XDR_QUADLEN(SM_MAXSTRLEN))
#define SM_mon_id_sz (SM_mon_name_sz+SM_my_id_sz)
#define SM_priv_sz (XDR_QUADLEN(SM_PRIV_SIZE))
#define SM_mon_sz (SM_mon_id_sz+SM_priv_sz)
#define SM_monres_sz 2
#define SM_unmonres_sz 1
static struct rpc_procinfo nsm_procedures[] = {
[NSMPROC_MON] = {
.p_proc = NSMPROC_MON,
.p_encode = (kxdreproc_t)nsm_xdr_enc_mon,
.p_decode = (kxdrdproc_t)nsm_xdr_dec_stat_res,
.p_arglen = SM_mon_sz,
.p_replen = SM_monres_sz,
.p_statidx = NSMPROC_MON,
.p_name = "MONITOR",
},
[NSMPROC_UNMON] = {
.p_proc = NSMPROC_UNMON,
.p_encode = (kxdreproc_t)nsm_xdr_enc_unmon,
.p_decode = (kxdrdproc_t)nsm_xdr_dec_stat,
.p_arglen = SM_mon_id_sz,
.p_replen = SM_unmonres_sz,
.p_statidx = NSMPROC_UNMON,
.p_name = "UNMONITOR",
},
};
static const struct rpc_version nsm_version1 = {
.number = 1,
.nrprocs = ARRAY_SIZE(nsm_procedures),
.procs = nsm_procedures
};
static const struct rpc_version *nsm_version[] = {
[1] = &nsm_version1,
};
static struct rpc_stat nsm_stats;
static const struct rpc_program nsm_program = {
.name = "statd",
.number = NSM_PROGRAM,
.nrvers = ARRAY_SIZE(nsm_version),
.version = nsm_version,
.stats = &nsm_stats
};
| {
"content_hash": "0549baca7837afbd29ef37e4514019c1",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 80,
"avg_line_length": 25.02173913043478,
"alnum_prop": 0.6671010715320012,
"repo_name": "michelborgess/RealOne-Victara-Kernel",
"id": "606a8dd8818ccadab535636ad41ce4906cbb4b40",
"size": "13930",
"binary": false,
"copies": "985",
"ref": "refs/heads/master",
"path": "fs/lockd/mon.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "4528"
},
{
"name": "Assembly",
"bytes": "8953302"
},
{
"name": "Awk",
"bytes": "18610"
},
{
"name": "C",
"bytes": "458831037"
},
{
"name": "C++",
"bytes": "4466976"
},
{
"name": "Groff",
"bytes": "22788"
},
{
"name": "Lex",
"bytes": "40798"
},
{
"name": "Makefile",
"bytes": "1273896"
},
{
"name": "Objective-C",
"bytes": "751522"
},
{
"name": "Perl",
"bytes": "357940"
},
{
"name": "Python",
"bytes": "32666"
},
{
"name": "Scilab",
"bytes": "21433"
},
{
"name": "Shell",
"bytes": "123788"
},
{
"name": "SourcePawn",
"bytes": "4856"
},
{
"name": "UnrealScript",
"bytes": "20838"
},
{
"name": "Yacc",
"bytes": "83091"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Wed Oct 03 05:15:38 UTC 2012 -->
<TITLE>
Uses of Interface org.apache.hadoop.mapred.TaskUmbilicalProtocol (Hadoop 1.0.4 API)
</TITLE>
<META NAME="date" CONTENT="2012-10-03">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface org.apache.hadoop.mapred.TaskUmbilicalProtocol (Hadoop 1.0.4 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/hadoop/mapred//class-useTaskUmbilicalProtocol.html" target="_top"><B>FRAMES</B></A>
<A HREF="TaskUmbilicalProtocol.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Interface<br>org.apache.hadoop.mapred.TaskUmbilicalProtocol</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.mapred"><B>org.apache.hadoop.mapred</B></A></TD>
<TD>A software framework for easily writing applications which process vast
amounts of data (multi-terabyte data-sets) parallelly on large clusters
(thousands of nodes) built of commodity hardware in a reliable, fault-tolerant
manner. </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.mapred"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> in <A HREF="../../../../../org/apache/hadoop/mapred/package-summary.html">org.apache.hadoop.mapred</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Classes in <A HREF="../../../../../org/apache/hadoop/mapred/package-summary.html">org.apache.hadoop.mapred</A> that implement <A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/mapred/TaskTracker.html" title="class in org.apache.hadoop.mapred">TaskTracker</A></B></CODE>
<BR>
TaskTracker is a process that starts and tracks MR Tasks
in a networked environment.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Fields in <A HREF="../../../../../org/apache/hadoop/mapred/package-summary.html">org.apache.hadoop.mapred</A> declared as <A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A></CODE></FONT></TD>
<TD><CODE><B>Task.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/Task.html#umbilical">umbilical</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../org/apache/hadoop/mapred/package-summary.html">org.apache.hadoop.mapred</A> with parameters of type <A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>Task.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/Task.html#done(org.apache.hadoop.mapred.TaskUmbilicalProtocol, org.apache.hadoop.mapred.Task.TaskReporter)">done</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> umbilical,
<A HREF="../../../../../org/apache/hadoop/mapred/Task.TaskReporter.html" title="class in org.apache.hadoop.mapred">Task.TaskReporter</A> reporter)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract void</CODE></FONT></TD>
<TD><CODE><B>TaskController.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/TaskController.html#initializeJob(java.lang.String, java.lang.String, org.apache.hadoop.fs.Path, org.apache.hadoop.fs.Path, org.apache.hadoop.mapred.TaskUmbilicalProtocol, java.net.InetSocketAddress)">initializeJob</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> user,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> jobid,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> credentials,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> jobConf,
<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> taskTracker,
<A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A> ttAddr)</CODE>
<BR>
Create all of the directories necessary for the job to start and download
all of the job and private distributed cache files.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>DefaultTaskController.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/DefaultTaskController.html#initializeJob(java.lang.String, java.lang.String, org.apache.hadoop.fs.Path, org.apache.hadoop.fs.Path, org.apache.hadoop.mapred.TaskUmbilicalProtocol, java.net.InetSocketAddress)">initializeJob</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> user,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> jobid,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> credentials,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> jobConf,
<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> taskTracker,
<A HREF="http://java.sun.com/javase/6/docs/api/java/net/InetSocketAddress.html?is-external=true" title="class or interface in java.net">InetSocketAddress</A> ttAddr)</CODE>
<BR>
This routine initializes the local file system for running a job.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>JobLocalizer.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/JobLocalizer.html#localizeJobFiles(org.apache.hadoop.mapreduce.JobID, org.apache.hadoop.mapred.JobConf, org.apache.hadoop.fs.Path, org.apache.hadoop.fs.Path, org.apache.hadoop.mapred.TaskUmbilicalProtocol)">localizeJobFiles</A></B>(<A HREF="../../../../../org/apache/hadoop/mapreduce/JobID.html" title="class in org.apache.hadoop.mapreduce">JobID</A> jobid,
<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> jConf,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> localJobFile,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> localJobTokenFile,
<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> taskTracker)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>JobLocalizer.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/JobLocalizer.html#localizeJobFiles(org.apache.hadoop.mapreduce.JobID, org.apache.hadoop.mapred.JobConf, org.apache.hadoop.fs.Path, org.apache.hadoop.mapred.TaskUmbilicalProtocol)">localizeJobFiles</A></B>(<A HREF="../../../../../org/apache/hadoop/mapreduce/JobID.html" title="class in org.apache.hadoop.mapreduce">JobID</A> jobid,
<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> jConf,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> localJobTokenFile,
<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> taskTracker)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B>Task.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/Task.html#reportNextRecordRange(org.apache.hadoop.mapred.TaskUmbilicalProtocol, long)">reportNextRecordRange</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> umbilical,
long nextRecIndex)</CODE>
<BR>
Reports the next executing record range to TaskTracker.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract void</CODE></FONT></TD>
<TD><CODE><B>Task.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/Task.html#run(org.apache.hadoop.mapred.JobConf, org.apache.hadoop.mapred.TaskUmbilicalProtocol)">run</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> job,
<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> umbilical)</CODE>
<BR>
Run this task as a part of the named job.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B>Task.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/Task.html#runJobCleanupTask(org.apache.hadoop.mapred.TaskUmbilicalProtocol, org.apache.hadoop.mapred.Task.TaskReporter)">runJobCleanupTask</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> umbilical,
<A HREF="../../../../../org/apache/hadoop/mapred/Task.TaskReporter.html" title="class in org.apache.hadoop.mapred">Task.TaskReporter</A> reporter)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B>Task.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/Task.html#runJobSetupTask(org.apache.hadoop.mapred.TaskUmbilicalProtocol, org.apache.hadoop.mapred.Task.TaskReporter)">runJobSetupTask</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> umbilical,
<A HREF="../../../../../org/apache/hadoop/mapred/Task.TaskReporter.html" title="class in org.apache.hadoop.mapred">Task.TaskReporter</A> reporter)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>JobLocalizer.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/JobLocalizer.html#runSetup(java.lang.String, java.lang.String, org.apache.hadoop.fs.Path, org.apache.hadoop.mapred.TaskUmbilicalProtocol)">runSetup</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> user,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> jobid,
<A HREF="../../../../../org/apache/hadoop/fs/Path.html" title="class in org.apache.hadoop.fs">Path</A> localJobTokenFile,
<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> taskTracker)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B>Task.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/Task.html#runTaskCleanupTask(org.apache.hadoop.mapred.TaskUmbilicalProtocol, org.apache.hadoop.mapred.Task.TaskReporter)">runTaskCleanupTask</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> umbilical,
<A HREF="../../../../../org/apache/hadoop/mapred/Task.TaskReporter.html" title="class in org.apache.hadoop.mapred">Task.TaskReporter</A> reporter)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B>Task.</B><B><A HREF="../../../../../org/apache/hadoop/mapred/Task.html#statusUpdate(org.apache.hadoop.mapred.TaskUmbilicalProtocol)">statusUpdate</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred">TaskUmbilicalProtocol</A> umbilical)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../org/apache/hadoop/mapred/TaskUmbilicalProtocol.html" title="interface in org.apache.hadoop.mapred"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/hadoop/mapred//class-useTaskUmbilicalProtocol.html" target="_top"><B>FRAMES</B></A>
<A HREF="TaskUmbilicalProtocol.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2009 The Apache Software Foundation
</BODY>
</HTML>
| {
"content_hash": "4dcc1f0787cca8f8ce8e8a6093b66395",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 469,
"avg_line_length": 64.8429003021148,
"alnum_prop": 0.6665424218422401,
"repo_name": "jrnz/hadoop",
"id": "28dba2fdf9ae1a3c3459f19937bbd9334253e468",
"size": "21463",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/api/org/apache/hadoop/mapred/class-use/TaskUmbilicalProtocol.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "401082"
},
{
"name": "C++",
"bytes": "403118"
},
{
"name": "Java",
"bytes": "16204516"
},
{
"name": "JavaScript",
"bytes": "132758"
},
{
"name": "Objective-C",
"bytes": "119767"
},
{
"name": "PHP",
"bytes": "152555"
},
{
"name": "Perl",
"bytes": "149888"
},
{
"name": "Python",
"bytes": "1533822"
},
{
"name": "Ruby",
"bytes": "28485"
},
{
"name": "Shell",
"bytes": "2460133"
},
{
"name": "Smalltalk",
"bytes": "56562"
},
{
"name": "XML",
"bytes": "235590"
}
],
"symlink_target": ""
} |
'use strict';
Connector.playerSelector = '#player-cover';
Connector.getArtist = () => document.querySelector('input#artist').value;
Connector.getTrack = () => document.querySelector('input#title').value;
Connector.getAlbum = () => document.querySelector('input#album').value;
Connector.playButtonSelector = '#player-cover #player-btn-playpause.ui-icon-play';
Connector.trackArtSelector = '#player-cover img#coverart';
// original selectors are `#duration-label .currentTime` and `#duration-label .endTime`
// but these values are pretty unstable during loading time
Connector.getCurrentTime = () => document.querySelector('#player').currentTime;
Connector.getDuration = () => document.querySelector('#player').duration;
Connector.getUniqueID = () => {
const src = document.querySelector('#player').src;
return src && src.match(/id=([^&]*)/i)[1] || null;
};
Connector.isScrobblingAllowed = () => Util.isElementVisible(Connector.playerSelector);
| {
"content_hash": "b87f76bce22b5479abbb14ee085013cc",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 87,
"avg_line_length": 36.76923076923077,
"alnum_prop": 0.7343096234309623,
"repo_name": "galeksandrp/web-scrobbler",
"id": "3998729dd45433568c8d05b052e7517252a1c0c1",
"size": "956",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "src/connectors/subfire.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4636"
},
{
"name": "HTML",
"bytes": "22413"
},
{
"name": "JavaScript",
"bytes": "470918"
}
],
"symlink_target": ""
} |
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef MIVALIDATE_H
#define MIVALIDATE_H
#include "regionstr.h"
typedef union _Validate {
struct BeforeValidate {
DDXPointRec oldAbsCorner; /* old window position */
RegionPtr borderVisible; /* visible region of border, */
/* non-null when size changes */
Bool resized; /* unclipped winSize has changed - */
/* don't call SaveDoomedAreas */
} before;
struct AfterValidate {
RegionRec exposed; /* exposed regions, absolute pos */
RegionRec borderExposed;
} after;
} ValidateRec;
#endif /* MIVALIDATE_H */
| {
"content_hash": "0b4d0296aa7e46f9280914b890ef3d9f",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 57,
"avg_line_length": 23.03846153846154,
"alnum_prop": 0.6961602671118531,
"repo_name": "egraba/vbox_openbsd",
"id": "ef258c0f89bc30a9290a420b6c20b3eb99606128",
"size": "1741",
"binary": false,
"copies": "135",
"ref": "refs/heads/master",
"path": "VirtualBox-5.0.0/src/VBox/Additions/x11/x11include/xorg-server-1.9.0/mivalidate.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ada",
"bytes": "88714"
},
{
"name": "Assembly",
"bytes": "4303680"
},
{
"name": "AutoIt",
"bytes": "2187"
},
{
"name": "Batchfile",
"bytes": "95534"
},
{
"name": "C",
"bytes": "192632221"
},
{
"name": "C#",
"bytes": "64255"
},
{
"name": "C++",
"bytes": "83842667"
},
{
"name": "CLIPS",
"bytes": "5291"
},
{
"name": "CMake",
"bytes": "6041"
},
{
"name": "CSS",
"bytes": "26756"
},
{
"name": "D",
"bytes": "41844"
},
{
"name": "DIGITAL Command Language",
"bytes": "56579"
},
{
"name": "DTrace",
"bytes": "1466646"
},
{
"name": "GAP",
"bytes": "350327"
},
{
"name": "Groff",
"bytes": "298540"
},
{
"name": "HTML",
"bytes": "467691"
},
{
"name": "IDL",
"bytes": "106734"
},
{
"name": "Java",
"bytes": "261605"
},
{
"name": "JavaScript",
"bytes": "80927"
},
{
"name": "Lex",
"bytes": "25122"
},
{
"name": "Logos",
"bytes": "4941"
},
{
"name": "Makefile",
"bytes": "426902"
},
{
"name": "Module Management System",
"bytes": "2707"
},
{
"name": "NSIS",
"bytes": "177212"
},
{
"name": "Objective-C",
"bytes": "5619792"
},
{
"name": "Objective-C++",
"bytes": "81554"
},
{
"name": "PHP",
"bytes": "58585"
},
{
"name": "Pascal",
"bytes": "69941"
},
{
"name": "Perl",
"bytes": "240063"
},
{
"name": "PowerShell",
"bytes": "10664"
},
{
"name": "Python",
"bytes": "9094160"
},
{
"name": "QMake",
"bytes": "3055"
},
{
"name": "R",
"bytes": "21094"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Shell",
"bytes": "1460572"
},
{
"name": "SourcePawn",
"bytes": "4139"
},
{
"name": "TypeScript",
"bytes": "142342"
},
{
"name": "Visual Basic",
"bytes": "7161"
},
{
"name": "XSLT",
"bytes": "1034475"
},
{
"name": "Yacc",
"bytes": "22312"
}
],
"symlink_target": ""
} |
require 'active_merchant/billing/integrations/netgiro/response_fields'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
module Integrations #:nodoc:
module Netgiro
class Return < ActiveMerchant::Billing::Integrations::Return
include ResponseFields
end
end
end
end
end
| {
"content_hash": "d6ab47dda2e4accdd3332522ae35fef2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 70,
"avg_line_length": 25,
"alnum_prop": 0.6953846153846154,
"repo_name": "guitarparty/active_merchant",
"id": "c4d667d80e674afa39cc08f4d2a756f3e53755c6",
"size": "325",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/active_merchant/billing/integrations/netgiro/return.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "3726345"
}
],
"symlink_target": ""
} |
Ti=ARTICLE 11 - AGRÉMENT DES TIERS
1.sec=Les parts sociales sont librement cessibles entre : {Co.Corp.Share.list}
2.sec=Elles ne peuvent être transmises à des tiers, autres que les catégories visées ci-dessus, qu'avec le consentement de la majorité des associés représentant au moins la moitié des parts sociales.
3.sec=Ce consentement est sollicité dans les conditions prévues par la loi.
=[Z/paras/s3] | {
"content_hash": "bf720b1cb30901f2bd39301f9ccbcac3",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 199,
"avg_line_length": 45.22222222222222,
"alnum_prop": 0.7911547911547911,
"repo_name": "CommonAccord/Cmacc-Source",
"id": "40d6a56b433660088b38afc30c0bc34f738e64fe",
"size": "418",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Doc/GH/Paris2/ServicePublic/StatutsSARL/Sec/11/0.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2498"
},
{
"name": "PHP",
"bytes": "1231"
}
],
"symlink_target": ""
} |
<?php
/**
* Provides JavaScript scripts for creating switchable tabs.
*
* @since 3.0.0
* @since 3.3.0 Extends `AdminPageFramework_Script_Base`.
* @package AdminPageFramework
* @subpackage JavaScript
* @internal
*/
class AdminPageFramework_Script_Tab extends AdminPageFramework_Script_Base {
/**
* Returns the script.
*
* @since 3.0.0
* @since 3.3.0 Changed the name from `getjQueryPlugin()`.
*/
static public function getScript() {
$_aParams = func_get_args() + array( null );
$_oMsg = $_aParams[ 0 ];
return <<<JAVASCRIPTS
( function( $ ) {
$.fn.createTabs = function( asOptions ) {
var _bIsRefresh = ( typeof asOptions === 'string' && asOptions === 'refresh' );
if ( typeof asOptions === 'object' )
var aOptions = $.extend( {
}, asOptions );
this.children( 'ul' ).each( function () {
var bSetActive = false;
$( this ).children( 'li' ).each( function( i ) {
var sTabContentID = $( this ).children( 'a' ).attr( 'href' );
if ( ! _bIsRefresh && ! bSetActive && $( this ).is( ':visible' ) ) {
$( this ).addClass( 'active' );
bSetActive = true;
}
if ( $( this ).hasClass( 'active' ) ) {
$( sTabContentID ).show();
} else {
$( sTabContentID ).css( 'display', 'none' );
}
$( this ).addClass( 'nav-tab' );
$( this ).children( 'a' ).addClass( 'anchor' );
$( this ).unbind( 'click' ); // for refreshing
$( this ).click( function( e ){
e.preventDefault(); // Prevents jumping to the anchor which moves the scroll bar.
// Remove the active tab and set the clicked tab to be active.
$( this ).siblings( 'li.active' ).removeClass( 'active' );
$( this ).addClass( 'active' );
// Find the element id and select the content element with it.
var sTabContentID = $( this ).find( 'a' ).attr( 'href' );
var _oActiveContent = $( this ).parent().parent().find( sTabContentID ).css( 'display', 'block' );
_oActiveContent.siblings( ':not( ul )' ).css( 'display', 'none' );
});
});
});
};
}( jQuery ));
JAVASCRIPTS;
}
} | {
"content_hash": "1e71e5c481a40fad4847fadd8f7bccce",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 119,
"avg_line_length": 35.63291139240506,
"alnum_prop": 0.43090586145648313,
"repo_name": "BST-Plus/BST-Plus",
"id": "6acd0a750834a9e29c1d5f0e003e9063316d4a55",
"size": "2956",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "includes/options/library/development/_view/AdminPageFramework_Script/AdminPageFramework_Script_Tab.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "20113"
},
{
"name": "HTML",
"bytes": "53429"
},
{
"name": "JavaScript",
"bytes": "39559"
},
{
"name": "PHP",
"bytes": "2346405"
}
],
"symlink_target": ""
} |
document.appLauncher = (function (document, window) {
console.log("app-launcher loaded.");
function init(containerElement, apps) {
var table = document.createElement("table");
table.className = "app-launcher-apps";
var tr = document.createElement("tr");
table.appendChild(tr);
var columns = 5; // todo option.
apps.forEach(function(app, index) {
if (index % columns === 0) {
tr = document.createElement("tr");
table.appendChild(tr);
}
var td = document.createElement("td");
tr.appendChild(td);
var a = document.createElement("a");
a.href = app.href;
a.title = app.name; // Added because of the ellipses.
// todo: support images in the future.
//var img = document.createElement("img");
//img.src = "http://placehold.it/100x100";
//a.appendChild(img);
var div = document.createElement("div");
var iconLetter = (app.name) ? app.name.substring(0, 1).toLowerCase() : "z";
div.className = "app-launcher-icon-" + iconLetter
+ " app-launcher-icon-" + app.name.toLowerCase().replace(" ", "-").replace(/\W/g, "");
var span = document.createElement("span");
var iconText = document.createTextNode(iconLetter);
span.appendChild(iconText);
div.appendChild(span);
a.appendChild(div);
var linkText = document.createTextNode(app.name);
a.appendChild(linkText);
td.appendChild(a);
});
while (containerElement.firstChild) {
containerElement.removeChild(containerElement.firstChild);
}
containerElement.appendChild(table);
}
/**
* Use XHR to get the dom of the app list page.
* @param {} callback
* @returns {}
*/
function getAppListDom(uri, callback) {
var xhr = new XMLHttpRequest();
xhr.onload = function () {
console.log(this.responseXML.title);
callback(this.responseXML);
}
xhr.open("GET", uri);
xhr.responseType = "document";
xhr.send();
}
/**
* Using a dom, find the app list table and convert into an object.
*/
function tableDomToAppList(columnNumber, dom) {
console.log(dom.title);
var rows = dom.querySelector("table").querySelectorAll("tr");
var apps = [];
// start at 1 since the first row is a header.
for (var index = 1; index < rows.length; index++) {
var name = rows[index].cells[0].innerText.trim();
var a = rows[index].cells[columnNumber].querySelector("a");
if (!a) {
continue;
}
apps.push({ "name": name, "href": a.href });
}
console.log(JSON.stringify(apps));
return apps;
}
/**
* Get the app list data from a table on a page.
* To prevent CORS issues: Use relative URL, protocol agnostic (beginning with //),
* or "direct" url without redirects.
* Give the table column number starting with zero.
* @param {} uri
* @param {} columnNumber
* @param {} callback
* @returns {}
*/
function scrapeTable(uri, columnNumber, callback) {
getAppListDom(uri, function (dom) {
var appList = tableDomToAppList(columnNumber, dom);
callback(appList);
});
}
return {
"init": init,
"scrapeTable" : scrapeTable
};
})(document, window); | {
"content_hash": "b56994525b2f628361121537c3cf7ef7",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 102,
"avg_line_length": 31.53448275862069,
"alnum_prop": 0.5481137233460908,
"repo_name": "jesslilly/app-launcher.js",
"id": "3b96b0cd5b9971486db6ee8564697a7ec78ea1e6",
"size": "3660",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app-launcher/wwwroot/js/app-launcher.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "16740"
},
{
"name": "CSS",
"bytes": "5861"
},
{
"name": "HTML",
"bytes": "6663"
},
{
"name": "JavaScript",
"bytes": "6706"
}
],
"symlink_target": ""
} |
package proyect.travelassistant.carousels;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.koushikdutta.ion.Ion;
import proyect.travelassistant.R;
/**
* Created by Pablo on 03/08/2017.
*/
public class ItemCarrouselDownFragment extends Fragment {
private ImageView iv_item;
private TextView tv_item;
public static Fragment newInstance(Context context, String urlImage, String text) {
Bundle b = new Bundle();
b.putString("urlImage", urlImage);
b.putString("text", text);
return Fragment.instantiate(context, ItemCarrouselDownFragment.class.getName(), b);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ViewGroup rootView = (ViewGroup) inflater.inflate(
R.layout.fragment_item_carrousel_down, container, false);
String urlImage = (String) this.getArguments().getSerializable("urlImage");
String text = (String) this.getArguments().getSerializable("text");
iv_item = (ImageView) rootView.findViewById(R.id.imageViewItemDown);
Ion.with(iv_item).error(R.drawable.pixel_vacio).load(urlImage);
tv_item = (TextView) rootView.findViewById(R.id.textViewItemDown);
tv_item.setText(text);
return rootView;
}
}
| {
"content_hash": "d577fb288d2bbb2eb0e6e7d79aa1d339",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 91,
"avg_line_length": 31.32,
"alnum_prop": 0.7049808429118773,
"repo_name": "pdehevia/TravelAssistant",
"id": "9f5b71b10bb03b86a79e4b5252fc7e707e305314",
"size": "1566",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "TravelAssistant/app/src/main/java/proyect/travelassistant/carousels/ItemCarrouselDownFragment.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "340928"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "d6f8988de6425982d6ff035251a82723",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "2e7de738b60dc04d434ef420e9983f5818ee8e7b",
"size": "196",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Habenaria/Habenaria excelsa/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/**
* © 2014 SAP AG. All rights reserved.
*/
package com.sap.bnet.ws.facade;
import com.sap.bnet.ws.model.PackageElement;
/**
* @title
* @description
* @usage
* @author I075320<[email protected]>
* @version ITradeService.java,v 1.0
* @create Sep 29, 2014 6:56:54 PM
*/
public interface ITradeServiceFacade {
public String getPortalRequest(String streamingNo,String randNo);
public String getEncodeString(String decode);
public PackageElement getPortalResult(String reqXML);
}
| {
"content_hash": "ae0fac185f87770ade2d481b58b1f67b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 66,
"avg_line_length": 20.833333333333332,
"alnum_prop": 0.726,
"repo_name": "saintaxl/work",
"id": "2c574239d66cd16264fed3399ab03855bb045349",
"size": "501",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bnet/src/main/java/com/sap/bnet/ws/facade/ITradeServiceFacade.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "2962"
},
{
"name": "Java",
"bytes": "127569"
}
],
"symlink_target": ""
} |
package com.navercorp.pinpoint.profiler.objectfactory;
import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass;
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod;
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.Name;
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.NoCache;
import com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScope;
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
import com.navercorp.pinpoint.exception.PinpointException;
import com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService;
import com.navercorp.pinpoint.profiler.util.TypeUtils;
import java.lang.annotation.Annotation;
/**
* @author Jongho Moon
*
*/
public class InterceptorArgumentProvider implements ArgumentProvider {
private final DataSourceMonitorRegistry dataSourceMonitorRegistry;
private final ApiMetaDataService apiMetaDataService;
private final InterceptorScope interceptorScope;
private final InstrumentClass targetClass;
private final InstrumentMethod targetMethod;
public InterceptorArgumentProvider(DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService, InstrumentClass targetClass) {
this(dataSourceMonitorRegistry, apiMetaDataService, null, targetClass, null);
}
public InterceptorArgumentProvider(DataSourceMonitorRegistry dataSourceMonitorRegistry, ApiMetaDataService apiMetaDataService, InterceptorScope interceptorScope, InstrumentClass targetClass, InstrumentMethod targetMethod) {
if (dataSourceMonitorRegistry == null) {
throw new NullPointerException("dataSourceMonitorRegistry must not be null");
}
if (apiMetaDataService == null) {
throw new NullPointerException("apiMetaDataService must not be null");
}
this.dataSourceMonitorRegistry = dataSourceMonitorRegistry;
this.apiMetaDataService = apiMetaDataService;
this.interceptorScope = interceptorScope;
this.targetClass = targetClass;
this.targetMethod = targetMethod;
}
@Override
public Option get(int index, Class<?> type, Annotation[] annotations) {
if (type == InstrumentClass.class) {
return Option.withValue(targetClass);
} else if (type == MethodDescriptor.class) {
MethodDescriptor descriptor = targetMethod.getDescriptor();
cacheApiIfAnnotationNotPresent(annotations, descriptor);
return Option.withValue(descriptor);
} else if (type == InstrumentMethod.class) {
return Option.withValue(targetMethod);
} else if (type == InterceptorScope.class) {
Name annotation = TypeUtils.findAnnotation(annotations, Name.class);
if (annotation == null) {
if (interceptorScope == null) {
throw new PinpointException("Scope parameter is not annotated with @Name and the target class is not associated with any Scope");
} else {
return Option.withValue(interceptorScope);
}
} else {
return Option.empty();
}
} else if (type == DataSourceMonitorRegistry.class) {
return Option.withValue(dataSourceMonitorRegistry);
}
return Option.empty();
}
private void cacheApiIfAnnotationNotPresent(Annotation[] annotations, MethodDescriptor descriptor) {
Annotation annotation = TypeUtils.findAnnotation(annotations, NoCache.class);
if (annotation == null) {
this.apiMetaDataService.cacheApi(descriptor);
}
}
}
| {
"content_hash": "9057586bce92bcc8d42529776df4da0c",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 227,
"avg_line_length": 46.21951219512195,
"alnum_prop": 0.7197889182058047,
"repo_name": "denzelsN/pinpoint",
"id": "f89a7a8d2c950c3c0e4370106dc9e800bd3aa804",
"size": "4383",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "profiler/src/main/java/com/navercorp/pinpoint/profiler/objectfactory/InterceptorArgumentProvider.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "22887"
},
{
"name": "CSS",
"bytes": "614658"
},
{
"name": "CoffeeScript",
"bytes": "10124"
},
{
"name": "Groovy",
"bytes": "1423"
},
{
"name": "HTML",
"bytes": "775712"
},
{
"name": "Java",
"bytes": "13863723"
},
{
"name": "JavaScript",
"bytes": "4817037"
},
{
"name": "Makefile",
"bytes": "5246"
},
{
"name": "PLSQL",
"bytes": "4156"
},
{
"name": "Python",
"bytes": "3523"
},
{
"name": "Ruby",
"bytes": "943"
},
{
"name": "Shell",
"bytes": "31667"
},
{
"name": "Thrift",
"bytes": "14916"
},
{
"name": "TypeScript",
"bytes": "1449771"
}
],
"symlink_target": ""
} |
package kz.epam.zd.action;
import kz.epam.zd.model.Book;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
import static kz.epam.zd.util.ConstantHolder.*;
/**
* Customer action to add Book to the session shopping cart.
*/
public class AddBookToCartAction implements Action {
@Override
public String execute(HttpServletRequest request, HttpServletResponse response) {
Book bookToAddToCart = (Book) request.getSession().getAttribute(BOOK);
HashMap hashMap = (HashMap) request.getSession().getAttribute(CART);
//noinspection unchecked
putBookToCartIfAbsent(bookToAddToCart, hashMap);
request.getSession().setAttribute(CART, hashMap);
String referrer = request.getHeader(REFERER);
return REDIRECT_PREFIX + referrer;
}
/**
* Checks whether book is already present in user's shopping cart and puts one
* entity of it if not.
*
* @param bookToAddToCart book to be checked in the cart and put if absent
* @param hashMap shopping cart HashMap instance
*/
private void putBookToCartIfAbsent(Book bookToAddToCart, HashMap<Book, Integer> hashMap) {
boolean isAbsent = true;
for (Object o : hashMap.entrySet()) {
Map.Entry pair = (Map.Entry) o;
Book book1 = (Book) pair.getKey();
if (book1.getId().equals(bookToAddToCart.getId()))
isAbsent = false;
}
if (isAbsent) {
hashMap.put(bookToAddToCart, ONE);
}
}
}
| {
"content_hash": "12b5cfc13883fed1ad88bfe4b3ea564a",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 94,
"avg_line_length": 33.520833333333336,
"alnum_prop": 0.670602858918583,
"repo_name": "zdiyax/book-shop-web",
"id": "082c46189df5811edfb97f1d4df321b6ab207b24",
"size": "1609",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/kz/epam/zd/action/AddBookToCartAction.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3404"
},
{
"name": "Java",
"bytes": "168321"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">c:geo - επαφές (πρόσθετο)</string>
<string name="contact_not_found">Δεν βρέθηκαν στοιχεία για την επαφή με το ψευδώνυμο %s. Προσθέστε την στην εφαρμογή \'Επαφές\' πρώτα.</string>
<string name="multiple_matches">Πολλαπλά αποτελέσματα</string>
<!-- permission handling -->
<string name="ask_again">Ρωτήστε με πάλι</string>
<string name="close">Κλείσιμο</string>
<string name="goto_app_details">Άνοιγμα πληροφοριών εφαρμογής</string>
<string name="contacts_permission_request_denied">Πρέπει να επιτρέψετε στο \"c:geo - contacts\" την πρόσβαση στον τηλεφωνικό σας κατάλογο ώστε να εντοπίσει το όνομα του χρήστη.</string>
<string name="contacts_permission_request_explanation">Το \"c:geo - contacts\" μπορεί να βρει τον παίκτη στον τηλεφωνικό σας κατάλογο αναζητώντας το όνομα του. Για να καταστεί αυτό δυνατό, πρέπει να παραχωρήσετε στην εφαρμογή την άδεια πρόσβασης.</string>
</resources>
| {
"content_hash": "47e4c447a153b50b70492d749ee16514",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 259,
"avg_line_length": 83.08333333333333,
"alnum_prop": 0.7392176529588766,
"repo_name": "S-Bartfast/cgeo",
"id": "879c2c8005da89ede6b0cd401f3e05f4392590b7",
"size": "1386",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "cgeo-contacts/res/values-el/strings.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "3615702"
},
{
"name": "Java",
"bytes": "4477299"
},
{
"name": "Shell",
"bytes": "8245"
}
],
"symlink_target": ""
} |
using PlainElastic.Net.Utils;
namespace PlainElastic.Net.Mappings
{
/// <summary>
/// Builds a mapping that allows to map certain sections in the document indexed as nested allowing to query them as if they are separate docs joining with the parent owning doc.
/// http://www.elasticsearch.org/guide/reference/mapping/nested-type.html
/// </summary>
public class NestedObject<T> : ObjectBase<T, NestedObject<T>>
{
/// <summary>
/// Allows to object fields be automatically added to the immediate parent.
/// </summary>
public NestedObject<T> IncludeInParent(bool includeInParent = false)
{
RegisterCustomJsonMap("'include_in_parent ': {0}", includeInParent.AsString());
return this;
}
/// <summary>
/// Allows to object fields be automatically added to the root object.
/// </summary>
public NestedObject<T> IncludeInRoot(bool includeInRoot = false)
{
RegisterCustomJsonMap("'include_in_root ': {0}", includeInRoot.AsString());
return this;
}
protected override string ApplyMappingTemplate(string mappingBody)
{
if (mappingBody.IsNullOrEmpty())
return "{0}: {{ 'type': 'nested' }}".AltQuoteF(Name.Quotate());
return "{0}: {{ 'type': 'nested',{1} }}".AltQuoteF(Name.Quotate(), mappingBody);
}
}
} | {
"content_hash": "dfcbdc2414df49460f34d1585eebfd84",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 182,
"avg_line_length": 36.15,
"alnum_prop": 0.6106500691562933,
"repo_name": "yonglehou/PlainElastic.Net",
"id": "b0a13569a517793ebbcf2583a1bb1073667ddde7",
"size": "1446",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/PlainElastic.Net/Builders/Mappings/NestedObject.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1324"
},
{
"name": "C#",
"bytes": "1318573"
}
],
"symlink_target": ""
} |
.soria .dijitSliderProgressBarH {
border-color: #b1badf;
background: #c0c2c5 url("../images/sliderFull.png") repeat-x top left;
}
.soria .dijitSliderProgressBarV {
border-color: #b1badf;
background: #c0c2c5 url("../images/sliderFullVertical.png") repeat-y bottom left;
}
.soria .dijitSliderFocused .dijitSliderProgressBarH,
.soria .dijitSliderFocused .dijitSliderLeftBumper {
background-image:url("../images/sliderFullFocus.png");
}
.soria .dijitSliderFocused .dijitSliderProgressBarV,
.soria .dijitSliderFocused .dijitSliderBottomBumper {
background-image:url("../images/sliderFullVerticalFocus.png");
}
.soria .dijitSliderRemainingBarV {
border-color: #b4b4b4;
background: #dcdcdc url("../images/sliderEmptyVertical.png") repeat-y bottom left;
}
.soria .dijitSliderRemainingBarH {
border-color: #b4b4b4;
background: #dcdcdc url("../images/sliderEmpty.png") repeat-x top left;
}
.soria .dijitSliderBar {
border-style: solid;
outline:1px;
}
.soria .dijitSliderFocused .dijitSliderBar {
border-color:#8ba0bd;
}
.soria .dijitSliderImageHandleH {
border:0px;
width:15px;
height:18px;
background:url("../images/preciseSliderThumb.png") no-repeat center top;
}
.soria .dijitSliderFocused .dijitSliderImageHandleH {
background-image:url("../images/preciseSliderThumbFocus.png");
#background-image:url("../images/preciseSliderThumbFocus.gif");
}
.dj_ie6 .soria .dijitSliderImageHandleH {
background-image:url("../images/preciseSliderThumb.gif");
}
.soria .dijitSliderLeftBumper {
border-left-width: 1px;
border-color: #aab0bb;
background: #c0c2c5 url("../images/sliderFull.png") repeat-x top left;
}
.soria .dijitSliderRightBumper {
background: #dcdcdc url("../images/sliderEmpty.png") repeat-x top left;
border-color: #b4b4b4;
border-right-width: 1px;
}
.soria .dijitSliderImageHandleV {
border:0px;
width:20px;
height:15px;
background:url("../images/sliderThumb.png") no-repeat center center;
#background:url("../images/sliderThumb.gif") no-repeat center center;
}
.soria .dijitSliderFocused .dijitSliderImageHandleV {
background-image:url("../images/sliderThumbFocus.png");
#background-image:url("../images/sliderThumbFocus.gif");
}
.soria .dijitSliderBottomBumper {
border-bottom-width: 1px;
border-color: #aab0bb;
background: #c0c2c5 url("../images/sliderFullVertical.png") repeat-y bottom left;
}
.soria .dijitSliderTopBumper {
background: #dcdcdc url("../images/sliderEmptyVertical.png") repeat-y top left;
border-color: #b4b4b4;
border-top-width: 1px;
}
.soria .dijitSliderIncrementIconH,
.soria .dijitSliderIncrementIconV {
background:url('../images/spriteRoundedIconsSmall.png') no-repeat -45px top;
#background:url('../images/spriteRoundedIconsSmall.gif') no-repeat -45px top;
width:15px; height:15px;
}
.soria .dijitSliderIncrementIconH {
background:url('../images/spriteRoundedIconsSmall.png') no-repeat -30px top;
#background:url('../images/spriteRoundedIconsSmall.gif') no-repeat -30px top;
}
.soria .dijitSliderDecrementIconH,
.soria .dijitSliderDecrementIconV {
width:15px;
height:15px;
background:url('../images/spriteRoundedIconsSmall.png') no-repeat -15px top;
#background:url('../images/spriteRoundedIconsSmall.gif') no-repeat -15px top;
}
.soria .dijitSliderDecrementIconH {
background:url('../images/spriteRoundedIconsSmall.png') no-repeat 0px top;
#background:url('../images/spriteRoundedIconsSmall.gif') no-repeat 0px top;
}
.soria .dijitSliderButtonInner {
visibility:hidden;
}
.soria .dijitSliderReadOnly *,
.soria .dijitSliderDisabled * {
border-color: #d5d5d5 #bdbdbd #bdbdbd #d5d5d5;
color: #bdbdbd;
}
.soria .dijitSliderReadOnly .dijitSliderDecrementIconH,
.soria .dijitSliderDisabled .dijitSliderDecrementIconH {
background-position: 0px -15px;
}
.soria .dijitSliderReadOnly .dijitSliderIncrementIconH,
.soria .dijitSliderDisabled .dijitSliderIncrementIconH {
background-position: -30px -15px;
}
.soria .dijitSliderReadOnly .dijitSliderDecrementIconV,
.soria .dijitSliderDisabled .dijitSliderDecrementIconV {
background-position: -15px -15px;
}
.soria .dijitSliderReadOnly .dijitSliderIncrementIconV,
.soria .dijitSliderDisabled .dijitSliderIncrementIconV {
background-position: -45px -15px;
}
| {
"content_hash": "aecb4cfa9f5771eb51463ae28fb08ad7",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 83,
"avg_line_length": 34.52892561983471,
"alnum_prop": 0.7714217328865486,
"repo_name": "emboss/pekan",
"id": "72e48b678eda6e15486061adc4dcf19e384fd099",
"size": "4179",
"binary": false,
"copies": "13",
"ref": "refs/heads/master",
"path": "lib/public/js/dijit/themes/soria/form/Slider.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "2779267"
},
{
"name": "Ruby",
"bytes": "1661"
}
],
"symlink_target": ""
} |
<?php
namespace Symfony\Component\Security\Core\Exception;
/**
* This exception is thrown when no session is available.
*
* Possible reasons for this are:
*
* a) The session timed out because the user waited too long.
* b) The user has disabled cookies, and a new session is started on each
* request.
*
* @author Johannes M. Schmitt <[email protected]>
* @author Alexander <[email protected]>
*/
class SessionUnavailableException extends AuthenticationException {
/**
* {@inheritdoc}
*/
public function getMessageKey() {
return 'No session available, it either timed out or cookies are not enabled.';
}
}
| {
"content_hash": "2ebf0fe8e1e4e8a54560b95cfd995e2e",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 87,
"avg_line_length": 24.035714285714285,
"alnum_prop": 0.6820208023774146,
"repo_name": "Amaire/filmy",
"id": "db9e65266e6ef8083f86c953140f3a4947710f09",
"size": "902",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/symfony/security-core/Symfony/Component/Security/Core/Exception/SessionUnavailableException.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "356"
},
{
"name": "JavaScript",
"bytes": "504"
},
{
"name": "PHP",
"bytes": "105599"
}
],
"symlink_target": ""
} |
package com.intellij.history.integration.ui;
import com.intellij.history.integration.TestVirtualFile;
import com.intellij.history.integration.ui.actions.LocalHistoryAction;
import com.intellij.history.integration.ui.actions.ShowHistoryAction;
import com.intellij.history.integration.ui.actions.ShowSelectionHistoryAction;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsDataKeys;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import static com.intellij.util.containers.UtilKt.stream;
public class LocalHistoryActionsTest extends LocalHistoryUITestCase {
VirtualFile f;
Editor editor;
Document document;
@Override
protected void setUpInWriteAction() throws Exception {
super.setUpInWriteAction();
f = createChildData(myRoot, "f.txt");
document = FileDocumentManager.getInstance().getDocument(f);
document.setText("foo");
editor = getEditorFactory().createEditor(document, myProject);
}
@Override
protected void tearDown() throws Exception {
try {
getEditorFactory().releaseEditor(editor);
}
catch (Throwable e) {
addSuppressedException(e);
}
finally {
super.tearDown();
}
}
private static EditorFactory getEditorFactory() {
return EditorFactory.getInstance();
}
public void testShowHistoryAction() {
ShowHistoryAction a = new ShowHistoryAction();
assertStatus(a, myRoot, true);
assertStatus(a, f, true);
assertStatus(a, null, false);
assertStatus(a, createChildData(myRoot, "f.hprof"), false);
assertStatus(a, createChildData(myRoot, "f.xxx"), false);
}
public void testLocalHistoryActionDisabledWithoutProject() {
LocalHistoryAction a = new LocalHistoryAction() {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
}
};
assertStatus(a, myRoot, myProject, true);
assertStatus(a, myRoot, null, false);
}
public void testShowHistoryActionIsDisabledForMultipleSelection() {
ShowHistoryAction a = new ShowHistoryAction();
assertStatus(a, new VirtualFile[] {f, new TestVirtualFile("ff")}, myProject, false);
}
public void testShowSelectionHistoryActionForSelection() {
editor.getSelectionModel().setSelection(0, 2);
ShowSelectionHistoryAction a = new ShowSelectionHistoryAction();
AnActionEvent e = createEventFor(a, new VirtualFile[] {f}, myProject);
a.update(e);
assertTrue(e.getPresentation().isEnabled());
assertEquals("Show History for Selection", e.getPresentation().getText());
}
public void testShowSelectionHistoryActionIsDisabledForNonFiles() {
ShowSelectionHistoryAction a = new ShowSelectionHistoryAction();
assertStatus(a, myRoot, false);
assertStatus(a, null, false);
}
public void testShowSelectionHistoryActionIsEnabledForEmptySelection() {
ShowSelectionHistoryAction a = new ShowSelectionHistoryAction();
assertStatus(a, f, true);
}
private void assertStatus(AnAction a, VirtualFile f, boolean isEnabled) {
assertStatus(a, f, myProject, isEnabled);
}
private void assertStatus(AnAction a, VirtualFile f, Project p, boolean isEnabled) {
VirtualFile[] files = f == null ? null : new VirtualFile[]{f};
assertStatus(a, files, p, isEnabled);
}
private void assertStatus(AnAction a, VirtualFile[] files, Project p, boolean isEnabled) {
AnActionEvent e = createEventFor(a, files, p);
a.update(e);
assertEquals(isEnabled, e.getPresentation().isEnabled());
}
private AnActionEvent createEventFor(AnAction a, final VirtualFile[] files, final Project p) {
DataContext dc = id -> {
if (VcsDataKeys.VIRTUAL_FILE_STREAM.is(id)) return stream(files);
if (CommonDataKeys.EDITOR.is(id)) return editor;
if (CommonDataKeys.PROJECT.is(id)) return p;
return null;
};
return AnActionEvent.createFromAnAction(a, null, "", dc);
}
}
| {
"content_hash": "5c74f0b7846250f3b2b2f3b6ac094073",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 96,
"avg_line_length": 33.69767441860465,
"alnum_prop": 0.7421210029905682,
"repo_name": "msebire/intellij-community",
"id": "139e6c92870b16b93a6556610280c39ebf141807",
"size": "4947",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "platform/platform-tests/testSrc/com/intellij/history/integration/ui/LocalHistoryActionsTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<title>AdminDesigns - A Responsive HTML5 Admin UI Framework</title>
<meta name="keywords" content="HTML5 Bootstrap 3 Admin Template UI Theme" />
<meta name="description" content="AdminDesigns - A Responsive HTML5 Admin UI Framework">
<meta name="author" content="AdminDesigns">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Font CSS (Via CDN) -->
<link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700'>
<!-- Theme CSS -->
<link rel="stylesheet" type="text/css" href="assets/skin/default_skin/css/theme.css">
<!-- Favicon -->
<link rel="shortcut icon" href="assets/img/favicon.ico">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body class="blank-page">
<!-- Start: Main -->
<div id="main">
<!-- Start: Header -->
<header class="navbar navbar-fixed-top bg-primary">
<div class="navbar-branding">
<a class="navbar-brand" href="dashboard.html">
<b>Admin</b>Designs
</a>
<span id="toggle_sidemenu_l" class="ad ad-lines"></span>
</div>
<ul class="nav navbar-nav navbar-left">
<li>
<a class="sidebar-menu-toggle" href="layout_navbar-search-alt.html#">
<span class="ad ad-ruby fs18"></span>
</a>
</li>
<li>
<a class="topbar-menu-toggle" href="layout_navbar-search-alt.html#">
<span class="ad ad-wand fs16"></span>
</a>
</li>
<li class="hidden-xs">
<a class="request-fullscreen toggle-active" href="layout_navbar-search-alt.html#">
<span class="ad ad-screen-full fs18"></span>
</a>
</li>
</ul>
<form class="navbar-form navbar-left navbar-search alt" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search..." value="Search...">
</div>
</form>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="layout_navbar-search-alt.html#">
<span class="ad ad-radio-tower fs18"></span>
</a>
<ul class="dropdown-menu media-list w350 animated animated-shorter fadeIn" role="menu">
<li class="dropdown-header">
<span class="dropdown-title"> Notifications</span>
<span class="label label-warning">12</span>
</li>
<li class="media">
<a class="media-left" href="layout_navbar-search-alt.html#"> <img src="assets/img/avatars/5.jpg" class="mw40" alt="avatar"> </a>
<div class="media-body">
<h5 class="media-heading">Article
<small class="text-muted">- 08/16/22</small>
</h5> Last Updated 36 days ago by
<a class="text-system" href="layout_navbar-search-alt.html#"> Max </a>
</div>
</li>
<li class="media">
<a class="media-left" href="layout_navbar-search-alt.html#"> <img src="assets/img/avatars/2.jpg" class="mw40" alt="avatar"> </a>
<div class="media-body">
<h5 class="media-heading mv5">Article
<small> - 08/16/22</small>
</h5>
Last Updated 36 days ago by
<a class="text-system" href="layout_navbar-search-alt.html#"> Max </a>
</div>
</li>
<li class="media">
<a class="media-left" href="layout_navbar-search-alt.html#"> <img src="assets/img/avatars/3.jpg" class="mw40" alt="avatar"> </a>
<div class="media-body">
<h5 class="media-heading">Article
<small class="text-muted">- 08/16/22</small>
</h5> Last Updated 36 days ago by
<a class="text-system" href="layout_navbar-search-alt.html#"> Max </a>
</div>
</li>
<li class="media">
<a class="media-left" href="layout_navbar-search-alt.html#"> <img src="assets/img/avatars/4.jpg" class="mw40" alt="avatar"> </a>
<div class="media-body">
<h5 class="media-heading mv5">Article
<small class="text-muted">- 08/16/22</small>
</h5> Last Updated 36 days ago by
<a class="text-system" href="layout_navbar-search-alt.html#"> Max </a>
</div>
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="layout_navbar-search-alt.html#">
<span class="flag-xs flag-us"></span> US
</a>
<ul class="dropdown-menu pv5 animated animated-short flipInX" role="menu">
<li>
<a href="javascript:void(0);">
<span class="flag-xs flag-in mr10"></span> Hindu </a>
</li>
<li>
<a href="javascript:void(0);">
<span class="flag-xs flag-tr mr10"></span> Turkish </a>
</li>
<li>
<a href="javascript:void(0);">
<span class="flag-xs flag-es mr10"></span> Spanish </a>
</li>
</ul>
</li>
<li class="menu-divider hidden-xs">
<i class="fa fa-circle"></i>
</li>
<li class="dropdown">
<a href="layout_navbar-search-alt.html#" class="dropdown-toggle fw600 p15" data-toggle="dropdown"> <img src="assets/img/avatars/1.jpg" alt="avatar" class="mw30 br64 mr15"> John.Smith
<span class="caret caret-tp hidden-xs"></span>
</a>
<ul class="dropdown-menu list-group dropdown-persist w250" role="menu">
<li class="dropdown-header clearfix">
<div class="pull-left ml10">
<select id="user-status">
<optgroup label="Current Status:">
<option value="1-1">Away</option>
<option value="1-2">Offline</option>
<option value="1-3" selected="selected">Online</option>
</optgroup>
</select>
</div>
<div class="pull-right mr10">
<select id="user-role">
<optgroup label="Logged in As:">
<option value="1-1">Client</option>
<option value="1-2">Editor</option>
<option value="1-3" selected="selected">Admin</option>
</optgroup>
</select>
</div>
</li>
<li class="list-group-item">
<a href="layout_navbar-search-alt.html#" class="animated animated-short fadeInUp">
<span class="fa fa-envelope"></span> Messages
<span class="label label-warning">2</span>
</a>
</li>
<li class="list-group-item">
<a href="layout_navbar-search-alt.html#" class="animated animated-short fadeInUp">
<span class="fa fa-user"></span> Friends
<span class="label label-warning">6</span>
</a>
</li>
<li class="list-group-item">
<a href="layout_navbar-search-alt.html#" class="animated animated-short fadeInUp">
<span class="fa fa-gear"></span> Account Settings </a>
</li>
<li class="list-group-item">
<a href="layout_navbar-search-alt.html#" class="animated animated-short fadeInUp">
<span class="fa fa-power-off"></span> Logout </a>
</li>
</ul>
</li>
</ul>
</header>
<!-- End: Header -->
<!-- Start: Sidebar -->
<aside id="sidebar_left" class="nano nano-primary">
<!-- Start: Sidebar Left Content -->
<div class="sidebar-left-content nano-content">
<!-- Start: Sidebar Header -->
<header class="sidebar-header">
<!-- Sidebar Widget - Menu (Slidedown) -->
<div class="sidebar-widget menu-widget">
<div class="row text-center mbn">
<div class="col-xs-4">
<a href="dashboard.html" class="text-primary" data-toggle="tooltip" data-placement="top" title="Dashboard">
<span class="glyphicon glyphicon-home"></span>
</a>
</div>
<div class="col-xs-4">
<a href="pages_messages.html" class="text-info" data-toggle="tooltip" data-placement="top" title="Messages">
<span class="glyphicon glyphicon-inbox"></span>
</a>
</div>
<div class="col-xs-4">
<a href="pages_profile.html" class="text-alert" data-toggle="tooltip" data-placement="top" title="Tasks">
<span class="glyphicon glyphicon-bell"></span>
</a>
</div>
<div class="col-xs-4">
<a href="pages_timeline.html" class="text-system" data-toggle="tooltip" data-placement="top" title="Activity">
<span class="fa fa-desktop"></span>
</a>
</div>
<div class="col-xs-4">
<a href="pages_profile.html" class="text-danger" data-toggle="tooltip" data-placement="top" title="Settings">
<span class="fa fa-gears"></span>
</a>
</div>
<div class="col-xs-4">
<a href="pages_gallery.html" class="text-warning" data-toggle="tooltip" data-placement="top" title="Cron Jobs">
<span class="fa fa-flask"></span>
</a>
</div>
</div>
</div>
<!-- Sidebar Widget - Author (hidden) -->
<div class="sidebar-widget author-widget hidden">
<div class="media">
<a class="media-left" href="layout_navbar-search-alt.html#">
<img src="assets/img/avatars/3.jpg" class="img-responsive">
</a>
<div class="media-body">
<div class="media-links">
<a href="layout_navbar-search-alt.html#" class="sidebar-menu-toggle">User Menu -</a> <a href="pages_login(alt).html">Logout</a>
</div>
<div class="media-author">Michael Richards</div>
</div>
</div>
</div>
<!-- Sidebar Widget - Search (hidden) -->
<div class="sidebar-widget search-widget hidden">
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-search"></i>
</span>
<input type="text" id="sidebar-search" class="form-control" placeholder="Search...">
</div>
</div>
</header>
<!-- End: Sidebar Header -->
<!-- Start: Sidebar Menu -->
<ul class="nav sidebar-menu">
<li class="sidebar-label pt20">Menu</li>
<li>
<a href="pages_calendar.html">
<span class="fa fa-calendar"></span>
<span class="sidebar-title">Calendar</span>
<span class="sidebar-title-tray">
<span class="label label-xs bg-primary">New</span>
</span>
</a>
</li>
<li>
<a href="http://admindesigns.com/demos/admin/README/index.html">
<span class="glyphicon glyphicon-book"></span>
<span class="sidebar-title">Documentation</span>
</a>
</li>
<li class="active">
<a href="dashboard.html">
<span class="glyphicon glyphicon-home"></span>
<span class="sidebar-title">Dashboard</span>
</a>
</li>
<li class="sidebar-label pt15">Exclusive Tools</li>
<li>
<a class="accordion-toggle menu-open" href="layout_navbar-search-alt.html#">
<span class="fa fa-columns"></span>
<span class="sidebar-title">Layout Templates</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa fa-arrows-h"></span>
Sidebars
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="layout_sidebar-left-static.html">
Left Static </a>
</li>
<li>
<a href="layout_sidebar-left-fixed.html">
Left Fixed </a>
</li>
<li>
<a href="layout_sidebar-left-widgets.html">
Left Widgets </a>
</li>
<li>
<a href="layout_sidebar-left-minified.html">
Left Minified </a>
</li>
<li>
<a href="layout_sidebar-left-light.html">
Left White </a>
</li>
<li>
<a href="layout_sidebar-right-static.html">
Right Static </a>
</li>
<li>
<a href="layout_sidebar-right-fixed.html">
Right Fixed </a>
</li>
<li>
<a href="layout_sidebar-right-menu.html">
Right w/Menu </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle menu-open" href="layout_navbar-search-alt.html#">
<span class="fa fa-arrows-v"></span>
Navbar
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="layout_navbar-static.html">
Navbar Static </a>
</li>
<li>
<a href="layout_navbar-fixed.html">
Navbar Fixed </a>
</li>
<li>
<a href="layout_navbar-menus.html">
Navbar Menus </a>
</li>
<li>
<a href="layout_navbar-contextual.html">
Contextual Example </a>
</li>
<li class="active">
<a href="layout_navbar-search-alt.html">
Search Alt Style </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-hand-o-up"></span>
Topbar
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="layout_topbar.html">
Default Style </a>
</li>
<li>
<a href="layout_topbar-menu.html">
Default w/Menu </a>
</li>
<li>
<a href="layout_topbar-alt.html">
Alternate Style </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-arrows-v"></span>
Content Body
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="layout_content-blank.html">
Blank Starter </a>
</li>
<li>
<a href="layout_content-fixed.html">
Fixed Window </a>
</li>
<li>
<a href="layout_content-heading.html">
Content Heading </a>
</li>
<li>
<a href="layout_content-tabs.html">
Content Tabs </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-pause"></span>
Content Trays
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="layout_tray-left.html">
Tray Left Static </a>
</li>
<li>
<a href="layout_tray-left-fixed.html">
Tray Left Fixed </a>
</li>
<li>
<a href="layout_tray-right.html">
Tray Right Static </a>
</li>
<li>
<a href="layout_tray-right-fixed.html">
Tray Right Fixed </a>
</li>
<li>
<a href="layout_tray-both.html">
Left + Right Static </a>
</li>
<li>
<a href="layout_tray-both-fixed.html">
Left + Right Fixed </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-plus-square-o"></span>
Boxed Layout
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="layout_boxed.html">
Default </a>
</li>
<li>
<a href="layout_boxed-horizontal.html">
Horizontal Menu </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-arrow-circle-o-up"></span>
Horizontal Menu
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="layout_horizontal-sm.html">
Small Size</a>
</li>
<li>
<a href="layout_horizontal-md.html">
Medium Size</a>
</li>
<li>
<a href="layout_horizontal-lg.html">
Large Size</a>
</li>
<li>
<a href="layout_horizontal-light.html">
Light Skin</a>
</li>
<li>
<a href="layout_horizontal-topbar.html">
With Topbar</a>
</li>
<li>
<a href="layout_horizontal-topbar-alt.html">
With Alt Topbar</a>
</li>
<li>
<a href="layout_horizontal-collapsed.html">
Collapsed onLoad</a>
</li>
<li>
<a href="layout_horizontal-boxed.html">
In Boxed Layout</a>
</li>
</ul>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="glyphicon glyphicon-fire"></span>
<span class="sidebar-title">Admin Plugins</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="admin_plugins-panels.html">
<span class="glyphicon glyphicon-book"></span> Admin Panels </a>
</li>
<li>
<a href="admin_plugins-modals.html">
<span class="glyphicon glyphicon-modal-window"></span> Admin Modals </a>
</li>
<li>
<a href="admin_plugins-dock.html">
<span class="glyphicon glyphicon-equalizer"></span> Admin Dock </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="glyphicon glyphicon-check"></span>
<span class="sidebar-title">Admin Forms</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="admin_forms-elements.html">
<span class="glyphicon glyphicon-edit"></span> Admin Elements </a>
</li>
<li>
<a href="admin_forms-widgets.html">
<span class="glyphicon glyphicon-calendar"></span> Admin Widgets </a>
</li>
<li>
<a href="admin_forms-validation.html">
<span class="glyphicon glyphicon-check"></span> Admin Validation </a>
</li>
<li>
<a href="admin_forms-layouts.html">
<span class="fa fa-desktop"></span> Admin Layouts </a>
</li>
<li>
<a href="admin_forms-wizard.html">
<span class="fa fa-clipboard"></span> Admin Wizard </a>
</li>
</ul>
</li>
<li class="sidebar-label pt20">Systems</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-diamond"></span>
<span class="sidebar-title">Widget Packages</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="widgets_tile.html">
<span class="fa fa-cube"></span> Tile Widgets</a>
</li>
<li>
<a href="widgets_panel.html">
<span class="fa fa-desktop"></span> Panel Widgets </a>
</li>
<li>
<a href="widgets_scroller.html">
<span class="fa fa-columns"></span> Scroller Widgets </a>
</li>
<li>
<a href="widgets_data.html">
<span class="fa fa-dot-circle-o"></span> Admin Widgets </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="glyphicon glyphicon-shopping-cart"></span>
<span class="sidebar-title">Ecommerce</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="ecommerce_dashboard.html">
<span class="glyphicon glyphicon-shopping-cart"></span> Dashboard
<span class="label label-xs bg-primary">New</span>
</a>
</li>
<li>
<a href="ecommerce_products.html">
<span class="glyphicon glyphicon-tags"></span> Products </a>
</li>
<li>
<a href="ecommerce_orders.html">
<span class="fa fa-money"></span> Orders </a>
</li>
<li>
<a href="ecommerce_customers.html">
<span class="fa fa-users"></span> Customers </a>
</li>
<li>
<a href="ecommerce_settings.html">
<span class="fa fa-gears"></span> Store Settings </a>
</li>
</ul>
</li>
<li>
<a href="email_templates.html">
<span class="fa fa-envelope-o"></span>
<span class="sidebar-title">Email Templates</span>
</a>
</li>
<!-- sidebar resources -->
<li class="sidebar-label pt20">Elements</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="glyphicon glyphicon-bell"></span>
<span class="sidebar-title">UI Elements</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="ui_alerts.html">
<span class="fa fa-warning"></span> Alerts </a>
</li>
<li>
<a href="ui_animations.html">
<span class="fa fa-spinner"></span> Animations </a>
</li>
<li>
<a href="ui_buttons.html">
<span class="fa fa-plus-square-o"></span> Buttons </a>
</li>
<li>
<a href="ui_typography.html">
<span class="fa fa-text-width"></span> Typography </a>
</li>
<li>
<a href="ui_portlets.html">
<span class="fa fa-archive"></span> Portlets </a>
</li>
<li>
<a href="ui_progress-bars.html">
<span class="fa fa-bars"></span> Progress Bars </a>
</li>
<li>
<a href="ui_tabs.html">
<span class="fa fa-toggle-off"></span> Tabs </a>
</li>
<li>
<a href="ui_icons.html">
<span class="fa fa-hand-o-right"></span> Icons </a>
</li>
<li>
<a href="ui_grid.html">
<span class="fa fa-th-large"></span> Grid </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="glyphicon glyphicon-hdd"></span>
<span class="sidebar-title">Form Elements</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="form_inputs.html">
<span class="fa fa-magic"></span> Basic Inputs </a>
</li>
<li>
<a href="form_plugins.html">
<span class="fa fa-bell-o"></span> Plugin Inputs
<span class="label label-xs bg-primary">New</span>
</a>
</li>
<li>
<a href="form_editors.html">
<span class="fa fa-clipboard"></span> Editors </a>
</li>
<li>
<a href="form_treeview.html">
<span class="fa fa-tree"></span> Treeview </a>
</li>
<li>
<a href="form_nestable.html">
<span class="fa fa-tasks"></span> Nestable </a>
</li>
<li>
<a href="form_image-tools.html">
<span class="fa fa-cloud-upload"></span> Image Tools
<span class="label label-xs bg-primary">New</span>
</a>
</li>
<li>
<a href="form_uploaders.html">
<span class="fa fa-cloud-upload"></span> Uploaders </a>
</li>
<li>
<a href="form_notifications.html">
<span class="fa fa-bell-o"></span> Notifications </a>
</li>
<li>
<a href="form_content-sliders.html">
<span class="fa fa-exchange"></span> Content Sliders </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="glyphicon glyphicon-tower"></span>
<span class="sidebar-title">Plugins</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="glyphicon glyphicon-globe"></span> Maps
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="maps_advanced.html">Admin Maps</a>
</li>
<li>
<a href="maps_basic.html">Basic Maps</a>
</li>
<li>
<a href="maps_vector.html">Vector Maps</a>
</li>
<li>
<a href="maps_full.html">Full Map</a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-area-chart"></span> Charts
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="charts_highcharts.html">Highcharts</a>
</li>
<li>
<a href="charts_d3.html">D3 Charts</a>
</li>
<li>
<a href="charts_flot.html">Flot Charts</a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-table"></span> Tables
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="tables_basic.html"> Basic Tables</a>
</li>
<li>
<a href="tables_datatables.html"> DataTables </a>
</li>
<li>
<a href="tables_datatables-editor.html"> Editable Tables </a>
</li>
<li>
<a href="tables_footable.html"> FooTables </a>
</li>
<li>
<a href="tables_pricing.html"> Pricing Tables </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-flask"></span> Misc
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="misc_tour.html"> Site Tour</a>
</li>
<li>
<a href="misc_timeout.html"> Session Timeout</a>
</li>
<li>
<a href="misc_nprogress.html"> Page Progress Loader </a>
</li>
</ul>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="glyphicon glyphicon-duplicate"></span>
<span class="sidebar-title">Pages</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-gears"></span> Utility
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="landing-page/landing1/index.html" target="_blank"> Landing Page </a>
</li>
<li>
<a href="pages_confirmation.html" target="_blank"> Confirmation
<span class="label label-xs bg-primary">New</span>
</a>
</li>
<li>
<a href="pages_login.html" target="_blank"> Login </a>
</li>
<li>
<a href="pages_login(alt).html" target="_blank"> Login Alt
<span class="label label-xs bg-primary">New</span>
</a>
</li>
<li>
<a href="pages_register.html" target="_blank"> Register </a>
</li>
<li>
<a href="pages_register(alt).html" target="_blank"> Register Alt
<span class="label label-xs bg-primary">New</span>
</a>
</li>
<li>
<a href="pages_screenlock.html" target="_blank"> Screenlock </a>
</li>
<li>
<a href="pages_screenlock(alt).html" target="_blank"> Screenlock Alt
<span class="label label-xs bg-primary">New</span>
</a>
</li>
<li>
<a href="pages_forgotpw.html" target="_blank"> Forgot Password </a>
</li>
<li>
<a href="pages_forgotpw(alt).html" target="_blank"> Forgot Password Alt
<span class="label label-xs bg-primary">New</span>
</a>
</li>
<li>
<a href="pages_coming-soon.html" target="_blank"> Coming Soon
</a>
</li>
<li>
<a href="pages_404.html"> 404 Error </a>
</li>
<li>
<a href="pages_500.html"> 500 Error </a>
</li>
<li>
<a href="pages_404(alt).html"> 404 Error Alt </a>
</li>
<li>
<a href="pages_500(alt).html"> 500 Error Alt </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-desktop"></span> Basic
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="pages_search-results.html">Search Results
<span class="label label-xs bg-primary">New</span>
</a>
</li>
<li>
<a href="pages_profile.html"> Profile </a>
</li>
<li>
<a href="pages_timeline.html"> Timeline Split </a>
</li>
<li>
<a href="pages_timeline-single.html"> Timeline Single </a>
</li>
<li>
<a href="pages_faq.html"> FAQ Page </a>
</li>
<li>
<a href="pages_calendar.html"> Calendar </a>
</li>
<li>
<a href="pages_messages.html"> Messages </a>
</li>
<li>
<a href="pages_messages(alt).html"> Messages Alt </a>
</li>
<li>
<a href="pages_gallery.html"> Gallery </a>
</li>
</ul>
</li>
<li>
<a class="accordion-toggle" href="layout_navbar-search-alt.html#">
<span class="fa fa-usd"></span> Misc
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="pages_invoice.html"> Printable Invoice </a>
</li>
<li>
<a href="pages_blank.html"> Blank </a>
</li>
</ul>
</li>
</ul>
</li>
<!-- sidebar bullets -->
<li class="sidebar-label pt20">Projects</li>
<li class="sidebar-proj">
<a href="layout_navbar-search-alt.html#projectOne">
<span class="fa fa-dot-circle-o text-primary"></span>
<span class="sidebar-title">Website Redesign</span>
</a>
</li>
<li class="sidebar-proj">
<a href="layout_navbar-search-alt.html#projectTwo">
<span class="fa fa-dot-circle-o text-info"></span>
<span class="sidebar-title">Ecommerce Panel</span>
</a>
</li>
<li class="sidebar-proj">
<a href="layout_navbar-search-alt.html#projectTwo">
<span class="fa fa-dot-circle-o text-danger"></span>
<span class="sidebar-title">Adobe Mockup</span>
</a>
</li>
<li class="sidebar-proj">
<a href="layout_navbar-search-alt.html#projectThree">
<span class="fa fa-dot-circle-o text-warning"></span>
<span class="sidebar-title">SSD Upgrades</span>
</a>
</li>
<!-- sidebar progress bars -->
<li class="sidebar-label pt25 pb10">User Stats</li>
<li class="sidebar-stat">
<a href="layout_navbar-search-alt.html#projectOne" class="fs11">
<span class="fa fa-inbox text-info"></span>
<span class="sidebar-title text-muted">Email Storage</span>
<span class="pull-right mr20 text-muted">35%</span>
<div class="progress progress-bar-xs mh20 mb10">
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 35%">
<span class="sr-only">35% Complete</span>
</div>
</div>
</a>
</li>
<li class="sidebar-stat">
<a href="layout_navbar-search-alt.html#projectOne" class="fs11">
<span class="fa fa-dropbox text-warning"></span>
<span class="sidebar-title text-muted">Bandwidth</span>
<span class="pull-right mr20 text-muted">58%</span>
<div class="progress progress-bar-xs mh20">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 58%">
<span class="sr-only">58% Complete</span>
</div>
</div>
</a>
</li>
</ul>
<!-- End: Sidebar Menu -->
<!-- Start: Sidebar Collapse Button -->
<div class="sidebar-toggle-mini">
<a href="layout_navbar-search-alt.html#">
<span class="fa fa-sign-out"></span>
</a>
</div>
<!-- End: Sidebar Collapse Button -->
</div>
<!-- End: Sidebar Left Content -->
</aside>
<!-- Start: Content-Wrapper -->
<section id="content_wrapper">
<!-- Start: Topbar-Dropdown -->
<div id="topbar-dropmenu">
<div class="topbar-menu row">
<div class="col-xs-4 col-sm-2">
<a href="layout_navbar-search-alt.html#" class="metro-tile">
<span class="metro-icon glyphicon glyphicon-inbox"></span>
<p class="metro-title">Messages</p>
</a>
</div>
<div class="col-xs-4 col-sm-2">
<a href="layout_navbar-search-alt.html#" class="metro-tile">
<span class="metro-icon glyphicon glyphicon-user"></span>
<p class="metro-title">Users</p>
</a>
</div>
<div class="col-xs-4 col-sm-2">
<a href="layout_navbar-search-alt.html#" class="metro-tile">
<span class="metro-icon glyphicon glyphicon-headphones"></span>
<p class="metro-title">Support</p>
</a>
</div>
<div class="col-xs-4 col-sm-2">
<a href="layout_navbar-search-alt.html#" class="metro-tile">
<span class="metro-icon fa fa-gears"></span>
<p class="metro-title">Settings</p>
</a>
</div>
<div class="col-xs-4 col-sm-2">
<a href="layout_navbar-search-alt.html#" class="metro-tile">
<span class="metro-icon glyphicon glyphicon-facetime-video"></span>
<p class="metro-title">Videos</p>
</a>
</div>
<div class="col-xs-4 col-sm-2">
<a href="layout_navbar-search-alt.html#" class="metro-tile">
<span class="metro-icon glyphicon glyphicon-picture"></span>
<p class="metro-title">Pictures</p>
</a>
</div>
</div>
</div>
<!-- End: Topbar-Dropdown -->
<!-- Start: Topbar -->
<header id="topbar" class="hidden">
<div class="topbar-left">
<ol class="breadcrumb">
<li class="crumb-active">
<a href="dashboard.html">Dashboard</a>
</li>
<li class="crumb-icon">
<a href="dashboard.html">
<span class="glyphicon glyphicon-home"></span>
</a>
</li>
<li class="crumb-link">
<a href="dashboard.html">Home</a>
</li>
<li class="crumb-trail">Dashboard</li>
</ol>
</div>
<div class="topbar-right">
<div class="ib topbar-dropdown">
<label for="topbar-multiple" class="control-label pr10 fs11 text-muted">Reporting Period</label>
<select id="topbar-multiple" class="hidden">
<optgroup label="Filter By:">
<option value="1-1">Last 30 Days</option>
<option value="1-2" selected="selected">Last 60 Days</option>
<option value="1-3">Last Year</option>
</optgroup>
</select>
</div>
<div class="ml15 ib va-m" id="toggle_sidemenu_r">
<a href="layout_navbar-search-alt.html#" class="pl5">
<i class="fa fa-sign-in fs22 text-primary"></i>
<span class="badge badge-hero badge-danger">3</span>
</a>
</div>
</div>
</header>
<!-- End: Topbar -->
<!-- Begin: Content -->
<section id="content" class="animated fadeIn">
<h4> Example Body Content </h4>
<hr class="alt short">
<p class="text-muted"> Lorem ipsum dolor sit amet, consectetur adipi sicing elit, sed do eiusmod tempor incididu ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exetation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</section>
<!-- End: Content -->
</section>
<!-- Start: Right Sidebar -->
<aside id="sidebar_right" class="nano affix">
<!-- Start: Sidebar Right Content -->
<div class="sidebar-right-content nano-content p15">
<h5 class="title-divider text-muted mb20"> Server Statistics
<span class="pull-right"> 2013
<i class="fa fa-caret-down ml5"></i>
</span>
</h5>
<div class="progress mh5">
<div class="progress-bar progress-bar-primary" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 44%">
<span class="fs11">DB Request</span>
</div>
</div>
<div class="progress mh5">
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 84%">
<span class="fs11 text-left">Server Load</span>
</div>
</div>
<div class="progress mh5">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 61%">
<span class="fs11 text-left">Server Connections</span>
</div>
</div>
<h5 class="title-divider text-muted mt30 mb10">Traffic Margins</h5>
<div class="row">
<div class="col-xs-5">
<h3 class="text-primary mn pl5">132</h3>
</div>
<div class="col-xs-7 text-right">
<h3 class="text-success-dark mn">
<i class="fa fa-caret-up"></i> 13.2% </h3>
</div>
</div>
<h5 class="title-divider text-muted mt25 mb10">Database Request</h5>
<div class="row">
<div class="col-xs-5">
<h3 class="text-primary mn pl5">212</h3>
</div>
<div class="col-xs-7 text-right">
<h3 class="text-success-dark mn">
<i class="fa fa-caret-up"></i> 25.6% </h3>
</div>
</div>
<h5 class="title-divider text-muted mt25 mb10">Server Response</h5>
<div class="row">
<div class="col-xs-5">
<h3 class="text-primary mn pl5">82.5</h3>
</div>
<div class="col-xs-7 text-right">
<h3 class="text-danger mn">
<i class="fa fa-caret-down"></i> 17.9% </h3>
</div>
</div>
<h5 class="title-divider text-muted mt40 mb20"> Server Statistics
<span class="pull-right text-primary fw600">USA</span>
</h5>
</div>
</aside>
<!-- End: Right Sidebar -->
</div>
<!-- End: Main -->
<!-- BEGIN: PAGE SCRIPTS -->
<!-- jQuery -->
<script src="vendor/jquery/jquery-1.11.1.min.js"></script>
<script src="vendor/jquery/jquery_ui/jquery-ui.min.js"></script>
<!-- Theme Javascript -->
<script src="assets/js/utility/utility.js"></script>
<script src="assets/js/demo/demo.js"></script>
<script src="assets/js/main.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
"use strict";
// Init Theme Core
Core.init();
});
</script>
<!-- END: PAGE SCRIPTS -->
</body>
</html>
| {
"content_hash": "c59ebf22482d7fd283014c8ca24df28e",
"timestamp": "",
"source": "github",
"line_count": 1184,
"max_line_length": 263,
"avg_line_length": 39.779560810810814,
"alnum_prop": 0.441920210620183,
"repo_name": "newset/theme",
"id": "f8463f58f564d07e929e66aad4dcb1d4f5eb46c8",
"size": "47099",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "backend/normal/AdminDesigns/layout_navbar-search-alt.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "18948543"
},
{
"name": "CoffeeScript",
"bytes": "16726"
},
{
"name": "HTML",
"bytes": "177338000"
},
{
"name": "Handlebars",
"bytes": "277664"
},
{
"name": "JavaScript",
"bytes": "49675136"
},
{
"name": "PHP",
"bytes": "238820"
},
{
"name": "Ruby",
"bytes": "902"
},
{
"name": "Shell",
"bytes": "616"
}
],
"symlink_target": ""
} |
<?php namespace Gzero\Repositories\MenuLink;
use Gzero\EloquentBaseModel\Model\Collection;
use Gzero\Models\Lang;
use Gzero\Models\MenuLink\MenuLink;
use Gzero\Models\MenuLink\MenuLinkTranslation;
use Gzero\Repositories\AbstractRepository;
use Gzero\Repositories\TreeRepositoryTrait;
class EloquentMenuLinkRepository extends AbstractRepository implements MenuLinkRepository {
use TreeRepositoryTrait;
protected $translationModel;
public function __construct(MenuLink $link, MenuLinkTranslation $translation)
{
$this->model = $link;
$this->translationModel = $translation;
}
public function create(array $input)
{
// TODO: Implement create() method.
}
public function update(array $input)
{
// TODO: Implement update() method.
}
public function delete($id)
{
// TODO: Implement delete() method.
}
/**
* Only public block
*
* @return $this
*/
public function onlyPublic()
{
// TODO: Implement onlyPublic() method.
}
/**
* Lazy load translations
*
* @param MenuLink|Collection $menuLink Block model
* @param Lang $lang Lang model
*
* @return mixed
*/
public function loadTranslations($menuLink, Lang $lang = NULL)
{
return $menuLink->load(
array(
'translations' => function ($query) use ($lang) {
$query->onlyActive($lang);
}
)
);
}
}
| {
"content_hash": "125a560b746bff1b25004b98bef419e7",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 91,
"avg_line_length": 23.696969696969695,
"alnum_prop": 0.59846547314578,
"repo_name": "AdrianSkierniewski/gzero-cms",
"id": "66a74c6daf015ced097fcceaa6a306cb791806a0",
"size": "1955",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Gzero/Repositories/MenuLink/EloquentMenuLinkRepository.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "190460"
},
{
"name": "CoffeeScript",
"bytes": "0"
},
{
"name": "JavaScript",
"bytes": "3821"
},
{
"name": "PHP",
"bytes": "136193"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Dragon.Context.Exceptions
{
public class InvalidUserOrOldSecretException : Exception
{
}
}
| {
"content_hash": "379810c23c04d702b578386f2e0fd33f",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 60,
"avg_line_length": 18.272727272727273,
"alnum_prop": 0.7611940298507462,
"repo_name": "aduggleby/dragon",
"id": "5f4f115c427bb7243cd2e67dcba6312be32153e9",
"size": "203",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "proj/CPR/src/Dragon.Context/Exceptions/InvalidOldSecretException.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "113"
},
{
"name": "Batchfile",
"bytes": "4209"
},
{
"name": "C#",
"bytes": "826681"
},
{
"name": "CSS",
"bytes": "513"
},
{
"name": "HTML",
"bytes": "5127"
},
{
"name": "JavaScript",
"bytes": "16833"
},
{
"name": "PowerShell",
"bytes": "1875"
}
],
"symlink_target": ""
} |
package frontend.objc;
import static org.hamcrest.MatcherAssert.assertThat;
import static utils.matchers.DotFilesEqual.dotFileEqualTo;
import com.google.common.collect.ImmutableList;
import org.junit.Rule;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import utils.DebuggableTemporaryFolder;
import utils.InferException;
import utils.InferRunner;
public class PredefinedExpressionTest {
@Rule
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
@Test
public void whenCaptureRunOnPropertyThenDotFilesAreTheSame()
throws InterruptedException, IOException, InferException {
String src = "infer/tests/codetoanalyze/objc/frontend/predefined_expr/PredefinedExprExample.m";
String dotty =
"infer/tests/codetoanalyze/objc/frontend/predefined_expr/PredefinedExprExample.dot";
ImmutableList<String> inferCmd =
InferRunner.createObjCInferCommandFrontendArc(folder, src);
File newDotFile = InferRunner.runInferFrontend(inferCmd);
assertThat(
"In the capture of " + src +
" the dotty files should be the same.",
newDotFile, dotFileEqualTo(dotty));
}
}
| {
"content_hash": "8836e88d1f00dd70727126fdce5d9b9f",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 99,
"avg_line_length": 26.886363636363637,
"alnum_prop": 0.7675401521555367,
"repo_name": "DoctorQ/infer",
"id": "085f1ea5c02f24c064ab6711e2dbddfe3b488805",
"size": "1485",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "infer/tests/frontend/objc/PredefinedExpressionTest.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "170874"
},
{
"name": "C++",
"bytes": "6101"
},
{
"name": "CMake",
"bytes": "700"
},
{
"name": "Java",
"bytes": "645873"
},
{
"name": "Makefile",
"bytes": "18109"
},
{
"name": "OCaml",
"bytes": "2542601"
},
{
"name": "Objective-C",
"bytes": "85475"
},
{
"name": "Objective-C++",
"bytes": "431"
},
{
"name": "Perl",
"bytes": "245"
},
{
"name": "Python",
"bytes": "87727"
},
{
"name": "Shell",
"bytes": "19432"
},
{
"name": "Standard ML",
"bytes": "768"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zip Encoding Class — CodeIgniter 3.0.1 documentation</title>
<link rel="shortcut icon" href="../_static/ci-icon.ico"/>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" />
<link rel="top" title="CodeIgniter 3.0.1 documentation" href="../index.html"/>
<link rel="up" title="Libraries" href="index.html"/>
<link rel="next" title="Helpers" href="../helpers/index.html"/>
<link rel="prev" title="XML-RPC and XML-RPC Server Classes" href="xmlrpc.html"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-nav-search">
<a href="../index.html" class="fa fa-home"> CodeIgniter</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a><ul class="simple">
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
</ul>
</li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Libraries</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="benchmark.html">Benchmarking Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="caching.html">Caching Driver</a></li>
<li class="toctree-l2"><a class="reference internal" href="calendar.html">Calendaring Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="cart.html">Shopping Cart Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="config.html">Config Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="email.html">Email Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="encrypt.html">Encrypt Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="encryption.html">Encryption Library</a></li>
<li class="toctree-l2"><a class="reference internal" href="file_uploading.html">File Uploading Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="form_validation.html">Form Validation</a></li>
<li class="toctree-l2"><a class="reference internal" href="ftp.html">FTP Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="image_lib.html">Image Manipulation Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="input.html">Input Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="javascript.html">Javascript Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="language.html">Language Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="loader.html">Loader Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="migration.html">Migrations Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="output.html">Output Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="pagination.html">Pagination Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="parser.html">Template Parser Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="security.html">Security Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="sessions.html">Session Library</a></li>
<li class="toctree-l2"><a class="reference internal" href="table.html">HTML Table Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="trackback.html">Trackback Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="typography.html">Typography Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="unit_testing.html">Unit Testing Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="uri.html">URI Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="user_agent.html">User Agent Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="xmlrpc.html">XML-RPC and XML-RPC Server Classes</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="">Zip Encoding Class</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
</ul>
</li>
</ul>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">CodeIgniter</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> »</li>
<li><a href="index.html">Libraries</a> »</li>
<li>Zip Encoding Class</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document">
<div class="section" id="zip-encoding-class">
<h1>Zip Encoding Class<a class="headerlink" href="#zip-encoding-class" title="Permalink to this headline">¶</a></h1>
<p>CodeIgniter’s Zip Encoding Class permits you to create Zip archives.
Archives can be downloaded to your desktop or saved to a directory.</p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#using-the-zip-encoding-class" id="id1">Using the Zip Encoding Class</a><ul>
<li><a class="reference internal" href="#initializing-the-class" id="id2">Initializing the Class</a></li>
<li><a class="reference internal" href="#usage-example" id="id3">Usage Example</a></li>
</ul>
</li>
<li><a class="reference internal" href="#class-reference" id="id4">Class Reference</a></li>
</ul>
</div>
<div class="custom-index container"></div><div class="section" id="using-the-zip-encoding-class">
<h2><a class="toc-backref" href="#id1">Using the Zip Encoding Class</a><a class="headerlink" href="#using-the-zip-encoding-class" title="Permalink to this headline">¶</a></h2>
<div class="section" id="initializing-the-class">
<h3><a class="toc-backref" href="#id2">Initializing the Class</a><a class="headerlink" href="#initializing-the-class" title="Permalink to this headline">¶</a></h3>
<p>Like most other classes in CodeIgniter, the Zip class is initialized in
your controller using the $this->load->library function:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$this</span><span class="o">-></span><span class="na">load</span><span class="o">-></span><span class="na">library</span><span class="p">(</span><span class="s1">'zip'</span><span class="p">);</span>
</pre></div>
</div>
<p>Once loaded, the Zip library object will be available using:</p>
<blockquote>
<div>$this->zip</div></blockquote>
</div>
<div class="section" id="usage-example">
<h3><a class="toc-backref" href="#id3">Usage Example</a><a class="headerlink" href="#usage-example" title="Permalink to this headline">¶</a></h3>
<p>This example demonstrates how to compress a file, save it to a folder on
your server, and download it to your desktop.</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$name</span> <span class="o">=</span> <span class="s1">'mydata1.txt'</span><span class="p">;</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="s1">'A Data String!'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">add_data</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span>
<span class="c1">// Write the zip file to a folder on your server. Name it "my_backup.zip"</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">archive</span><span class="p">(</span><span class="s1">'/path/to/directory/my_backup.zip'</span><span class="p">);</span>
<span class="c1">// Download the file to your desktop. Name it "my_backup.zip"</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">download</span><span class="p">(</span><span class="s1">'my_backup.zip'</span><span class="p">);</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="class-reference">
<h2><a class="toc-backref" href="#id4">Class Reference</a><a class="headerlink" href="#class-reference" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="CI_Zip">
<em class="property">class </em><tt class="descname">CI_Zip</tt><a class="headerlink" href="#CI_Zip" title="Permalink to this definition">¶</a></dt>
<dd><dl class="attribute">
<dt>
<tt class="descname">$compression_level = 2</tt></dt>
<dd><p>The compression level to use.</p>
<p>It can range from 0 to 9, with 9 being the highest and 0 effectively disabling compression:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">compression_level</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="CI_Zip::add_data">
<tt class="descname">add_data</tt><big>(</big><em>$filepath</em><span class="optional">[</span>, <em>$data = NULL</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#CI_Zip::add_data" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>$filepath</strong> (<em>mixed</em>) – A single file path or an array of file => data pairs</li>
<li><strong>$data</strong> (<em>array</em>) – File contents (ignored if $filepath is an array)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p>
</td>
</tr>
</tbody>
</table>
<p>Adds data to the Zip archive. Can work both in single and multiple files mode.</p>
<p>When adding a single file, the first parameter must contain the name you would
like given to the file and the second must contain the file contents:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$name</span> <span class="o">=</span> <span class="s1">'mydata1.txt'</span><span class="p">;</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="s1">'A Data String!'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">add_data</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span>
<span class="nv">$name</span> <span class="o">=</span> <span class="s1">'mydata2.txt'</span><span class="p">;</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="s1">'Another Data String!'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">add_data</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span>
</pre></div>
</div>
<p>When adding multiple files, the first parameter must contain <em>file => contents</em> pairs
and the second parameter is ignored:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
<span class="s1">'mydata1.txt'</span> <span class="o">=></span> <span class="s1">'A Data String!'</span><span class="p">,</span>
<span class="s1">'mydata2.txt'</span> <span class="o">=></span> <span class="s1">'Another Data String!'</span>
<span class="p">);</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">add_data</span><span class="p">(</span><span class="nv">$data</span><span class="p">);</span>
</pre></div>
</div>
<p>If you would like your compressed data organized into sub-directories, simply include
the path as part of the filename(s):</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$name</span> <span class="o">=</span> <span class="s1">'personal/my_bio.txt'</span><span class="p">;</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="s1">'I was born in an elevator...'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">add_data</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span>
</pre></div>
</div>
<p>The above example will place my_bio.txt inside a folder called personal.</p>
</dd></dl>
<dl class="method">
<dt id="CI_Zip::add_dir">
<tt class="descname">add_dir</tt><big>(</big><em>$directory</em><big>)</big><a class="headerlink" href="#CI_Zip::add_dir" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>$directory</strong> (<em>mixed</em>) – Directory name string or an array of multiple directories</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p>
</td>
</tr>
</tbody>
</table>
<p>Permits you to add a directory. Usually this method is unnecessary since you can place
your data into directories when using <tt class="docutils literal"><span class="pre">$this->zip->add_data()</span></tt>, but if you would like
to create an empty directory you can do so:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">add_dir</span><span class="p">(</span><span class="s1">'myfolder'</span><span class="p">);</span> <span class="c1">// Creates a directory called "myfolder"</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="CI_Zip::read_file">
<tt class="descname">read_file</tt><big>(</big><em>$path</em><span class="optional">[</span>, <em>$archive_filepath = FALSE</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#CI_Zip::read_file" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>$path</strong> (<em>string</em>) – Path to file</li>
<li><strong>$archive_filepath</strong> (<em>mixed</em>) – New file name/path (string) or (boolean) whether to maintain the original filepath</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE on success, FALSE on failure</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
</td>
</tr>
</tbody>
</table>
<p>Permits you to compress a file that already exists somewhere on your server.
Supply a file path and the zip class will read it and add it to the archive:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$path</span> <span class="o">=</span> <span class="s1">'/path/to/photo.jpg'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">read_file</span><span class="p">(</span><span class="nv">$path</span><span class="p">);</span>
<span class="c1">// Download the file to your desktop. Name it "my_backup.zip"</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">download</span><span class="p">(</span><span class="s1">'my_backup.zip'</span><span class="p">);</span>
</pre></div>
</div>
<p>If you would like the Zip archive to maintain the directory structure of
the file in it, pass TRUE (boolean) in the second parameter. Example:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$path</span> <span class="o">=</span> <span class="s1">'/path/to/photo.jpg'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">read_file</span><span class="p">(</span><span class="nv">$path</span><span class="p">,</span> <span class="k">TRUE</span><span class="p">);</span>
<span class="c1">// Download the file to your desktop. Name it "my_backup.zip"</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">download</span><span class="p">(</span><span class="s1">'my_backup.zip'</span><span class="p">);</span>
</pre></div>
</div>
<p>In the above example, photo.jpg will be placed into the <em>path/to/</em> directory.</p>
<p>You can also specify a new name (path included) for the added file on the fly:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$path</span> <span class="o">=</span> <span class="s1">'/path/to/photo.jpg'</span><span class="p">;</span>
<span class="nv">$new_path</span> <span class="o">=</span> <span class="s1">'/new/path/some_photo.jpg'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">read_file</span><span class="p">(</span><span class="nv">$path</span><span class="p">,</span> <span class="nv">$new_path</span><span class="p">);</span>
<span class="c1">// Download ZIP archive containing /new/path/some_photo.jpg</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">download</span><span class="p">(</span><span class="s1">'my_archive.zip'</span><span class="p">);</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="CI_Zip::read_dir">
<tt class="descname">read_dir</tt><big>(</big><em>$path</em><span class="optional">[</span>, <em>$preserve_filepath = TRUE</em><span class="optional">[</span>, <em>$root_path = NULL</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#CI_Zip::read_dir" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>$path</strong> (<em>string</em>) – Path to directory</li>
<li><strong>$preserve_filepath</strong> (<em>bool</em>) – Whether to maintain the original path</li>
<li><strong>$root_path</strong> (<em>string</em>) – Part of the path to exclude from the archive directory</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE on success, FALSE on failure</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
</td>
</tr>
</tbody>
</table>
<p>Permits you to compress a directory (and its contents) that already exists somewhere on your server.
Supply a path to the directory and the zip class will recursively read and recreate it as a Zip archive.
All files contained within the supplied path will be encoded, as will any sub-directories contained within it. Example:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$path</span> <span class="o">=</span> <span class="s1">'/path/to/your/directory/'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">read_dir</span><span class="p">(</span><span class="nv">$path</span><span class="p">);</span>
<span class="c1">// Download the file to your desktop. Name it "my_backup.zip"</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">download</span><span class="p">(</span><span class="s1">'my_backup.zip'</span><span class="p">);</span>
</pre></div>
</div>
<p>By default the Zip archive will place all directories listed in the first parameter
inside the zip. If you want the tree preceding the target directory to be ignored,
you can pass FALSE (boolean) in the second parameter. Example:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$path</span> <span class="o">=</span> <span class="s1">'/path/to/your/directory/'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">read_dir</span><span class="p">(</span><span class="nv">$path</span><span class="p">,</span> <span class="k">FALSE</span><span class="p">);</span>
</pre></div>
</div>
<p>This will create a ZIP with a directory named “directory” inside, then all sub-directories
stored correctly inside that, but will not include the <em>/path/to/your</em> part of the path.</p>
</dd></dl>
<dl class="method">
<dt id="CI_Zip::archive">
<tt class="descname">archive</tt><big>(</big><em>$filepath</em><big>)</big><a class="headerlink" href="#CI_Zip::archive" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>$filepath</strong> (<em>string</em>) – Path to target zip archive</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">TRUE on success, FALSE on failure</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">bool</p>
</td>
</tr>
</tbody>
</table>
<p>Writes the Zip-encoded file to a directory on your server. Submit a valid server path
ending in the file name. Make sure the directory is writable (755 is usually OK).
Example:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">archive</span><span class="p">(</span><span class="s1">'/path/to/folder/myarchive.zip'</span><span class="p">);</span> <span class="c1">// Creates a file named myarchive.zip</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="CI_Zip::download">
<tt class="descname">download</tt><big>(</big><em>$filename = 'backup.zip'</em><big>)</big><a class="headerlink" href="#CI_Zip::download" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>$filename</strong> (<em>string</em>) – Archive file name</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p>
</td>
</tr>
</tbody>
</table>
<p>Causes the Zip file to be downloaded from your server.
You must pass the name you would like the zip file called. Example:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">download</span><span class="p">(</span><span class="s1">'latest_stuff.zip'</span><span class="p">);</span> <span class="c1">// File will be named "latest_stuff.zip"</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Do not display any data in the controller in which you call
this method since it sends various server headers that cause the
download to happen and the file to be treated as binary.</p>
</div>
</dd></dl>
<dl class="method">
<dt id="CI_Zip::get_zip">
<tt class="descname">get_zip</tt><big>(</big><big>)</big><a class="headerlink" href="#CI_Zip::get_zip" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Zip file content</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
<p>Returns the Zip-compressed file data. Generally you will not need this method unless you
want to do something unique with the data. Example:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$name</span> <span class="o">=</span> <span class="s1">'my_bio.txt'</span><span class="p">;</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="s1">'I was born in an elevator...'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">add_data</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span>
<span class="nv">$zip_file</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">get_zip</span><span class="p">();</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="CI_Zip::clear_data">
<tt class="descname">clear_data</tt><big>(</big><big>)</big><a class="headerlink" href="#CI_Zip::clear_data" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">void</td>
</tr>
</tbody>
</table>
<p>The Zip class caches your zip data so that it doesn’t need to recompile the Zip archive
for each method you use above. If, however, you need to create multiple Zip archives,
each with different data, you can clear the cache between calls. Example:</p>
<div class="highlight-ci"><div class="highlight"><pre><span class="nv">$name</span> <span class="o">=</span> <span class="s1">'my_bio.txt'</span><span class="p">;</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="s1">'I was born in an elevator...'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">add_data</span><span class="p">(</span><span class="nv">$name</span><span class="p">,</span> <span class="nv">$data</span><span class="p">);</span>
<span class="nv">$zip_file</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">get_zip</span><span class="p">();</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">clear_data</span><span class="p">();</span>
<span class="nv">$name</span> <span class="o">=</span> <span class="s1">'photo.jpg'</span><span class="p">;</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">read_file</span><span class="p">(</span><span class="s2">"/path/to/photo.jpg"</span><span class="p">);</span> <span class="c1">// Read the file's contents</span>
<span class="nv">$this</span><span class="o">-></span><span class="na">zip</span><span class="o">-></span><span class="na">download</span><span class="p">(</span><span class="s1">'myphotos.zip'</span><span class="p">);</span>
</pre></div>
</div>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="../helpers/index.html" class="btn btn-neutral float-right" title="Helpers">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="xmlrpc.html" class="btn btn-neutral" title="XML-RPC and XML-RPC Server Classes"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2014 - 2015, British Columbia Institute of Technology.
Last updated on Aug 07, 2015.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'3.0.1',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html> | {
"content_hash": "1165ff466e308976162bad81f526772e",
"timestamp": "",
"source": "github",
"line_count": 673,
"max_line_length": 372,
"avg_line_length": 63.49034175334324,
"alnum_prop": 0.65941164080601,
"repo_name": "andreproxd/descubre_turismo",
"id": "47d001dfee9bff42e36fa1353581906f63710991",
"size": "42743",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "user_guide/libraries/zip.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "526"
},
{
"name": "CSS",
"bytes": "878451"
},
{
"name": "HTML",
"bytes": "8772746"
},
{
"name": "JavaScript",
"bytes": "3125621"
},
{
"name": "PHP",
"bytes": "2696173"
}
],
"symlink_target": ""
} |
import unittest
import os.path
import codecs
import json
from datetime import datetime
from mock import sentinel
from pyhy.api.registry import HyvesRegistry
from pyhy.api.jsonreader.scrapparser import ScrapParser
class Test(unittest.TestCase):
def setUp(self):
self.r = HyvesRegistry(sentinel.connectionobject)
self.p = ScrapParser(self.r)
def testParse(self):
datafile = os.path.join(os.path.split(__file__)[0], 'users.getScraps_homoapi.data')
scrapjson = json.load(codecs.open(datafile))['scrap'][0]
scrap = self.p.parse(scrapjson)
self.assertEqual(scrap, self.r.Scrap(u'cb1040b149d76baa'))
self.assertEqual(scrap.sender, self.r.User(u'6c7ec0b62fca4e5f'))
self.assertEqual(scrap.target, self.r.User(u'6f89a2f516034edc'))
self.assertEqual(scrap.created, datetime(2009, 12, 9, 11, 7, 13))
self.assertEqual(scrap.body[:10], u'I want my ')
| {
"content_hash": "6b1b279af50e1d59e245def4b6bdcdfa",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 91,
"avg_line_length": 34.55555555555556,
"alnum_prop": 0.7020364415862809,
"repo_name": "valhallasw/pyhy",
"id": "23b563d353ce1888a40d4185b6c267d364ad780e",
"size": "933",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/api/jsonreader/test_scrapparser.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "30710"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="keywords" content="Luã, Pessoal">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="description" content="Site Sobre Lua">
<meta name="publisher" content="Aluno WEB 2">
<meta name="author" content="Lua Ivo Machado">
<meta name="robots" content="index,follow">
<!-- OG -->
<meta property="og:url" content="http://luaMachado.com">
<meta property="og:title" content="Luã Ivo Machado">
<meta property="og:site_name" content="">
<meta property="og:description" content="">
<meta property="og:image" content="">
<title>Luã Ivo Machado</title>
<link rel="stylesheet" href="css/src/estilo.css">
<script type="text/javascript" src="pen.js"></script>
<link href="https://fonts.googleapis.com/css?family=Droid+Serif:400i|Raleway:400,700,900" rel="stylesheet">
</head>
<body>
<nav class="main-nav" id="main-nav">
<ul class="menu">
<li class="menu__item"><a class="menu__link" href="#about-us">Dados</a></li>
<li class="menu__item"><a class="menu__link" href="#Int">Interesses</a></li>
<li class="menu__item"><a class="menu__link" href="#INf">Formação</a></li>
<li class="menu__item"><a class="menu__link" href="#nContact">Histórico</a></li>
</ul>
<div class="menu-bar" id="menu">
<div class="uno"></div>
<div class="dos"></div>
<div class="tres"></div>
</div>
</nav>
</div>
<section id="about-us">
<div id="divDados">
<div class="center">
<header id="title">
<h1> Luã</h1>
<h2>Ivo Machado</h2>
<h3>E-mail: [email protected]</h3>
</header>
</div>
<section id="Int">
<div id="divInteresses">
<h2>Áreas de Interesses</h2>
</div>
<div id="blocks">
<div class="block">
<h3>Desenvolvimento web</h3>
<p id="sublinhado">___</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui et porro, illo nesciunt, impedit deserunt, est ex expedita quo cum soluta eaque.</p>
</div>
<div class="block">
<h3>Desenvolvimento mobile</h3>
<p id="sublinhado">___</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui et porro, illo nesciunt, impedit deserunt, est ex expedita quo cum soluta eaque.</p>
</div>
<div class="block">
<h3>Engenharia de software</h3>
<p id="sublinhado">___</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui et porro, illo nesciunt, impedit deserunt, est ex expedita quo cum soluta eaque.</p>
</div>
</div>
</section>
<div id="imagem">
<img src = "1.jpg" height="500" width="450"/>
</div>
</section>
<section id="INf">
<div id="divemp">
<div class="center">
<header id="products">
<h1> Formação</h1>
</header>
<div id="message">
<p>Atualmente sou estudante do 7° semestre do curso de engenharia de Software na UTFPR, possuo ensino tecnico de ferramentaria realizado no SENAI!</p>
</div>
</div>
<h1> Historico Profissional</h1>
<div id="divartigos">
<article>
<h3>Ourofront</h3>
<p>Cargo: Trainne de Analista de help desk</p>
<p>Período: Entrada 01/08/2016 Saída 03/2017 </p>
</article>
<article>
<h3> Embryotech / Vbservicos </h3>
<p>Cargo: Analista de help desk junior</p>
<p>Período: Entrada 09/2013 Saída 06/2014 </p>
</article>
</div>
<div id="divartigos">
<article>
<h3> Faculdades Metropolitanas Unidas </h3>
<p>Cargo: Auxiliar de serviços gerais de escritório. </p>
<p>Período: Entrada 03/2012 Saída 10/201</p>
</article>
<article>
<h3>TECMACH </h3>
<p>Cargo: Assistente técnico de computação (nível 1 e 2) </p>
<p>Período: Entrada 11/2011 Saída 01/2012 </p>
</article>
</div>
</div>
</section>
<section id="nContact">
<div id="divcontact">
<div id="divtitle">
<header id="title">
<h1> Contato</h1>
</header>
<p>____</p>
</div>
<form>
<input id="name" required="required" type="text" placeholder="NOME">
<br>
<input id="email" required="required" type="email" placeholder="E-MAIL">
<br>
<input id="assunto" required="required" type="text" placeholder="ASSUNTO">
<br>
<textarea id="message2" placeholder="MENSAGEM"></textarea>
<br>
<input id="btenviar" type="submit" value="Enviar">
</form>
</div>
</section>
</body>
</html> | {
"content_hash": "e8f85af018e4ba7eb819786cb78ae805",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 155,
"avg_line_length": 30.361842105263158,
"alnum_prop": 0.6017334777898158,
"repo_name": "stehleao/dctb-utfpr",
"id": "9d339a51c80cb4be8af90ccf74c655bfc002f40d",
"size": "4640",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "programacao-web-2/tasks/lua-ivo/gulp/index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "170691"
},
{
"name": "CSS",
"bytes": "250512"
},
{
"name": "HTML",
"bytes": "364395"
},
{
"name": "JavaScript",
"bytes": "347246"
},
{
"name": "PHP",
"bytes": "283381"
},
{
"name": "Vue",
"bytes": "2902"
}
],
"symlink_target": ""
} |
var path = require('path'),
when = require('when'),
semver = require('semver'),
fs = require('fs'),
path = require('path'),
_ = require('underscore'),
spawn = require("child_process").spawn,
buildDirectory = path.resolve(process.cwd(), '.build'),
distDirectory = path.resolve(process.cwd(), '.dist'),
configLoader = require('./core/config-loader.js'),
buildGlob = [
'**',
'!docs/**',
'!_site/**',
'!content/images/**',
'content/images/README.md',
'!content/themes/**',
'content/themes/casper/**',
'!content/plugins/**',
'content/plugins/README.md',
'!node_modules/**',
'!core/test/**',
'!core/client/assets/sass/**',
'!**/*.db*',
'!*.db*',
'!.sass*',
'!.af*',
'!.git*',
'!.groc*',
'!*.iml',
'!config.js',
'!CONTRIBUTING.md',
'!SECURITY.md',
'!.travis.yml'
],
configureGrunt = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
var cfg = {
// Common paths to be used by tasks
paths: {
adminAssets: './core/client/assets',
build: buildDirectory,
nightlyBuild: path.join(buildDirectory, 'nightly'),
weeklyBuild: path.join(buildDirectory, 'weekly'),
buildBuild: path.join(buildDirectory, 'build'),
dist: distDirectory,
nightlyDist: path.join(distDirectory, 'nightly'),
weeklyDist: path.join(distDirectory, 'weekly'),
buildDist: path.join(distDirectory, 'build'),
releaseDist: path.join(distDirectory, 'release')
},
buildType: 'Build',
pkg: grunt.file.readJSON('package.json'),
// Watch files and livereload in the browser during development
watch: {
handlebars: {
files: ['core/client/tpl/**/*.hbs'],
tasks: ['handlebars']
},
sass: {
files: ['<%= paths.adminAssets %>/sass/**/*'],
tasks: ['sass:admin']
},
concat: {
files: [
'core/client/*.js',
'core/client/helpers/*.js',
'core/client/models/*.js',
'core/client/tpl/*.js',
'core/client/views/*.js'
],
tasks: ['concat']
},
livereload: {
files: [
// Theme CSS
'content/themes/casper/css/*.css',
// Theme JS
'content/themes/casper/js/*.js',
// Admin CSS
'<%= paths.adminAssets %>/css/*.css',
// Admin JS
'core/built/scripts/*.js'
],
options: {
livereload: true
}
},
express: {
// Restart any time client or server js files change
files: ['core/server/**/*.js'],
tasks: ['express:dev'],
options: {
//Without this option specified express won't be reloaded
nospawn: true
}
}
},
// Start our server in development
express: {
options: {
script: 'index.js'
},
dev: {
options: {
//output: "Express server listening on address:.*$"
}
},
test: {
options: {
node_env: 'testing'
}
}
},
// Open the site in a browser
open: {
server: {
// TODO: Load this port from config?
path: 'http://0.0.0.0:2368'
}
},
// JSLint all the things!
jslint: {
server: {
directives: {
// node environment
node: true,
// browser environment
browser: false,
// allow dangling underscores in var names
nomen: true,
// allow to do statements
todo: true,
// allow unused parameters
unparam: true,
// don't require use strict pragma
sloppy: true
},
files: {
src: [
'*.js',
'core/*.js',
'core/server/**/*.js'
]
}
},
client: {
directives: {
// node environment
node: false,
// browser environment
browser: true,
// allow dangling underscores in var names
nomen: true,
// allow to do statements
todo: true,
// allow unused parameters
unparam: true
},
files: {
src: 'core/client/**/*.js'
},
exclude: [
'core/client/assets/**/*.js',
'core/client/tpl/**/*.js'
]
},
shared: {
directives: {
// node environment
node: true,
// browser environment
browser: false,
// allow dangling underscores in var names
nomen: true,
// allow to do statements
todo: true,
// allow unused parameters
unparam: true,
// don't require use strict pragma
sloppy: true
},
files: {
src: [
'core/shared/**/*.js'
]
},
exclude: [
'core/shared/vendor/**/*.js'
]
}
},
mochacli: {
options: {
ui: 'bdd',
reporter: 'spec'
},
all: {
src: ['core/test/unit/**/*_spec.js']
},
api: {
src: ['core/test/unit/**/api*_spec.js']
},
client: {
src: ['core/test/unit/**/client*_spec.js']
},
server: {
src: ['core/test/unit/**/server*_spec.js']
},
shared: {
src: ['core/test/unit/**/shared*_spec.js']
},
perm: {
src: ['core/test/unit/**/permissions_spec.js']
},
migrate: {
src: [
'core/test/unit/**/export_spec.js',
'core/test/unit/**/import_spec.js'
]
}
},
// Compile all the SASS!
sass: {
admin: {
files: {
'<%= paths.adminAssets %>/css/screen.css': '<%= paths.adminAssets %>/sass/screen.scss'
}
}
},
shell: {
bourbon: {
command: 'bourbon install --path <%= paths.adminAssets %>/sass/modules/'
}
},
handlebars: {
core: {
options: {
namespace: 'JST',
processName: function (filename) {
filename = filename.replace('core/client/tpl/', '');
return filename.replace('.hbs', '');
}
},
files: {
'core/client/tpl/hbs-tpl.js': 'core/client/tpl/**/*.hbs'
}
}
},
groc: {
docs: {
options: {
'out': './docs/',
'glob': [
'README.md',
'config.example.js',
'index.js',
'core/*.js',
'core/server/**/*.js',
'core/shared/**/*.js',
'core/client/**/*.js'
],
'except': [
'!core/**/vendor/**/*.js',
'!core/client/tpl/**/*.js'
]
}
}
},
clean: {
build: {
src: ['<%= paths.buildBuild %>/**']
}
},
copy: {
nightly: {
files: [{
expand: true,
src: buildGlob,
dest: '<%= paths.nightlyBuild %>/<%= pkg.version %>/'
}]
},
weekly: {
files: [{
expand: true,
src: buildGlob,
dest: '<%= paths.weeklyBuild %>/<%= pkg.version %>/'
}]
},
build: {
files: [{
expand: true,
src: buildGlob,
dest: '<%= paths.buildBuild %>/'
}]
}
},
compress: {
nightly: {
options: {
archive: '<%= paths.nightlyDist %>/Ghost-Nightly-<%= pkg.version %>.zip'
},
expand: true,
cwd: '<%= paths.nightlyBuild %>/<%= pkg.version %>/',
src: ['**']
},
weekly: {
options: {
archive: '<%= paths.weeklyDist %>/Ghost-Weekly-<%= pkg.version %>.zip'
},
expand: true,
cwd: '<%= paths.weeklyBuild %>/<%= pkg.version %>/',
src: ['**']
},
build: {
options: {
archive: '<%= paths.buildDist %>/Ghost-Build.zip'
},
expand: true,
cwd: '<%= paths.buildBuild %>/',
src: ['**']
},
release: {
options: {
archive: '<%= paths.releaseDist %>/Ghost-<%= pkg.version %>.zip'
},
expand: true,
cwd: '<%= paths.buildBuild %>/',
src: ['**']
}
},
bump: {
options: {
tagName: '%VERSION%',
commitMessage: '<%= buildType %> Release %VERSION%',
tagMessage: '<%= buildType %> Release %VERSION%',
pushTo: 'origin build'
}
},
concat: {
dev: {
files: {
'core/built/scripts/vendor.js': [
'core/shared/vendor/jquery/jquery.js',
'core/shared/vendor/jquery/jquery-ui-1.10.3.custom.min.js',
'core/client/assets/lib/jquery-utils.js',
'core/client/assets/lib/uploader.js',
'core/shared/vendor/underscore.js',
'core/shared/vendor/backbone/backbone.js',
'core/shared/vendor/handlebars/handlebars-runtime.js',
'core/shared/vendor/moment.js',
'core/client/assets/vendor/icheck/jquery.icheck.min.js',
'core/shared/vendor/jquery/jquery.ui.widget.js',
'core/shared/vendor/jquery/jquery.iframe-transport.js',
'core/shared/vendor/jquery/jquery.fileupload.js',
'core/client/assets/vendor/codemirror/codemirror.js',
'core/client/assets/vendor/codemirror/addon/mode/overlay.js',
'core/client/assets/vendor/codemirror/mode/markdown/markdown.js',
'core/client/assets/vendor/codemirror/mode/gfm/gfm.js',
'core/client/assets/vendor/showdown/showdown.js',
'core/client/assets/vendor/showdown/extensions/ghostdown.js',
'core/shared/vendor/showdown/extensions/github.js',
'core/client/assets/vendor/shortcuts.js',
'core/client/assets/vendor/validator-client.js',
'core/client/assets/vendor/countable.js',
'core/client/assets/vendor/to-title-case.js',
'core/client/assets/vendor/packery.pkgd.min.js',
'core/client/assets/vendor/fastclick.js'
],
'core/built/scripts/helpers.js': [
'core/client/init.js',
'core/client/mobile-interactions.js',
'core/client/toggle.js',
'core/client/markdown-actions.js',
'core/client/helpers/index.js'
],
'core/built/scripts/templates.js': [
'core/client/tpl/hbs-tpl.js'
],
'core/built/scripts/models.js': [
'core/client/models/**/*.js'
],
'core/built/scripts/views.js': [
'core/client/views/**/*.js',
'core/client/router.js'
]
}
},
prod: {
files: {
'core/built/scripts/ghost.js': [
'core/shared/vendor/jquery/jquery.js',
'core/shared/vendor/jquery/jquery-ui-1.10.3.custom.min.js',
'core/client/assets/lib/jquery-utils.js',
'core/client/assets/lib/uploader.js',
'core/shared/vendor/underscore.js',
'core/shared/vendor/backbone/backbone.js',
'core/shared/vendor/handlebars/handlebars-runtime.js',
'core/shared/vendor/moment.js',
'core/client/assets/vendor/icheck/jquery.icheck.min.js',
'core/shared/vendor/jquery/jquery.ui.widget.js',
'core/shared/vendor/jquery/jquery.iframe-transport.js',
'core/shared/vendor/jquery/jquery.fileupload.js',
'core/client/assets/vendor/codemirror/codemirror.js',
'core/client/assets/vendor/codemirror/addon/mode/overlay.js',
'core/client/assets/vendor/codemirror/mode/markdown/markdown.js',
'core/client/assets/vendor/codemirror/mode/gfm/gfm.js',
'core/client/assets/vendor/showdown/showdown.js',
'core/client/assets/vendor/showdown/extensions/ghostdown.js',
'core/shared/vendor/showdown/extensions/github.js',
'core/client/assets/vendor/shortcuts.js',
'core/client/assets/vendor/validator-client.js',
'core/client/assets/vendor/countable.js',
'core/client/assets/vendor/to-title-case.js',
'core/client/assets/vendor/packery.pkgd.min.js',
'core/client/assets/vendor/fastclick.js',
'core/client/init.js',
'core/client/mobile-interactions.js',
'core/client/toggle.js',
'core/client/markdown-actions.js',
'core/client/helpers/index.js',
'core/client/tpl/hbs-tpl.js',
'core/client/models/**/*.js',
'core/client/views/**/*.js',
'core/client/router.js'
]
}
}
},
uglify: {
prod: {
files: {
'core/built/scripts/ghost.min.js': 'core/built/scripts/ghost.js'
}
}
}
};
grunt.initConfig(cfg);
grunt.registerTask('setTestEnv', function () {
// Use 'testing' Ghost config; unless we are running on travis (then show queries for debugging)
process.env.NODE_ENV = process.env.TRAVIS ? 'travis' : 'testing';
});
grunt.registerTask('loadConfig', function () {
var done = this.async();
configLoader.loadConfig().then(function () {
done();
});
});
// Update the package information after changes
grunt.registerTask('updateCurrentPackageInfo', function () {
cfg.pkg = grunt.file.readJSON('package.json');
});
grunt.registerTask('setCurrentBuildType', function (type) {
cfg.buildType = type;
});
grunt.registerTask('spawn-casperjs', function () {
var done = this.async(),
options = ['host', 'noPort', 'port', 'email', 'password'],
args = ['test', 'admin/', 'frontend/', '--includes=base.js', '--direct', '--log-level=debug', '--port=2369'];
// Forward parameters from grunt to casperjs
_.each(options, function processOption(option) {
if (grunt.option(option)) {
args.push('--' + option + '=' + grunt.option(option));
}
});
grunt.util.spawn({
cmd: 'casperjs',
args: args,
opts: {
cwd: path.resolve('core/test/functional'),
stdio: 'inherit'
}
}, function (error, result, code) {
if (error) {
grunt.fail.fatal(result.stdout);
}
grunt.log.writeln(result.stdout);
done();
});
});
/* Generate Changelog
* - Pulls changelog from git, excluding merges.
* - Uses first line of commit message. Includes committer name.
*/
grunt.registerTask("changelog", "Generate changelog from Git", function () {
// TODO: Break the contents of this task out into a separate module,
// put on npm. (@cgiffard)
var done = this.async();
function git(args, callback, depth) {
depth = depth || 0;
if (!depth) {
grunt.log.writeln('git ' + args.join(' '));
}
var buffer = [];
spawn('git', args, {
// We can reasonably assume the gruntfile will be in the root of the repo.
cwd : __dirname,
stdio : ['ignore', 'pipe', process.stderr]
}).on('exit', function (code) {
// Process exited correctly but we got no output.
// Spawn again, but make sure we don't spiral out of control.
// Hack to work around an apparent node bug.
//
// Frustratingly, it's impossible to distinguish this
// bug from a genuine empty log.
if (!buffer.length && code === 0 && depth < 20) {
return setImmediate(function () {
git(args, callback, depth ? depth + 1 : 1);
});
}
if (code === 0) {
return callback(buffer.join(''));
}
// We failed. Git returned a non-standard exit code.
grunt.log.error('Git returned a non-zero exit code.');
done(false);
// Push returned data into the buffer
}).stdout.on('data', buffer.push.bind(buffer));
}
// Crazy function for getting around inconsistencies in tagging
function sortTags(a, b) {
a = a.tag;
b = b.tag;
// NOTE: Accounting for different tagging method for
// 0.2.1 and up.
// If we didn't have this issue I'd just pass rcompare
// into sort directly. Could be something to think about
// in future.
if (semver.rcompare(a, '0.2.0') < 0 ||
semver.rcompare(b, '0.2.0') < 0) {
return semver.rcompare(a, b);
}
a = a.split('-');
b = b.split('-');
if (semver.rcompare(a[0], b[0]) !== 0) {
return semver.rcompare(a[0], b[0]);
}
// Using this janky looking integerising-method
// because it's faster and doesn't result in NaN, which
// breaks sorting
/*jslint bitwise: true */
return (+b[1] | 0) - (+a[1] | 0);
}
// Gets tags in master branch, sorts them with semver,
function getTags(callback) {
git(['show-ref', '--tags'], function (results) {
results = results
.split(/\n+/)
.filter(function (tag) {
return tag.length && tag.match(/\/\d+\.\d+/);
})
.map(function (tag) {
return {
'tag': tag.split(/tags\//).pop().trim(),
'ref': tag.split(/\s+/).shift().trim()
};
})
.sort(sortTags);
callback(results);
});
}
// Parses log to extract commit data.
function parseLog(data) {
var commits = [],
commitRegex =
new RegExp(
'\\n*[|\\*\\s]*commit\\s+([a-f0-9]+)' +
'\\n[|\\*\\s]*Author:\\s+([^<\\n]+)<([^>\\n]+)>' +
'\\n[|\\*\\s]*Date:\\s+([^\\n]+)' +
'\\n+[|\\*\\s]*[ ]{4}([^\\n]+)',
'ig'
);
// Using String.prototype.replace as a kind of poor-man's substitute
// for a streaming parser.
data.replace(
commitRegex,
function (wholeCommit, hash, author, email, date, message) {
// The author name and commit message may have trailing space.
author = author.trim();
message = message.trim();
// Reformat date to make it parse-able by JS
date =
date.replace(
/^(\w+)\s(\w+)\s(\d+)\s([\d\:]+)\s(\d+)\s([\+\-\d]+)$/,
'$1, $2 $3 $5 $4 $6'
);
commits.push({
'hash': hash,
'author': author,
'email': email,
'date': date,
'parsedDate': new Date(Date.parse(date)),
'message': message
});
return null;
}
);
return commits;
}
// Gets git log for specified range.
function getLog(to, from, callback) {
var range = from && to ? from + '..' + to : '',
args = [ 'log', 'master', '--no-color', '--no-merges', '--graph' ];
if (range) {
args.push(range);
}
git(args, function (data) {
callback(parseLog(data));
});
}
// Run the job
getTags(function (tags) {
var logPath = path.join(__dirname, 'CHANGELOG.md'),
log = fs.createWriteStream(logPath),
commitCache = {};
function processTag(tag, callback) {
var buffer = '',
peek = tag[1];
tag = tag[0];
getLog(tag.tag, peek.tag, function (commits) {
// Use the comparison with HEAD to remove commits which
// haven't been included in a build/release yet.
if (tag.tag === "HEAD") {
commits.forEach(function (commit) {
commitCache[commit.hash] = true;
});
return callback("");
}
buffer += '## Release ' + tag.tag + '\n';
commits = commits
.filter(function (commit) {
// Get rid of jenkins' release tagging commits
// Remove commits we've already spat out
return (
commit.author !== 'TryGhost-Jenkins' &&
!commitCache[commit.hash]
);
})
.map(function (commit) {
buffer += '\n* ' + commit.message + ' (_' + commit.author + '_)';
commitCache[commit.hash] = true;
});
if (!commits.length) {
buffer += "\nNo changes were made in this build.\n";
}
callback(buffer + '\n');
});
}
// Get two weeks' worth of tags
tags.unshift({'tag': 'HEAD'});
tags =
tags
.slice(0, 14)
.map(function (tag, index) {
return [
tag,
tags[index + 1] || tags[index]
];
});
log.write('# Ghost Changelog\n\n');
log.write('_Showing ' + tags.length + ' releases._\n');
when.reduce(tags,
function (prev, tag, idx) {
return when.promise(function (resolve) {
processTag(tag, function (releaseData) {
resolve(prev + '\n' + releaseData);
});
});
}, '')
.then(function (reducedChangelog) {
log.write(reducedChangelog);
log.close();
done(true);
});
});
});
/* Nightly builds
* - Do our standard build steps (sass, handlebars, etc)
* - Bump patch version in package.json, commit, tag and push
* - Generate changelog for the past 14 releases
* - Copy files to build-folder/#/#{version} directory
* - Clean out unnecessary files (travis, .git*, .af*, .groc*)
* - Zip files in build folder to dist-folder/#{version} directory
*/
grunt.registerTask("nightly", [
'setCurrentBuildType:Nightly',
'shell:bourbon',
'sass:admin',
'handlebars',
'concat',
'uglify',
'bump:build',
'updateCurrentPackageInfo',
'changelog',
'copy:nightly',
'compress:nightly'
]);
grunt.registerTask("weekly", [
'setCurrentBuildType:Weekly',
'shell:bourbon',
'sass:admin',
'handlebars',
'concat',
'uglify',
'bump:build',
'updateCurrentPackageInfo',
'changelog',
'copy:weekly',
'compress:weekly'
]);
grunt.registerTask('build', [
'shell:bourbon',
'sass:admin',
'handlebars',
'concat',
'uglify',
'changelog',
'clean:build',
'copy:build',
'compress:build'
]);
grunt.registerTask('release', [
'shell:bourbon',
'sass:admin',
'handlebars',
'concat',
'uglify',
'changelog',
'clean:build',
'copy:build',
'compress:release'
]);
// Dev Mode; watch files and restart server on changes
grunt.registerTask('dev', [
'default',
'express:dev',
'open',
'watch'
]);
// Prepare the project for development
// TODO: Git submodule init/update (https://github.com/jaubourg/grunt-update-submodules)?
grunt.registerTask('init', ['shell:bourbon', 'default']);
// Run unit tests
grunt.registerTask('test-unit', ['setTestEnv', 'loadConfig', 'mochacli:all']);
// Run casperjs tests only
grunt.registerTask('test-functional', ['setTestEnv', 'express:test', 'spawn-casperjs']);
// Run tests and lint code
grunt.registerTask('validate', ['jslint', 'test-unit', 'test-functional']);
// Generate Docs
grunt.registerTask('docs', ['groc']);
// TODO: Production build task that minifies with uglify:prod
grunt.registerTask('prod', ['sass:admin', 'handlebars', 'concat', 'uglify']);
// When you just say 'grunt'
grunt.registerTask('default', ['sass:admin', 'handlebars', 'concat']);
};
module.exports = configureGrunt;
| {
"content_hash": "05e0b2468b8a361cb6fa0d5b9de7e79e",
"timestamp": "",
"source": "github",
"line_count": 871,
"max_line_length": 125,
"avg_line_length": 37.068886337543056,
"alnum_prop": 0.37485675349211756,
"repo_name": "Elesant/shang-li",
"id": "37f53b71b8f1114811f02a40c0911670125983c8",
"size": "32287",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Gruntfile.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "173731"
},
{
"name": "JavaScript",
"bytes": "2166035"
}
],
"symlink_target": ""
} |
<?php
namespace Eloquent\Typhoon\Extension;
use Eloquent\Typhax\Type\ExtensionType;
use Eloquent\Typhoon\Generator\TyphaxASTGenerator;
use Icecave\Pasta\AST\Func\Closure;
interface ExtensionInterface
{
/**
* @param TyphaxASTGenerator $generator The AST generator that loaded this extension.
* @param ExtensionType $type Type extension type for which code should be generated.
*
* @return Closure A closure AST node that accepts a single value parameter.
*/
public function generateTypeCheck(TyphaxASTGenerator $generator, ExtensionType $extensionType);
}
| {
"content_hash": "391e847e7018f8cf2ad0eab699596161",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 99,
"avg_line_length": 30.15,
"alnum_prop": 0.7512437810945274,
"repo_name": "eloquent/typhoon",
"id": "f12bcbafda143eb222d03613e00ffeabb9f494b4",
"size": "821",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/Eloquent/Typhoon/Extension/ExtensionInterface.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "935304"
}
],
"symlink_target": ""
} |
package edu.mille.uppgifter;
import java.util.Scanner;
public class U2_2 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("Svenska: ");
String svenska = s.next();
System.out.print("Engelska: ");
String engelska = s.next();
System.out.println("\n"+svenska + " heter \"" +engelska +"\" på engelska.");
s.close();
}
}
| {
"content_hash": "0f08f3b39eccd29afb10afb821fb6a50",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 84,
"avg_line_length": 25.294117647058822,
"alnum_prop": 0.5767441860465117,
"repo_name": "iceklue/Java",
"id": "b7dc0673e05f5270be5a416bcb7aec7cba5b64f7",
"size": "431",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Java Workspace/Programmering 1/src/edu/mille/uppgifter/U2_2.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "97"
},
{
"name": "Java",
"bytes": "50725"
}
],
"symlink_target": ""
} |
description: |
The Parallels Packer builder is able to create Parallels Desktop for Mac
virtual machines and export them in the PVM format.
layout: docs
page_title: 'Parallels - Builders'
sidebar_current: 'docs-builders-parallels'
---
# Parallels Builder
The Parallels Packer builder is able to create [Parallels Desktop for
Mac](https://www.parallels.com/products/desktop/) virtual machines and export
them in the PVM format.
Packer actually comes with multiple builders able to create Parallels machines,
depending on the strategy you want to use to build the image. Packer supports
the following Parallels builders:
- [parallels-iso](/docs/builders/parallels-iso.html) - Starts from an ISO file,
creates a brand new Parallels VM, installs an OS, provisions software within
the OS, then exports that machine to create an image. This is best for people
who want to start from scratch.
- [parallels-pvm](/docs/builders/parallels-pvm.html) - This builder imports an
existing PVM file, runs provisioners on top of that VM, and exports that
machine to create an image. This is best if you have an existing Parallels VM
export you want to use as the source. As an additional benefit, you can feed
the artifact of this builder back into itself to iterate on a machine.
## Requirements
In addition to [Parallels Desktop for
Mac](https://www.parallels.com/products/desktop/) this requires the [Parallels
Virtualization SDK](https://www.parallels.com/downloads/desktop/).
The SDK can be installed by downloading and following the instructions in the
dmg.
Parallels Desktop for Mac 9 and later is supported, from PD 11 Pro or Business
edition is required.
| {
"content_hash": "c0664493435afec4eec660a0723d4a33",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 81,
"avg_line_length": 42.4,
"alnum_prop": 0.7724056603773585,
"repo_name": "deasmi/terraform-provider-libvirt",
"id": "d88cfc1ced1231b56286d1c68935c91ed1c037b7",
"size": "1700",
"binary": false,
"copies": "17",
"ref": "refs/heads/master",
"path": "vendor/github.com/mitchellh/packer/website/source/docs/builders/parallels.html.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "178528"
},
{
"name": "HTML",
"bytes": "1555"
},
{
"name": "Makefile",
"bytes": "508"
},
{
"name": "Shell",
"bytes": "2852"
}
],
"symlink_target": ""
} |
""" Downloading dataset
"""
from world import world, setup_module, teardown_module
import create_source_steps as source_create
import create_dataset_steps as dataset_create
class TestDownloadDataset(object):
def test_scenario1(self):
"""
Scenario: Successfully exporting a dataset:
Given I create a data source uploading a "<data>" file
And I wait until the source is ready less than <time_1> secs
And I create a dataset
And I wait until the dataset is ready less than <time_2> secs
And I download the dataset file to "<local_file>"
Then file "<local_file>" is like file "<data>"
Examples:
| data | time_1 | time_2 | local_file |
| ../data/iris.csv | 30 | 30 | ./tmp/exported_iris.csv |
"""
print self.test_scenario1.__doc__
examples = [
['data/iris.csv', '30', '30', 'tmp/exported_iris.csv']]
for example in examples:
print "\nTesting with:\n", example
source_create.i_upload_a_file(self, example[0])
source_create.the_source_is_finished(self, example[1])
dataset_create.i_create_a_dataset(self)
dataset_create.the_dataset_is_finished_in_less_than(self, example[2])
dataset_create.i_export_a_dataset(self, example[3])
dataset_create.files_equal(self, example[3], example[0])
| {
"content_hash": "21be98009488c13f4d986ffa2d46e8d3",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 81,
"avg_line_length": 42.82857142857143,
"alnum_prop": 0.580386924616411,
"repo_name": "ShaguptaS/python",
"id": "971487b85edaa674d0ede9c87dd2199fb1aeed56",
"size": "2118",
"binary": false,
"copies": "1",
"ref": "refs/heads/next",
"path": "bigml/tests/test_15_download_dataset.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "600936"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using NUnit;
//using NUnit.Framework;
using FluentAssertions;
using unirest_rt;
using unirest_rt.http;
using unirest_rt.request;
using System.Net.Http;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
namespace unicorn_net_tests.request
{
[TestClass]
public class HttpRequestTests
{
[TestMethod]
public void HttpRequest_Should_Construct()
{
Action Get = () => new HttpRequest(HttpMethod.Get, "http://localhost");
Action Post = () => new HttpRequest(HttpMethod.Post, "http://localhost");
Action Delete = () => new HttpRequest(HttpMethod.Delete, "http://localhost");
Action Patch = () => new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
Action Put = () => new HttpRequest(HttpMethod.Put, "http://localhost");
Get.ShouldNotThrow();
Post.ShouldNotThrow();
Delete.ShouldNotThrow();
Patch.ShouldNotThrow();
Put.ShouldNotThrow();
}
[TestMethod]
public void HttpRequest_Should_Not_Construct_With_Invalid_URL()
{
Action Get = () => new HttpRequest(HttpMethod.Get, "http:///invalid");
Action Post = () => new HttpRequest(HttpMethod.Post, "http:///invalid");
Action Delete = () => new HttpRequest(HttpMethod.Delete, "http:///invalid");
Action Patch = () => new HttpRequest(new HttpMethod("PATCH"), "http:///invalid");
Action Put = () => new HttpRequest(HttpMethod.Put, "http:///invalid");
Get.ShouldThrow<ArgumentException>();
Post.ShouldThrow<ArgumentException>();
Delete.ShouldThrow<ArgumentException>();
Patch.ShouldThrow<ArgumentException>();
Put.ShouldThrow<ArgumentException>();
}
[TestMethod]
public void HttpRequest_Should_Not_Construct_With_None_HTTP_URL()
{
Action Get = () => new HttpRequest(HttpMethod.Get, "ftp://localhost");
Action Post = () => new HttpRequest(HttpMethod.Post, "mailto:localhost");
Action Delete = () => new HttpRequest(HttpMethod.Delete, "news://localhost");
Action Patch = () => new HttpRequest(new HttpMethod("PATCH"), "about:blank");
Action Put = () => new HttpRequest(HttpMethod.Put, "about:settings");
Get.ShouldThrow<ArgumentException>();
Post.ShouldThrow<ArgumentException>();
Delete.ShouldThrow<ArgumentException>();
Patch.ShouldThrow<ArgumentException>();
Put.ShouldThrow<ArgumentException>();
}
[TestMethod]
public void HttpRequest_Should_Construct_With_Correct_Verb()
{
var Get = new HttpRequest(HttpMethod.Get, "http://localhost");
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Get.HttpMethod.Should().Be(HttpMethod.Get);
Post.HttpMethod.Should().Be(HttpMethod.Post);
Delete.HttpMethod.Should().Be(HttpMethod.Delete);
Patch.HttpMethod.Should().Be(new HttpMethod("PATCH"));
Put.HttpMethod.Should().Be(HttpMethod.Put);
}
[TestMethod]
public void HttpRequest_Should_Construct_With_Correct_URL()
{
var Get = new HttpRequest(HttpMethod.Get, "http://localhost");
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Get.URL.OriginalString.Should().Be("http://localhost");
Post.URL.OriginalString.Should().Be("http://localhost");
Delete.URL.OriginalString.Should().Be("http://localhost");
Patch.URL.OriginalString.Should().Be("http://localhost");
Put.URL.OriginalString.Should().Be("http://localhost");
}
[TestMethod]
public void HttpRequest_Should_Construct_With_Headers()
{
var Get = new HttpRequest(HttpMethod.Get, "http://localhost");
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Get.Headers.Should().NotBeNull();
Post.URL.OriginalString.Should().NotBeNull();
Delete.URL.OriginalString.Should().NotBeNull();
Patch.URL.OriginalString.Should().NotBeNull();
Put.URL.OriginalString.Should().NotBeNull();
}
[TestMethod]
public void HttpRequest_Should_Add_Headers()
{
var Get = new HttpRequest(HttpMethod.Get, "http://localhost");
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Get.header("User-Agent", "unirest-net/1.0");
Post.header("User-Agent", "unirest-net/1.0");
Delete.header("User-Agent", "unirest-net/1.0");
Patch.header("User-Agent", "unirest-net/1.0");
Put.header("User-Agent", "unirest-net/1.0");
Get.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Post.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Delete.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Patch.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Put.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
}
[TestMethod]
public void HttpRequest_Should_Add_Headers_Dictionary()
{
var Get = new HttpRequest(HttpMethod.Get, "http://localhost");
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Get.headers(new Dictionary<string, string> { { "User-Agent", "unirest-net/1.0" } });
Post.headers(new Dictionary<string, string> { { "User-Agent", "unirest-net/1.0" } });
Delete.headers(new Dictionary<string, string> { { "User-Agent", "unirest-net/1.0" } });
Patch.headers(new Dictionary<string, string> { { "User-Agent", "unirest-net/1.0" } });
Put.headers(new Dictionary<string, string> { { "User-Agent", "unirest-net/1.0" } });
Get.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Post.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Delete.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Patch.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Put.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
}
[TestMethod]
public void HttpRequest_Should_Return_String()
{
var Get = new HttpRequest(HttpMethod.Get, "http://www.google.com");
var Post = new HttpRequest(HttpMethod.Post, "http://www.google.com");
var Delete = new HttpRequest(HttpMethod.Delete, "http://www.google.com");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://www.google.com");
var Put = new HttpRequest(HttpMethod.Put, "http://www.google.com");
Get.asString().Body.Should().NotBeBlank();
Post.asString().Body.Should().NotBeBlank();
Delete.asString().Body.Should().NotBeBlank();
Patch.asString().Body.Should().NotBeBlank();
Put.asString().Body.Should().NotBeBlank();
}
[TestMethod]
public void HttpRequest_Should_Return_Stream()
{
var Get = new HttpRequest(HttpMethod.Get, "http://www.google.com");
var Post = new HttpRequest(HttpMethod.Post, "http://www.google.com");
var Delete = new HttpRequest(HttpMethod.Delete, "http://www.google.com");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://www.google.com");
var Put = new HttpRequest(HttpMethod.Put, "http://www.google.com");
Get.asBinary().Body.Should().NotBeNull();
Post.asBinary().Body.Should().NotBeNull();
Delete.asBinary().Body.Should().NotBeNull();
Patch.asBinary().Body.Should().NotBeNull();
Put.asBinary().Body.Should().NotBeNull();
}
[TestMethod]
public void HttpRequest_Should_Return_Parsed_JSON()
{
var Get = new HttpRequest(HttpMethod.Get, "http://www.google.com");
var Post = new HttpRequest(HttpMethod.Post, "http://www.google.com");
var Delete = new HttpRequest(HttpMethod.Delete, "http://www.google.com");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://www.google.com");
var Put = new HttpRequest(HttpMethod.Put, "http://www.google.com");
Get.asJson<String>().Body.Should().NotBeBlank();
Post.asJson<String>().Body.Should().NotBeBlank();
Delete.asJson<String>().Body.Should().NotBeBlank();
Patch.asJson<String>().Body.Should().NotBeBlank();
Put.asJson<String>().Body.Should().NotBeBlank();
}
[TestMethod]
public void HttpRequest_Should_Return_String_Async()
{
var Get = new HttpRequest(HttpMethod.Get, "http://www.google.com").asStringAsync();
var Post = new HttpRequest(HttpMethod.Post, "http://www.google.com").asStringAsync();
var Delete = new HttpRequest(HttpMethod.Delete, "http://www.google.com").asStringAsync();
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://www.google.com").asStringAsync();
var Put = new HttpRequest(HttpMethod.Put, "http://www.google.com").asStringAsync();
Task.WaitAll(Get, Post, Delete, Patch, Put);
Get.Result.Body.Should().NotBeBlank();
Post.Result.Body.Should().NotBeBlank();
Delete.Result.Body.Should().NotBeBlank();
Patch.Result.Body.Should().NotBeBlank();
Put.Result.Body.Should().NotBeBlank();
}
[TestMethod]
public void HttpRequest_Should_Return_Stream_Async()
{
var Get = new HttpRequest(HttpMethod.Get, "http://www.google.com").asBinaryAsync();
var Post = new HttpRequest(HttpMethod.Post, "http://www.google.com").asBinaryAsync();
var Delete = new HttpRequest(HttpMethod.Delete, "http://www.google.com").asBinaryAsync();
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://www.google.com").asBinaryAsync();
var Put = new HttpRequest(HttpMethod.Put, "http://www.google.com").asBinaryAsync();
Task.WaitAll(Get, Post, Delete, Patch, Put);
Get.Result.Body.Should().NotBeNull();
Post.Result.Body.Should().NotBeNull();
Delete.Result.Body.Should().NotBeNull();
Patch.Result.Body.Should().NotBeNull();
Put.Result.Body.Should().NotBeNull();
}
[TestMethod]
public void HttpRequest_Should_Return_Parsed_JSON_Async()
{
var Get = new HttpRequest(HttpMethod.Get, "http://www.google.com").asJsonAsync<String>();
var Post = new HttpRequest(HttpMethod.Post, "http://www.google.com").asJsonAsync<String>();
var Delete = new HttpRequest(HttpMethod.Delete, "http://www.google.com").asJsonAsync<String>();
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://www.google.com").asJsonAsync<String>();
var Put = new HttpRequest(HttpMethod.Put, "http://www.google.com").asJsonAsync<String>();
Task.WaitAll(Get, Post, Delete, Patch, Put);
Get.Result.Body.Should().NotBeBlank();
Post.Result.Body.Should().NotBeBlank();
Delete.Result.Body.Should().NotBeBlank();
Patch.Result.Body.Should().NotBeBlank();
Put.Result.Body.Should().NotBeBlank();
}
[TestMethod]
public void HttpRequest_With_Body_Should_Construct()
{
Action Post = () => new HttpRequest(HttpMethod.Post, "http://localhost");
Action Delete = () => new HttpRequest(HttpMethod.Delete, "http://localhost");
Action Patch = () => new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
Action Put = () => new HttpRequest(HttpMethod.Put, "http://localhost");
Post.ShouldNotThrow();
Delete.ShouldNotThrow();
Patch.ShouldNotThrow();
Put.ShouldNotThrow();
}
[TestMethod]
public void HttpRequest_With_Body_Should_Not_Construct_With_Invalid_URL()
{
Action Post = () => new HttpRequest(HttpMethod.Post, "http:///invalid");
Action delete = () => new HttpRequest(HttpMethod.Delete, "http:///invalid");
Action patch = () => new HttpRequest(new HttpMethod("PATCH"), "http:///invalid");
Action put = () => new HttpRequest(HttpMethod.Put, "http:///invalid");
Post.ShouldThrow<ArgumentException>();
delete.ShouldThrow<ArgumentException>();
patch.ShouldThrow<ArgumentException>();
put.ShouldThrow<ArgumentException>();
}
[TestMethod]
public void HttpRequest_With_Body_Should_Not_Construct_With_None_HTTP_URL()
{
Action Post = () => new HttpRequest(HttpMethod.Post, "mailto:localhost");
Action delete = () => new HttpRequest(HttpMethod.Delete, "news://localhost");
Action patch = () => new HttpRequest(new HttpMethod("PATCH"), "about:blank");
Action put = () => new HttpRequest(HttpMethod.Put, "about:settings");
Post.ShouldThrow<ArgumentException>();
delete.ShouldThrow<ArgumentException>();
patch.ShouldThrow<ArgumentException>();
put.ShouldThrow<ArgumentException>();
}
[TestMethod]
public void HttpRequest_With_Body_Should_Construct_With_Correct_Verb()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Post.HttpMethod.Should().Be(HttpMethod.Post);
Delete.HttpMethod.Should().Be(HttpMethod.Delete);
Patch.HttpMethod.Should().Be(new HttpMethod("PATCH"));
Put.HttpMethod.Should().Be(HttpMethod.Put);
}
[TestMethod]
public void HttpRequest_With_Body_Should_Construct_With_Correct_URL()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Post.URL.OriginalString.Should().Be("http://localhost");
Delete.URL.OriginalString.Should().Be("http://localhost");
Patch.URL.OriginalString.Should().Be("http://localhost");
Put.URL.OriginalString.Should().Be("http://localhost");
}
[TestMethod]
public void HttpRequest_With_Body_Should_Construct_With_Headers()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Post.URL.OriginalString.Should().NotBeNull();
Delete.URL.OriginalString.Should().NotBeNull();
Patch.URL.OriginalString.Should().NotBeNull();
Put.URL.OriginalString.Should().NotBeNull();
}
[TestMethod]
public void HttpRequest_With_Body_Should_Add_Headers()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Post.header("User-Agent", "unirest-net/1.0");
Delete.header("User-Agent", "unirest-net/1.0");
Patch.header("User-Agent", "unirest-net/1.0");
Put.header("User-Agent", "unirest-net/1.0");
Post.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Delete.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Patch.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Put.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
}
[TestMethod]
public void HttpRequest_With_Body_Should_Add_Headers_Dictionary()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Post.headers(new Dictionary<string, string> { { "User-Agent", "unirest-net/1.0" } });
Delete.headers(new Dictionary<string, string> { { "User-Agent", "unirest-net/1.0" } });
Patch.headers(new Dictionary<string, string> { { "User-Agent", "unirest-net/1.0" } });
Put.headers(new Dictionary<string, string> { { "User-Agent", "unirest-net/1.0" } });
Post.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Delete.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Patch.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
Put.Headers.Should().Contain("User-Agent", "unirest-net/1.0");
}
[TestMethod]
public void HttpRequest_With_Body_Should_Encode_Fields()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Post.field("key", "value");
Delete.field("key", "value");
Patch.field("key", "value");
Put.field("key", "value");
Post.Body.Should().NotBeEmpty();
Delete.Body.Should().NotBeEmpty();
Patch.Body.Should().NotBeEmpty();
Put.Body.Should().NotBeEmpty();
}
[TestMethod]
public void HttpRequest_With_Body_Should_Encode_File()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
var stream = new MemoryStream();
Post.field(stream);
Delete.field(stream);
Patch.field(stream);
Put.field(stream);
Post.Body.Should().NotBeEmpty();
Delete.Body.Should().NotBeEmpty();
Patch.Body.Should().NotBeEmpty();
Put.Body.Should().NotBeEmpty();
}
[TestMethod]
public void HttpRequestWithBody_Should_Encode_Multiple_Fields()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
var dict = new Dictionary<string, object>
{
{"key", "value"},
{"key2", "value2"},
{"key3", new MemoryStream()}
};
Post.fields(dict);
Delete.fields(dict);
Patch.fields(dict);
Put.fields(dict);
Post.Body.Should().NotBeEmpty();
Delete.Body.Should().NotBeEmpty();
Patch.Body.Should().NotBeEmpty();
Put.Body.Should().NotBeEmpty();
}
[TestMethod]
public void HttpRequestWithBody_Should_Add_String_Body()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Post.body("test");
Delete.body("test");
Patch.body("test");
Put.body("test");
Post.Body.Should().NotBeEmpty();
Delete.Body.Should().NotBeEmpty();
Patch.Body.Should().NotBeEmpty();
Put.Body.Should().NotBeEmpty();
}
[TestMethod]
public void HttpRequestWithBody_Should_Add_JSON_Body()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
Post.body(new List<int> { 1, 2, 3 });
Delete.body(new List<int> { 1, 2, 3 });
Patch.body(new List<int> { 1, 2, 3 });
Put.body(new List<int> { 1, 2, 3 });
Post.Body.Should().NotBeEmpty();
Delete.Body.Should().NotBeEmpty();
Patch.Body.Should().NotBeEmpty();
Put.Body.Should().NotBeEmpty();
}
[TestMethod]
public void Http_Request_Shouldnt_Add_Fields_To_Get()
{
var Get = new HttpRequest(HttpMethod.Get, "http://localhost");
Action addStringField = () => Get.field("name", "value");
Action addKeyField = () => Get.field(new MemoryStream());
Action addStringFields = () => Get.fields(new Dictionary<string, object> {{"name", "value"}});
Action addKeyFields = () => Get.fields(new Dictionary<string, object> {{"key", new MemoryStream()}});
addStringField.ShouldThrow<InvalidOperationException>();
addKeyField.ShouldThrow<InvalidOperationException>();
addStringFields.ShouldThrow<InvalidOperationException>();
addKeyFields.ShouldThrow<InvalidOperationException>();
}
[TestMethod]
public void Http_Request_Shouldnt_Add_Body_To_Get()
{
var Get = new HttpRequest(HttpMethod.Get, "http://localhost");
Action addStringBody = () => Get.body("string");
Action addJSONBody = () => Get.body(new List<int> {1,2,3});
addStringBody.ShouldThrow<InvalidOperationException>();
addJSONBody.ShouldThrow<InvalidOperationException>();
}
[TestMethod]
public void HttpRequestWithBody_Should_Not_Allow_Body_For_Request_With_Field()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
var stream = new MemoryStream();
Post.field(stream);
Delete.field(stream);
Patch.field(stream);
Put.field(stream);
Action addBodyPost = () => Post.body("test");
Action addBodyDelete = () => Delete.body("test");
Action addBodyPatch = () => Patch.body("test");
Action addBodyPut = () => Put.body("test");
Action addObjectBodyPost = () => Post.body(1);
Action addObjectBodyDelete = () => Delete.body(1);
Action addObjectBodyPatch = () => Patch.body(1);
Action addObjectBodyPut = () => Put.body(1);
addBodyPost.ShouldThrow<InvalidOperationException>();
addBodyDelete.ShouldThrow<InvalidOperationException>();
addBodyPatch.ShouldThrow<InvalidOperationException>();
addBodyPut.ShouldThrow<InvalidOperationException>();
addObjectBodyPost.ShouldThrow<InvalidOperationException>();
addObjectBodyDelete.ShouldThrow<InvalidOperationException>();
addObjectBodyPatch.ShouldThrow<InvalidOperationException>();
addObjectBodyPut.ShouldThrow<InvalidOperationException>();
}
[TestMethod]
public void HttpRequestWithBody_Should_Not_Allow_Fields_For_Request_With_Body()
{
var Post = new HttpRequest(HttpMethod.Post, "http://localhost");
var Delete = new HttpRequest(HttpMethod.Delete, "http://localhost");
var Patch = new HttpRequest(new HttpMethod("PATCH"), "http://localhost");
var Put = new HttpRequest(HttpMethod.Put, "http://localhost");
var stream = new MemoryStream();
Post.body("test");
Delete.body("test");
Patch.body("test");
Put.body("lalala");
Action addFieldPost = () => Post.field("key", "value");
Action addFieldDelete = () => Delete.field("key", "value");
Action addFieldPatch = () => Patch.field("key", "value");
Action addFieldPut = () => Put.field("key", "value");
Action addStreamFieldPost = () => Post.field(stream);
Action addStreamFieldDelete = () => Delete.field(stream);
Action addStreamFieldPatch = () => Patch.field(stream);
Action addStreamFieldPut = () => Put.field(stream);
Action addFieldsPost = () => Post.fields(new Dictionary<string, object> {{"test", "test"}});
Action addFieldsDelete = () => Delete.fields(new Dictionary<string, object> {{"test", "test"}});
Action addFieldsPatch = () => Patch.fields(new Dictionary<string, object> {{"test", "test"}});
Action addFieldsPut = () => Put.fields(new Dictionary<string, object> {{"test", "test"}});
addFieldPost.ShouldThrow<InvalidOperationException>();
addFieldDelete.ShouldThrow<InvalidOperationException>();
addFieldPatch.ShouldThrow<InvalidOperationException>();
addFieldPut.ShouldThrow<InvalidOperationException>();
addStreamFieldPost.ShouldThrow<InvalidOperationException>();
addStreamFieldDelete.ShouldThrow<InvalidOperationException>();
addStreamFieldPatch.ShouldThrow<InvalidOperationException>();
addStreamFieldPut.ShouldThrow<InvalidOperationException>();
addFieldsPost.ShouldThrow<InvalidOperationException>();
addFieldsDelete.ShouldThrow<InvalidOperationException>();
addFieldsPatch.ShouldThrow<InvalidOperationException>();
addFieldsPut.ShouldThrow<InvalidOperationException>();
}
}
}
| {
"content_hash": "37d9bc57e4542463e0e3be1dd98c94c4",
"timestamp": "",
"source": "github",
"line_count": 593,
"max_line_length": 113,
"avg_line_length": 48.0893760539629,
"alnum_prop": 0.5948732335098362,
"repo_name": "Mashape/unirest-win8",
"id": "14adf1fa574a976ee2c32e1eb7580d3215710109",
"size": "28519",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "unirest-rt/unirest-rt-tests/src/request/HttpRequestTests.cs",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "44851"
},
{
"name": "PowerShell",
"bytes": "1658"
}
],
"symlink_target": ""
} |
using System;
using CoreGraphics;
using UIKit;
namespace AiForms.Renderers.iOS
{
/// <summary>
/// No caret field.
/// </summary>
[Foundation.Preserve(AllMembers = true)]
public class NoCaretField : UITextField
{
/// <summary>
/// Initializes a new instance of the <see cref="T:AiForms.Renderers.iOS.NoCaretField"/> class.
/// </summary>
public NoCaretField() : base(new CGRect())
{
}
/// <summary>
/// Gets the caret rect for position.
/// </summary>
/// <returns>The caret rect for position.</returns>
/// <param name="position">Position.</param>
public override CoreGraphics.CGRect GetCaretRectForPosition(UITextPosition position)
{
return new CGRect();
}
}
}
| {
"content_hash": "90a5bdfa2c09246a7283fe2d97be7910",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 103,
"avg_line_length": 27.266666666666666,
"alnum_prop": 0.5806845965770171,
"repo_name": "muak/AiForms.Renderers",
"id": "3a22a9c662c1a1b26f7e14faf855ed3efe2db4d3",
"size": "820",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SettingsView.iOS/Cells/NoCaretField.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "475225"
},
{
"name": "Shell",
"bytes": "173"
}
],
"symlink_target": ""
} |
package org.redisson.api;
import java.util.stream.Stream;
/**
* Redis based priority deque.
*
* @author Nikita Koksharov
*
* @param <V> value type
*/
public interface RPriorityDeque<V> extends RDeque<V>, RPriorityQueue<V> {
/**
* Returns stream of elements contained in this deque in reverse order
*
* @return stream of elements in reverse order
*/
Stream<V> descendingStream();
}
| {
"content_hash": "0f8a0a85d30d91b621d222bd829cac95",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 74,
"avg_line_length": 19.318181818181817,
"alnum_prop": 0.6611764705882353,
"repo_name": "redisson/redisson",
"id": "62e61bc78d86668ca29ca3f172ef881e07532599",
"size": "1033",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "redisson/src/main/java/org/redisson/api/RPriorityDeque.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "12833620"
}
],
"symlink_target": ""
} |
#ifndef TCLAPW_VALUESCONSTRAINT_H
#define TCLAPW_VALUESCONSTRAINT_H
#include <string>
#include <vector>
#include <tclapw/Constraint.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#else
#define HAVE_SSTREAM
#endif
#if defined(HAVE_SSTREAM)
#include <sstream>
#elif defined(HAVE_STRSTREAM)
#include <strstream>
#else
#error L"Need a stringstream (sstream or strstream) to compile!"
#endif
namespace TCLAPW {
/**
* A Constraint that constrains the Arg to only those values specified
* in the constraint.
*/
template<class T>
class ValuesConstraint : public Constraint<T>
{
public:
/**
* Constructor.
* \param allowed - vector of allowed values.
*/
ValuesConstraint(std::vector<T>& allowed);
/**
* Virtual destructor.
*/
virtual ~ValuesConstraint() {}
/**
* Returns a description of the Constraint.
*/
virtual std::wstring description() const;
/**
* Returns the short ID for the Constraint.
*/
virtual std::wstring shortID() const;
/**
* The method used to verify that the value parsed from the command
* line meets the constraint.
* \param value - The value that will be checked.
*/
virtual bool check(const T& value) const;
protected:
/**
* The list of valid values.
*/
std::vector<T> _allowed;
/**
* The string used to describe the allowed values of this constraint.
*/
std::wstring _typeDesc;
};
template<class T>
ValuesConstraint<T>::ValuesConstraint(std::vector<T>& allowed)
: _allowed(allowed),
_typeDesc(L"")
{
for ( unsigned int i = 0; i < _allowed.size(); i++ )
{
#if defined(HAVE_SSTREAM)
std::wostringstream os;
#elif defined(HAVE_STRSTREAM)
std::wostrstream os;
#else
#error L"Need a stringstream (sstream or strstream) to compile!"
#endif
os << _allowed[i];
std::wstring temp( os.str() );
if ( i > 0 )
_typeDesc += L"|";
_typeDesc += temp;
}
}
template<class T>
bool ValuesConstraint<T>::check( const T& val ) const
{
if ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() )
return false;
else
return true;
}
template<class T>
std::wstring ValuesConstraint<T>::shortID() const
{
return _typeDesc;
}
template<class T>
std::wstring ValuesConstraint<T>::description() const
{
return _typeDesc;
}
} //namespace TCLAPW
#endif
| {
"content_hash": "11322c61fc491a792327642d1fba4d1b",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 72,
"avg_line_length": 18.076923076923077,
"alnum_prop": 0.654468085106383,
"repo_name": "undisputed-seraphim/waifu2x-caffe",
"id": "42e90860d6374f39834d3bb889dfb2665051219a",
"size": "3218",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "include/tclapw/ValuesConstraint.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1620"
},
{
"name": "C",
"bytes": "8624"
},
{
"name": "C++",
"bytes": "559053"
},
{
"name": "Makefile",
"bytes": "25128"
},
{
"name": "Python",
"bytes": "11860"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CidrRootsConfiguration">
<libraryRoots>
<file path="$PROJECT_DIR$/Pods" />
</libraryRoots>
</component>
<component name="masterDetails">
<states>
<state key="ScopeChooserConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project> | {
"content_hash": "6f2225d3b80e2693facc096b4a8c58f9",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 47,
"avg_line_length": 26.08695652173913,
"alnum_prop": 0.54,
"repo_name": "yunWJR/YunKits",
"id": "4820f33b7be462a7aa475a90ec9ec8d45e133de9",
"size": "600",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".idea/misc.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "2212"
},
{
"name": "Objective-C",
"bytes": "257405"
},
{
"name": "Ruby",
"bytes": "6714"
}
],
"symlink_target": ""
} |
package org.jabref.logic.importer.fetcher;
import java.util.Optional;
import org.jabref.logic.importer.FetcherException;
import org.jabref.model.entry.BibEntry;
import org.jabref.testutils.category.FetcherTest;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@FetcherTest
public abstract class AbstractIsbnFetcherTest {
protected AbstractIsbnFetcher fetcher;
protected BibEntry bibEntry;
public abstract void testName();
public abstract void testHelpPage();
public abstract void authorsAreCorrectlyFormatted() throws Exception;
public abstract void searchByIdSuccessfulWithShortISBN() throws FetcherException;
@Test
public void searchByIdSuccessfulWithLongISBN() throws FetcherException {
Optional<BibEntry> fetchedEntry = fetcher.performSearchById("978-0321356680");
assertEquals(Optional.of(bibEntry), fetchedEntry);
}
@Test
public void searchByIdReturnsEmptyWithEmptyISBN() throws FetcherException {
Optional<BibEntry> fetchedEntry = fetcher.performSearchById("");
assertEquals(Optional.empty(), fetchedEntry);
}
@Test
public void searchByIdThrowsExceptionForShortInvalidISBN() {
assertThrows(FetcherException.class, () -> fetcher.performSearchById("123456789"));
}
@Test
public void searchByIdThrowsExceptionForLongInvalidISB() {
assertThrows(FetcherException.class, () -> fetcher.performSearchById("012345678910"));
}
@Test
public void searchByIdThrowsExceptionForInvalidISBN() {
assertThrows(FetcherException.class, () -> fetcher.performSearchById("jabref-4-ever"));
}
}
| {
"content_hash": "439775d63195e5524f460271ff9924a4",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 95,
"avg_line_length": 31.672727272727272,
"alnum_prop": 0.756601607347876,
"repo_name": "tobiasdiez/jabref",
"id": "096f11e840aa0a412ad5d7bbf3145ca1f24aadd6",
"size": "1742",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/org/jabref/logic/importer/fetcher/AbstractIsbnFetcherTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ANTLR",
"bytes": "1751"
},
{
"name": "Batchfile",
"bytes": "138"
},
{
"name": "CSS",
"bytes": "33600"
},
{
"name": "GAP",
"bytes": "1466"
},
{
"name": "Java",
"bytes": "6465332"
},
{
"name": "PowerShell",
"bytes": "1688"
},
{
"name": "Python",
"bytes": "28937"
},
{
"name": "Ruby",
"bytes": "1115"
},
{
"name": "Shell",
"bytes": "5283"
},
{
"name": "TeX",
"bytes": "307513"
},
{
"name": "XSLT",
"bytes": "2185"
}
],
"symlink_target": ""
} |
<?php
namespace Cryptography;
/**
* Provides an implementation of the RSA algorithm.
* @author ludovic.senecaux
*
*/
final class RSA extends AsymmetricAlgorithm
{
/**
* Initializes a new instance of the RSA class with a randomly generated key of the specified size.
* @param int $KeySize
* @return \Cryptography\RSA
*/
public static function Create($KeySize = 1024)
{
$object = new RSA();
$object->_params['private_key_type'] = OPENSSL_KEYTYPE_RSA;
$object->_properties['LegalKeySizes'] = array_map(function($f) { return pow(2, $f); }, range(9, 14, 1));
$object->KeySize = $KeySize;
$object->_GenerateKey();
$object->_getProperties();
$object->_publicOnly = false;
return $object;
}
/**
* Initializes an RSA object from the key information from a file.
* @param string $FileName
* @param string $Passphrase
* @return \Cryptography\RSA
*/
public static function CreateFromFile($FileName, $Passphrase = NULL)
{
return RSA::CreateFromString(file_get_contents($FileName), $Passphrase);
}
/**
* Initializes an RSA object from the key information from a string.
* @param string $PEM
* @param string $Passphrase
* @return \Cryptography\RSA
*/
public static function CreateFromString($PEM, $Passphrase = NULL)
{
$object = new RSA();
try
{
$object->_resource = openssl_pkey_get_private($PEM, $Passphrase);
$object->_publicOnly = false;
}
catch (\Exception $e)
{
$object->_resource = openssl_pkey_get_public($PEM);
$object->_publicOnly = true;
}
$object->_getProperties();
return $object;
}
/**
* Gets key properties.
*/
private function _getProperties()
{
$this->_Export();
$details = openssl_pkey_get_details($this->_resource);
$this->PublicKey = base64_decode(trim(preg_replace('/-----(BEGIN|END)(.+)PUBLIC KEY-----/i', NULL, $details['key'])));
$this->KeySize = $details['bits'];
$this->_properties['Params'] = array(
'Modulus' => $details['rsa']['n'],
'Exponent' => $details['rsa']['e'],
);
if ($this->_publicOnly === FALSE)
{
$this->_properties['Params']['P'] = $details['rsa']['p'];
$this->_properties['Params']['Q'] = $details['rsa']['q'];
$this->_properties['Params']['D'] = $details['rsa']['d'];
$this->_properties['Params']['DP'] = $details['rsa']['dmp1'];
$this->_properties['Params']['DQ'] = $details['rsa']['dmq1'];
$this->_properties['Params']['InverseQ'] = $details['rsa']['iqmp'];
}
}
/**
*
* {@inheritDoc}
* @see \Cryptography\AsymmetricAlgorithm::ToXMLString()
*/
public function ToXMLString($IncludePrivateParamerters = TRUE)
{
$xml = new \DOMDocument('1.0', 'UTF-8');
$root = $xml->createElement('RSAKeyValue');
if ($IncludePrivateParamerters === FALSE || $this->_publicOnly === TRUE)
{
$root->appendChild($xml->createElement('Modulus', $this->_properties['Params']['Modulus']));
$root->appendChild($xml->createElement('Exponent', $this->_properties['Params']['Exponent']));
}
else
{
if ($this->_publicOnly === TRUE)
throw new \Exception('This is a public key, private data cannot be exported');
foreach ($this->_properties['Params'] as $param => $value)
$root->appendChild($xml->createElement($param, $value));
}
$xml->appendChild($root);
return $xml->saveXML();
}
/**
* Encrypts the input data using the public key.
* @param string $Data
* @param boolean $RawOutput
* @throws \Exception
* @return string
*/
public function Encrypt($Data, $RawOutput = TRUE)
{
if (!openssl_public_encrypt($Data, $cipherText, sprintf("-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----", base64_encode($this->PublicKey))));
throw new \Exception('An error occured while encrypting data');
return $RawOutput === TRUE ? $cipherText : base64_encode($cipherText);
}
/**
* Decrypts the input data using the private key.
* @param string $Data
* @param boolean $RawInput
* @throws \Exception
* @return string
*/
public function Decrypt($Data, $RawInput = TRUE)
{
if ($this->_publicOnly === TRUE)
throw new \Exception('This is a public key, data cannot be decrypted !');
if (!openssl_private_decrypt($RawInput === TRUE ? $Data : base64_decode($Data), $clearText, $this->_resource))
throw new \Exception('An error occured while decrypting data');
return $clearText;
}
}
| {
"content_hash": "2b09c8683fbd771544ce7d67dc394fd7",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 159,
"avg_line_length": 32.08387096774194,
"alnum_prop": 0.5584154433943294,
"repo_name": "lsenecaux/phpCrypto",
"id": "1b1707a7dd272beafa5bc629e11470c887e45587",
"size": "4973",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Cryptography/RSA.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "PHP",
"bytes": "36837"
}
],
"symlink_target": ""
} |
<?php namespace Grinder\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class Inspire extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'inspire';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
}
| {
"content_hash": "eaa028ee4098263f02933c4192266b5c",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 55,
"avg_line_length": 18.08823529411765,
"alnum_prop": 0.6943089430894309,
"repo_name": "chris-schmitz/thedevgrind",
"id": "d1d35e937b1ff99a9aa81ab94c95257ee782010f",
"size": "615",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Console/Commands/Inspire.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "356"
},
{
"name": "JavaScript",
"bytes": "111820"
},
{
"name": "PHP",
"bytes": "103188"
},
{
"name": "Shell",
"bytes": "885"
}
],
"symlink_target": ""
} |
\documentclass[a4paper, twoside, 12pt, listof=nochaptergap]{book}
\input{util/packages}
\input{util/utils}
\input{util/styles}
\input{util/variables}
\input{util/setting}
\input{lang/indonesian/hyphenation}
\addbibresource{holy.bib}
\begin{document}
%-- Things that should go first but can't be placed in preamble
% Figure numbering uses chapter numbering as prefix
\counterwithin {figure}{chapter}
\pagestyle {normal}
\frontmatter
\include{buku/sampul}
\include{buku/pengesahan}
\include{buku/abstrak}
\include{buku/kata_pengantar}
\include{buku/daftar_isi}
\mainmatter
\include{buku/bab1} \cleardoublepage
\include{buku/bab2} \cleardoublepage
\include{buku/bab3} \cleardoublepage
\include{buku/bab4} \cleardoublepage
\include{buku/bab5} \cleardoublepage
\backmatter
\include{buku/daftar_pustaka}
\include{buku/biodata}
\end{document} | {
"content_hash": "fb36377ae71156c175ea3306f7a05bf9",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 65,
"avg_line_length": 25.8,
"alnum_prop": 0.7342192691029901,
"repo_name": "rafgugi/guess-the-number",
"id": "36cf6741e008e26e5ee01477b6c1ff23ce23645f",
"size": "903",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/tex/buku.tex",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "31225"
},
{
"name": "CSS",
"bytes": "1427"
},
{
"name": "CoffeeScript",
"bytes": "48734"
},
{
"name": "HTML",
"bytes": "1073"
},
{
"name": "JavaScript",
"bytes": "1294"
},
{
"name": "TeX",
"bytes": "189856"
}
],
"symlink_target": ""
} |
@interface CGRectStoreValue : NSObject
@property (nonatomic) CGRect startRect;
@property (nonatomic) CGRect midRect;
@property (nonatomic) CGRect endRect;
@end
| {
"content_hash": "a52b99c457832b643b3ba593074012b3",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 39,
"avg_line_length": 23.142857142857142,
"alnum_prop": 0.7901234567901234,
"repo_name": "LTMana/code",
"id": "885a62c83f905b6d6e2c10cb01f42170805ed016",
"size": "343",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ObjC/大神源码/YoCelsius/YoCelsius/CGRectStoreValue.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "221642"
},
{
"name": "C++",
"bytes": "4282363"
},
{
"name": "CSS",
"bytes": "5671819"
},
{
"name": "DTrace",
"bytes": "1236"
},
{
"name": "HTML",
"bytes": "4754669"
},
{
"name": "JavaScript",
"bytes": "2590435"
},
{
"name": "Jupyter Notebook",
"bytes": "978217"
},
{
"name": "Makefile",
"bytes": "165"
},
{
"name": "Objective-C",
"bytes": "15506407"
},
{
"name": "Objective-C++",
"bytes": "1004991"
},
{
"name": "PHP",
"bytes": "60147"
},
{
"name": "Python",
"bytes": "33527"
},
{
"name": "Ruby",
"bytes": "4641"
},
{
"name": "Shell",
"bytes": "197483"
},
{
"name": "Swift",
"bytes": "462956"
},
{
"name": "Vue",
"bytes": "1701"
}
],
"symlink_target": ""
} |
var collection_1 = require('angular2/src/facade/collection');
var async_1 = require('angular2/src/facade/async');
var lang_1 = require('angular2/src/facade/lang');
var RouteParams = (function () {
function RouteParams(params) {
this.params = params;
}
RouteParams.prototype.get = function (param) { return lang_1.normalizeBlank(collection_1.StringMapWrapper.get(this.params, param)); };
return RouteParams;
})();
exports.RouteParams = RouteParams;
/**
* An `Instruction` represents the component hierarchy of the application based on a given route
*/
var Instruction = (function () {
function Instruction(_a) {
var _this = this;
var _b = _a === void 0 ? {} : _a, params = _b.params, component = _b.component, children = _b.children, matchedUrl = _b.matchedUrl, parentSpecificity = _b.parentSpecificity;
this.reuse = false;
this.capturedUrl = matchedUrl;
this.accumulatedUrl = matchedUrl;
this.specificity = parentSpecificity;
if (lang_1.isPresent(children)) {
this._children = children;
var childUrl;
collection_1.StringMapWrapper.forEach(this._children, function (child, _) {
childUrl = child.accumulatedUrl;
_this.specificity += child.specificity;
});
if (lang_1.isPresent(childUrl)) {
this.accumulatedUrl += childUrl;
}
}
else {
this._children = collection_1.StringMapWrapper.create();
}
this.component = component;
this.params = params;
}
Instruction.prototype.hasChild = function (outletName) {
return collection_1.StringMapWrapper.contains(this._children, outletName);
};
/**
* Returns the child instruction with the given outlet name
*/
Instruction.prototype.getChild = function (outletName) {
return collection_1.StringMapWrapper.get(this._children, outletName);
};
/**
* (child:Instruction, outletName:string) => {}
*/
Instruction.prototype.forEachChild = function (fn) { collection_1.StringMapWrapper.forEach(this._children, fn); };
/**
* Does a synchronous, breadth-first traversal of the graph of instructions.
* Takes a function with signature:
* (child:Instruction, outletName:string) => {}
*/
Instruction.prototype.traverseSync = function (fn) {
this.forEachChild(fn);
this.forEachChild(function (childInstruction, _) { return childInstruction.traverseSync(fn); });
};
/**
* Takes a currently active instruction and sets a reuse flag on each of this instruction's
* children
*/
Instruction.prototype.reuseComponentsFrom = function (oldInstruction) {
this.traverseSync(function (childInstruction, outletName) {
var oldInstructionChild = oldInstruction.getChild(outletName);
if (shouldReuseComponent(childInstruction, oldInstructionChild)) {
childInstruction.reuse = true;
}
});
};
return Instruction;
})();
exports.Instruction = Instruction;
function shouldReuseComponent(instr1, instr2) {
return instr1.component == instr2.component &&
collection_1.StringMapWrapper.equals(instr1.params, instr2.params);
}
function mapObjAsync(obj, fn) {
return async_1.PromiseWrapper.all(mapObj(obj, fn));
}
function mapObj(obj, fn) {
var result = collection_1.ListWrapper.create();
collection_1.StringMapWrapper.forEach(obj, function (value, key) { return collection_1.ListWrapper.push(result, fn(value, key)); });
return result;
}
exports.__esModule = true;
//# sourceMappingURL=instruction.js.map | {
"content_hash": "cbc0e9e05077e64575ba94ebe975b4b0",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 181,
"avg_line_length": 42.08888888888889,
"alnum_prop": 0.6393875395987328,
"repo_name": "MiisterPatate/planning",
"id": "ea3881c0deb33865f5a504167bc0477331cf9695",
"size": "3788",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "node_modules/angular2/src/router/instruction.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2821"
},
{
"name": "JavaScript",
"bytes": "1132576"
},
{
"name": "TypeScript",
"bytes": "1980"
}
],
"symlink_target": ""
} |
package com.bazaarvoice.emodb.common.stash;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/**
* POJO for metadata about a single table in Stash and its files.
*/
public class StashTableMetadata extends StashTable {
private final List<StashFileMetadata> _files;
@JsonCreator
public StashTableMetadata(@JsonProperty("bucket") String bucket,
@JsonProperty("prefix") String prefix,
@JsonProperty("tableName") String tableName,
@JsonProperty("files") List<StashFileMetadata> files) {
super(bucket, prefix, tableName);
_files = files;
}
public List<StashFileMetadata> getFiles() {
return _files;
}
public long getSize() {
long size = 0;
for (StashFileMetadata file : _files) {
size += file.getSize();
}
return size;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof StashTableMetadata)) {
return false;
}
if (!super.equals(o)) {
return false;
}
StashTableMetadata that = (StashTableMetadata) o;
return _files.equals(that._files);
}
@Override
public int hashCode() {
return 31 * super.hashCode() + _files.hashCode();
}
}
| {
"content_hash": "96a9ef409f41ab54db4fe6a086812630",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 85,
"avg_line_length": 26.410714285714285,
"alnum_prop": 0.5828262339418526,
"repo_name": "r48patel/emodb",
"id": "8434c8ea1732e15217b7f43a4e11b69cb31ed94f",
"size": "1479",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/StashTableMetadata.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "6174535"
},
{
"name": "Shell",
"bytes": "10022"
}
],
"symlink_target": ""
} |
require "rubygems"
require "reliable-msg/agent"
module ReliableMsg::Agent #:nodoc:
module Version #:nodoc:
unless defined? MAJOR
MAJOR = 0
MINOR = 1
TINY = 0
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
end
end
| {
"content_hash": "b13937656f26203c77a1b6bb9c0bac8d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 58,
"avg_line_length": 17.8125,
"alnum_prop": 0.5859649122807018,
"repo_name": "ummm/reliable-msg-agent",
"id": "78b6a58d7c41c07ff3ef8d0df615c7a7715541ea",
"size": "286",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/reliable-msg/agent/version.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "22091"
},
{
"name": "Shell",
"bytes": "729"
}
],
"symlink_target": ""
} |
/**
* ag-grid-community - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v19.0.0
* @link http://www.ag-grid.com/
* @license MIT
*/
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var gridOptionsWrapper_1 = require("../../gridOptionsWrapper");
var context_1 = require("../../context/context");
var component_1 = require("../../widgets/component");
var NoRowsOverlayComponent = /** @class */ (function (_super) {
__extends(NoRowsOverlayComponent, _super);
function NoRowsOverlayComponent() {
return _super.call(this) || this;
}
NoRowsOverlayComponent.prototype.init = function (params) {
var template = this.gridOptionsWrapper.getOverlayNoRowsTemplate() ?
this.gridOptionsWrapper.getOverlayNoRowsTemplate() : NoRowsOverlayComponent.DEFAULT_NO_ROWS_TEMPLATE;
var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
var localisedTemplate = template.replace('[NO_ROWS_TO_SHOW]', localeTextFunc('noRowsToShow', 'No Rows To Show'));
this.setTemplate(localisedTemplate);
};
NoRowsOverlayComponent.DEFAULT_NO_ROWS_TEMPLATE = '<span class="ag-overlay-no-rows-center">[NO_ROWS_TO_SHOW]</span>';
__decorate([
context_1.Autowired('gridOptionsWrapper'),
__metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper)
], NoRowsOverlayComponent.prototype, "gridOptionsWrapper", void 0);
return NoRowsOverlayComponent;
}(component_1.Component));
exports.NoRowsOverlayComponent = NoRowsOverlayComponent;
| {
"content_hash": "db0f3105d31221a2d5d8af63a584a463",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 150,
"avg_line_length": 56.7,
"alnum_prop": 0.6497354497354497,
"repo_name": "sufuf3/cdnjs",
"id": "6be3766b2cf62b995711f329a866a24f09c6e25e",
"size": "2835",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "ajax/libs/ag-grid/19.0.1/lib/rendering/overlays/noRowsOverlayComponent.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
import sys
import os
import csv
import cv2
from collections import OrderedDict
import argparse
import numpy as np
import pandas as pd
from seqlearn.perceptron import StructuredPerceptron
from seqlearn.evaluation import SequenceKFold
from sklearn.metrics import accuracy_score
from sklearn.externals import joblib
from sklearn.preprocessing import MinMaxScaler
if __name__ == '__main__':
sys.path.append('../../')
#=============================================
class ImmersionDetector:
"""
Implements the detector of immersion using a Hidden Markov Model.
"""
#---------------------------------------------
def __init__(self):
"""
Class constructor.
"""
self._clf = StructuredPerceptron(max_iter=100)
"""
Gaussian HMM for the detection of the immersion level (as the hidden
states of the model) from the distance gradient and the blink rate of
players.
"""
self._states = OrderedDict([
(0, 'not at all'), (1, 'slightly'),
(2, 'moderately'), (3, 'fairly'), (4, 'extremely')
])
"""
Hidden states of the immersion level.
"""
modulePath = os.path.dirname(__file__)
self._modelFile = os.path.abspath('{}/./models/immersion_model.dat' \
.format(modulePath))
"""
Name of the file used to persist the model in the disk.
"""
# Load the model from the disk, if its file exists
if os.path.isfile(self._modelFile):
if not self.load():
print('Could not load the model from file {}' \
.format(self._modelFile))
#---------------------------------------------
def save(self):
"""
Persists the model to the disk.
Returns
-------
ret: bool
Indication on if the saving was succeeded or not.
"""
try:
joblib.dump(self._clf, self._modelFile)
except:
return False
return True
#---------------------------------------------
def load(self):
"""
Restores the model from the disk.
Returns
-------
ret: bool
Indication on if the loading was succeeded or not.
"""
try:
clf = joblib.load(self._modelFile)
except:
return False
self._clf = clf
return True
#---------------------------------------------
def detect(self, features):
"""
Detects the immersion level based on the given features.
Parameters
----------
features: TODO
TODO
Returns
-------
level: int
Immersion level, as one of the possible values: 0 ("not at all"),
1 ("slightly"), 2 ("moderately"), 3 ("fairly") or 4 ("extremely").
"""
pass # TODO
#---------------------------------------------
def readData(self, annotationPath):
"""
Reads the data used for training or cross-validating the model.
Parameters
----------
annotationPath: str
Path where to find the annotation files to read the data from.
Returns
-------
data: OrderedDict
Dictionary with the face distance gradient, blink rate and
immersion labels of each subject, in individual data frames.
"""
##################################
# Read the data
##################################
print('Reading the data...')
scaler = MinMaxScaler(feature_range=(0, 1))
subjects = [1, 2, 6, 7, 14, 15, 17, 18, 20, 21, 23, 25, 26, 30, 31, 34,
37, 38, 39, 40, 41]
data = OrderedDict()
for subject in subjects:
print('Reading data of subject {}...'.format(subject))
# Read the face data
name = '{}/player_{:03d}-face.csv' \
.format(annotationPath, subject)
face = pd.read_csv(name, index_col=0, usecols=(0, 1, 2, 3, 4, 142))
# Find the frames where the face detection failed
t = (face[[0, 1, 2, 3]] == 0).all(1)
fails = face[t].index[:]
# Drop the rows where face detection failed
face = face.drop(fails)
# Read the blink data
name = '{}/player_{:03d}-blinks.csv' \
.format(annotationPath, subject)
blink = pd.read_csv(name, index_col=0, usecols=(0, 2))
# Drop the rows where face detection failed
blink = blink.drop(fails)
# Read the review responses
name = '{}/player_{:03d}-review.csv' \
.format(annotationPath, subject)
review = pd.read_csv(name, index_col=0, usecols=(0, 2))
# Drop the rows where face detection failed
review = review.drop(fails)
# Join the features and labels in the same data frame
df = pd.DataFrame()
df['gradient'] = face['face.gradient']
df['rate'] = blink['blink.rate']
df['immersion'] = review['involvement']
# Keep only the data of the last 5 minutes of the video
# (with 30 fps, the start frame is: 5 * 60 * 30 = 9000)
df = df.loc[9000:]
# Normalize the data
grad = np.reshape(np.array(df['gradient']), (-1, 1))
rat = np.reshape(np.array(df['rate']), (-1, 1))
grad = scaler.fit_transform(grad)
rat = scaler.fit_transform(rat)
df['gradient'] = grad.squeeze(-1)
df['rate'] = rat.squeeze(-1)
# Store the data frame for the subject
data[subject] = df
return data
#---------------------------------------------
def crossValidate(self, args):
"""
Performs a cross-validation on the EmotionsDetector model.
Parameters
----------
args: object
Object produced by the package argparse with the command line
arguments.
Returns
-------
errLevel: int
Error level of the execution (i.e. 0 indicates success; any other
value indicates specific failure conditions).
"""
##################################
# Read the training data
##################################
if not os.path.isdir(args.annotationPath):
print('annotation path does not exist: {}' \
.format(args.annotationPath))
return -1
data = self.readData(args.annotationPath)
############################
# Execute the K-Fold cross validation
############################
x = []
y = []
l = []
for subject, df in data.items():
lx = df[['gradient', 'rate']].values.tolist()
#lx = df[['rate']].values.tolist()
ly = np.array(df[['immersion']].values.tolist()).squeeze(-1)
x.extend(lx)
y.extend(ly.tolist())
l.append(len(lx))
x = np.array(x)
y = np.array(y)
print('Executing cross-validation with k = {}...'.format(args.k))
clf = StructuredPerceptron(random_state=2)
scores = []
folds = SequenceKFold(l, n_folds=args.k)
for train_idx, train_len, test_idx, test_len in folds:
xTrain = x[train_idx]
yTrain = y[train_idx]
clf.fit(xTrain, yTrain, train_len)
xTest = x[test_idx]
yTest = y[test_idx]
yPred = clf.predict(xTest, test_len)
scores.append(accuracy_score(yTest, yPred))
scores = np.array(scores)
print(scores)
print('Result of the K-Fold CV: {:3f} (+- {:3f})' \
.format(scores.mean(), 2 * scores.std()))
############################
# Execute the Leave-One-Out cross validation
############################
return 0
#---------------------------------------------
def train(self, args):
"""
Trains the EmotionsDetector model.
Parameters
----------
args: object
Object produced by the package argparse with the command line
arguments.
Returns
-------
errLevel: int
Error level of the execution (i.e. 0 indicates success; any other
value indicates specific failure conditions).
"""
##################################
# Read the training data
##################################
if not os.path.isdir(args.annotationPath):
print('annotation path does not exist: {}' \
.format(args.annotationPath))
return -1
data = self.readData(args.annotationPath)
x = []
y = []
l = []
for subject, df in data.items():
lx = df[['gradient', 'rate']].values.tolist()
ly = np.array(df[['immersion']].values.tolist()).squeeze(-1)
x.extend(lx)
y.extend(ly.tolist())
l.append(len(lx))
############################
# Execute the training
############################
print('Training the detector...')
self._clf.fit(x, y, l)
if not self.save():
print('Could not persist the trained model to disk (in file {})' \
.format(self._modelFile))
return 0
#---------------------------------------------
def optimize(self, args):
"""
Optimizes the EmotionsDetector model, trying to find the SVM parameters
that would yield better results.
Parameters
----------
args: object
Object produced by the package argparse with the command line
arguments.
Returns
-------
errLevel: int
Error level of the execution (i.e. 0 indicates success; any other
value indicates specific failure conditions).
"""
############################
# Get the data
############################
# Read the CSV file ignoring the header and the first column (which
# contains the file name of the image used for extracting the data in
# a row)
try:
data = np.genfromtxt(args.featuresFile, delimiter=',',
skip_header=1)
data = data[:, 1:]
except:
print('Could not read CSV file: {}'.format(args.featuresFile))
return -1
x = data[:, :-1]
y = np.squeeze(data[:, -1:])
############################
# Execute the optimization
############################
tunningParams = [
{
'kernel': ['linear'],
'C': [1e-3, 1e-2, 1e-1, 1, 1e+1, 1e+2, 1e+3]
},
{
'kernel': ['rbf'],
'gamma': [1e-3, 1e-2, 1e-1, 1, 1e+1, 1e+2, 1e+3],
'C': [1e-3, 1e-2, 1e-1, 1, 1e+1, 1e+2, 1e+3]
},
]
scores = ['precision', 'recall']
for score in scores:
print('# Tuning hyper-parameters for {}\n'.format(score))
clf = GridSearchCV(svm.SVC(C=1), tunningParams, cv=5,
scoring=format('{}_macro'.format(score)))
clf.fit(x, y)
print('Best parameters set found on development set:\n')
print(clf.best_params_)
print('\nGrid scores on development set:\n')
means = clf.cv_results_['mean_test_score']
stds = clf.cv_results_['std_test_score']
for mean, std, params in zip(means, stds, clf.cv_results_['params']):
print('{:.3f} (+/-{:.3f}) for {}'.format(mean, std * 2, params))
#print('\nDetailed classification report:\n')
#print('The model is trained on the full development set.')
#print('The scores are computed on the full evaluation set.\n')
#y_true, y_pred = y_test, clf.predict(X_test)
#print(classification_report(y_true, y_pred))
#print()
return 0
#---------------------------------------------
# namespace verification for running this script
#---------------------------------------------
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Automation of the '
'ImmersionDetector. Allows cross-'
'validating and training the model.')
subparser = parser.add_subparsers(help='Existing sub commands.',
dest='subParser')
cvParser = subparser.add_parser(name='crossValidate',
help='Runs a cross-validation in model '
'with the KFold method.')
cvParser.add_argument('annotationPath',
help='Path with the annotated data.'
)
cvParser.add_argument('-k', metavar='int', type=int, default=5,
help='Number of folds to use in the cross-validation. '
'The default is 5.'
)
trParser = subparser.add_parser(name='trainModel',
help='Trains the model from the annotated '
'data.')
trParser.add_argument('annotationPath',
help='Path with the annotated data.'
)
args = parser.parse_args()
if args.subParser is None:
parser.error('one subcomand is required')
model = ImmersionDetector()
if args.subParser == 'crossValidate':
if args.k < 5:
parser.error('value of option -k must be at least 5')
sys.exit(model.crossValidate(args))
elif args.subParser == 'trainModel':
sys.exit(model.train(args)) | {
"content_hash": "1fc62b0c44cd3960660d2cb367b31cbb",
"timestamp": "",
"source": "github",
"line_count": 445,
"max_line_length": 81,
"avg_line_length": 32.33483146067416,
"alnum_prop": 0.46806588366113006,
"repo_name": "luigivieira/fsdk",
"id": "bcbb5963cc44b6916b160017403c8a0c21842de2",
"size": "15698",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "fsdk/detectors/immersion.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "348877"
}
],
"symlink_target": ""
} |
using System;
using Newtonsoft.Json.Linq;
namespace DevZH.AspNetCore.Authentication.Baidu
{
/// <summary>
/// Contains static methods that allow to extract user's information from a <see cref="JObject"/>
/// instance retrieved from Baidu after a successful authentication process.
/// </summary>
internal static class BaiduHelper
{
/// <summary>
/// 获取百度账号 ID
/// </summary>
public static string GetId(JObject user)
{
if (user == null)
{
throw new ArgumentNullException(nameof(user));
}
return user.Value<string>("uid");
}
/// <summary>
/// 获取百度账号昵称
/// </summary>
public static string GetName(JObject user)
{
if (user == null)
{
throw new ArgumentNullException(nameof(user));
}
return user.Value<string>("uname");
}
/// <summary>
/// 获取百度账号标识,一般用来获取头像
/// </summary>
public static string GetPortrait(JObject user)
{
if (user == null)
{
throw new ArgumentNullException(nameof(user));
}
return user.Value<string>("portrait");
}
}
} | {
"content_hash": "9304f16073573c7d2c2a7013a0bb1b1f",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 101,
"avg_line_length": 25.58823529411765,
"alnum_prop": 0.5118773946360153,
"repo_name": "noliar/MoreAuthentication",
"id": "6621ba0feae5d3e0e442175374c4bc60aa61fff2",
"size": "1369",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "src/DevZH.AspNetCore.Authentication.Baidu/BaiduHelper.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "144360"
}
],
"symlink_target": ""
} |
/* This file contains all the js functions of the accounts app, it is divided in the following sections:
-GENERAL VALIDATIONS
isNull()
isNumberInteger()
isNumberDecimal()
-ADD ACCOUNT
SAVE button function (add account modal)
jsonAjax()
CANCEL button function (add account modal)
-EDIT ACCOUNT
editAccount()
getJson()
SAVE button function (edit account modal)
updateJson()
-DELETE ACCOUNT
DELETE button function (edit account modal)
NO button function (edit account modal)
YES button function (edit account modal)
deleteJson()
-MONEY TRANSFER
selectSourceAccount()
selectDestinyAccount()
validateExchangeRate()
calculateAmount()
SAVE button function (money transfer modal)
jsonTransfer()
CANCEL button function (money transfer modal)
-ADD CURRENCY
SAVE button function (add currency modal)
jsonAddCurrency()
CANCEL button function (add currency modal)
-DELETE CURRENCY
currencyDeleteConfirm()
YES button function (delete currency modal)
jsonDeleteCurrency()
-CSS FUNCTIONS
cashSelectAddAccount() (add account modal)
bankSelectAddAccount() (add account modal)
cashSelectEditAccount() (edit account modal)
bankSelectEditAccount() (edit account modal)
deleteBtnOver() (edit account modal)
deleteBtnOut() (edit account modal)
deleteBtnOverYes() (edit account and delete currency modal)
deleteBtnOutYes() (edit account and delete currency modal)
deleteBtnOverNo() (edit account and delete currency modal)
deleteBtnOutNo() (edit account and delete currency modal)
cashSelectMoneyTransferSource() (money transfer modal)
bankSelectMoneyTransferSource() (money transfer modal)
cashSelectMoneyTransferDestiny() (money transfer modal)
bankSelectMoneyTransferDestiny() (money transfer modal)
*/
//************************************** GENERAL VALIDATIONS ***********************************************************
//Function to validate if a field or select is null or empty
function isNull(field){
if (field == '' || field == null) {
return false;
}
else {
return true;
}
}
//Function to validate if a field has only number without decimals
function isNumberInteger(field){
if(field.match(/^[1-9]\d*$/)){
return true;
}
else{
return false;
}
}
//Function to validate if a field has only numbers with or without decimals
//(Number can start with zero or decimal and have or not numbers after decimal)
function isNumberDecimal(field){
//if(field.match(/^[1-9]\d*(\.\d+)?$/)){
if(field.match(/^\d*\.?\d*$/)){
return true;
}else{
return false;
}
}
//************************************* END GENERAL VALIDATIONS ********************************************************
//******************************************* ADD ACCOUNT **************************************************************
//Function triggered by SAVE on the Add Account modal
//Validates fields, creates json and calls jsonAjax() function
$(document).on('click', '#modal_save' ,function (){
//Validate account type
var accountType = $('input[name=accountTypeRadio]:checked', '#addAccountForm').val();
//Get data according to the account type
if(accountType == "c"){
var currency = $('#currencySelect').val();
var amount= $('#inputAmount').val();
//Validations
if(isNull(currency)==false){
alert("You need to select a currency");
return;
}
if(isNull(amount)==false){
alert("The field Amount cannot be empty");
return;
}
if(isNumberDecimal(amount)==false){
alert("The amount must be a number");
return;
}
//Connection to backend
var accountData = {"account_type": accountType, "balance":amount, "currency":currency};
jsonAjax(accountData);
}
if(accountType == "b"){
var currency = $('#currencySelect').val();
var bank= $('#inputBank').val();
var account= $('#inputAccountNo').val();
var amount= $('#inputAmount').val();
//Validations
if(isNull(currency)==false){
alert("You need to select a currency");
return;
}
if(isNull(bank)==false){
alert("The field Bank cannot be empty");
return;
}
if(isNull(account)==false){
alert("The field Account cannot be empty");
return;
}
if(isNull(amount)==false){
alert("The field Amount cannot be empty");
return;
}
if(isNumberInteger(account)==false){
alert("The Account # must be a number without decimals");
return;
}
if(isNumberDecimal(amount)==false){
alert("The amount must be a number");
return;
}
//Connection to backend
var accountData={"account_type":accountType, "bank_name":bank, "number":account, "balance":amount, "currency":currency};
jsonAjax(accountData)
}
});
//Function that receives a json with the New Account info and connects to the backend to add the account
function jsonAjax(lejson){
$.ajax({
url : "create_account/", // the endpoint
type : "POST", // http method
data : lejson, // data sent with the post request
dataType: 'json',
//Handle a successful response
success : function(jsonResponse) {
// Hides the modal, updates the tables DOM and cleans the modal fields
$('#modalAddAccount').modal('hide');
$('#modalAddAccount').find('#inputAmount').val('');
$('#modalAddAccount').find('#inputAccountNo').val('');
$('#modalAddAccount').find('#inputBank').val('');
var balance = parseInt(lejson.balance).toFixed(2);
location.reload();
},
//Handle a non-successful response
error : function(xhr,errmsg,err) {
console.log(xhr.status + ": " + xhr.responseText); // provide a bit more info about the error to the console
alert("Error saving the account. Please try again or contact the system manager.");
// Hides the modal and cleans the modal fields
$('#modalAddAccount').modal('hide');
$('#modalAddAccount').find('#inputAmount').val('');
$('#modalAddAccount').find('#inputAccountNo').val('');
$('#modalAddAccount').find('#inputBank').val('');
}
});
return true;
}
//Function triggered by the CANCEL button on the Add Account modal
//Hides the modal, cleans fields
$(document).on('click', '#addAccountCancel' ,function () {
$('#modalAddAccount').modal('hide');
$('#modalAddAccount').find('#inputAmount').val('');
$('#modalAddAccount').find('#inputAccountNo').val('');
$('#modalAddAccount').find('#inputBank').val('');
//Set the default account type to Bank
$('#radioBank').prop('checked', true);
$('#bankTxtField').css("display", "block");
$('#accountNoTxtField').css("display", "block");
});
//************************************* ENDS ADD ACCOUNT ***************************************************************
//*************************************** EDIT ACCOUNT *****************************************************************
//Function to fill in information in the Edit Account modal
//Receives the account id, calls getJson() function that returns a json with the account info and fills in the modal fields
function editAccount(id){
//Get the id from the object
id = id.attr('id');
//Get json form backend
var response = getJson(id);
response.done(function(data){
var accountType = data.type;
// Get data
if(accountType == "b") {
var bank = data.bank;
var accountNo = data.number;
var amount = data.balance;
var currency = data.currency;
//Fill fields
$("#idAccountEdit").val(id);
$("#radioBankEdit").prop('checked', true);
$("#currencySelectEdit").val(currency);
$("#inputBankEdit").val(bank);
$("#inputAccountNoEdit").val(accountNo);
$("#inputAmountEdit").val(amount);
$('#bankTxtFieldEdit').css("display", "block");
$('#accountNoTxtFieldEdit').css("display", "block");
}
if(accountType == "c"){
var amount = data.balance;
var currency = data.currency;
//Fill fields
$("#idAccountEdit").val(id);
$("#radioCashEdit").prop('checked', true);
$("#currencySelectEdit").val(currency);
$("#inputAmountEdit").val(amount);
$('#bankTxtFieldEdit').css("display", "none");
$('#accountNoTxtFieldEdit').css("display", "none");
}
}).fail(function (json) {
alert("Error 1. Can't reach the server.");
return;
});
}
//Function that receives an account id, connects to the backend and return a json with the account info
function getJson(id){
//Create json with the account id
var lejson = {'id': id };
var jxhr = $.ajax({
url : "create_account/", // the endpoint
type : "GET", // http method
data : lejson, // data sent with the post request
// handle a successful response
success : function(jsonResponse) {
},
// handle a non-successful response
error : function(xhr,errmsg,err) {
console.log(xhr.status + ": " + xhr.responseText); // provide a bit more info about the error to the console
alert("Error connecting to the server. Please try again or contact the system manager.");
}
});
return jxhr;
}
//Function triggered by SAVE on the Edit Account modal
//Validates fields, creates json and calls updateJson() function
$(document).on('click', '#modal_edit' ,function () {
var accountType = $('input[name=accountTypeRadioEdit]:checked', '#editAccountForm').val();
var id = $("#idAccountEdit").val();
//Get data
if(accountType == "c"){
var currency = $('#currencySelectEdit').val();
var amount= $('#inputAmountEdit').val();
//Validations
if(isNull(currency)==false){
console.log("in currency");
alert("You need to select a Currency");
return;
}
if(isNull(amount)==false){
console.log("in amount");
alert("The field Amount cannot be empty");
return;
}
if(isNumberDecimal(amount)==false){
console.log("in number");
alert("The amount must be a number");
return;
}
//Connection to backend
var accountData = {"id":id, "account_type": accountType, "balance":amount, "currency":currency};
updateJson(accountData);
}
if(accountType == "b") {
var currency = $('#currencySelectEdit').val();
var bank = $('#inputBankEdit').val();
var account = $('#inputAccountNoEdit').val();
var amount = $('#inputAmountEdit').val();
//Validations
if (isNull(currency) == false) {
alert("You need to select a currency");
return;
}
if (isNull(bank) == false) {
alert("The field Bank cannot be empty");
return;
}
if (isNull(account) == false) {
alert("The field Account cannot be empty");
return;
}
if (isNull(amount) == false) {
alert("The field amount cannot be empty");
return;
}
if (isNumberInteger(account) == false) {
alert("The Account # must be a number without decimals");
return;
}
if (isNumberDecimal(amount) == false) {
alert("The Amount must be a number");
return;
}
}
//Connection to backend
var accountData={"id":id, "account_type":accountType, "bank_name":bank, "number":account, "balance":amount, "currency":currency};
updateJson(accountData);
});
//Function that receives a json with the Account info and connects to the backend to edit the account
function updateJson(json){
$.ajax({
url : "change_account/", // the endpoint
type : "POST", // http method
data : json, // data sent with the post request
// handle a successful response
success : function(jsonResponse) {
// Hides the modal, updates the tables DOM and cleans modal fields
$('#modalEditAccount').modal('hide');
$('#modalEditAccount').find('#inputAmountEdit').val('');
$('#modalEditAccount').find('#inputAccountNoEdit').val('');
$('#modalEditAccount').find('#inputBankEdit').val('');
location.reload();
},
// handle a non-successful response
error : function(xhr,errmsg,err) {
console.log(xhr.status + ": " + xhr.responseText); // provide a bit more info about the error to the console
alert("Error editing the account. Please try again or contact the system manager.");
}
});
}
//***************************************** ENDS EDIT ACCOUNT **********************************************************
//******************************************* DELETE ACCOUNT ***********************************************************
//Function triggered by the DELETE button on the Edit Account modal
//Display the confirmation to delete the account
$(document).on('click', '#modal_editDelete' ,function () {
$('#modal_editDelete').css("background", "#C61212");
$('#modal_editDelete').css("color", "#ffffff");
$('#deleteConfirmation').css("display", "block");
});
//Function triggered by the NO button on the confirmation to delete the account
//Hides the confirmation
$(document).on('click', '#deleteNo' ,function () {
$('#modal_editDelete').css("background", "#ffffff");
$('#modal_editDelete').css("color", "#C61212");
$('#deleteConfirmation').css("display", "none");
});
//Function triggered by the YES button on the confirmation to delete the account
//Hides the confirmation, gets the account id and calls deleteJson() function
$(document).on('click', '#deleteYes' ,function () {
$('#modal_editDelete').css("background", "#ffffff");
$('#modal_editDelete').css("color", "#C61212");
$('#deleteConfirmation').css("display", "none");
var id = $("#idAccountEdit").val();
deleteJson(id);
});
//Function that receives the account id and connects to the backend to delete the account
function deleteJson(id){
//Create json with the id
var lejson = {'id': id };
var jxhr = $.ajax({
url : "change_account/", // the endpoint
type : "GET", // http method
data : lejson, // data sent with the post request
// handle a successful response
success : function(jsonResponse) {
// Hides the modal and update the tables DOM
$('#modalEditAccount').modal('hide');
location.reload()
},
// handle a non-successful response
error : function(xhr,errmsg,err) {
console.log(xhr.status + ": " + xhr.responseText); // provide a bit more info about the error to the console
alert("Error deleting the account. Please try again or contact the system manager.");
}
});
return jxhr;
}
//*************************************** ENDS DELETE ACCOUNT **********************************************************
//***************************************** MONEY TRANSFER *************************************************************
//Function triggered (onchange) when you select the Source Account int the Money Transfer modal
//Updates the source currency label on the exchange rate section
function selectSourceAccount(currency){
//currency has the account currency+.+account id
//Get the account currency
var data = currency.split('.');
var lastChar = data[0].slice(-1);
//If the currency is in plural, delete the last "s"
if(lastChar == "s"){
var curr = data[0].slice(0, -1);
}
//Create the label to look like --> "1 Dollar ="
var label = "1 "+curr+" =";
//Set the label
$('#labelSourceCurrency').empty();
$('#labelSourceCurrency').append(label);
}
//Function triggered (onchange) when you select the Destiny Account int the Money Transfer modal
//Updates the destiny currency label on the exchange rate section
function selectDestinyAccount(currency){
//currency has the account currency+.+account id
var data = currency.split('.');
//Set the label
$('#labelDestinyCurrency').empty();
$('#labelDestinyCurrency').append(data[0]);
}
//Function triggered when an exchange rate is entered (onmouseup)
//Validates the exchange rate and amount and updates the result of the amount transferred (amount*exchangeRate)
function validateExchangeRate(exchangeRate){
if(exchangeRate != "") {
//Validate if the exchange rate is a number
if (!(exchangeRate.match(/^\d*\.?\d*$/))) {
alert("The exchange rate must be a number.");
//Clear the field
$("#inputExchangeRate").val("");
return;
}
}
if($("#inputAmountTransfer").val() != ""){
//Get the amount
var amount = $("#inputAmountTransfer").val();
//Validate if the amount is a number
if (!(amount.match(/^\d*\.?\d*$/))) {
alert("The amount must be a number.");
//Clear the field
$("#inputAmountTransfer").val("");
return;
}
//Get the result of the amount transferred and update the label on the amount section
var res = amount*exchangeRate;
$("#inputAmountTransferResult").val(res);
}
}
//Function triggered when an amount is entered (onmouseup)
//Validates the amount and updates the result of the amount transferred (amount*exchangeRate)
function calculateAmount(amount){
//Get the exchange rate
var exchangeRate = $("#inputExchangeRate").val();
if(amount != "") {
if(isNull(exchangeRate) == true){
//Validate if the amount is a number
if (!(amount.match(/^\d*\.?\d*$/))) {
alert("The amount must be a number.");
$("#inputAmountTransfer").val("");
return;
}
}
}
///Get the result of the amount transferred and update the label on the amount section
var res = amount*exchangeRate;
$("#inputAmountTransferResult").val(res);
}
//Function triggered by the SAVE button on the Money Transfer modal
//Validates fields, creates json and calls jsonTransfer() function
$(document).on('click', '#btnSaveTransfer' ,function (){
//Get destiny and source account type
var sourceType = $('input[name=accountTypeRadioSource]:checked', '#modalMoneyTransfer').val();
var destinyType = $('input[name=accountTypeRadioDestiny]:checked', '#modalMoneyTransfer').val();
//Validate destiny and source account types
if(isNull(sourceType)==false){
alert("You must select a Source Account type (bank/cash).");
return;
}
if(isNull(destinyType)==false){
alert("You must select a Destiny Account type (bank/cash).");
return;
}
//Get the source account id
//The field value is account currency+.+account id
if(sourceType == "b"){
var valSource = $("#sourceBankAccount").val();
var valSourceArray = valSource.split('.');
var sourceId = valSourceArray[1];
}else{
var valSource = $("#sourceCashAccount").val();
var valSourceArray = valSource.split('.');
var sourceId = valSourceArray[1];
}
//Get the destiny account id
//The field value is account currency+.+account id
if(destinyType == "b"){
var valDestiny = $("#destinyAccountBank").val();
var valDestinyArray = valDestiny.split('.');
var destinyId = valDestinyArray[1];
}else{
var valDestiny = $("#destinyAccountCash").val();
var valDestinyArray = valDestiny.split('.');
var destinyId = valDestinyArray[1];
}
//Get the exchange rate and amount
var exchangeRate = $("#inputExchangeRate").val();
var amount = $("#inputAmountTransfer").val();
//Validations
if(isNull(sourceId)==false){
alert("You must select a source account.");
return;
}
if(isNull(destinyId)==false){
alert("You must select a destiny account.");
return;
}
if(isNull(exchangeRate) == false){
alert("You must enter an exchange rate.");
return;
}
if(isNumberDecimal(exchangeRate)==false){
alert("The exchange rate must be a number1.");
return;
}
if(isNull(amount)==false){
alert("You must enter an amount.");
return;
}
if(isNumberDecimal(amount)==false){
alert("The amount must be a number.");
return;
}
//Connection to the backend
var json = {"source_id":sourceId, "target_id":destinyId, "amount":amount, "rate":exchangeRate};
jsonTransfer(json);
});
//Function that receives the Money Transfer info and connects to the backend to add it
function jsonTransfer(json) {
$.ajax({
url: "money_transfer/", // the endpoint
type: "POST", // http method
data: json, // data sent with the post request
dataType: 'json',
// handle a successful response
success: function (jsonResponse) {
// Hides the modal, cleans fields and update the tables DOM
$('#modalMoneyTransfer').modal('hide');
$('#modalMoneyTransfer').find('#sourceBankAccount').val('');
$('#modalMoneyTransfer').find('#sourceCashAccount').val('');
$('#modalMoneyTransfer').find('#destinyAccountBank').val('');
$('#modalMoneyTransfer').find('#destinyAccountCash').val('');
$('#modalMoneyTransfer').find('#inputExchangeRate').val('');
$('#modalMoneyTransfer').find('#inputAmountTransfer').val('');
$('#modalMoneyTransfer').find('#inputAmountTransferResult').val('');
$('#labelDestinyCurrency').empty();
$('#labelSourceCurrency').empty();
$('#destinyAccountBank').css("display", "none");
$('#defaultSelectDestiny').css("display", "block");
$('#destinyAccountCash').css("display", "none");
$('#sourceBankAccount').css("display", "none");
$('#defaultSelectSource').css("display", "block");
$('#sourceCashAccount').css("display", "none");
$('#radioBankTransferSource').prop('checked', false);
$('#radioCashTransferSource').prop('checked', false);
$('#radioBankTransferDestiny').prop('checked', false);
$('#radioCashTransferDestiny').prop('checked', false);
location.reload();
},
// handle a non-successful response
error: function (xhr, errmsg, err) {
console.log(xhr.status + ": " + xhr.responseText); // provide a bit more info about the error to the console
alert("Error saving the Money Transfer. Please try again or contact the system manager.");
}
});
}
//Function triggered by the CANCEL button on the Money Transfer modal
//Hides the modal, cleans all fields
$(document).on('click', '#moneyTransferCancel' ,function () {
$('#modalMoneyTransfer').modal('hide');
//Source account type
$('#radioBankTransferSource').prop('checked', false);
$('#radioCashTransferSource').prop('checked', false);
//Destiny account type
$('#radioBankTransferDestiny').prop('checked', false);
$('#radioCashTransferDestiny').prop('checked', false);
//Source account select
$('#modalMoneyTransfer').find('#sourceBankAccount').val('');
$('#modalMoneyTransfer').find('#sourceCashAccount').val('');
//Destiny account select
$('#modalMoneyTransfer').find('#destinyAccountBank').val('');
$('#modalMoneyTransfer').find('#destinyAccountCash').val('');
//Set the default Destiny Account Select
$('#defaultSelectDestiny').css("display", "block");
$('#destinyAccountBank').css("display", "none");
$('#destinyAccountCash').css("display", "none");
//Set the default Source Account Select
$('#defaultSelectSource').css("display", "block");
$('#sourceBankAccount').css("display", "none");
$('#sourceCashAccount').css("display", "none");
//Exchange rate field
$('#modalMoneyTransfer').find('#inputExchangeRate').val('');
//Labels for source and destiny currency on exchange rate section
$('#labelDestinyCurrency').empty();
$('#labelSourceCurrency').empty();
//Amount field
$('#modalMoneyTransfer').find('#inputAmountTransfer').val('');
//Result amount
$('#modalMoneyTransfer').find('#inputAmountTransferResult').val('');
});
//*************************************** ENDS MONEY TRANSFER **********************************************************
//******************************************* ADD CURRENCY *************************************************************
//Function triggered by the SAVE button on the Add Currency modal
//Validates fields, creates json and calls jsonAddCurrency() function
$(document).on('click', '#currencySave' ,function () {
//Get data
var name = $("#inputName").val();
var contraction = $("#inputContraction").val();
//Validations
if(isNull(name)==false){
alert("You must enter a name.")
return;
}
if(isNull(contraction)==false){
alert("You must enter a contraction.")
return;
}
//Connection to backend
var json = {"name":name, "contraction":contraction};
jsonAddCurrency(json);
});
//Function that receives the New Currency info and connects to the backend to add it
function jsonAddCurrency(json){
$.ajax({
url : "../currencies/", // the endpoint
type : "POST", // http method
data : json, // data sent with the post request
dataType: 'json',
// handle a successful response
success : function(jsonResponse) {
// Hides the modal, cleans fields and update the tables DOM
$('#modalAddCurrency').modal('hide');
$('#modalAddCurrency').find('#inputName').val('');
$('#modalAddCurrency').find('#inputContraction').val('');
location.reload();
},
// handle a non-successful response
error : function(xhr,errmsg,err) {
console.log(xhr.status + ": " + xhr.responseText); // provide a bit more info about the error to the console
alert("Error saving the currency. Please try again or contact the system manager.");
$('#modalAddCurrency').find('#inputName').val('');
$('#modalAddCurrency').find('#inputContraction').val('');
}
});
return true;
}
//Function triggered by the CANCEL button on the Add Currency modal
//Hides the modal, cleans all fields
$(document).on('click', '#addCurrencyCancel' ,function () {
$('#modalAddCurrency').modal('hide');
$('#modalAddCurrency').find('#inputName').val('');
$('#modalAddCurrency').find('#inputContraction').val('');
});
//***************************************** ENDS ADD CURRENCY **********************************************************
//****************************************** DELETE CURRENCY ***********************************************************
//Function triggered by the Delete icon on the currencies table
//Receives the currency info and updates the confirmation question
function currencyDeleteConfirm(data){
//get the currency name and id
// data is currency id+.+currency name
data = data.attr('id');
var arrayData = data.split(".");
var id = arrayData[0];
var name = "Are your sure you want to delete the currency "+arrayData[1]+"?";
//Update fields
$('#currencyId').val(id);
$('#labelCurrencyName').empty();
$('#labelCurrencyName').append(name);
}
//Function triggered by the YES button on the Delete Currency confirmation modal
//Gets the currency id, creates the json and calls jsonDeleteCurrency() function
$(document).on('click', '#currencyDeleteYes' ,function () {
var id= $('#currencyId').val();
var json = {"currency_id":id};
jsonDeleteCurrency(json);
});
//Function that receives the Currency id and connects to the backend to delete the currency
function jsonDeleteCurrency(json){
$.ajax({
url : "../currencies/", // the endpoint
type : "GET", // http method
data : json, // data sent with the post request
dataType: 'json',
// handle a successful response
success : function(jsonResponse) {
// Hides the modal and update the tables DOM
$('#modalDeleteCurrency').modal('hide');
location.reload();
},
// handle a non-successful response
error : function(xhr,errmsg,err) {
console.log(xhr.status + ": " + xhr.responseText); // provide a bit more info about the error to the console
alert("Error deleting the currency. Please try again or contact the system manager.");
}
});
return true;
}
//**************************************** ENDS DELETE CURRENCY ********************************************************
//********************************************* CSS FUNCTIONS **********************************************************
//Add account modal
//Function to hide additional fields when the account type is cash
function cashSelectAddAccount(){
$('#bankTxtField').css("display", "none");
$('#accountNoTxtField').css("display", "none");
}
//Add account modal
//Function to display additional fields when the account type is bank
function bankSelectAddAccount(){
$('#bankTxtField').css("display", "block");
$('#accountNoTxtField').css("display", "block");
}
//Edit account modal
//Function to hide additional fields when the account type is cash
function cashSelectEditAccount(){
$('#bankTxtFieldEdit').css("display", "none");
$('#accountNoTxtFieldEdit').css("display", "none");
}
//Edit account modal
//Function to display additional fields when the account type is bank
function bankSelectEditAccount(){
$('#bankTxtFieldEdit').css("display", "block");
$('#accountNoTxtFieldEdit').css("display", "block");
}
//Edit Account modal
//Changes DELETE button styles onmouseover
function deleteBtnOver(id){
id.css("background", "#C61212");
id.css("color", "#ffffff");
}
//Edit Account modal
//Changes DELETE button styles onmouseout
function deleteBtnOut(id){
id.css("background", "#ffffff");
id.css("color", "#C61212");
}
//Edit Account and Delete Currency modal
//Changes YES button styles onmouseover
function deleteBtnOverYes(id){
id.css("background", "#C61212");
id.css("color", "#ffffff");
}
//Edit Account and Delete Currency modal
//Changes YES button styles onmouseout
function deleteBtnOutYes(id){
id.css("background", "#ffffff");
id.css("color", "#C61212");
}
//Edit Account and Delete Currency modal
//Changes NO button styles onmouseover
function deleteBtnOverNo(id){
id.css("background", "darkorange");
id.css("color", "#ffffff");
}
//Edit Account and Delete Currency modal
//Changes NO button styles onmouseout
function deleteBtnOutNo(id){
id.css("background", "#ffffff");
id.css("color", "darkorange");
}
//Money Transfer modal
//Triggered when the Source Account Type is CASH
//Function that displays the source cash accounts select, sets the value to ' ' and hides the bank accounts select
function cashSelectMoneyTransferSource(){
$('#sourceCashAccount').css("display", "block");
$('#sourceBankAccount').css("display", "none");
$('#defaultSelectSource').css("display", "none");
$('#sourceCashAccount').val('');
$('#labelSourceCurrency').empty();
}
//Money Transfer modal
//Triggered when the Source Account Type is BANK
//Function that displays the source bank accounts select, sets the value to ' ' and hides the cash accounts select
function bankSelectMoneyTransferSource(){
$('#sourceBankAccount').css("display", "block");
$('#defaultSelectSource').css("display", "none");
$('#sourceCashAccount').css("display", "none");
$('#sourceBankAccount').val('');
$('#labelSourceCurrency').empty();
}
//Money Transfer modal
//Triggered when the Destiny Account Type is CASH
//Function that displays the destiny cash accounts select, sets the value to ' ' and hides the bank accounts select
function cashSelectMoneyTransferDestiny(){
$('#destinyAccountCash').css("display", "block");
$('#destinyAccountBank').css("display", "none");
$('#defaultSelectDestiny').css("display", "none");
$('#destinyAccountCash').val('');
$('#labelDestinyCurrency').empty();
}
//Money Transfer modal
//Triggered when the Destiny Account Type is BANK
//Function that displays the destiny bank accounts select, sets the value to ' ' and hides the cash accounts select
function bankSelectMoneyTransferDestiny(){
$('#destinyAccountBank').css("display", "block");
$('#defaultSelectDestiny').css("display", "none");
$('#destinyAccountCash').css("display", "none");
$('#destinyAccountBank').val('');
$('#labelDestinyCurrency').empty();
}
//*********************************** END CSS FUNCTIONS ****************************************************************
| {
"content_hash": "c1f67eee1a9fad413ecda54ddba42ef3",
"timestamp": "",
"source": "github",
"line_count": 1020,
"max_line_length": 137,
"avg_line_length": 33.48529411764706,
"alnum_prop": 0.5833699311960181,
"repo_name": "m1k3r/gvi-accounts",
"id": "fb692529ab9be85361a3972132abd48470620672",
"size": "34155",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "gvi/static/js/app.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6142"
},
{
"name": "HTML",
"bytes": "152771"
},
{
"name": "JavaScript",
"bytes": "112023"
},
{
"name": "Python",
"bytes": "64506"
}
],
"symlink_target": ""
} |
using System;
using Irony.Ast;
using Irony.Interpreter;
using Irony.Interpreter.Ast;
using Irony.Parsing;
namespace Bitbrains.AmmyParser
{
public partial class AstAmmyBindSetBindingGroupName
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
internal class AstAmmyBindSetBindsDirectlyToSource : AstNode, IAstAmmyBindSetItemProvider
{
public IAstAmmyBindSetItem GetData(ScriptThread thread) => throw new NotImplementedException();
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetFallbackValue
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetMode
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetIsAsync
{
public override void Init(AstContext context, ParseTreeNode treeNode)
{
base.Init(context, treeNode);
}
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetNotifyOnSourceUpdated
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetNotifyOnTargetUpdated
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetNotifyOnValidationError
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetStringFormat
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
internal class AstAmmyBindSetUpdateSourceTrigger : AstNode, IAstAmmyBindSetItemProvider
{
public IAstAmmyBindSetItem GetData(ScriptThread thread) => throw new NotImplementedException();
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetValidatesOnDataErrors
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetValidatesOnExceptions
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetValidatesOnNotifyDataErrors
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var data = base.DoEvaluate(thread);
return new AstAmmyBindSetItemData(Keyword, data);
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
partial class AstAmmyBindSetItem : IAstAmmyBindSetItemProvider
{
public IAstAmmyBindSetItem GetData(ScriptThread thread)
{
var x = base.DoEvaluate(thread);
return (IAstAmmyBindSetItem)x;
}
protected override object DoEvaluate(ScriptThread thread) => GetData(thread);
}
public class AstAmmyBindSetItemData : IAstAmmyBindSetItem
{
public override string ToString() => PropertyName + ": " + Value;
public AstAmmyBindSetItemData(string propertyName, object value)
{
PropertyName = propertyName;
Value = value;
}
public string PropertyName { get; }
public object Value { get; }
}
} | {
"content_hash": "e90fe6c29faa556777078a298d3d0890",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 103,
"avg_line_length": 30.931428571428572,
"alnum_prop": 0.6643266210973582,
"repo_name": "isukces/isukces.code",
"id": "a49eeb72a2438695dc9fd66d8793fa21b878591a",
"size": "5413",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Bitbrains.AmmyParser/_ast/+AstAmmyBindSetItemProviders.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "52"
},
{
"name": "C#",
"bytes": "871212"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
null
#### Original name
Ochrolechia alboflavescens var. alboflavescens
### Remarks
null | {
"content_hash": "78bb9dae3c8f5a2eb8da928be4d5911e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 46,
"avg_line_length": 11.615384615384615,
"alnum_prop": 0.7417218543046358,
"repo_name": "mdoering/backbone",
"id": "834d670b6f431bf93fc4cb8e7ec4133566b85976",
"size": "221",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Lecanoromycetes/Pertusariales/Ochrolechiaceae/Ochrolechia/Ochrolechia alboflavescens/Ochrolechia alboflavescens alboflavescens/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The xbhcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef _BITCOINALERT_H_
#define _BITCOINALERT_H_ 1
#include "serialize.h"
#include "sync.h"
#include <map>
#include <set>
#include <stdint.h>
#include <string>
class CAlert;
class CNode;
class uint256;
extern std::map<uint256, CAlert> mapAlerts;
extern CCriticalSection cs_mapAlerts;
/** Alerts are for notifying old versions if they become too obsolete and
* need to upgrade. The message is displayed in the status bar.
* Alert messages are broadcast as a vector of signed data. Unserializing may
* not read the entire buffer if the alert is for a newer version, but older
* versions can still relay the original data.
*/
class CUnsignedAlert
{
public:
int nVersion;
int64_t nRelayUntil; // when newer nodes stop relaying to newer nodes
int64_t nExpiration;
int nID;
int nCancel;
std::set<int> setCancel;
int nMinVer; // lowest version inclusive
int nMaxVer; // highest version inclusive
std::set<std::string> setSubVer; // empty matches all
int nPriority;
// Actions
std::string strComment;
std::string strStatusBar;
std::string strReserved;
IMPLEMENT_SERIALIZE
(
READWRITE(this->nVersion);
nVersion = this->nVersion;
READWRITE(nRelayUntil);
READWRITE(nExpiration);
READWRITE(nID);
READWRITE(nCancel);
READWRITE(setCancel);
READWRITE(nMinVer);
READWRITE(nMaxVer);
READWRITE(setSubVer);
READWRITE(nPriority);
READWRITE(strComment);
READWRITE(strStatusBar);
READWRITE(strReserved);
)
void SetNull();
std::string ToString() const;
void print() const;
};
/** An alert is a combination of a serialized CUnsignedAlert and a signature. */
class CAlert : public CUnsignedAlert
{
public:
std::vector<unsigned char> vchMsg;
std::vector<unsigned char> vchSig;
CAlert()
{
SetNull();
}
IMPLEMENT_SERIALIZE
(
READWRITE(vchMsg);
READWRITE(vchSig);
)
void SetNull();
bool IsNull() const;
uint256 GetHash() const;
bool IsInEffect() const;
bool Cancels(const CAlert& alert) const;
bool AppliesTo(int nVersion, std::string strSubVerIn) const;
bool AppliesToMe() const;
bool RelayTo(CNode* pnode) const;
bool CheckSignature() const;
bool ProcessAlert(bool fThread = true);
/*
* Get copy of (active) alert object by hash. Returns a null alert if it is not found.
*/
static CAlert getAlertByHash(const uint256 &hash);
};
#endif
| {
"content_hash": "cf1bbed99d525adb820948d974205f51",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 90,
"avg_line_length": 25.678899082568808,
"alnum_prop": 0.6677384780278671,
"repo_name": "zccdy/xzcoin",
"id": "3fe4cf3baf59a382e5f27ed59b42e790daf83cab",
"size": "2799",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/alert.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "57050"
},
{
"name": "C++",
"bytes": "2984499"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "HTML",
"bytes": "50620"
},
{
"name": "M4",
"bytes": "111966"
},
{
"name": "Makefile",
"bytes": "1010314"
},
{
"name": "NSIS",
"bytes": "6476"
},
{
"name": "Objective-C",
"bytes": "1052"
},
{
"name": "Objective-C++",
"bytes": "6262"
},
{
"name": "Protocol Buffer",
"bytes": "2308"
},
{
"name": "Python",
"bytes": "95260"
},
{
"name": "QMake",
"bytes": "2019"
},
{
"name": "Roff",
"bytes": "583648"
},
{
"name": "Shell",
"bytes": "147722"
}
],
"symlink_target": ""
} |
Debug = debug.Debug
var exception = null;
var break_count = 0;
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
print(event_data.sourceLineText());
var column = event_data.sourceColumn();
assertTrue(event_data.sourceLineText().indexOf(
`Break ${break_count++}. ${column}.`) > 0);
exec_state.prepareStep(Debug.StepAction.StepIn);
} catch (e) {
print(e + e.stack);
exception = e;
}
};
function f() {
var a = 1; // Break 2. 10.
return a; // Break 3. 2.
} // Break 4. 0.
Debug.setListener(listener);
debugger; // Break 0. 0.
f(); // Break 1. 0.
Debug.setListener(null); // Break 5. 0.
assertNull(exception);
assertEquals(6, break_count);
| {
"content_hash": "a6a9d7705183cabef6d17d907ee028cf",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 56,
"avg_line_length": 28.161290322580644,
"alnum_prop": 0.5406643757159221,
"repo_name": "runtimejs/runtime",
"id": "d31150b6d37aac89c6f968e5d74d2da28eb67567",
"size": "1076",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "deps/v8/test/mjsunit/ignition/elided-instruction.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "31425"
},
{
"name": "C",
"bytes": "2053"
},
{
"name": "C++",
"bytes": "2777013"
},
{
"name": "Dockerfile",
"bytes": "1050"
},
{
"name": "JavaScript",
"bytes": "331562"
},
{
"name": "Python",
"bytes": "6672"
},
{
"name": "Shell",
"bytes": "117"
}
],
"symlink_target": ""
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package example.websocket.data;
/**
* PingPong 送信
*/
public class Ping implements TextBase{}
| {
"content_hash": "126bfea7e10528cdec11c08f085123aa",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 79,
"avg_line_length": 25.545454545454547,
"alnum_prop": 0.7366548042704626,
"repo_name": "enterprisegeeks/java_ee_example",
"id": "d1df2dae0eb801b8ee71070ba8cf4300b99247aa",
"size": "285",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/example/websocket/data/Ping.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "4044"
},
{
"name": "Java",
"bytes": "68672"
},
{
"name": "JavaScript",
"bytes": "13682"
}
],
"symlink_target": ""
} |
//-----------------------------------------------------------------------------
// Copyright (c) 2013 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "platformWin32/platformWin32.h"
#include "platform/platformVFS.h"
#include "console/console.h"
#include "io/memstream.h"
#include "io/zip/zipArchive.h"
#include "memory/safeDelete.h"
#include "VFSRes.h"
//////////////////////////////////////////////////////////////////////////
struct Win32VFSState
{
S32 mRefCount;
HGLOBAL mResData;
MemStream *mZipStream;
Zip::ZipArchive *mZip;
Win32VFSState() : mResData(NULL), mZip(NULL), mRefCount(0), mZipStream(NULL)
{
}
};
static Win32VFSState gVFSState;
//////////////////////////////////////////////////////////////////////////
Zip::ZipArchive *openEmbeddedVFSArchive()
{
if(gVFSState.mZip)
{
++gVFSState.mRefCount;
return gVFSState.mZip;
}
HRSRC hRsrc = FindResource(NULL, MAKEINTRESOURCE(IDR_ZIPFILE), dT("RT_RCDATA"));
if(hRsrc == NULL)
return NULL;
if((gVFSState.mResData = LoadResource(NULL, hRsrc)) == NULL)
return NULL;
void *mem;
if(mem = LockResource(gVFSState.mResData))
{
U32 size = SizeofResource(NULL, hRsrc);
gVFSState.mZipStream = new MemStream(size, mem, true, false);
gVFSState.mZip = new Zip::ZipArchive;
if(gVFSState.mZip->openArchive(gVFSState.mZipStream))
{
++gVFSState.mRefCount;
return gVFSState.mZip;
}
SAFE_DELETE(gVFSState.mZip);
SAFE_DELETE(gVFSState.mZipStream);
}
FreeResource(gVFSState.mResData);
gVFSState.mResData = NULL;
return NULL;
}
void closeEmbeddedVFSArchive()
{
if(gVFSState.mRefCount == 0)
return;
--gVFSState.mRefCount;
if(gVFSState.mRefCount < 1)
{
SAFE_DELETE(gVFSState.mZip);
SAFE_DELETE(gVFSState.mZipStream);
if(gVFSState.mResData)
{
FreeResource(gVFSState.mResData);
gVFSState.mResData = NULL;
}
}
}
| {
"content_hash": "d00a45b535b47e8d984b00ca31fd1223",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 83,
"avg_line_length": 28.68141592920354,
"alnum_prop": 0.605368713360074,
"repo_name": "JeffProgrammer/Torque2D-empty",
"id": "9ccd6dfb621f0e2063d9232de7d201fd741ee45d",
"size": "3465",
"binary": false,
"copies": "6",
"ref": "refs/heads/empty",
"path": "engine/source/platformWin32/winVFS.cc",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "30895"
},
{
"name": "Bison",
"bytes": "16053"
},
{
"name": "C",
"bytes": "4512249"
},
{
"name": "C#",
"bytes": "29745"
},
{
"name": "C++",
"bytes": "5860255"
},
{
"name": "CMake",
"bytes": "44898"
},
{
"name": "Groff",
"bytes": "31697"
},
{
"name": "HTML",
"bytes": "336235"
},
{
"name": "Java",
"bytes": "354"
},
{
"name": "Lua",
"bytes": "15242"
},
{
"name": "Makefile",
"bytes": "695054"
},
{
"name": "Mathematica",
"bytes": "8776"
},
{
"name": "Objective-C",
"bytes": "42558"
},
{
"name": "Objective-C++",
"bytes": "251477"
},
{
"name": "Perl",
"bytes": "69"
},
{
"name": "QMake",
"bytes": "77"
},
{
"name": "SAS",
"bytes": "14051"
},
{
"name": "Shell",
"bytes": "125071"
},
{
"name": "Smalltalk",
"bytes": "2735"
}
],
"symlink_target": ""
} |
#ifndef DatabaseContext_h
#define DatabaseContext_h
#include "core/dom/ContextLifecycleObserver.h"
#include "platform/heap/Handle.h"
namespace blink {
class DatabaseContext;
class DatabaseThread;
class ExecutionContext;
class SecurityOrigin;
class DatabaseContext final : public GarbageCollectedFinalized<DatabaseContext>,
public ContextLifecycleObserver {
USING_GARBAGE_COLLECTED_MIXIN(DatabaseContext);
public:
friend class DatabaseManager;
static DatabaseContext* create(ExecutionContext*);
~DatabaseContext();
DECLARE_VIRTUAL_TRACE();
// For life-cycle management (inherited from ContextLifecycleObserver):
void contextDestroyed(ExecutionContext*) override;
DatabaseContext* backend();
DatabaseThread* databaseThread();
bool databaseThreadAvailable();
void setHasOpenDatabases() { m_hasOpenDatabases = true; }
// Blocks the caller thread until cleanup tasks are completed.
void stopDatabases();
bool allowDatabaseAccess() const;
SecurityOrigin* getSecurityOrigin() const;
bool isContextThread() const;
private:
explicit DatabaseContext(ExecutionContext*);
Member<DatabaseThread> m_databaseThread;
bool m_hasOpenDatabases; // This never changes back to false, even after the
// database thread is closed.
bool m_hasRequestedTermination;
};
} // namespace blink
#endif // DatabaseContext_h
| {
"content_hash": "e897189b9567f1c021fa534a4f932c17",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 80,
"avg_line_length": 25.69090909090909,
"alnum_prop": 0.748761500353857,
"repo_name": "google-ar/WebARonARCore",
"id": "4eda9775bc6a63ca63fbe31eb72379b3798fee3e",
"size": "2822",
"binary": false,
"copies": "1",
"ref": "refs/heads/webarcore_57.0.2987.5",
"path": "third_party/WebKit/Source/modules/webdatabase/DatabaseContext.h",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<div class="row">
<div class="col-md-12">
<ul id="posts-list">
{% for post in site.posts %}
{% if post.category=='jvm' %}
<li class="posts-list-item">
<div class="posts-content">
<span class="posts-list-meta">{{ post.date | date: "%Y-%m-%d" }}</span>
<a class="posts-list-name bubble-float-left" href="{{ site.url }}{{ post.url }}">{{ post.title }}</a>
<span class='circle'></span>
</div>
</li>
{% endif %}
{% endfor %}
</ul>
<!-- Pagination -->
{% include pagination.html %}
<!-- Comments -->
<div class="comment">
{% include comments.html %}
</div>
</div>
</div>
<script>
$(document).ready(function(){
// Enable bootstrap tooltip
$("body").tooltip({ selector: '[data-toggle=tooltip]' });
});
</script> | {
"content_hash": "fa4bf9905e6a130718f356a3b6cb74ba",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 125,
"avg_line_length": 27.944444444444443,
"alnum_prop": 0.42445328031809143,
"repo_name": "ityouknow/ityouknow.github.io",
"id": "62cb451498d9d2c44c3ced880eed9f347e42e574",
"size": "1006",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_includes/jvm.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "26228"
},
{
"name": "HTML",
"bytes": "40430"
},
{
"name": "JavaScript",
"bytes": "4284"
},
{
"name": "Ruby",
"bytes": "4721"
}
],
"symlink_target": ""
} |
<script src="<?php echo base_url(); ?>public/js/jquery-2.1.3.min.js"></script>
<script src="<?php echo base_url(); ?>public/js/bootstrap.min.js"></script>
<script src="<?php echo base_url(); ?>public/js/smoke.js"></script>
<script src="<?php echo base_url(); ?>public/js/jquery-select.js"></script>
<script src="<?php echo base_url(); ?>public/js/contabilidad/catalogo/grupo_jquery.js"></script>
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container-fluid">
<div align="center"><i class="fa fa-copyright"> PHD Systems</i> Cacao <?= date('Y') ?></div>
</div>
</nav>
</body>
</html> | {
"content_hash": "e37f6a4b852a43956f5014e1e520b07e",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 100,
"avg_line_length": 51.666666666666664,
"alnum_prop": 0.6516129032258065,
"repo_name": "fjcm777/cacao",
"id": "cfabd7cf71f5e67688927f836502a58490702415",
"size": "620",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "application/views/modules/foot/contabilidad/grupo_foot.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "233"
},
{
"name": "CSS",
"bytes": "144905"
},
{
"name": "HTML",
"bytes": "5373014"
},
{
"name": "JavaScript",
"bytes": "201884"
},
{
"name": "PHP",
"bytes": "19702894"
}
],
"symlink_target": ""
} |
package engine
import (
"bytes"
"context"
"fmt"
"io/fs"
"os"
"path"
"path/filepath"
"reflect"
"strings"
"unicode"
"github.com/GoogleContainerTools/kpt/internal/builtins"
"github.com/GoogleContainerTools/kpt/internal/fnruntime"
kptfile "github.com/GoogleContainerTools/kpt/pkg/api/kptfile/v1"
"github.com/GoogleContainerTools/kpt/pkg/fn"
api "github.com/GoogleContainerTools/kpt/porch/api/porch/v1alpha1"
configapi "github.com/GoogleContainerTools/kpt/porch/api/porchconfig/v1alpha1"
"github.com/GoogleContainerTools/kpt/porch/pkg/cache"
"github.com/GoogleContainerTools/kpt/porch/pkg/kpt"
"github.com/GoogleContainerTools/kpt/porch/pkg/meta"
"github.com/GoogleContainerTools/kpt/porch/pkg/repository"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/trace"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/kustomize/kyaml/comments"
"sigs.k8s.io/kustomize/kyaml/kio"
"sigs.k8s.io/kustomize/kyaml/yaml"
)
var tracer = otel.Tracer("engine")
type CaDEngine interface {
// ObjectCache() is a cache of all our objects.
ObjectCache() WatcherManager
UpdatePackageResources(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *PackageRevision, old, new *api.PackageRevisionResources) (*PackageRevision, *api.RenderStatus, error)
ListFunctions(ctx context.Context, repositoryObj *configapi.Repository) ([]*Function, error)
ListPackageRevisions(ctx context.Context, repositorySpec *configapi.Repository, filter repository.ListPackageRevisionFilter) ([]*PackageRevision, error)
CreatePackageRevision(ctx context.Context, repositoryObj *configapi.Repository, obj *api.PackageRevision, parent *PackageRevision) (*PackageRevision, error)
UpdatePackageRevision(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *PackageRevision, old, new *api.PackageRevision, parent *PackageRevision) (*PackageRevision, error)
DeletePackageRevision(ctx context.Context, repositoryObj *configapi.Repository, obj *PackageRevision) error
ListPackages(ctx context.Context, repositorySpec *configapi.Repository, filter repository.ListPackageFilter) ([]*Package, error)
CreatePackage(ctx context.Context, repositoryObj *configapi.Repository, obj *api.Package) (*Package, error)
UpdatePackage(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *Package, old, new *api.Package) (*Package, error)
DeletePackage(ctx context.Context, repositoryObj *configapi.Repository, obj *Package) error
}
type Package struct {
repoPackage repository.Package
}
func (p *Package) GetPackage() *api.Package {
return p.repoPackage.GetPackage()
}
func (p *Package) KubeObjectName() string {
return p.repoPackage.KubeObjectName()
}
// TODO: This is a bit awkward, and we should see if there is a way to avoid
// having to expose this function. Any functionality that requires creating new
// engine.PackageRevision resources should be in the engine package.
func ToPackageRevision(pkgRev repository.PackageRevision, pkgRevMeta meta.PackageRevisionMeta) *PackageRevision {
return &PackageRevision{
repoPackageRevision: pkgRev,
packageRevisionMeta: pkgRevMeta,
}
}
type PackageRevision struct {
repoPackageRevision repository.PackageRevision
packageRevisionMeta meta.PackageRevisionMeta
}
func (p *PackageRevision) GetPackageRevision(ctx context.Context) (*api.PackageRevision, error) {
repoPkgRev, err := p.repoPackageRevision.GetPackageRevision(ctx)
if err != nil {
return nil, err
}
var isLatest bool
if val, found := repoPkgRev.Labels[api.LatestPackageRevisionKey]; found && val == api.LatestPackageRevisionValue {
isLatest = true
}
repoPkgRev.Labels = p.packageRevisionMeta.Labels
if isLatest {
if repoPkgRev.Labels == nil {
repoPkgRev.Labels = make(map[string]string)
}
repoPkgRev.Labels[api.LatestPackageRevisionKey] = api.LatestPackageRevisionValue
}
repoPkgRev.Annotations = p.packageRevisionMeta.Annotations
repoPkgRev.Finalizers = p.packageRevisionMeta.Finalizers
repoPkgRev.OwnerReferences = p.packageRevisionMeta.OwnerReferences
repoPkgRev.DeletionTimestamp = p.packageRevisionMeta.DeletionTimestamp
return repoPkgRev, nil
}
func (p *PackageRevision) KubeObjectName() string {
return p.repoPackageRevision.KubeObjectName()
}
func (p *PackageRevision) GetResources(ctx context.Context) (*api.PackageRevisionResources, error) {
return p.repoPackageRevision.GetResources(ctx)
}
type Function struct {
RepoFunction repository.Function
}
func (f *Function) Name() string {
return f.RepoFunction.Name()
}
func (f *Function) GetFunction() (*api.Function, error) {
return f.RepoFunction.GetFunction()
}
func NewCaDEngine(opts ...EngineOption) (CaDEngine, error) {
engine := &cadEngine{}
for _, opt := range opts {
if err := opt.apply(engine); err != nil {
return nil, err
}
}
return engine, nil
}
type cadEngine struct {
cache *cache.Cache
// runnerOptionsResolver returns the RunnerOptions for function execution in the specified namespace.
runnerOptionsResolver func(namespace string) fnruntime.RunnerOptions
runtime fn.FunctionRuntime
credentialResolver repository.CredentialResolver
referenceResolver ReferenceResolver
userInfoProvider repository.UserInfoProvider
metadataStore meta.MetadataStore
watcherManager *watcherManager
}
var _ CaDEngine = &cadEngine{}
type mutation interface {
Apply(ctx context.Context, resources repository.PackageResources) (repository.PackageResources, *api.TaskResult, error)
}
// ObjectCache is a cache of all our objects.
func (cad *cadEngine) ObjectCache() WatcherManager {
return cad.watcherManager
}
func (cad *cadEngine) OpenRepository(ctx context.Context, repositorySpec *configapi.Repository) (repository.Repository, error) {
ctx, span := tracer.Start(ctx, "cadEngine::OpenRepository", trace.WithAttributes())
defer span.End()
return cad.cache.OpenRepository(ctx, repositorySpec)
}
func (cad *cadEngine) ListPackageRevisions(ctx context.Context, repositorySpec *configapi.Repository, filter repository.ListPackageRevisionFilter) ([]*PackageRevision, error) {
ctx, span := tracer.Start(ctx, "cadEngine::ListPackageRevisions", trace.WithAttributes())
defer span.End()
repo, err := cad.cache.OpenRepository(ctx, repositorySpec)
if err != nil {
return nil, err
}
pkgRevs, err := repo.ListPackageRevisions(ctx, filter)
if err != nil {
return nil, err
}
var packageRevisions []*PackageRevision
for _, pr := range pkgRevs {
pkgRevMeta, err := cad.metadataStore.Get(ctx, types.NamespacedName{
Name: pr.KubeObjectName(),
Namespace: pr.KubeObjectNamespace(),
})
if err != nil {
// If a PackageRev CR doesn't exist, we treat the
// Packagerevision as not existing.
if apierrors.IsNotFound(err) {
continue
}
return nil, err
}
packageRevisions = append(packageRevisions, &PackageRevision{
repoPackageRevision: pr,
packageRevisionMeta: pkgRevMeta,
})
}
return packageRevisions, nil
}
func buildPackageConfig(ctx context.Context, obj *api.PackageRevision, parent *PackageRevision) (*builtins.PackageConfig, error) {
config := &builtins.PackageConfig{}
parentPath := ""
var parentConfig *unstructured.Unstructured
if parent != nil {
parentObj, err := parent.GetPackageRevision(ctx)
if err != nil {
return nil, err
}
parentPath = parentObj.Spec.PackageName
resources, err := parent.GetResources(ctx)
if err != nil {
return nil, fmt.Errorf("error getting resources from parent package %q: %w", parentObj.Name, err)
}
configMapObj, err := ExtractContextConfigMap(resources.Spec.Resources)
if err != nil {
return nil, fmt.Errorf("error getting configuration from parent package %q: %w", parentObj.Name, err)
}
parentConfig = configMapObj
if parentConfig != nil {
// TODO: Should we support kinds other than configmaps?
var parentConfigMap corev1.ConfigMap
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(parentConfig.Object, &parentConfigMap); err != nil {
return nil, fmt.Errorf("error parsing ConfigMap from parent configuration: %w", err)
}
if s := parentConfigMap.Data[builtins.ConfigKeyPackagePath]; s != "" {
parentPath = s + "/" + parentPath
}
}
}
if parentPath == "" {
config.PackagePath = obj.Spec.PackageName
} else {
config.PackagePath = parentPath + "/" + obj.Spec.PackageName
}
return config, nil
}
func (cad *cadEngine) CreatePackageRevision(ctx context.Context, repositoryObj *configapi.Repository, obj *api.PackageRevision, parent *PackageRevision) (*PackageRevision, error) {
ctx, span := tracer.Start(ctx, "cadEngine::CreatePackageRevision", trace.WithAttributes())
defer span.End()
packageConfig, err := buildPackageConfig(ctx, obj, parent)
if err != nil {
return nil, err
}
// Validate package lifecycle. Cannot create a final package
switch obj.Spec.Lifecycle {
case "":
// Set draft as default
obj.Spec.Lifecycle = api.PackageRevisionLifecycleDraft
case api.PackageRevisionLifecycleDraft, api.PackageRevisionLifecycleProposed:
// These values are ok
case api.PackageRevisionLifecyclePublished:
// TODO: generate errors that can be translated to correct HTTP responses
return nil, fmt.Errorf("cannot create a package revision with lifecycle value 'Final'")
default:
return nil, fmt.Errorf("unsupported lifecycle value: %s", obj.Spec.Lifecycle)
}
repo, err := cad.cache.OpenRepository(ctx, repositoryObj)
if err != nil {
return nil, err
}
if err := repository.ValidateWorkspaceName(obj.Spec.WorkspaceName); err != nil {
return nil, fmt.Errorf("failed to create packagerevision: %w", err)
}
// The workspaceName must be unique, because it used to generate the package revision's metadata.name.
revs, err := repo.ListPackageRevisions(ctx, repository.ListPackageRevisionFilter{Package: obj.Spec.PackageName, WorkspaceName: obj.Spec.WorkspaceName})
if err != nil {
return nil, fmt.Errorf("error searching through existing package revisions: %w", err)
}
if len(revs) != 0 {
return nil, fmt.Errorf("package revision workspaceNames must be unique; package revision with name %s in repo %s with "+
"workspaceName %s already exists", obj.Spec.PackageName, obj.Spec.RepositoryName, obj.Spec.WorkspaceName)
}
sameOrigin, err := cad.ensureSameOrigin(ctx, obj, repo)
if err != nil {
return nil, fmt.Errorf("error ensuring same origin: %w", err)
}
if !sameOrigin {
return nil, fmt.Errorf("cannot create revision of %s with a different origin than other package revisions in the same package", obj.Spec.PackageName)
}
draft, err := repo.CreatePackageRevision(ctx, obj)
if err != nil {
return nil, err
}
if err := cad.applyTasks(ctx, draft, repositoryObj, obj, packageConfig); err != nil {
return nil, err
}
if err := draft.UpdateLifecycle(ctx, obj.Spec.Lifecycle); err != nil {
return nil, err
}
// Updates are done.
repoPkgRev, err := draft.Close(ctx)
if err != nil {
return nil, err
}
pkgRevMeta := meta.PackageRevisionMeta{
Name: repoPkgRev.KubeObjectName(),
Namespace: repoPkgRev.KubeObjectNamespace(),
Labels: obj.Labels,
Annotations: obj.Annotations,
Finalizers: obj.Finalizers,
OwnerReferences: obj.OwnerReferences,
}
pkgRevMeta, err = cad.metadataStore.Create(ctx, pkgRevMeta, repositoryObj.Name, repoPkgRev.UID())
if err != nil {
return nil, err
}
cad.watcherManager.NotifyPackageRevisionChange(watch.Added, repoPkgRev, pkgRevMeta)
return &PackageRevision{
repoPackageRevision: repoPkgRev,
packageRevisionMeta: pkgRevMeta,
}, nil
}
func (cad *cadEngine) ensureSameOrigin(ctx context.Context, obj *api.PackageRevision, r repository.Repository) (bool, error) {
revs, err := r.ListPackageRevisions(ctx, repository.ListPackageRevisionFilter{
Package: obj.Spec.PackageName})
if err != nil {
return false, fmt.Errorf("error listing package revisions: %w", err)
}
if len(revs) == 0 {
// no prior package revisions, no need to check anything else
return true, nil
}
tasks := obj.Spec.Tasks
if len(tasks) == 0 || (tasks[0].Type != api.TaskTypeInit && tasks[0].Type != api.TaskTypeClone) {
// If there are no tasks, or the first task is not init or clone, then this revision was not
// created from another package revision. That means we expect it to be the first revision
// for this package.
return false, nil
}
firstObjTask := tasks[0].DeepCopy()
// iterate over existing package revisions, and look for one with a matching init or clone task
for _, rev := range revs {
p, err := rev.GetPackageRevision(ctx)
if err != nil {
return false, err
}
revTasks := p.Spec.Tasks
if len(revTasks) == 0 {
// not a match
continue
}
firstRevTask := revTasks[0].DeepCopy()
if firstRevTask.Type != firstObjTask.Type {
// not a match
continue
}
if firstObjTask.Type == api.TaskTypeClone {
// the user is allowed to update the git upstream ref, so we exclude that from the equality check.
// We make the git upstream refs equal before calling reflect.DeepEqual
if firstRevTask.Clone != nil && firstObjTask.Clone != nil {
if firstRevTask.Clone.Upstream.Git != nil && firstObjTask.Clone.Upstream.Git != nil {
firstRevTask.Clone.Upstream.Git.Ref = firstObjTask.Clone.Upstream.Git.Ref
}
if firstRevTask.Clone.Upstream.UpstreamRef != nil && firstObjTask.Clone.Upstream.UpstreamRef != nil {
firstRevTask.Clone.Upstream.UpstreamRef = firstObjTask.Clone.Upstream.UpstreamRef
}
}
}
if reflect.DeepEqual(firstRevTask, firstObjTask) {
return true, nil
}
}
return false, nil
}
func (cad *cadEngine) applyTasks(ctx context.Context, draft repository.PackageDraft, repositoryObj *configapi.Repository, obj *api.PackageRevision, packageConfig *builtins.PackageConfig) error {
var mutations []mutation
// Unless first task is Init or Clone, insert Init to create an empty package.
tasks := obj.Spec.Tasks
if len(tasks) == 0 || (tasks[0].Type != api.TaskTypeInit && tasks[0].Type != api.TaskTypeClone) {
mutations = append(mutations, &initPackageMutation{
name: obj.Spec.PackageName,
task: &api.Task{
Init: &api.PackageInitTaskSpec{
Subpackage: "",
Description: fmt.Sprintf("%s description", obj.Spec.PackageName),
},
},
})
}
for i := range tasks {
task := &tasks[i]
mutation, err := cad.mapTaskToMutation(ctx, obj, task, repositoryObj.Spec.Deployment, packageConfig)
if err != nil {
return err
}
mutations = append(mutations, mutation)
}
// Render package after creation.
mutations = cad.conditionalAddRender(obj, mutations)
baseResources := repository.PackageResources{}
if _, _, err := applyResourceMutations(ctx, draft, baseResources, mutations); err != nil {
return err
}
return nil
}
type RepositoryOpener interface {
OpenRepository(ctx context.Context, repositorySpec *configapi.Repository) (repository.Repository, error)
}
func (cad *cadEngine) mapTaskToMutation(ctx context.Context, obj *api.PackageRevision, task *api.Task, isDeployment bool, packageConfig *builtins.PackageConfig) (mutation, error) {
switch task.Type {
case api.TaskTypeInit:
if task.Init == nil {
return nil, fmt.Errorf("init not set for task of type %q", task.Type)
}
return &initPackageMutation{
name: obj.Spec.PackageName,
task: task,
}, nil
case api.TaskTypeClone:
if task.Clone == nil {
return nil, fmt.Errorf("clone not set for task of type %q", task.Type)
}
return &clonePackageMutation{
task: task,
namespace: obj.Namespace,
name: obj.Spec.PackageName,
isDeployment: isDeployment,
repoOpener: cad,
credentialResolver: cad.credentialResolver,
referenceResolver: cad.referenceResolver,
packageConfig: packageConfig,
}, nil
case api.TaskTypeUpdate:
if task.Update == nil {
return nil, fmt.Errorf("update not set for task of type %q", task.Type)
}
cloneTask := findCloneTask(obj)
if cloneTask == nil {
return nil, fmt.Errorf("upstream source not found for package rev %q; only cloned packages can be updated", obj.Spec.PackageName)
}
return &updatePackageMutation{
cloneTask: cloneTask,
updateTask: task,
namespace: obj.Namespace,
repoOpener: cad,
referenceResolver: cad.referenceResolver,
pkgName: obj.Spec.PackageName,
}, nil
case api.TaskTypePatch:
return buildPatchMutation(ctx, task)
case api.TaskTypeEdit:
if task.Edit == nil {
return nil, fmt.Errorf("edit not set for task of type %q", task.Type)
}
return &editPackageMutation{
task: task,
namespace: obj.Namespace,
repoOpener: cad,
referenceResolver: cad.referenceResolver,
}, nil
case api.TaskTypeEval:
if task.Eval == nil {
return nil, fmt.Errorf("eval not set for task of type %q", task.Type)
}
// TODO: We should find a different way to do this. Probably a separate
// task for render.
if task.Eval.Image == "render" {
runnerOptions := cad.runnerOptionsResolver(obj.Namespace)
return &renderPackageMutation{
runnerOptions: runnerOptions,
runtime: cad.runtime,
}, nil
} else {
runnerOptions := cad.runnerOptionsResolver(obj.Namespace)
return &evalFunctionMutation{
runnerOptions: runnerOptions,
runtime: cad.runtime,
task: task,
}, nil
}
default:
return nil, fmt.Errorf("task of type %q not supported", task.Type)
}
}
func (cad *cadEngine) UpdatePackageRevision(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *PackageRevision, oldObj, newObj *api.PackageRevision, parent *PackageRevision) (*PackageRevision, error) {
ctx, span := tracer.Start(ctx, "cadEngine::UpdatePackageRevision", trace.WithAttributes())
defer span.End()
repo, err := cad.cache.OpenRepository(ctx, repositoryObj)
if err != nil {
return nil, err
}
// Check if the PackageRevision is in the terminating state and
// and this request removes the last finalizer.
repoPkgRev := oldPackage.repoPackageRevision
pkgRevMetaNN := types.NamespacedName{
Name: repoPkgRev.KubeObjectName(),
Namespace: repoPkgRev.KubeObjectNamespace(),
}
pkgRevMeta, err := cad.metadataStore.Get(ctx, pkgRevMetaNN)
if err != nil {
return nil, err
}
// If this is in the terminating state and we are removing the last finalizer,
// we delete the resource instead of updating it.
if pkgRevMeta.DeletionTimestamp != nil && len(newObj.Finalizers) == 0 {
if err := cad.deletePackageRevision(ctx, repo, repoPkgRev, pkgRevMeta); err != nil {
return nil, err
}
return ToPackageRevision(repoPkgRev, pkgRevMeta), nil
}
// Validate package lifecycle. Can only update a draft.
switch lifecycle := oldObj.Spec.Lifecycle; lifecycle {
default:
return nil, fmt.Errorf("invalid original lifecycle value: %q", lifecycle)
case api.PackageRevisionLifecycleDraft, api.PackageRevisionLifecycleProposed:
// Draft or proposed can be updated.
case api.PackageRevisionLifecyclePublished:
// Only metadata (currently labels and annotations) can be updated for published packages.
pkgRevMeta, err = cad.updatePkgRevMeta(ctx, repoPkgRev, newObj)
if err != nil {
return nil, err
}
cad.watcherManager.NotifyPackageRevisionChange(watch.Modified, repoPkgRev, pkgRevMeta)
return ToPackageRevision(repoPkgRev, pkgRevMeta), nil
}
switch lifecycle := newObj.Spec.Lifecycle; lifecycle {
default:
return nil, fmt.Errorf("invalid desired lifecycle value: %q", lifecycle)
case api.PackageRevisionLifecycleDraft, api.PackageRevisionLifecycleProposed, api.PackageRevisionLifecyclePublished:
// These values are ok
}
if isRecloneAndReplay(oldObj, newObj) {
packageConfig, err := buildPackageConfig(ctx, newObj, parent)
if err != nil {
return nil, err
}
repoPkgRev, err := cad.recloneAndReplay(ctx, repo, repositoryObj, newObj, packageConfig)
if err != nil {
return nil, err
}
pkgRevMeta, err = cad.updatePkgRevMeta(ctx, repoPkgRev, newObj)
if err != nil {
return nil, err
}
cad.watcherManager.NotifyPackageRevisionChange(watch.Modified, repoPkgRev, pkgRevMeta)
return ToPackageRevision(repoPkgRev, pkgRevMeta), nil
}
var mutations []mutation
if len(oldObj.Spec.Tasks) > len(newObj.Spec.Tasks) {
return nil, fmt.Errorf("removing tasks is not yet supported")
}
for i := range oldObj.Spec.Tasks {
oldTask := &oldObj.Spec.Tasks[i]
newTask := &newObj.Spec.Tasks[i]
if oldTask.Type != newTask.Type {
return nil, fmt.Errorf("changing task types is not yet supported")
}
}
if len(newObj.Spec.Tasks) > len(oldObj.Spec.Tasks) {
if len(newObj.Spec.Tasks) > len(oldObj.Spec.Tasks)+1 {
return nil, fmt.Errorf("can only append one task at a time")
}
newTask := newObj.Spec.Tasks[len(newObj.Spec.Tasks)-1]
if newTask.Type != api.TaskTypeUpdate {
return nil, fmt.Errorf("appended task is type %q, must be type %q", newTask.Type, api.TaskTypeUpdate)
}
if newTask.Update == nil {
return nil, fmt.Errorf("update not set for updateTask of type %q", newTask.Type)
}
cloneTask := findCloneTask(oldObj)
if cloneTask == nil {
return nil, fmt.Errorf("upstream source not found for package rev %q; only cloned packages can be updated", oldObj.Spec.PackageName)
}
mutation := &updatePackageMutation{
cloneTask: cloneTask,
updateTask: &newTask,
repoOpener: cad,
referenceResolver: cad.referenceResolver,
namespace: repositoryObj.Namespace,
pkgName: oldObj.GetName(),
}
mutations = append(mutations, mutation)
}
// Re-render if we are making changes.
mutations = cad.conditionalAddRender(newObj, mutations)
draft, err := repo.UpdatePackageRevision(ctx, oldPackage.repoPackageRevision)
if err != nil {
return nil, err
}
// If any of the fields in the API that are projections from the Kptfile
// must be updated in the Kptfile as well.
kfPatchTask, created, err := createKptfilePatchTask(ctx, oldPackage.repoPackageRevision, newObj)
if err != nil {
return nil, err
}
if created {
kfPatchMutation, err := buildPatchMutation(ctx, kfPatchTask)
if err != nil {
return nil, err
}
mutations = append(mutations, kfPatchMutation)
}
// Re-render if we are making changes.
mutations = cad.conditionalAddRender(newObj, mutations)
// TODO: Handle the case if alongside lifecycle change, tasks are changed too.
// Update package contents only if the package is in draft state
if oldObj.Spec.Lifecycle == api.PackageRevisionLifecycleDraft {
apiResources, err := oldPackage.GetResources(ctx)
if err != nil {
return nil, fmt.Errorf("cannot get package resources: %w", err)
}
resources := repository.PackageResources{
Contents: apiResources.Spec.Resources,
}
if _, _, err := applyResourceMutations(ctx, draft, resources, mutations); err != nil {
return nil, err
}
}
if err := draft.UpdateLifecycle(ctx, newObj.Spec.Lifecycle); err != nil {
return nil, err
}
// Updates are done.
repoPkgRev, err = draft.Close(ctx)
if err != nil {
return nil, err
}
pkgRevMeta, err = cad.updatePkgRevMeta(ctx, repoPkgRev, newObj)
if err != nil {
return nil, err
}
cad.watcherManager.NotifyPackageRevisionChange(watch.Modified, repoPkgRev, pkgRevMeta)
return ToPackageRevision(repoPkgRev, pkgRevMeta), nil
}
func (cad *cadEngine) updatePkgRevMeta(ctx context.Context, repoPkgRev repository.PackageRevision, apiPkgRev *api.PackageRevision) (meta.PackageRevisionMeta, error) {
pkgRevMeta := meta.PackageRevisionMeta{
Name: repoPkgRev.KubeObjectName(),
Namespace: repoPkgRev.KubeObjectNamespace(),
Labels: apiPkgRev.Labels,
Annotations: apiPkgRev.Annotations,
Finalizers: apiPkgRev.Finalizers,
OwnerReferences: apiPkgRev.OwnerReferences,
}
return cad.metadataStore.Update(ctx, pkgRevMeta)
}
func createKptfilePatchTask(ctx context.Context, oldPackage repository.PackageRevision, newObj *api.PackageRevision) (*api.Task, bool, error) {
kf, err := oldPackage.GetKptfile(ctx)
if err != nil {
return nil, false, err
}
var orgKfString string
{
var buf bytes.Buffer
d := yaml.NewEncoder(&buf)
if err := d.Encode(kf); err != nil {
return nil, false, err
}
orgKfString = buf.String()
}
var readinessGates []kptfile.ReadinessGate
for _, rg := range newObj.Spec.ReadinessGates {
readinessGates = append(readinessGates, kptfile.ReadinessGate{
ConditionType: rg.ConditionType,
})
}
var conditions []kptfile.Condition
for _, c := range newObj.Status.Conditions {
conditions = append(conditions, kptfile.Condition{
Type: c.Type,
Status: convertStatusToKptfile(c.Status),
Reason: c.Reason,
Message: c.Message,
})
}
if kf.Info == nil && len(readinessGates) > 0 {
kf.Info = &kptfile.PackageInfo{}
}
if len(readinessGates) > 0 {
kf.Info.ReadinessGates = readinessGates
}
if kf.Status == nil && len(conditions) > 0 {
kf.Status = &kptfile.Status{}
}
if len(conditions) > 0 {
kf.Status.Conditions = conditions
}
var newKfString string
{
var buf bytes.Buffer
d := yaml.NewEncoder(&buf)
if err := d.Encode(kf); err != nil {
return nil, false, err
}
newKfString = buf.String()
}
patchSpec, err := GeneratePatch(kptfile.KptFileName, orgKfString, newKfString)
if err != nil {
return nil, false, err
}
// If patch is empty, don't create a Task.
if patchSpec.Contents == "" {
return nil, false, nil
}
return &api.Task{
Type: api.TaskTypePatch,
Patch: &api.PackagePatchTaskSpec{
Patches: []api.PatchSpec{
patchSpec,
},
},
}, true, nil
}
func convertStatusToKptfile(s api.ConditionStatus) kptfile.ConditionStatus {
switch s {
case api.ConditionTrue:
return kptfile.ConditionTrue
case api.ConditionFalse:
return kptfile.ConditionFalse
case api.ConditionUnknown:
return kptfile.ConditionUnknown
default:
panic(fmt.Errorf("unknown condition status: %v", s))
}
}
// conditionalAddRender adds a render mutation to the end of the mutations slice if the last
// entry is not already a render mutation.
func (cad *cadEngine) conditionalAddRender(subject client.Object, mutations []mutation) []mutation {
if len(mutations) == 0 {
return mutations
}
lastMutation := mutations[len(mutations)-1]
_, isRender := lastMutation.(*renderPackageMutation)
if isRender {
return mutations
}
runnerOptions := cad.runnerOptionsResolver(subject.GetNamespace())
return append(mutations, &renderPackageMutation{
runnerOptions: runnerOptions,
runtime: cad.runtime,
})
}
func (cad *cadEngine) DeletePackageRevision(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *PackageRevision) error {
ctx, span := tracer.Start(ctx, "cadEngine::DeletePackageRevision", trace.WithAttributes())
defer span.End()
repo, err := cad.cache.OpenRepository(ctx, repositoryObj)
if err != nil {
return err
}
// We delete the PackageRev regardless of any finalizers, since it
// will always have the same finalizers as the PackageRevision. This
// will put the PackageRev, and therefore the PackageRevision in the
// terminating state.
// But we only delete the PackageRevision from the repo once all finalizers
// have been removed.
namespacedName := types.NamespacedName{
Name: oldPackage.repoPackageRevision.KubeObjectName(),
Namespace: oldPackage.repoPackageRevision.KubeObjectNamespace(),
}
pkgRevMeta, err := cad.metadataStore.Delete(ctx, namespacedName, false)
if err != nil {
return err
}
if len(pkgRevMeta.Finalizers) > 0 {
klog.Infof("PackageRevision %s deleted, but still have finalizers: %s", oldPackage.KubeObjectName(), strings.Join(pkgRevMeta.Finalizers, ","))
cad.watcherManager.NotifyPackageRevisionChange(watch.Modified, oldPackage.repoPackageRevision, oldPackage.packageRevisionMeta)
return nil
}
klog.Infof("PackageRevision %s deleted for real since no finalizers", oldPackage.KubeObjectName())
return cad.deletePackageRevision(ctx, repo, oldPackage.repoPackageRevision, oldPackage.packageRevisionMeta)
}
func (cad *cadEngine) deletePackageRevision(ctx context.Context, repo repository.Repository, repoPkgRev repository.PackageRevision, pkgRevMeta meta.PackageRevisionMeta) error {
ctx, span := tracer.Start(ctx, "cadEngine::deletePackageRevision", trace.WithAttributes())
defer span.End()
if err := repo.DeletePackageRevision(ctx, repoPkgRev); err != nil {
return err
}
nn := types.NamespacedName{
Name: pkgRevMeta.Name,
Namespace: pkgRevMeta.Namespace,
}
if _, err := cad.metadataStore.Delete(ctx, nn, true); err != nil {
// If this fails, the CR will be cleaned up by the background job.
klog.Warningf("Error deleting PkgRevMeta %s: %v", nn.String(), err)
}
cad.watcherManager.NotifyPackageRevisionChange(watch.Deleted, repoPkgRev, pkgRevMeta)
return nil
}
func (cad *cadEngine) ListPackages(ctx context.Context, repositorySpec *configapi.Repository, filter repository.ListPackageFilter) ([]*Package, error) {
ctx, span := tracer.Start(ctx, "cadEngine::ListPackages", trace.WithAttributes())
defer span.End()
repo, err := cad.cache.OpenRepository(ctx, repositorySpec)
if err != nil {
return nil, err
}
pkgs, err := repo.ListPackages(ctx, filter)
if err != nil {
return nil, err
}
var packages []*Package
for _, p := range pkgs {
packages = append(packages, &Package{
repoPackage: p,
})
}
return packages, nil
}
func (cad *cadEngine) CreatePackage(ctx context.Context, repositoryObj *configapi.Repository, obj *api.Package) (*Package, error) {
ctx, span := tracer.Start(ctx, "cadEngine::CreatePackage", trace.WithAttributes())
defer span.End()
repo, err := cad.cache.OpenRepository(ctx, repositoryObj)
if err != nil {
return nil, err
}
pkg, err := repo.CreatePackage(ctx, obj)
if err != nil {
return nil, err
}
return &Package{
repoPackage: pkg,
}, nil
}
func (cad *cadEngine) UpdatePackage(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *Package, oldObj, newObj *api.Package) (*Package, error) {
ctx, span := tracer.Start(ctx, "cadEngine::UpdatePackage", trace.WithAttributes())
defer span.End()
// TODO
var pkg *Package
return pkg, fmt.Errorf("Updating packages is not yet supported")
}
func (cad *cadEngine) DeletePackage(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *Package) error {
ctx, span := tracer.Start(ctx, "cadEngine::DeletePackage", trace.WithAttributes())
defer span.End()
repo, err := cad.cache.OpenRepository(ctx, repositoryObj)
if err != nil {
return err
}
if err := repo.DeletePackage(ctx, oldPackage.repoPackage); err != nil {
return err
}
return nil
}
func (cad *cadEngine) UpdatePackageResources(ctx context.Context, repositoryObj *configapi.Repository, oldPackage *PackageRevision, old, new *api.PackageRevisionResources) (*PackageRevision, *api.RenderStatus, error) {
ctx, span := tracer.Start(ctx, "cadEngine::UpdatePackageResources", trace.WithAttributes())
defer span.End()
rev, err := oldPackage.repoPackageRevision.GetPackageRevision(ctx)
if err != nil {
return nil, nil, err
}
// Validate package lifecycle. Can only update a draft.
switch lifecycle := rev.Spec.Lifecycle; lifecycle {
default:
return nil, nil, fmt.Errorf("invalid original lifecycle value: %q", lifecycle)
case api.PackageRevisionLifecycleDraft:
// Only draf can be updated.
case api.PackageRevisionLifecycleProposed, api.PackageRevisionLifecyclePublished:
// TODO: generate errors that can be translated to correct HTTP responses
return nil, nil, fmt.Errorf("cannot update a package revision with lifecycle value %q; package must be Draft", lifecycle)
}
repo, err := cad.cache.OpenRepository(ctx, repositoryObj)
if err != nil {
return nil, nil, err
}
draft, err := repo.UpdatePackageRevision(ctx, oldPackage.repoPackageRevision)
if err != nil {
return nil, nil, err
}
runnerOptions := cad.runnerOptionsResolver(old.GetNamespace())
mutations := []mutation{
&mutationReplaceResources{
newResources: new,
oldResources: old,
},
}
prevResources, err := oldPackage.repoPackageRevision.GetResources(ctx)
if err != nil {
return nil, nil, fmt.Errorf("cannot get package resources: %w", err)
}
resources := repository.PackageResources{
Contents: prevResources.Spec.Resources,
}
appliedResources, _, err := applyResourceMutations(ctx, draft, resources, mutations)
if err != nil {
return nil, nil, err
}
// render the package
// Render failure will not fail the overall API operation.
// The render error and result is captured as part of renderStatus above
// and is returned in packageresourceresources API's status field. We continue with
// saving the non-rendered resources to avoid losing user's changes.
// and supress this err.
_, renderStatus, _ := applyResourceMutations(ctx,
draft,
appliedResources,
[]mutation{&renderPackageMutation{
runnerOptions: runnerOptions,
runtime: cad.runtime,
}})
// No lifecycle change when updating package resources; updates are done.
repoPkgRev, err := draft.Close(ctx)
if err != nil {
return nil, renderStatus, err
}
return &PackageRevision{
repoPackageRevision: repoPkgRev,
}, renderStatus, nil
}
// applyResourceMutations mutates the resources and returns the most recent renderResult.
func applyResourceMutations(ctx context.Context, draft repository.PackageDraft, baseResources repository.PackageResources, mutations []mutation) (applied repository.PackageResources, renderStatus *api.RenderStatus, err error) {
for _, m := range mutations {
updatedResources, taskResult, err := m.Apply(ctx, baseResources)
var task *api.Task
if taskResult != nil {
task = taskResult.Task
}
if taskResult != nil && task.Type == api.TaskTypeEval {
renderStatus = taskResult.RenderStatus
}
if err != nil {
return updatedResources, renderStatus, err
}
if err := draft.UpdateResources(ctx, &api.PackageRevisionResources{
Spec: api.PackageRevisionResourcesSpec{
Resources: updatedResources.Contents,
},
}, task); err != nil {
return updatedResources, renderStatus, err
}
baseResources = updatedResources
applied = updatedResources
}
return applied, renderStatus, nil
}
func (cad *cadEngine) ListFunctions(ctx context.Context, repositoryObj *configapi.Repository) ([]*Function, error) {
ctx, span := tracer.Start(ctx, "cadEngine::ListFunctions", trace.WithAttributes())
defer span.End()
repo, err := cad.cache.OpenRepository(ctx, repositoryObj)
if err != nil {
return nil, err
}
fns, err := repo.ListFunctions(ctx)
if err != nil {
return nil, err
}
var functions []*Function
for _, f := range fns {
functions = append(functions, &Function{
RepoFunction: f,
})
}
return functions, nil
}
type updatePackageMutation struct {
cloneTask *api.Task
updateTask *api.Task
repoOpener RepositoryOpener
referenceResolver ReferenceResolver
namespace string
pkgName string
}
func (m *updatePackageMutation) Apply(ctx context.Context, resources repository.PackageResources) (repository.PackageResources, *api.TaskResult, error) {
ctx, span := tracer.Start(ctx, "updatePackageMutation::Apply", trace.WithAttributes())
defer span.End()
currUpstreamPkgRef, err := m.currUpstream()
if err != nil {
return repository.PackageResources{}, nil, err
}
targetUpstream := m.updateTask.Update.Upstream
if targetUpstream.Type == api.RepositoryTypeGit || targetUpstream.Type == api.RepositoryTypeOCI {
return repository.PackageResources{}, nil, fmt.Errorf("update is not supported for non-porch upstream packages")
}
originalResources, err := (&PackageFetcher{
repoOpener: m.repoOpener,
referenceResolver: m.referenceResolver,
}).FetchResources(ctx, currUpstreamPkgRef, m.namespace)
if err != nil {
return repository.PackageResources{}, nil, fmt.Errorf("error fetching the resources for package %s with ref %+v",
m.pkgName, *currUpstreamPkgRef)
}
upstreamRevision, err := (&PackageFetcher{
repoOpener: m.repoOpener,
referenceResolver: m.referenceResolver,
}).FetchRevision(ctx, targetUpstream.UpstreamRef, m.namespace)
if err != nil {
return repository.PackageResources{}, nil, fmt.Errorf("error fetching revision for target upstream %s", targetUpstream.UpstreamRef.Name)
}
upstreamResources, err := upstreamRevision.GetResources(ctx)
if err != nil {
return repository.PackageResources{}, nil, fmt.Errorf("error fetching resources for target upstream %s", targetUpstream.UpstreamRef.Name)
}
klog.Infof("performing pkg upgrade operation for pkg %s resource counts local[%d] original[%d] upstream[%d]",
m.pkgName, len(resources.Contents), len(originalResources.Spec.Resources), len(upstreamResources.Spec.Resources))
// May be have packageUpdater part of engine to make it easy for testing ?
updatedResources, err := (&defaultPackageUpdater{}).Update(ctx,
resources,
repository.PackageResources{
Contents: originalResources.Spec.Resources,
},
repository.PackageResources{
Contents: upstreamResources.Spec.Resources,
})
if err != nil {
return repository.PackageResources{}, nil, fmt.Errorf("error updating the package to revision %s", targetUpstream.UpstreamRef.Name)
}
newUpstream, newUpstreamLock, err := upstreamRevision.GetLock()
if err != nil {
return repository.PackageResources{}, nil, fmt.Errorf("error fetching the resources for package revisions %s", targetUpstream.UpstreamRef.Name)
}
if err := kpt.UpdateKptfileUpstream("", updatedResources.Contents, newUpstream, newUpstreamLock); err != nil {
return repository.PackageResources{}, nil, fmt.Errorf("failed to apply upstream lock to package %q: %w", m.pkgName, err)
}
// ensure merge-key comment is added to newly added resources.
result, err := ensureMergeKey(ctx, updatedResources)
if err != nil {
klog.Infof("failed to add merge key comments: %v", err)
}
return result, &api.TaskResult{Task: m.updateTask}, nil
}
// Currently assumption is that downstream packages will be forked from a porch package.
// As per current implementation, upstream package ref is stored in a new update task but this may
// change so the logic of figuring out current upstream will live in this function.
func (m *updatePackageMutation) currUpstream() (*api.PackageRevisionRef, error) {
if m.cloneTask == nil || m.cloneTask.Clone == nil {
return nil, fmt.Errorf("package %s does not have original upstream info", m.pkgName)
}
upstream := m.cloneTask.Clone.Upstream
if upstream.Type == api.RepositoryTypeGit || upstream.Type == api.RepositoryTypeOCI {
return nil, fmt.Errorf("upstream package must be porch native package. Found it to be %s", upstream.Type)
}
return upstream.UpstreamRef, nil
}
func findCloneTask(pr *api.PackageRevision) *api.Task {
if len(pr.Spec.Tasks) == 0 {
return nil
}
firstTask := pr.Spec.Tasks[0]
if firstTask.Type == api.TaskTypeClone {
return &firstTask
}
return nil
}
func writeResourcesToDirectory(dir string, resources repository.PackageResources) error {
for k, v := range resources.Contents {
p := filepath.Join(dir, k)
dir := filepath.Dir(p)
if err := os.MkdirAll(dir, 0755); err != nil {
return fmt.Errorf("failed to create directory %q: %w", dir, err)
}
if err := os.WriteFile(p, []byte(v), 0644); err != nil {
return fmt.Errorf("failed to write file %q: %w", dir, err)
}
}
return nil
}
func loadResourcesFromDirectory(dir string) (repository.PackageResources, error) {
// TODO: return abstraction instead of loading everything
result := repository.PackageResources{
Contents: map[string]string{},
}
if err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
if d.IsDir() {
return nil
}
rel, err := filepath.Rel(dir, path)
if err != nil {
return fmt.Errorf("cannot compute relative path %q, %q, %w", dir, path, err)
}
contents, err := os.ReadFile(path)
if err != nil {
return fmt.Errorf("cannot read file %q: %w", dir, err)
}
result.Contents[rel] = string(contents)
return nil
}); err != nil {
return repository.PackageResources{}, err
}
return result, nil
}
type mutationReplaceResources struct {
newResources *api.PackageRevisionResources
oldResources *api.PackageRevisionResources
}
func (m *mutationReplaceResources) Apply(ctx context.Context, resources repository.PackageResources) (repository.PackageResources, *api.TaskResult, error) {
ctx, span := tracer.Start(ctx, "mutationReplaceResources::Apply", trace.WithAttributes())
defer span.End()
patch := &api.PackagePatchTaskSpec{}
old := resources.Contents
new, err := healConfig(old, m.newResources.Spec.Resources)
if err != nil {
return repository.PackageResources{}, nil, fmt.Errorf("failed to heal resources: %w", err)
}
for k, newV := range new {
oldV, ok := old[k]
// New config or changed config
if !ok {
patchSpec := api.PatchSpec{
File: k,
PatchType: api.PatchTypeCreateFile,
Contents: newV,
}
patch.Patches = append(patch.Patches, patchSpec)
} else if newV != oldV {
patchSpec, err := GeneratePatch(k, oldV, newV)
if err != nil {
return repository.PackageResources{}, nil, fmt.Errorf("error generating patch: %w", err)
}
patch.Patches = append(patch.Patches, patchSpec)
}
}
for k := range old {
// Deleted config
if _, ok := new[k]; !ok {
patchSpec := api.PatchSpec{
File: k,
PatchType: api.PatchTypeDeleteFile,
}
patch.Patches = append(patch.Patches, patchSpec)
}
}
task := &api.Task{
Type: api.TaskTypePatch,
Patch: patch,
}
return repository.PackageResources{Contents: new}, &api.TaskResult{Task: task}, nil
}
func healConfig(old, new map[string]string) (map[string]string, error) {
// Copy comments from old config to new
oldResources, err := (&packageReader{
input: repository.PackageResources{Contents: old},
extra: map[string]string{},
}).Read()
if err != nil {
return nil, fmt.Errorf("failed to read old packge resources: %w", err)
}
var filter kio.FilterFunc = func(r []*yaml.RNode) ([]*yaml.RNode, error) {
for _, n := range r {
for _, original := range oldResources {
if n.GetNamespace() == original.GetNamespace() &&
n.GetName() == original.GetName() &&
n.GetApiVersion() == original.GetApiVersion() &&
n.GetKind() == original.GetKind() {
comments.CopyComments(original, n)
}
}
}
return r, nil
}
out := &packageWriter{
output: repository.PackageResources{
Contents: map[string]string{},
},
}
extra := map[string]string{}
if err := (kio.Pipeline{
Inputs: []kio.Reader{&packageReader{
input: repository.PackageResources{Contents: new},
extra: extra,
}},
Filters: []kio.Filter{filter},
Outputs: []kio.Writer{out},
ContinueOnEmptyResult: true,
}).Execute(); err != nil {
return nil, err
}
healed := out.output.Contents
for k, v := range extra {
healed[k] = v
}
return healed, nil
}
// isRecloneAndReplay determines if an update should be handled using reclone-and-replay semantics.
// We detect this by checking if both old and new versions start by cloning a package, but the version has changed.
// We may expand this scope in future.
func isRecloneAndReplay(oldObj, newObj *api.PackageRevision) bool {
oldTasks := oldObj.Spec.Tasks
newTasks := newObj.Spec.Tasks
if len(oldTasks) == 0 || len(newTasks) == 0 {
return false
}
if oldTasks[0].Type != api.TaskTypeClone || newTasks[0].Type != api.TaskTypeClone {
return false
}
if reflect.DeepEqual(oldTasks[0], newTasks[0]) {
return false
}
return true
}
// recloneAndReplay performs an update by recloning the upstream package and replaying all tasks.
// This is more like a git rebase operation than the "classic" kpt update algorithm, which is more like a git merge.
func (cad *cadEngine) recloneAndReplay(ctx context.Context, repo repository.Repository, repositoryObj *configapi.Repository, newObj *api.PackageRevision, packageConfig *builtins.PackageConfig) (repository.PackageRevision, error) {
ctx, span := tracer.Start(ctx, "cadEngine::recloneAndReplay", trace.WithAttributes())
defer span.End()
// For reclone and replay, we create a new package every time
// the version should be in newObj so we will overwrite.
draft, err := repo.CreatePackageRevision(ctx, newObj)
if err != nil {
return nil, err
}
if err := cad.applyTasks(ctx, draft, repositoryObj, newObj, packageConfig); err != nil {
return nil, err
}
if err := draft.UpdateLifecycle(ctx, newObj.Spec.Lifecycle); err != nil {
return nil, err
}
return draft.Close(ctx)
}
// ExtractContextConfigMap returns the package-context configmap, if found
func ExtractContextConfigMap(resources map[string]string) (*unstructured.Unstructured, error) {
var matches []*unstructured.Unstructured
for itemPath, itemContents := range resources {
ext := path.Ext(itemPath)
ext = strings.ToLower(ext)
parse := false
switch ext {
case ".yaml", ".yml":
parse = true
default:
klog.Warningf("ignoring non-yaml file %s", itemPath)
}
if !parse {
continue
}
// TODO: Use https://github.com/kubernetes-sigs/kustomize/blob/a5b61016bb40c30dd1b0a78290b28b2330a0383e/kyaml/kio/byteio_reader.go#L170 or similar?
for _, s := range strings.Split(itemContents, "\n---\n") {
if isWhitespace(s) {
continue
}
o := &unstructured.Unstructured{}
if err := yaml.Unmarshal([]byte(s), &o); err != nil {
return nil, fmt.Errorf("error parsing yaml from %s: %w", itemPath, err)
}
// TODO: sync with kpt logic; skip objects marked with the local-only annotation
configMapGK := schema.GroupKind{Kind: "ConfigMap"}
if o.GroupVersionKind().GroupKind() == configMapGK {
if o.GetName() == builtins.PkgContextName {
matches = append(matches, o)
}
}
}
}
if len(matches) == 0 {
return nil, nil
}
if len(matches) > 1 {
return nil, fmt.Errorf("found multiple configmaps matching name %q", builtins.PkgContextFile)
}
return matches[0], nil
}
func isWhitespace(s string) bool {
for _, r := range s {
if !unicode.IsSpace(r) {
return false
}
}
return true
}
| {
"content_hash": "585200a8c9b39e5e3f41a89c1bf1454d",
"timestamp": "",
"source": "github",
"line_count": 1413,
"max_line_length": 230,
"avg_line_length": 32.88747346072187,
"alnum_prop": 0.7266408435549817,
"repo_name": "GoogleContainerTools/kpt",
"id": "51b5a8aaa54f8bc3099371fbf6f81b59b3807e6b",
"size": "47059",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "porch/pkg/engine/engine.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2879"
},
{
"name": "Dockerfile",
"bytes": "8582"
},
{
"name": "Go",
"bytes": "2388058"
},
{
"name": "HTML",
"bytes": "2763"
},
{
"name": "JavaScript",
"bytes": "17968"
},
{
"name": "Makefile",
"bytes": "21245"
},
{
"name": "Ruby",
"bytes": "1168"
},
{
"name": "Shell",
"bytes": "176644"
}
],
"symlink_target": ""
} |
package alien4cloud.plugin.marathon.artifacts;
import alien4cloud.component.repository.IConfigurableArtifactResolver;
import alien4cloud.component.repository.IConfigurableArtifactResolverFactory;
/**
* When having a DockerImageResolver it is also required to have such bean.
*/
public class DockerArtifactResolverFactory implements IConfigurableArtifactResolverFactory {
@Override
public IConfigurableArtifactResolver newInstance() {
return null;
}
@Override
public Class getResolverConfigurationType() {
return null;
}
@Override
public String getResolverType() {
return null;
}
}
| {
"content_hash": "ba14d467187b4f468940c267d5f572e8",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 92,
"avg_line_length": 26.958333333333332,
"alnum_prop": 0.7573415765069552,
"repo_name": "alien4cloud/alien4cloud-marathon-plugin",
"id": "db8e2e5560b71876b57367129f01183a105fceee",
"size": "647",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/main/java/alien4cloud/plugin/marathon/artifacts/DockerArtifactResolverFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "115240"
}
],
"symlink_target": ""
} |
<div class="col-lg-8 col-lg-offset-1">
<h1>EDIT</h1>
<form method="POST" role="form" >
<div class="help-block"><?= form_error('name_camp[]'); ?></div>
<input class="form-control" type="text" name="name_camp[]" value="<?= set_value('name_camp[]', $name[0]['name']);?>">
<input type="text" hidden name="table" value="<?= $table ?>">
<br>
<button class="btn btn-default pull-right" type="submit">Edit</button>
</form>
</div> | {
"content_hash": "16efbf959130c8b4526f83e20e31b099",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 125,
"avg_line_length": 44.54545454545455,
"alnum_prop": 0.5387755102040817,
"repo_name": "alexsanro/Mygamelist",
"id": "8c7da3880e8aa5b7517b1298ea6df1a173772ad1",
"size": "490",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/administracion/editNames.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "240"
},
{
"name": "CSS",
"bytes": "237656"
},
{
"name": "HTML",
"bytes": "5633"
},
{
"name": "JavaScript",
"bytes": "291538"
},
{
"name": "PHP",
"bytes": "2027887"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
null
#### Original name
Leptospora sparsa Sacc. & Fairm.
### Remarks
null | {
"content_hash": "5a626fb62281a1ff458eb260c1e4e7a5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 32,
"avg_line_length": 10.538461538461538,
"alnum_prop": 0.6934306569343066,
"repo_name": "mdoering/backbone",
"id": "153ff2a868773c135b3ac5bb7b2cdb3a3fe7a8e9",
"size": "193",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Dothideomycetes/Dothideales/Leptospora/Leptospora sparsa/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Xemio.GameLibrary.Common.Randomization
{
public class SimpleRandom : IRandom
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="SimpleRandom"/> class.
/// </summary>
public SimpleRandom() : this((int)DateTime.Now.Ticks)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SimpleRandom"/> class.
/// </summary>
/// <param name="seed">The seed.</param>
public SimpleRandom(string seed) : this(seed.GetHashCode())
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SimpleRandom"/> class.
/// </summary>
/// <param name="seed">The seed.</param>
public SimpleRandom(int seed)
{
this._random = new System.Random(seed);
}
#endregion
#region Fields
protected System.Random _random;
#endregion
#region IRandom Member
/// <summary>
/// Returns a random integer value.
/// </summary>
/// <returns></returns>
public int Next()
{
return this.Next(int.MinValue, int.MaxValue);
}
/// <summary>
/// Returns a random integer value, that is smaller than the specified maximum.
/// </summary>
/// <param name="max">The max.</param>
/// <returns></returns>
public int Next(int max)
{
return this.Next(0, max);
}
/// <summary>
/// Returns a random integer value, that is within the defined range.
/// </summary>
/// <param name="min">The min.</param>
/// <param name="max">The max.</param>
/// <returns></returns>
public int Next(int min, int max)
{
return this._random.Next(min, max);
}
/// <summary>
/// Returns a random double value between 0.0 and 1.0.
/// </summary>
/// <returns></returns>
public double NextDouble()
{
return this._random.NextDouble();
}
/// <summary>
/// Returns a random float value between 0.0f and 1.0f.
/// </summary>
/// <returns></returns>
public float NextFloat()
{
return (float)this.NextDouble();
}
/// <summary>
/// Returns a random boolean value.
/// </summary>
/// <returns></returns>
public bool NextBoolean()
{
return this.NextBoolean(0.5);
}
/// <summary>
/// Returns a random boolean value that has a chance of the specified probability to be true.
/// </summary>
/// <param name="probability">The probability between 0.0 and 1.0.</param>
/// <returns></returns>
public bool NextBoolean(double probability)
{
return this.NextDouble() <= probability;
}
/// <summary>
/// Returns a random byte array.
/// </summary>
/// <param name="count">The count.</param>
/// <returns></returns>
public byte[] NextBytes(int count)
{
var buffer = new byte[count];
this._random.NextBytes(buffer);
return buffer;
}
#endregion
}
}
| {
"content_hash": "4929c8578e836db8fd210ff0d912606f",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 101,
"avg_line_length": 30.37719298245614,
"alnum_prop": 0.5177591683511407,
"repo_name": "XemioNetwork/GameLibrary",
"id": "2d3952f61b8b570e72ba26960ec1ea134b2a39d0",
"size": "3465",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "GameLibrary/Common/Randomization/SimpleRandom.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1238521"
}
],
"symlink_target": ""
} |
package org.apache.isis.viewer.dnd.view.content;
import java.util.Arrays;
import java.util.List;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.applib.query.QueryFindAllInstances;
import org.apache.isis.core.commons.ensure.Assert;
import org.apache.isis.core.commons.exceptions.UnexpectedCallException;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.ResolveState;
import org.apache.isis.core.metamodel.consent.Consent;
import org.apache.isis.core.metamodel.consent.ConsentAbstract;
import org.apache.isis.core.metamodel.consent.Veto;
import org.apache.isis.core.metamodel.services.container.query.QueryCardinality;
import org.apache.isis.core.metamodel.spec.ActionType;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.Persistability;
import org.apache.isis.core.metamodel.spec.feature.Contributed;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.core.runtime.system.persistence.Persistor;
import org.apache.isis.viewer.dnd.drawing.Image;
import org.apache.isis.viewer.dnd.drawing.ImageFactory;
import org.apache.isis.viewer.dnd.drawing.Location;
import org.apache.isis.viewer.dnd.view.Content;
import org.apache.isis.viewer.dnd.view.ObjectContent;
import org.apache.isis.viewer.dnd.view.Placement;
import org.apache.isis.viewer.dnd.view.UserActionSet;
import org.apache.isis.viewer.dnd.view.View;
import org.apache.isis.viewer.dnd.view.Workspace;
import org.apache.isis.viewer.dnd.view.option.UserActionAbstract;
public abstract class AbstractObjectContent extends AbstractContent implements ObjectContent {
public static final class ExplorationInstances extends UserActionAbstract {
public ExplorationInstances() {
super("Instances", ActionType.EXPLORATION);
}
@Override
public Consent disabled(final View view) {
final ObjectAdapter object = view.getContent().getAdapter();
return ConsentAbstract.allowIf(object != null);
}
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
final ObjectAdapter object = view.getContent().getAdapter();
final ObjectSpecification spec = object.getSpecification();
final ObjectAdapter instances = IsisContext.getPersistenceSession().findInstances(new QueryFindAllInstances(spec.getFullIdentifier()), QueryCardinality.MULTIPLE);
workspace.objectActionResult(instances, new Placement(view));
}
}
public static final class ExplorationClone extends UserActionAbstract {
public ExplorationClone() {
super("Clone", ActionType.EXPLORATION);
}
@Override
public Consent disabled(final View view) {
final ObjectAdapter object = view.getContent().getAdapter();
return ConsentAbstract.allowIf(object != null);
}
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
final ObjectAdapter original = view.getContent().getAdapter();
// ObjectAdapter original = getObject();
final ObjectSpecification spec = original.getSpecification();
final ObjectAdapter clone = getPersistenceSession().createTransientInstance(spec);
final List<ObjectAssociation> fields = spec.getAssociations(Contributed.EXCLUDED);
for (int i = 0; i < fields.size(); i++) {
final ObjectAdapter fld = fields.get(i).get(original);
if (fields.get(i).isOneToOneAssociation()) {
((OneToOneAssociation) fields.get(i)).setAssociation(clone, fld);
} else if (fields.get(i).isOneToManyAssociation()) {
// clone.setValue((OneToOneAssociation) fields[i],
// fld.getObject());
}
}
workspace.objectActionResult(clone, new Placement(view));
}
}
public static final class DebugClearResolvedOption extends UserActionAbstract {
private DebugClearResolvedOption() {
super("Clear resolved", ActionType.DEBUG);
}
@Override
public Consent disabled(final View view) {
final ObjectAdapter object = view.getContent().getAdapter();
return ConsentAbstract.allowIf(object == null || !object.isTransient() || object.isGhost());
}
@Override
public void execute(final Workspace workspace, final View view, final Location at) {
final ObjectAdapter object = view.getContent().getAdapter();
object.changeState(ResolveState.GHOST);
}
}
// REVIEW: should provide this rendering context, rather than hardcoding.
// the net effect currently is that class members annotated with
// @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
// be hidden/disabled, but will be visible/enabled (perhaps incorrectly)
// for any other value for Where
protected final Where where = Where.ANYWHERE;
@Override
public abstract Consent canClear();
@Override
public Consent canDrop(final Content sourceContent) {
final ObjectAdapter target = getObject();
if (!(sourceContent instanceof ObjectContent) || target == null) {
// TODO: move logic into Facet
return new Veto(String.format("Can't drop %s onto empty target", sourceContent.getAdapter().titleString()));
} else {
final ObjectAdapter source = ((ObjectContent) sourceContent).getObject();
return canDropOntoObject(target, source);
}
}
private Consent canDropOntoObject(final ObjectAdapter target, final ObjectAdapter source) {
final ObjectAction action = dropAction(source, target);
if (action != null) {
final Consent parameterSetValid = action.isProposedArgumentSetValid(target, new ObjectAdapter[] { source });
parameterSetValid.setDescription("Execute '" + action.getName() + "' with " + source.titleString());
return parameterSetValid;
} else {
return setFieldOfMatchingType(target, source);
}
}
private Consent setFieldOfMatchingType(final ObjectAdapter targetAdapter, final ObjectAdapter sourceAdapter) {
if (targetAdapter.isTransient() && sourceAdapter.representsPersistent()) {
// TODO: use Facet for this test instead.
return new Veto("Can't set field in persistent object with reference to non-persistent object");
}
final List<ObjectAssociation> fields = targetAdapter.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(IsisContext.getAuthenticationSession(), targetAdapter, where));
for (final ObjectAssociation fld : fields) {
if (!fld.isOneToOneAssociation()) {
continue;
}
if (!sourceAdapter.getSpecification().isOfType(fld.getSpecification())) {
continue;
}
if (fld.get(targetAdapter) != null) {
continue;
}
final Consent associationValid = ((OneToOneAssociation) fld).isAssociationValid(targetAdapter, sourceAdapter);
if (associationValid.isAllowed()) {
return associationValid.setDescription("Set field " + fld.getName());
}
}
// TODO: use Facet for this test instead
return new Veto(String.format("No empty field accepting object of type %s in %s", sourceAdapter.getSpecification().getSingularName(), title()));
}
@Override
public abstract Consent canSet(final ObjectAdapter dragSource);
@Override
public abstract void clear();
@Override
public ObjectAdapter drop(final Content sourceContent) {
if (!(sourceContent instanceof ObjectContent)) {
return null;
}
final ObjectAdapter source = sourceContent.getAdapter();
Assert.assertNotNull(source);
final ObjectAdapter target = getObject();
Assert.assertNotNull(target);
if (!canDrop(sourceContent).isAllowed()) {
return null;
}
final ObjectAction action = dropAction(source, target);
if ((action != null) && action.isProposedArgumentSetValid(target, new ObjectAdapter[] { source }).isAllowed()) {
return action.execute(target, new ObjectAdapter[] { source });
}
final List<ObjectAssociation> associations = target.getSpecification().getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.dynamicallyVisible(IsisContext.getAuthenticationSession(), target, where));
for (int i = 0; i < associations.size(); i++) {
final ObjectAssociation association = associations.get(i);
if (association.isOneToOneAssociation() && source.getSpecification().isOfType(association.getSpecification())) {
final OneToOneAssociation otoa = (OneToOneAssociation) association;
if (association.get(target) == null && otoa.isAssociationValid(target, source).isAllowed()) {
otoa.setAssociation(target, source);
break;
}
}
}
return null;
}
private ObjectAction dropAction(final ObjectAdapter source, final ObjectAdapter target) {
final ObjectAction action = target.getSpecification().getObjectAction(ActionType.USER, null, Arrays.asList(source.getSpecification()));
return action;
}
@Override
public abstract ObjectAdapter getObject();
@Override
public boolean isPersistable() {
return getObject().getSpecification().persistability() == Persistability.USER_PERSISTABLE;
}
@Override
public void contentMenuOptions(final UserActionSet options) {
final ObjectAdapter object = getObject();
options.addObjectMenuOptions(object);
if (getObject() == null) {
options.addCreateOptions(getSpecification());
} else {
options.add(new ExplorationInstances());
}
options.add(new ExplorationClone());
options.add(new DebugClearResolvedOption());
}
public void parseTextEntry(final String entryText) {
throw new UnexpectedCallException();
}
@Override
public abstract void setObject(final ObjectAdapter object);
@Override
public String getIconName() {
final ObjectAdapter object = getObject();
return object == null ? null : object.getIconName();
}
@Override
public Image getIconPicture(final int iconHeight) {
final ObjectAdapter adapter = getObject();
if (adapter == null) {
return ImageFactory.getInstance().loadIcon("empty-field", iconHeight, null);
}
final ObjectSpecification specification = adapter.getSpecification();
final Image icon = ImageFactory.getInstance().loadIcon(specification, iconHeight, null);
return icon;
}
// ////////////////////////////////////////////////////////////
// Dependencies (from context)
// ////////////////////////////////////////////////////////////
private static Persistor getPersistenceSession() {
return IsisContext.getPersistenceSession();
}
}
| {
"content_hash": "a10684dd276d2a132c4aca70a5e720b5",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 226,
"avg_line_length": 42.238267148014444,
"alnum_prop": 0.6713675213675213,
"repo_name": "peridotperiod/isis",
"id": "6586e08cae647287c56758c938bec30cb80af4b9",
"size": "12525",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "mothballed/component/viewer/dnd/impl/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractObjectContent.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "169398"
},
{
"name": "Cucumber",
"bytes": "8162"
},
{
"name": "Groovy",
"bytes": "28126"
},
{
"name": "HTML",
"bytes": "601123"
},
{
"name": "Java",
"bytes": "18098201"
},
{
"name": "JavaScript",
"bytes": "118425"
},
{
"name": "Shell",
"bytes": "12793"
},
{
"name": "XSLT",
"bytes": "72290"
}
],
"symlink_target": ""
} |
<?php
namespace DeliciousBrains\WPMDB\Free;
use DeliciousBrains\WPMDB\Common\Plugin\Menu;
use DeliciousBrains\WPMDB\Container;
use DeliciousBrains\WPMDB\WPMigrateDB;
class WPMigrateDBFree extends WPMigrateDB {
public function __construct( $pro = false ) {
parent::__construct( false );
}
public function register() {
parent::register();
$container = Container::getInstance();
//Menu
$this->menu = $container->addClass( 'menu', new Menu(
$container->get( 'properties' ),
$container->get( 'plugin_manager_base' ),
$container->get( 'assets' )
)
);
$container->get( 'migration_manager' )->register();
$container->get( 'plugin_manager' )->register();
$container->get( 'menu' )->register();
$container->get( 'free_template' )->register();
$filesystem = $container->get( 'filesystem' );
$filesystem->register();
}
}
| {
"content_hash": "26f4684cb6a312efe03bf104137fee72",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 55,
"avg_line_length": 24.571428571428573,
"alnum_prop": 0.6732558139534883,
"repo_name": "mandino/www.bloggingshakespeare.com",
"id": "15e28533ab3908b12bb9aadc00934f7923698c20",
"size": "860",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "reviewing-shakespeare/wp-content/plugins/wp-migrate-db/class/Free/WPMigrateDBFree.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5211957"
},
{
"name": "CoffeeScript",
"bytes": "552"
},
{
"name": "HTML",
"bytes": "525757"
},
{
"name": "JavaScript",
"bytes": "6055696"
},
{
"name": "Modelica",
"bytes": "10338"
},
{
"name": "PHP",
"bytes": "44197755"
},
{
"name": "Perl",
"bytes": "2554"
},
{
"name": "Ruby",
"bytes": "3917"
},
{
"name": "Smarty",
"bytes": "27821"
},
{
"name": "XSLT",
"bytes": "34552"
}
],
"symlink_target": ""
} |
// -*- tab-width: 4 -*-
package Jet.Time;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.ho.yaml.Yaml;
import org.joda.time.DateTime;
import org.joda.time.DateTimeFieldType;
import org.joda.time.IllegalFieldValueException;
import Jet.Tipster.Annotation;
import Jet.Tipster.Document;
import Jet.Tipster.Span;
import Jet.Util.IOUtils;
/**
* Rule-driven time expression annotator. The rules are encoded in YAML format
* and consist of the main rules (marked "mainRules") and the transform rules
* (marked "transformRules").
*
* @author Akira Oda
*/
public class TimeAnnotator {
private List<TimeRule> mainRules;
private List<TimeRule> transformRules;
private Map config;
private int early_month = 4;
private int late_month = 9;
private int min_year = 1000;
private int max_year = 9999;
public TimeAnnotator() {
}
public TimeAnnotator(String ruleFilename) throws IOException {
this(new File(ruleFilename));
}
public TimeAnnotator(File ruleFile) throws IOException {
FileInputStream in = null;
try {
in = new FileInputStream(ruleFile);
load(in);
} finally {
if (in != null) {
in.close();
}
}
}
/**
* annotate the time expressions in 'span' with TIMEX2 annotations.
*
* @param doc
* the document to be annotated
* @param span
* the span of doc to be annotated
* @param ref
* the reference time -- the time the text was written
*/
public void annotate(Document doc, Span span, DateTime ref) {
applyRules(doc, span, ref, mainRules);
if (transformRules != null) {
applyRules(doc, span, ref, transformRules);
}
}
private void applyRules(Document doc, Span span, DateTime ref, List<TimeRule> rules) {
List<Annotation> tokens = doc.annotationsOfType("token", span);
if (tokens == null)
return;
int offset = 0;
while (offset < tokens.size()) {
Span resultSpan = null;
for (TimeRule rule : rules) {
List<Object> values = new ArrayList<Object>();
resultSpan = rule.matches(doc, tokens, offset, ref, values);
if (resultSpan != null) {
try {
rule.apply(doc, values, resultSpan, ref);
break;
} catch (IllegalFieldValueException e) {
// skip when IllegalFIeldValueException is thrown
} catch (IllegalArgumentException e) {
System.err.println ("TimeAnnotator.applyRules: " + e);
}
}
}
if (resultSpan != null) {
offset = nextOffset(tokens, offset, resultSpan);
} else {
offset++;
}
}
}
/**
* load the time expression rules from 'in'. These rules should be in YAML
* format.
*/
public void load(InputStream in) throws IOException {
mainRules = null;
Map root = (Map) Yaml.load(in);
List rules = (List) root.get("rules");
config = (Map) root.get("config");
if (config == null) {
config = new HashMap();
}
this.mainRules = new ArrayList<TimeRule>(rules.size());
boolean sortByPatternLength = true;
if (config.containsKey("sortByPatternLength")) {
sortByPatternLength = ((Boolean) config.get("sortByPatternLength")).booleanValue();
}
if (config.containsKey("min_year")) {
min_year = (Integer) config.get("min_year");
}
if (config.containsKey("max_year")) {
max_year = (Integer) config.get("max_year");
}
if (config.containsKey("early_month")) {
early_month = (Integer) config.get("early_month");
}
if (config.containsKey("late_month")) {
late_month = (Integer) config.get("late_month");
}
mainRules = loadRules(rules, sortByPatternLength);
if (root.containsKey("transformRules")) {
transformRules = loadRules((List) root.get("transformRules"), sortByPatternLength);
}
}
/**
* load the time expression rules from 'in'. These rules should be in YAML
* format.
*
* @param file
* the file object
* @throws IOException
* if an I/O error occurs
*/
public void load(File file) throws IOException {
InputStream in = null;
try {
in = new FileInputStream(file);
load(in);
} finally {
IOUtils.closeQuietly(in);
}
}
public Map getConfig() {
return config;
}
private List<TimeRule> loadRules(List rules, boolean sortByPatternLength) {
List<TimeRule> result = new ArrayList<TimeRule>();
for (Object obj : rules) {
result.addAll(loadRule((Map) obj));
}
if (sortByPatternLength) {
Comparator<TimeRule> cmp = new Comparator<TimeRule>() {
public int compare(TimeRule o1, TimeRule o2) {
return o2.getPatternItems().length - o1.getPatternItems().length;
}
};
Collections.sort(result, cmp);
}
return result;
}
public List<TimeRule> loadRule(Map params) {
List<TimeRule> rules = new ArrayList<TimeRule>();
String type = (String) params.get("type");
Map ruleParams = (Map) params.get("params");
if (type.equals("simple")) {
for (PatternItem[] patterns : getPatterns(getPatternStrings(params))) {
SimpleTimeRule timeRule = new SimpleTimeRule();
timeRule.setTimeAnnotator(this);
timeRule.setPatternItems(patterns);
timeRule.setParameters(ruleParams);
rules.add(timeRule);
}
} else if (type.equals("script")) {
for (PatternItem[] patterns : getPatterns(getPatternStrings(params))) {
TimeRule timeRule = new ScriptRule();
timeRule.setTimeAnnotator(this);
timeRule.setParameters(ruleParams);
timeRule.setPatternItems(patterns);
rules.add(timeRule);
}
} else {
new RuntimeException(type + " is not supported.");
}
return rules;
}
public List<PatternItem[]> getPatterns(List<String[]> patternStrings) {
List<PatternItem[]> result = new ArrayList<PatternItem[]>();
Pattern regexp = Pattern.compile("\\(regex:(.*)\\)");
Matcher m;
for (String[] patternString : patternStrings) {
PatternItem[] patternItem = new PatternItem[patternString.length];
for (int i = 0; i < patternString.length; i++) {
if (patternString[i].equals("(number)")) {
patternItem[i] = new NumberPattern();
} else if (patternString[i].equals("(ordinal)")) {
patternItem[i] = new NumberPattern(NumberPattern.Ordinal.MUST);
} else if (patternString[i].equals("(year)")) {
patternItem[i] = new NumberPattern(min_year, max_year);
} else if (patternString[i].equals("(month)")) {
patternItem[i] = new MonthPattern();
} else if (patternString[i].equals("(day)")) {
patternItem[i] = new NumberPattern(1, 31);
} else if (patternString[i].equals("(dow)")) {
patternItem[i] = new DayOfWeekPattern();
} else if (patternString[i].equals("(time)")) {
patternItem[i] = new TimePattern(false);
} else if (patternString[i].equals("(duration)")) {
patternItem[i] = new TimePattern(true);
} else if ((m = regexp.matcher(patternString[i])).matches()) {
Pattern p = Pattern.compile(m.group(1));
patternItem[i] = new RegexPattern(p);
} else {
patternItem[i] = new StringPattern(patternString[i]);
}
}
result.add(patternItem);
}
return result;
}
public List<String[]> getPatternStrings(Map params) {
List<String> patterns;
if (params.containsKey("patterns")) {
patterns = (List<String>) params.get("patterns");
} else if (params.containsKey("pattern")) {
patterns = new ArrayList<String>(1);
patterns.add((String) params.get("pattern"));
} else {
throw new RuntimeException();
}
List<String[]> result = new ArrayList<String[]>(patterns.size());
for (String pattern : patterns) {
result.add(pattern.split("\\s+"));
}
return result;
}
private int nextOffset(List<Annotation> tokens, int offset, Span span) {
int i = offset;
while (i < tokens.size()) {
if (tokens.get(i).start() >= span.end()) {
break;
}
i++;
}
return i;
}
public DateTime normalizeMonth(DateTime ref, int month) {
int refMonth = ref.getMonthOfYear();
int refYear = ref.getYear();
DateTime result = ref.withField(DateTimeFieldType.monthOfYear(), month);
if (refMonth < early_month && month > late_month) {
result = result.withField(DateTimeFieldType.year(), refYear - 1);
} else if (refMonth > late_month && month < early_month) {
result = result.withField(DateTimeFieldType.year(), refYear + 1);
}
return result;
}
}
| {
"content_hash": "74c5daa83050894934b0d72af1545a7d",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 87,
"avg_line_length": 27.12779552715655,
"alnum_prop": 0.6649393475444588,
"repo_name": "Aureliu/NYT_tools",
"id": "7099930a7f566d919df07c99075273bcf11b4c97",
"size": "8491",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Jet/Time/TimeAnnotator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "48693"
},
{
"name": "Java",
"bytes": "1785291"
}
],
"symlink_target": ""
} |
FROM balenalib/zc702-zynq7-debian:sid-build
# remove several traces of debian python
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# key 63C7CC90: public key "Simon McVittie <[email protected]>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <[email protected]>" imported
RUN gpg --batch --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
ENV PYTHON_VERSION 3.10.2
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.3.1
ENV SETUPTOOLS_VERSION 60.5.4
RUN set -x \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-armv7hf-libffi3.3.tar.gz" \
&& echo "c868e526f94e90d355a9b632388a0ddb56d7f3502cd3cb1a885d5945df23acd8 Python-$PYTHON_VERSION.linux-armv7hf-libffi3.3.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-armv7hf-libffi3.3.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-armv7hf-libffi3.3.tar.gz" \
&& ldconfig \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip3 install --no-cache-dir virtualenv
ENV PYTHON_DBUS_VERSION 1.2.18
# install dbus-python dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libdbus-1-dev \
libdbus-glib-1-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -y autoremove
# install dbus-python
RUN set -x \
&& mkdir -p /usr/src/dbus-python \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz" -o dbus-python.tar.gz \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz.asc" -o dbus-python.tar.gz.asc \
&& gpg --verify dbus-python.tar.gz.asc \
&& tar -xzC /usr/src/dbus-python --strip-components=1 -f dbus-python.tar.gz \
&& rm dbus-python.tar.gz* \
&& cd /usr/src/dbus-python \
&& PYTHON_VERSION=$(expr match "$PYTHON_VERSION" '\([0-9]*\.[0-9]*\)') ./configure \
&& make -j$(nproc) \
&& make install -j$(nproc) \
&& cd / \
&& rm -rf /usr/src/dbus-python
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
# set PYTHONPATH to point to dist-packages
ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/[email protected]" \
&& echo "Running test-stack@python" \
&& chmod +x [email protected] \
&& bash [email protected] \
&& rm -rf [email protected]
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Sid \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.10.2, Pip v21.3.1, Setuptools v60.5.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | {
"content_hash": "ee0105241b580300f8da5b4dccbcbba7",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 708,
"avg_line_length": 50.82105263157895,
"alnum_prop": 0.7031897265948633,
"repo_name": "resin-io-library/base-images",
"id": "f43c40dfe7f6b789370fa3554739bb31a74d1fa0",
"size": "4849",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/python/zc702-zynq7/debian/sid/3.10.2/build/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "71234697"
},
{
"name": "JavaScript",
"bytes": "13096"
},
{
"name": "Shell",
"bytes": "12051936"
},
{
"name": "Smarty",
"bytes": "59789"
}
],
"symlink_target": ""
} |
// eslint-disable-next-line import/no-extraneous-dependencies
const webpack = require('webpack');
/* const sourceMap = process.env.TEST || process.env.NODE_ENV !== 'production'
? [new webpack.SourceMapDevToolPlugin({
exclude: [/luxon/],
filename: '[name].js.map',
})]
: [new webpack.SourceMapDevToolPlugin({
exclude: ['luxon', '@types/luxon'],
filename: '[name].js.map',
})]; */
const basePlugins = [
new webpack.DefinePlugin({
'process.env.VERSION': JSON.stringify(require('../package.json').version),
'process.env.BUILD_TIME': JSON.stringify((new Date()).toString()),
__DEV__: process.env.NODE_ENV !== 'production',
__TEST__: JSON.stringify(process.env.TEST || false),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
new webpack.LoaderOptionsPlugin({
debug: true,
}),
// eslint-disable-next-line no-useless-escape
new webpack.ContextReplacementPlugin(/moment[\/\\]locale/, /en/),
];// .concat(sourceMap);
const devPlugins = [];
const prodPlugins = [];
module.exports = basePlugins
.concat(process.env.NODE_ENV === 'production' ? prodPlugins : [])
.concat(process.env.NODE_ENV === 'development' ? devPlugins : []);
| {
"content_hash": "c7aece1431c51adabed2e6bc8edcf100",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 33.44444444444444,
"alnum_prop": 0.6619601328903655,
"repo_name": "spiral/toolkit",
"id": "d0cbb8dd33f2bec28c8f426d87858d56cbcfa0f2",
"size": "1204",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "webpack/plugins.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "400"
},
{
"name": "Hack",
"bytes": "21252"
},
{
"name": "JavaScript",
"bytes": "73222"
},
{
"name": "PHP",
"bytes": "9011"
},
{
"name": "SCSS",
"bytes": "22888"
},
{
"name": "TypeScript",
"bytes": "299930"
}
],
"symlink_target": ""
} |
import {
DirectiveNode,
getNamedType,
GraphQLInterfaceType,
GraphQLObjectType,
GraphQLResolveInfo,
ResponsePath,
responsePathAsArray
} from 'graphql';
import { GraphQLExtension } from 'graphql-extensions';
export interface CacheControlFormat {
version: 1;
hints: ({ path: (string | number)[] } & CacheHint)[];
}
export interface CacheHint {
maxAge?: number;
scope?: CacheScope;
}
export enum CacheScope {
Public = 'PUBLIC',
Private = 'PRIVATE'
}
export interface CacheControlExtensionOptions {
defaultMaxAge?: number;
}
declare module 'graphql/type/definition' {
interface GraphQLResolveInfo {
cacheControl: {
setCacheHint: (hint: CacheHint) => void
cacheHint: CacheHint;
};
}
}
export class CacheControlExtension<TContext = any> implements GraphQLExtension<TContext> {
private defaultMaxAge: number;
constructor(options: CacheControlExtensionOptions = {}) {
this.defaultMaxAge = options.defaultMaxAge || 0;
}
private hints: Map<ResponsePath, CacheHint> = new Map();
willResolveField(
_source: any,
_args: { [argName: string]: any },
_context: TContext,
info: GraphQLResolveInfo
) {
let hint: CacheHint = {};
// If this field's resolver returns an object or interface, look for hints
// on that return type.
const targetType = getNamedType(info.returnType);
if (targetType instanceof GraphQLObjectType
|| targetType instanceof GraphQLInterfaceType) {
if (targetType.astNode) {
hint = mergeHints(hint, cacheHintFromDirectives(targetType.astNode.directives));
}
}
// If this field is a field on an object, look for hints on the field
// itself, taking precedence over previously calculated hints.
const parentType = info.parentType;
if (parentType instanceof GraphQLObjectType) {
const fieldDef = parentType.getFields()[info.fieldName];
if (fieldDef.astNode) {
hint = mergeHints(hint, cacheHintFromDirectives(fieldDef.astNode.directives));
}
}
// If this resolver returns an object and we haven't seen an explicit maxAge
// hint, set the maxAge to 0 (uncached) or the default if specified in the
// constructor. (Non-object fields by default are assumed to inherit their
// cacheability from their parents.)
if (targetType instanceof GraphQLObjectType && hint.maxAge === undefined) {
hint.maxAge = this.defaultMaxAge;
}
if (hint.maxAge !== undefined || hint.scope !== undefined) {
this.addHint(info.path, hint);
}
info.cacheControl = {
setCacheHint: (hint: CacheHint) => {
this.addHint(info.path, hint);
},
cacheHint: hint
}
}
addHint(path: ResponsePath, hint: CacheHint) {
const existingCacheHint = this.hints.get(path);
if (existingCacheHint) {
this.hints.set(path, mergeHints(existingCacheHint, hint));
} else {
this.hints.set(path, hint);
}
}
format(): [string, CacheControlFormat] {
return [
'cacheControl',
{
version: 1,
hints: Array.from(this.hints).map(([path, hint]) => ({
path: responsePathAsArray(path),
...hint
}))
}
];
}
}
function cacheHintFromDirectives(directives: DirectiveNode[] | undefined): CacheHint | undefined {
if (!directives) return undefined;
const cacheControlDirective = directives.find(directive => directive.name.value === 'cacheControl');
if (!cacheControlDirective) return undefined;
if (!cacheControlDirective.arguments) return undefined;
const maxAgeArgument = cacheControlDirective.arguments.find(argument => argument.name.value === 'maxAge');
const scopeArgument = cacheControlDirective.arguments.find(argument => argument.name.value === 'scope');
// TODO: Add proper typechecking of arguments
return {
maxAge:
maxAgeArgument && maxAgeArgument.value && maxAgeArgument.value.kind === 'IntValue'
? parseInt(maxAgeArgument.value.value)
: undefined,
scope:
scopeArgument && scopeArgument.value && scopeArgument.value.kind === 'EnumValue'
? scopeArgument.value.value as CacheScope
: undefined
};
}
function mergeHints(hint: CacheHint, otherHint: CacheHint | undefined): CacheHint {
if (!otherHint) return hint;
return {
maxAge: otherHint.maxAge !== undefined ? otherHint.maxAge : hint.maxAge,
scope: otherHint.scope || hint.scope
};
}
| {
"content_hash": "3fa689b26504ec8baeb684f0f3313706",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 108,
"avg_line_length": 29.210526315789473,
"alnum_prop": 0.6795045045045045,
"repo_name": "mrtequino/JSW",
"id": "eb6a202e906c92401d1ef1b8f230ac5c3e31198f",
"size": "4440",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "graphql/server1/node_modules/apollo-cache-control/src/index.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "243783"
},
{
"name": "HTML",
"bytes": "137440"
},
{
"name": "Java",
"bytes": "360339"
},
{
"name": "JavaScript",
"bytes": "93395"
},
{
"name": "TypeScript",
"bytes": "291910"
},
{
"name": "Vue",
"bytes": "14811"
}
],
"symlink_target": ""
} |
//导入框架
import { Platform } from 'react-native';
import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
import thunk from 'redux-thunk';
import createLogger from 'redux-logger'; //日志工具
//导入所有的reducer
import rootReducer from '../reducers/index';
const dev_env = (process.env.NODE_ENV !== 'production');
const middleware = [thunk];
// 用log显示Action变化
// if (process.env.NODE_ENV !== 'production') {
// middleware.push(createLogger());
// }
const enhancer = compose(
applyMiddleware(
...middleware
// other store enhancers if any
),
//使用RND Tools调试
(global.reduxNativeDevTools) && dev_env ?
global.reduxNativeDevTools(/*options*/) :
noop => noop
);
/**
* 创建store状态树,并关联reducer,加入middleware中间件
* @param {any} preloadedState
*/
const configureStore = preloadedState => createStore(
rootReducer,
preloadedState,
enhancer
);
// If you have other enhancers & middlewares
// update the store after creating / changing to allow devTools to use them
//使用RND Tools调试
if (global.reduxNativeDevTools && dev_env) {
global.reduxNativeDevTools.updateStore(configureStore);
}
export default configureStore; | {
"content_hash": "fdea92e9943fec5e9c71a6cba2628b50",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 77,
"avg_line_length": 25.82608695652174,
"alnum_prop": 0.7003367003367004,
"repo_name": "littlethree/DemoProject",
"id": "2ad7ea961df3fafee93b60d6c5c9490e3b60d760",
"size": "1270",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/counter/store/configureStore.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "GLSL",
"bytes": "4473"
},
{
"name": "HTML",
"bytes": "32447"
},
{
"name": "Java",
"bytes": "284884"
},
{
"name": "JavaScript",
"bytes": "187445"
},
{
"name": "Objective-C",
"bytes": "416128"
},
{
"name": "Python",
"bytes": "1529"
}
],
"symlink_target": ""
} |
<?php
namespace RandData\Set;
/**
* Complex dataset
*/
class Complex extends \RandData\Set
{
/**
* Template string
* @var string
*/
protected $template;
/**
* Class constructor
*/
public function __construct($template = "")
{
$this->template = (string) $template;
}
/**
* @inherit
*/
public function get()
{
$matches = [];
$ret = $this->template;
$fabric = new \RandData\Fabric\DataSet\Str();
preg_match_all("/{([^}]+)}/", $ret, $matches);
$data = !empty($matches[1]) ? $matches[1] : [];
foreach ($data as $randdataStr) {
$dataSet = $fabric->create($randdataStr);
$search = "{" . $randdataStr . "}";
$ret = str_replace($search, $dataSet->get(), $ret);
}
return $ret;
}
/**
* @inherit
*/
public function init($params = [])
{
if (is_string($params)) {
$this->template = $params;
} elseif (!empty($params["template"])) {
$this->template = $params["template"];
}
// var_dump($this->template); die;
}
}
| {
"content_hash": "cd468007853815da335e82742bfb9b05",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 63,
"avg_line_length": 20.964912280701753,
"alnum_prop": 0.46527196652719666,
"repo_name": "KonstantinFilin/RandData",
"id": "377864405448ddd14dacda2e32f3a1d2285cb5fa",
"size": "1195",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/RandData/Set/Complex.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1835"
},
{
"name": "HTML",
"bytes": "2860879"
},
{
"name": "PHP",
"bytes": "286270"
}
],
"symlink_target": ""
} |
package com.omnia.common.listener;
import akka.actor.ActorSystem;
import com.omnia.module.user.command.CreateUserCommand;
import com.omnia.module.user.query.UserListener;
import org.axonframework.commandhandling.CommandBus;
import org.axonframework.commandhandling.GenericCommandMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import scala.concurrent.duration.Duration;
import javax.servlet.ServletContextEvent;
import java.util.concurrent.TimeUnit;
/**
* Created by khaerothe on 2015/4/30.
*/
public class ComponentListener extends ContextLoaderListener {
private static final Logger LOG = LoggerFactory.getLogger(ComponentListener.class);
@Autowired
private CommandBus commandBus;
@Autowired
private ActorSystem system;
@Autowired
private UserListener userListener;
public ComponentListener() {
}
public ComponentListener(WebApplicationContext context) {
super(context);
}
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
super.contextInitialized(servletContextEvent);
//Get the actor system from the spring context
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
// User user = userRepository.getUserById("bcf5e485-a81f-4b4b-ae12-3fd7c7c7ef73");
// UserQueryRepository.inMemoryUser.put(user.getIdentifier(), user);
CreateUserCommand command = new CreateUserCommand("lisi", "lisi");
commandBus.dispatch(new GenericCommandMessage<>(command));
userListener.handleUserTracing();
}
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
super.contextDestroyed(servletContextEvent);
if (system != null) {
LOG.info("Killing ActorSystem as a part of web application ctx destruction.");
system.shutdown();
system.awaitTermination(Duration.create(15, TimeUnit.SECONDS));
} else {
LOG.warn("No actor system loaded, yet trying to shut down. Check AppContext config and consider if you need this listener.");
}
}
}
| {
"content_hash": "81b699c6bf910deacf0e3e8c7061361e",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 137,
"avg_line_length": 36.98461538461538,
"alnum_prop": 0.7529118136439268,
"repo_name": "AmyStorm/omnia-web",
"id": "651a0d6db880f509a9460751f47f737b798c8386",
"size": "2404",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "omnia-web-manage/src/main/java/com/omnia/common/listener/ComponentListener.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "10718640"
},
{
"name": "FreeMarker",
"bytes": "41802"
},
{
"name": "HTML",
"bytes": "27656087"
},
{
"name": "Java",
"bytes": "245979"
},
{
"name": "JavaScript",
"bytes": "9350190"
},
{
"name": "PHP",
"bytes": "9846"
}
],
"symlink_target": ""
} |
class CreateUseCaseGroups < ActiveRecord::Migration
def change
create_table :use_case_groups do |t|
t.string :name
t.integer :project_id
t.timestamps
end
end
end
| {
"content_hash": "576a4fc052b6e23d0fc212cbf27473f1",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 51,
"avg_line_length": 19.3,
"alnum_prop": 0.6683937823834197,
"repo_name": "narisso/Smartboard",
"id": "c9ed7eabd7e1aea177b9d725a79777c94d71f7c8",
"size": "193",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrate/20131024204038_create_use_case_groups.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "45345"
},
{
"name": "CoffeeScript",
"bytes": "1700"
},
{
"name": "JavaScript",
"bytes": "194988"
},
{
"name": "Ruby",
"bytes": "351462"
},
{
"name": "Shell",
"bytes": "2275"
}
],
"symlink_target": ""
} |
package kafka.api
import java.nio.ByteBuffer
import kafka.cluster.BrokerEndPoint
import org.apache.kafka.common.protocol.Errors
object GroupCoordinatorResponse {
val CurrentVersion = 0
private val NoBrokerEndpointOpt = Some(BrokerEndPoint(id = -1, host = "", port = -1))
def readFrom(buffer: ByteBuffer) = {
val correlationId = buffer.getInt
val error = Errors.forCode(buffer.getShort)
val broker = BrokerEndPoint.readFrom(buffer)
val coordinatorOpt = if (error == Errors.NONE)
Some(broker)
else
None
GroupCoordinatorResponse(coordinatorOpt, error, correlationId)
}
}
case class GroupCoordinatorResponse (coordinatorOpt: Option[BrokerEndPoint], error: Errors, correlationId: Int)
extends RequestOrResponse() {
def sizeInBytes =
4 + /* correlationId */
2 + /* error code */
coordinatorOpt.orElse(GroupCoordinatorResponse.NoBrokerEndpointOpt).get.sizeInBytes
def writeTo(buffer: ByteBuffer) {
buffer.putInt(correlationId)
buffer.putShort(error.code)
coordinatorOpt.orElse(GroupCoordinatorResponse.NoBrokerEndpointOpt).foreach(_.writeTo(buffer))
}
def describe(details: Boolean) = toString
}
| {
"content_hash": "769f698f67b5839b7c6f168068046c10",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 111,
"avg_line_length": 27.41860465116279,
"alnum_prop": 0.7421543681085666,
"repo_name": "rhauch/kafka",
"id": "782eebb0d9cbde8abf90d439ae251e5217b79fc6",
"size": "1980",
"binary": false,
"copies": "8",
"ref": "refs/heads/trunk",
"path": "core/src/main/scala/kafka/api/GroupCoordinatorResponse.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "26532"
},
{
"name": "HTML",
"bytes": "5443"
},
{
"name": "Java",
"bytes": "8140516"
},
{
"name": "Python",
"bytes": "515758"
},
{
"name": "Scala",
"bytes": "4073174"
},
{
"name": "Shell",
"bytes": "65485"
},
{
"name": "XSLT",
"bytes": "7116"
}
],
"symlink_target": ""
} |
/* Block newsletter */
#columns #newsletter_block_left .form-group {
margin-bottom: 0; }
#columns #newsletter_block_left .form-group .form-control {
max-width: 222px;
display: inline-block;
margin-right: 6px; }
@media (min-width: 768px) and (max-width: 1199px) {
#columns #newsletter_block_left .form-group .form-control {
margin-bottom: 10px;
margin-right: 0; } }
#columns #newsletter_block_left .success_inline, #columns #newsletter_block_left .warning_inline {
text-align: left;
padding: 1px 0 0 0;
margin-bottom: -19px; }
#columns #newsletter_block_left .success_inline {
color: #418B19; }
#columns #newsletter_block_left .warning_inline {
color: #f13340; }
/* Block newsletter footer */
#footer #newsletter_block_left {
overflow: hidden;
width: 50%;
float: left;
padding: 13px 15px 7px 15px;
margin-bottom: 0; }
@media (max-width: 767px) {
#footer #newsletter_block_left {
width: 100%; } }
#footer #newsletter_block_left h4 {
background: none;
float: left;
padding: 7px 16px 5px 0;
text-transform: none;
font-size: 21px;
line-height: 25px;
border: none; }
#footer #newsletter_block_left h4:after {
display: none; }
#footer #newsletter_block_left .block_content {
overflow: hidden; }
#footer #newsletter_block_left .form-group {
margin-bottom: 0; }
#footer #newsletter_block_left .form-group .form-control {
height: 45px;
max-width: 267px;
background: #3c3c3c;
border-color: #515151;
color: #fff;
padding: 10px 43px 10px 12px;
display: inline-block;
float: left; }
#footer #newsletter_block_left .form-group .form-control:focus {
-moz-box-shadow: black 0px 0px 0px;
-webkit-box-shadow: black 0px 0px 0px;
box-shadow: black 0px 0px 0px; }
#footer #newsletter_block_left .form-group .button-small {
margin-left: -43px;
border: none;
background: none;
text-align: center;
color: #908f8f;
padding: 8px; }
#footer #newsletter_block_left .form-group .button-small:before {
content: "\f138";
font-family: "FontAwesome";
font-size: 28px;
line-height: 28px; }
#footer #newsletter_block_left .form-group .button-small:hover {
color: #fff !important; }
#footer #newsletter_block_left .form-group .button-small span {
display: none; }
#footer #newsletter_block_left .warning_inline {
display: block;
color: #f13340;
font-size: 13px;
line-height: 26px;
clear: both; }
@media (min-width: 1200px) {
#footer #newsletter_block_left .warning_inline {
display: inline-block;
position: relative;
top: -35px;
margin-bottom: -35px;
left: 15px;
clear: none; } }
#footer #newsletter_block_left .newsletter-input {
max-width: 300px !important; }
/*# sourceMappingURL=blocknewsletter.css.map */
| {
"content_hash": "5792e89e53d0278c906a7c1041371813",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 98,
"avg_line_length": 32.69230769230769,
"alnum_prop": 0.6302521008403361,
"repo_name": "amicavi/grupo-ochoa",
"id": "00225caf502f9520db76c0fbf81f79228d491200",
"size": "2975",
"binary": false,
"copies": "42",
"ref": "refs/heads/master",
"path": "prestashop/themes/default-bootstrap/css/modules/blocknewsletter/blocknewsletter.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "2795"
},
{
"name": "C",
"bytes": "33908"
},
{
"name": "CSS",
"bytes": "1974460"
},
{
"name": "HTML",
"bytes": "931130"
},
{
"name": "JavaScript",
"bytes": "2246008"
},
{
"name": "PHP",
"bytes": "27164119"
},
{
"name": "Ruby",
"bytes": "2543"
},
{
"name": "Smarty",
"bytes": "3774341"
}
],
"symlink_target": ""
} |
class ChoreLogsController < ApplicationController
# def index
# @user = current_user
# @house = House.find_by(id: params[:house_id])
# @users = @house.users
# @chores = @house.chores
# @chore = Chore.find_by(id: params[:chore_id])
# @chore_logs = @house.users.map {|user| user.chore_logs}
# end
def create
@user = current_user
@chore = Chore.find_by(id: params[:chore_id])
@house = @chore.house
@chores = @house.chores
@chore_log = @user.chore_logs.new(chore: @chore)
params[:house_id] = @house.id
if @chore_log.save
redirect_to "/houses/#{@house.id}/chores"
end
end
def destroy
@user = current_user
@chore_log = ChoreLog.find_by(id: params[:id])
@chore = @chore_log.chore
@house = @chore.house
@chores = @house.chores
if @chore_log.destroy
redirect_to "/houses/#{@house.id}/chores"
end
end
end
| {
"content_hash": "4060189ae4df7038ab8b98dcef3275bf",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 61,
"avg_line_length": 25.36111111111111,
"alnum_prop": 0.6089813800657174,
"repo_name": "chi-sea-lions-2015/house-rules",
"id": "1b027c2134e2398fd4f08238bfacbf8585097cb6",
"size": "913",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "app/controllers/chore_logs_controller.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "233820"
},
{
"name": "HTML",
"bytes": "38528"
},
{
"name": "JavaScript",
"bytes": "19889"
},
{
"name": "Ruby",
"bytes": "92733"
}
],
"symlink_target": ""
} |
/*
*
* Purpose: v2 B-tree indexing for chunked datasets with > 1 unlimited dimensions.
* Each dataset chunk in the b-tree is identified by its dimensional offset.
*
*/
/****************/
/* Module Setup */
/****************/
#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dpkg.h" /* Datasets */
#include "H5FLprivate.h" /* Free Lists */
#include "H5MFprivate.h" /* File space management */
#include "H5VMprivate.h" /* Vector and array functions */
/****************/
/* Local Macros */
/****************/
/******************/
/* Local Typedefs */
/******************/
/* User data for creating callback context */
typedef struct H5D_bt2_ctx_ud_t {
const H5F_t *f; /* Pointer to file info */
uint32_t chunk_size; /* Size of chunk (bytes; for filtered object) */
unsigned ndims; /* Number of dimensions */
uint32_t *dim; /* Size of chunk in elements */
} H5D_bt2_ctx_ud_t;
/* The callback context */
typedef struct H5D_bt2_ctx_t {
uint32_t chunk_size; /* Size of chunk (bytes; constant for unfiltered object) */
size_t sizeof_addr; /* Size of file addresses in the file (bytes) */
size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */
unsigned ndims; /* Number of dimensions in chunk */
uint32_t *dim; /* Size of chunk in elements */
} H5D_bt2_ctx_t;
/* User data for the chunk's removal callback routine */
typedef struct H5D_bt2_remove_ud_t {
H5F_t *f; /* File pointer for operation */
hid_t dxpl_id; /* DXPL ID for operation */
} H5D_bt2_remove_ud_t;
/* Callback info for iteration over chunks in v2 B-tree */
typedef struct H5D_bt2_it_ud_t {
H5D_chunk_cb_func_t cb; /* Callback routine for the chunk */
void *udata; /* User data for the chunk's callback routine */
} H5D_bt2_it_ud_t;
/* User data for compare callback */
typedef struct H5D_bt2_ud_t {
H5D_chunk_rec_t rec; /* The record to search for */
unsigned ndims; /* Number of dimensions for the chunked dataset */
} H5D_bt2_ud_t;
/********************/
/* Local Prototypes */
/********************/
/* Shared v2 B-tree methods for indexing filtered and non-filtered chunked datasets */
static void *H5D__bt2_crt_context(void *udata);
static herr_t H5D__bt2_dst_context(void *ctx);
static herr_t H5D__bt2_store(void *native, const void *udata);
static herr_t H5D__bt2_compare(const void *rec1, const void *rec2, int *result);
/* v2 B-tree class for indexing non-filtered chunked datasets */
static herr_t H5D__bt2_unfilt_encode(uint8_t *raw, const void *native, void *ctx);
static herr_t H5D__bt2_unfilt_decode(const uint8_t *raw, void *native, void *ctx);
static herr_t H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth,
const void *record, const void *u_ctx);
/* v2 B-tree class for indexing filtered chunked datasets */
static herr_t H5D__bt2_filt_encode(uint8_t *raw, const void *native, void *ctx);
static herr_t H5D__bt2_filt_decode(const uint8_t *raw, void *native, void *ctx);
static herr_t H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth,
const void *record, const void *u_ctx);
/* Helper routine */
static herr_t H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info);
static herr_t H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info);
/* Callback for H5B2_iterate() which is called in H5D__bt2_idx_iterate() */
static int H5D__bt2_idx_iterate_cb(const void *_record, void *_udata);
/* Callback for H5B2_find() which is called in H5D__bt2_idx_get_addr() */
static herr_t H5D__bt2_found_cb(const void *nrecord, void *op_data);
/*
* Callback for H5B2_remove() and H5B2_delete() which is called
* in H5D__bt2_idx_remove() and H5D__bt2_idx_delete().
*/
static herr_t H5D__bt2_remove_cb(const void *nrecord, void *_udata);
/* Callback for H5B2_modify() which is called in H5D__bt2_idx_insert() */
static herr_t H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed);
/* Chunked layout indexing callbacks for v2 B-tree indexing */
static herr_t H5D__bt2_idx_init(const H5D_chk_idx_info_t *idx_info,
const H5S_t *space, haddr_t dset_ohdr_addr);
static herr_t H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info);
static hbool_t H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
static herr_t H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info,
H5D_chunk_ud_t *udata, const H5D_t *dset);
static herr_t H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
H5D_chunk_ud_t *udata);
static int H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info,
H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
static herr_t H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info,
H5D_chunk_common_ud_t *udata);
static herr_t H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info);
static herr_t H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
const H5D_chk_idx_info_t *idx_info_dst);
static herr_t H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
H5O_storage_chunk_t *storage_dst, hid_t dxpl_id);
static herr_t H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size);
static herr_t H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
static herr_t H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage,
FILE *stream);
static herr_t H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info);
/*********************/
/* Package Variables */
/*********************/
/* Chunked dataset I/O ops for v2 B-tree indexing */
const H5D_chunk_ops_t H5D_COPS_BT2[1] = {{
TRUE, /* Fixed array indices support SWMR access */
H5D__bt2_idx_init, /* init */
H5D__bt2_idx_create, /* create */
H5D__bt2_idx_is_space_alloc, /* is_space_alloc */
H5D__bt2_idx_insert, /* insert */
H5D__bt2_idx_get_addr, /* get_addr */
NULL, /* resize */
H5D__bt2_idx_iterate, /* iterate */
H5D__bt2_idx_remove, /* remove */
H5D__bt2_idx_delete, /* delete */
H5D__bt2_idx_copy_setup, /* copy_setup */
H5D__bt2_idx_copy_shutdown, /* copy_shutdown */
H5D__bt2_idx_size, /* size */
H5D__bt2_idx_reset, /* reset */
H5D__bt2_idx_dump, /* dump */
H5D__bt2_idx_dest /* destroy */
}};
/*****************************/
/* Library Private Variables */
/*****************************/
/* v2 B-tree class for indexing non-filtered chunked datasets */
const H5B2_class_t H5D_BT2[1] = {{ /* B-tree class information */
H5B2_CDSET_ID, /* Type of B-tree */
"H5B2_CDSET_ID", /* Name of B-tree class */
sizeof(H5D_chunk_rec_t), /* Size of native record */
H5D__bt2_crt_context, /* Create client callback context */
H5D__bt2_dst_context, /* Destroy client callback context */
H5D__bt2_store, /* Record storage callback */
H5D__bt2_compare, /* Record comparison callback */
H5D__bt2_unfilt_encode, /* Record encoding callback */
H5D__bt2_unfilt_decode, /* Record decoding callback */
H5D__bt2_unfilt_debug /* Record debugging callback */
}};
/* v2 B-tree class for indexing filtered chunked datasets */
const H5B2_class_t H5D_BT2_FILT[1] = {{ /* B-tree class information */
H5B2_CDSET_FILT_ID, /* Type of B-tree */
"H5B2_CDSET_FILT_ID", /* Name of B-tree class */
sizeof(H5D_chunk_rec_t), /* Size of native record */
H5D__bt2_crt_context, /* Create client callback context */
H5D__bt2_dst_context, /* Destroy client callback context */
H5D__bt2_store, /* Record storage callback */
H5D__bt2_compare, /* Record comparison callback */
H5D__bt2_filt_encode, /* Record encoding callback */
H5D__bt2_filt_decode, /* Record decoding callback */
H5D__bt2_filt_debug /* Record debugging callback */
}};
/*******************/
/* Local Variables */
/*******************/
/* Declare a free list to manage the H5D_bt2_ctx_t struct */
H5FL_DEFINE_STATIC(H5D_bt2_ctx_t);
/* Declare a free list to manage the H5D_bt2_ctx_ud_t struct */
H5FL_DEFINE_STATIC(H5D_bt2_ctx_ud_t);
/* Declare a free list to manage the page elements */
H5FL_BLK_DEFINE(chunk_dim);
/*-------------------------------------------------------------------------
* Function: H5D__bt2_crt_context
*
* Purpose: Create client callback context
*
* Return: Success: non-NULL
* Failure: NULL
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static void *
H5D__bt2_crt_context(void *_udata)
{
H5D_bt2_ctx_ud_t *udata = (H5D_bt2_ctx_ud_t *)_udata; /* User data for building callback context */
H5D_bt2_ctx_t *ctx; /* Callback context structure */
uint32_t *my_dim = NULL; /* Pointer to copy of chunk dimension size */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(udata);
HDassert(udata->f);
HDassert(udata->ndims > 0 && udata->ndims < H5O_LAYOUT_NDIMS);
/* Allocate callback context */
if(NULL == (ctx = H5FL_MALLOC(H5D_bt2_ctx_t)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate callback context")
/* Determine the size of addresses and set the chunk size and # of dimensions for the dataset */
ctx->sizeof_addr = H5F_SIZEOF_ADDR(udata->f);
ctx->chunk_size = udata->chunk_size;
ctx->ndims = udata->ndims;
/* Set up the "local" information for this dataset's chunk dimension sizes */
if(NULL == (my_dim = (uint32_t *)H5FL_BLK_MALLOC(chunk_dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims")
HDmemcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t));
ctx->dim = my_dim;
/*
* Compute the size required for encoding the size of a chunk,
* allowing for an extra byte, in case the filter makes the chunk larger.
*/
ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8);
if(ctx->chunk_size_len > 8)
ctx->chunk_size_len = 8;
/* Set return value */
ret_value = ctx;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_crt_context() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_dst_context
*
* Purpose: Destroy client callback context
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_dst_context(void *_ctx)
{
H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(ctx);
/* Free array for chunk dimension sizes */
if(ctx->dim)
(void)H5FL_BLK_FREE(chunk_dim, ctx->dim);
/* Release callback context */
ctx = H5FL_FREE(H5D_bt2_ctx_t, ctx);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_dst_context() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_store
*
* Purpose: Store native information into record for v2 B-tree
* (non-filtered)
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_store(void *record, const void *_udata)
{
const H5D_bt2_ud_t *udata = (const H5D_bt2_ud_t *)_udata; /* User data */
FUNC_ENTER_STATIC_NOERR
*(H5D_chunk_rec_t *)record = udata->rec;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_store() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_compare
*
* Purpose: Compare two native information records, according to some key
* (non-filtered)
*
* Return: <0 if rec1 < rec2
* =0 if rec1 == rec2
* >0 if rec1 > rec2
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_compare(const void *_udata, const void *_rec2, int *result)
{
const H5D_bt2_ud_t *udata = (const H5D_bt2_ud_t *)_udata; /* User data */
const H5D_chunk_rec_t *rec1 = &(udata->rec); /* The search record */
const H5D_chunk_rec_t *rec2 = (const H5D_chunk_rec_t *)_rec2; /* The native record */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(rec1);
HDassert(rec2);
/* Compare the offsets but ignore the other fields */
*result = H5VM_vector_cmp_u(udata->ndims, rec1->scaled, rec2->scaled);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_compare() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_unfilt_encode
*
* Purpose: Encode native information into raw form for storing on disk
* (non-filtered)
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx)
{
H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
unsigned u; /* Local index varible */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(ctx);
/* Encode the record's fields */
H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr);
/* (Don't encode the chunk size & filter mask for non-filtered B-tree records) */
for(u = 0; u < ctx->ndims; u++)
UINT64ENCODE(raw, record->scaled[u]);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_unfilt_encode() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_unfilt_decode
*
* Purpose: Decode raw disk form of record into native form
* (non-filtered)
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx)
{
H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */
unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(ctx);
/* Decode the record's fields */
H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr);
record->nbytes = ctx->chunk_size;
record->filter_mask = 0;
for(u = 0; u < ctx->ndims; u++)
UINT64DECODE(raw, record->scaled[u]);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_unfilt_decode() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_unfilt_debug
*
* Purpose: Debug native form of record (non-filtered)
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth,
const void *_record, const void *_ctx)
{
const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
const H5D_bt2_ctx_t *ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */
unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(record);
HDassert(ctx->chunk_size == record->nbytes);
HDassert(0 == record->filter_mask);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr);
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
for(u = 0; u < ctx->ndims; u++)
HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * ctx->dim[u]);
HDfputs("}\n", stream);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_unfilt_debug() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_filt_encode
*
* Purpose: Encode native information into raw form for storing on disk
* (filtered)
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_filt_encode(uint8_t *raw, const void *_record, void *_ctx)
{
H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(ctx);
HDassert(record);
HDassert(H5F_addr_defined(record->chunk_addr));
HDassert(0 != record->nbytes);
/* Encode the record's fields */
H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr);
UINT64ENCODE_VAR(raw, record->nbytes, ctx->chunk_size_len);
UINT32ENCODE(raw, record->filter_mask);
for(u = 0; u < ctx->ndims; u++)
UINT64ENCODE(raw, record->scaled[u]);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_filt_encode() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_filt_decode
*
* Purpose: Decode raw disk form of record into native form
* (filtered)
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx)
{
H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */
H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */
unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(ctx);
HDassert(record);
/* Decode the record's fields */
H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr);
UINT64DECODE_VAR(raw, record->nbytes, ctx->chunk_size_len);
UINT32DECODE(raw, record->filter_mask);
for(u = 0; u < ctx->ndims; u++)
UINT64DECODE(raw, record->scaled[u]);
/* Sanity checks */
HDassert(H5F_addr_defined(record->chunk_addr));
HDassert(0 != record->nbytes);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_filt_decode() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_filt_debug
*
* Purpose: Debug native form of record (filtered)
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth,
const void *_record, const void *_ctx)
{
const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
const H5D_bt2_ctx_t *ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */
unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(record);
HDassert(H5F_addr_defined(record->chunk_addr));
HDassert(0 != record->nbytes);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr);
HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)record->nbytes);
HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", record->filter_mask);
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
for(u = 0; u < ctx->ndims; u++)
HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * ctx->dim[u]);
HDfputs("}\n", stream);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_filt_debug() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_init
*
* Purpose: Initialize the indexing information for a dataset.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Neil Fortner
* Wednesday, May 23, 2012
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_init(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info,
const H5S_t H5_ATTR_UNUSED *space, haddr_t dset_ohdr_addr)
{
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(H5F_addr_defined(dset_ohdr_addr));
idx_info->storage->u.btree2.dset_ohdr_addr = dset_ohdr_addr;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__bt2_idx_init() */
/*-------------------------------------------------------------------------
* Function: H5D__btree2_idx_depend
*
* Purpose: Create flush dependency between v2 B-tree and dataset's
* object header.
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Quincey Koziol
* Friday, December 18, 2015
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info)
{
H5O_loc_t oloc; /* Temporary object header location for dataset */
H5O_proxy_t *oh_proxy = NULL; /* Dataset's object header proxy */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE);
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(H5D_CHUNK_IDX_BT2 == idx_info->layout->idx_type);
HDassert(idx_info->storage);
HDassert(H5D_CHUNK_IDX_BT2 == idx_info->storage->idx_type);
HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
HDassert(idx_info->storage->u.btree2.bt2);
/* Set up object header location for dataset */
H5O_loc_reset(&oloc);
oloc.file = idx_info->f;
oloc.addr = idx_info->storage->u.btree.dset_ohdr_addr;
/* Pin the dataset's object header proxy */
if(NULL == (oh_proxy = H5O_pin_flush_dep_proxy(&oloc, idx_info->dxpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header proxy")
/* Make the v2 B-tree a child flush dependency of the dataset's object header */
if(H5B2_depend((H5AC_info_t *)oh_proxy, idx_info->storage->u.btree2.bt2) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header")
done:
/* Unpin the dataset's object header proxy */
if(oh_proxy && H5O_unpin_flush_dep_proxy(oh_proxy) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header proxy")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__btree2_idx_depend() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_open()
*
* Purpose: Opens an existing v2 B-tree.
*
* Note: This information is passively initialized from each index
* operation callback because those abstract chunk index operations
* are designed to work with the v2 B-tree chunk indices also,
* which don't require an 'open' for the data structure.
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info)
{
H5D_bt2_ctx_ud_t u_ctx; /* user data for creating context */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(H5D_CHUNK_IDX_BT2 == idx_info->layout->idx_type);
HDassert(idx_info->storage);
HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
HDassert(NULL == idx_info->storage->u.btree2.bt2);
/* Set up the user data */
u_ctx.f = idx_info->f;
u_ctx.ndims = idx_info->layout->ndims - 1;
u_ctx.chunk_size = idx_info->layout->size;
u_ctx.dim = idx_info->layout->dim;
/* Open v2 B-tree for the chunk index */
if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open v2 B-tree for tracking chunked dataset")
/* Check for SWMR writes to the file */
if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
if(H5D__btree2_idx_depend(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_open() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_create
*
* Purpose: Create the v2 B-tree for tracking dataset chunks
*
* Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info)
{
H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */
H5D_bt2_ctx_ud_t u_ctx; /* data for context call */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(idx_info->storage);
HDassert(!H5F_addr_defined(idx_info->storage->idx_addr));
bt2_cparam.rrec_size = H5F_SIZEOF_ADDR(idx_info->f) /* Address of chunk */
+ (idx_info->layout->ndims - 1) * 8; /* # of dimensions x 64-bit chunk offsets */
/* General parameters */
if(idx_info->pline->nused > 0) {
unsigned chunk_size_len; /* Size of encoded chunk size */
/*
* Compute the size required for encoding the size of a chunk,
* allowing for an extra byte, in case the filter makes the chunk larger.
*/
chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8);
if(chunk_size_len > 8)
chunk_size_len = 8;
bt2_cparam.rrec_size += chunk_size_len + 4; /* Size of encoded chunk size & filter mask */
bt2_cparam.cls = H5D_BT2_FILT;
} /* end if */
else
bt2_cparam.cls = H5D_BT2;
bt2_cparam.node_size = idx_info->layout->u.btree2.cparam.node_size;
bt2_cparam.split_percent = idx_info->layout->u.btree2.cparam.split_percent;
bt2_cparam.merge_percent = idx_info->layout->u.btree2.cparam.merge_percent;
u_ctx.f = idx_info->f;
u_ctx.ndims = idx_info->layout->ndims - 1;
u_ctx.chunk_size = idx_info->layout->size;
u_ctx.dim = idx_info->layout->dim;
/* Create the v2 B-tree for the chunked dataset */
if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_create(idx_info->f, idx_info->dxpl_id, &bt2_cparam, &u_ctx)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking chunked dataset")
/* Retrieve the v2 B-tree's address in the file */
if(H5B2_get_addr(idx_info->storage->u.btree2.bt2, &(idx_info->storage->idx_addr)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get v2 B-tree address for tracking chunked dataset")
/* Check for SWMR writes to the file */
if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
if(H5D__btree2_idx_depend(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on object header")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_create() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_is_space_alloc
*
* Purpose: Query if space is allocated for index method
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static hbool_t
H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
{
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(storage);
FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
} /* end H5D__bt2_idx_is_space_alloc() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_mod_cb
*
* Purpose: Modify record for dataset chunk when it is found in a v2 B-tree.
* This is the callback for H5B2_modify() which is called in
* H5D__bt2_idx_insert().
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed)
{
H5D_bt2_ud_t *op_data = (H5D_bt2_ud_t *)_op_data; /* User data for v2 B-tree calls */
H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* Chunk record */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
#ifndef NDEBUG
{
unsigned u; /* Local index variable */
for(u = 0; u < op_data->ndims; u++)
HDassert(record->scaled[u] == op_data->rec.scaled[u]);
}
#endif /* NDEBUG */
/* Modify record */
*record = op_data->rec;
/* Note that the record changed */
*changed = TRUE;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__bt2_mod_cb() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_insert
*
* Purpose: Insert chunk address into the indexing structure.
* A non-filtered chunk:
* Should not exist
* Allocate the chunk and pass chunk address back up
* A filtered chunk:
* If it was not found, create the chunk and pass chunk address back up
* If it was found but its size changed, reallocate the chunk and pass chunk address back up
* If it was found but its size was the same, pass chunk address back up
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata,
const H5D_t H5_ATTR_UNUSED *dset)
{
H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree calls */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(idx_info->storage);
HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
HDassert(udata);
HDassert(H5F_addr_defined(udata->chunk_block.offset));
/* Check if the v2 B-tree is open yet */
if(NULL == idx_info->storage->u.btree2.bt2) {
/* Open existing v2 B-tree */
if(H5D__bt2_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
} else /* Patch the top level file pointer contained in bt2 if needed */
H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f);
/* Set convenience pointer to v2 B-tree structure */
bt2 = idx_info->storage->u.btree2.bt2;
/* Set up callback info */
bt2_udata.ndims = idx_info->layout->ndims - 1;
bt2_udata.rec.chunk_addr = udata->chunk_block.offset;
if(idx_info->pline->nused > 0) { /* filtered chunk */
H5_CHECKED_ASSIGN(bt2_udata.rec.nbytes, uint32_t, udata->chunk_block.length, hsize_t);
bt2_udata.rec.filter_mask = udata->filter_mask;
} /* end if */
else { /* non-filtered chunk */
bt2_udata.rec.nbytes = idx_info->layout->size;
bt2_udata.rec.filter_mask = 0;
} /* end else */
for(u = 0; u < (idx_info->layout->ndims - 1); u++)
bt2_udata.rec.scaled[u] = udata->common.scaled[u];
/* Update record for v2 B-tree (could be insert or modify) */
if(H5B2_update(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTUPDATE, FAIL, "unable to update record in v2 B-tree")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_idx_insert() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_found_cb
*
* Purpose: Retrieve record for dataset chunk when it is found in a v2 B-tree.
* This is the callback for H5B2_find() which is called in
* H5D__bt2_idx_get_addr() and H5D__bt2_idx_insert().
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_found_cb(const void *nrecord, void *op_data)
{
FUNC_ENTER_STATIC_NOERR
*(H5D_chunk_rec_t *)op_data = *(const H5D_chunk_rec_t *)nrecord;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__bt2_found_cb() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_get_addr
*
* Purpose: Get the file address of a chunk if file space has been
* assigned. Save the retrieved information in the udata
* supplied.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata)
{
H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree calls */
H5D_chunk_rec_t found_rec; /* Record found from searching for object */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(idx_info->layout->ndims > 0);
HDassert(idx_info->storage);
HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
HDassert(udata);
/* Check if the v2 B-tree is open yet */
if(NULL == idx_info->storage->u.btree2.bt2) {
/* Open existing v2 B-tree */
if(H5D__bt2_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
} else /* Patch the top level file pointer contained in bt2 if needed */
H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f);
/* Set convenience pointer to v2 B-tree structure */
bt2 = idx_info->storage->u.btree2.bt2;
/* Clear the found record */
found_rec.chunk_addr = HADDR_UNDEF;
found_rec.nbytes = 0;
found_rec.filter_mask = 0;
/* Prepare user data for compare callback */
bt2_udata.rec.chunk_addr = HADDR_UNDEF;
bt2_udata.ndims = idx_info->layout->ndims - 1;
/* Set the chunk offset to be searched for */
for(u = 0; u < (idx_info->layout->ndims - 1); u++)
bt2_udata.rec.scaled[u] = udata->common.scaled[u];
/* Go get chunk information from v2 B-tree */
if(H5B2_find(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_found_cb, &found_rec) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree")
/* Set common info for the chunk */
udata->chunk_block.offset = found_rec.chunk_addr;
/* Check for setting other info */
if(H5F_addr_defined(udata->chunk_block.offset)) {
/* Sanity check */
HDassert(0 != found_rec.nbytes);
/* Set other info for the chunk */
if(idx_info->pline->nused > 0) { /* filtered chunk */
udata->chunk_block.length = found_rec.nbytes;
udata->filter_mask = found_rec.filter_mask;
} /* end if */
else { /* non-filtered chunk */
udata->chunk_block.length = idx_info->layout->size;
udata->filter_mask = 0;
} /* end else */
} /* end if */
else {
udata->chunk_block.length = 0;
udata->filter_mask = 0;
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_idx_get_addr() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_iterate_cb
*
* Purpose: Translate the B-tree specific chunk record into a generic
* form and make the callback to the generic chunk callback
* routine.
* This is the callback for H5B2_iterate() which is called in
* H5D__bt2_idx_iterate().
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static int
H5D__bt2_idx_iterate_cb(const void *_record, void *_udata)
{
H5D_bt2_it_ud_t *udata = (H5D_bt2_it_ud_t *)_udata; /* User data */
const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* Native record */
int ret_value = -1; /* Return value */
FUNC_ENTER_STATIC_NOERR
/* Make "generic chunk" callback */
if((ret_value = (udata->cb)(record, udata->udata)) < 0)
HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback");
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_idx_iterate_cb() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_iterate
*
* Purpose: Iterate over the chunks in an index, making a callback
* for each one.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static int
H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info,
H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
{
H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
H5D_bt2_it_ud_t udata; /* User data for B-tree iterator callback */
int ret_value = FAIL; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(idx_info->storage);
HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
HDassert(chunk_cb);
HDassert(chunk_udata);
/* Check if the v2 B-tree is open yet */
if(NULL == idx_info->storage->u.btree2.bt2) {
/* Open existing v2 B-tree */
if(H5D__bt2_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
} else /* Patch the top level file pointer contained in bt2 if needed */
H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f);
/* Set convenience pointer to v2 B-tree structure */
bt2 = idx_info->storage->u.btree2.bt2;
/* Prepare user data for iterate callback */
udata.cb = chunk_cb;
udata.udata = chunk_udata;
/* Iterate over the records in the v2 B-tree */
if((ret_value = H5B2_iterate(bt2, idx_info->dxpl_id, H5D__bt2_idx_iterate_cb, &udata)) < 0)
HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk v2 B-tree");
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_iterate() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_remove_cb()
*
* Purpose: Free space for 'dataset chunk' object as v2 B-tree
* is being deleted or v2 B-tree node is removed.
* This is the callback for H5B2_remove() and H5B2_delete() which
* which are called in H5D__bt2_idx_remove() and H5D__bt2_idx_delete().
*
* Return: Success: non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_remove_cb(const void *_record, void *_udata)
{
const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */
H5D_bt2_remove_ud_t *udata = (H5D_bt2_remove_ud_t *)_udata; /* User data for removal callback */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(udata);
HDassert(udata->f);
/* Free the space in the file for the object being removed */
H5_CHECK_OVERFLOW(record->nbytes, uint32_t, hsize_t);
if(H5MF_xfree(udata->f, H5FD_MEM_DRAW, udata->dxpl_id, record->chunk_addr, (hsize_t)record->nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_remove_cb() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_remove
*
* Purpose: Remove chunk from index.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata)
{
H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */
H5D_bt2_remove_ud_t remove_udata; /* User data for removal callback */
H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree find call */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(idx_info->storage);
HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
HDassert(udata);
/* Check if the v2 B-tree is open yet */
if(NULL == idx_info->storage->u.btree2.bt2)
/* Open existing v2 B-tree */
if(H5D__bt2_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
/* Set convenience pointer to v2 B-tree structure */
bt2 = idx_info->storage->u.btree2.bt2;
/* Initialize user data for removal callback */
remove_udata.f = idx_info->f;
remove_udata.dxpl_id = idx_info->dxpl_id;
/* Prepare user data for compare callback */
bt2_udata.ndims = idx_info->layout->ndims - 1;
/* Initialize the record to search for */
for(u = 0; u < (idx_info->layout->ndims - 1); u++)
bt2_udata.rec.scaled[u] = udata->scaled[u];
/* Remove the record for the "dataset chunk" object from the v2 B-tree */
/* (space in the file for the object is freed in the 'remove' callback) */
if(H5B2_remove(bt2, idx_info->dxpl_id, &bt2_udata, (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) ? NULL : H5D__bt2_remove_cb, &remove_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__bt2_idx_remove() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_delete
*
* Purpose: Delete index and raw data storage for entire dataset
* (i.e. all chunks)
*
* Return: Success: Non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
* Modifications:
* Vailin Choi; March 2011
* Initialize size of an unfiltered chunk.
* This is a fix for for the assertion failure in:
* [src/H5FSsection.c:968: H5FS_sect_link_size: Assertion `bin < sinfo->nbins' failed.]
* which is uncovered by test_unlink_chunked_dataset() in test/unlink.c
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info)
{
H5D_bt2_remove_ud_t remove_udata; /* User data for removal callback */
H5B2_remove_t remove_op; /* The removal callback */
H5D_bt2_ctx_ud_t u_ctx; /* data for context call */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(idx_info->storage);
/* Check if the index data structure has been allocated */
if(H5F_addr_defined(idx_info->storage->idx_addr)) {
/* Set up user data for creating context */
u_ctx.f = idx_info->f;
u_ctx.ndims = idx_info->layout->ndims - 1;
u_ctx.chunk_size = idx_info->layout->size;
u_ctx.dim = idx_info->layout->dim;
/* Initialize user data for removal callback */
remove_udata.f = idx_info->f;
remove_udata.dxpl_id = idx_info->dxpl_id;
/* Set remove operation. Do not remove chunks in SWMR_WRITE mode */
if(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)
remove_op = NULL;
else
remove_op = H5D__bt2_remove_cb;
/* Delete the v2 B-tree */
/*(space in the file for each object is freed in the 'remove' callback) */
if(H5B2_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx, remove_op, &remove_udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree")
idx_info->storage->idx_addr = HADDR_UNDEF;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_delete() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_copy_setup
*
* Purpose: Set up any necessary information for copying chunks
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
const H5D_chk_idx_info_t *idx_info_dst)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Source file */
HDassert(idx_info_src);
HDassert(idx_info_src->f);
HDassert(idx_info_src->pline);
HDassert(idx_info_src->layout);
HDassert(idx_info_src->storage);
/* Destination file */
HDassert(idx_info_dst);
HDassert(idx_info_dst->f);
HDassert(idx_info_dst->pline);
HDassert(idx_info_dst->layout);
HDassert(idx_info_dst->storage);
HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr));
/* Check if the source v2 B-tree is open yet */
if(NULL == idx_info_src->storage->u.btree2.bt2)
if(H5D__bt2_idx_open(idx_info_src) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
/* Set copied metadata tag */
H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL);
/* Create v2 B-tree that describes the chunked dataset in the destination file */
if(H5D__bt2_idx_create(idx_info_dst) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr));
/* Reset metadata tag */
H5_END_TAG(FAIL);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_copy_setup() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_copy_shutdown
*
* Purpose: Shutdown any information from copying chunks
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src,
H5O_storage_chunk_t *storage_dst, hid_t H5_ATTR_UNUSED dxpl_id)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
HDassert(storage_src);
HDassert(storage_src->u.btree2.bt2);
HDassert(storage_dst);
HDassert(storage_dst->u.btree2.bt2);
/* Close v2 B-tree for source file */
if(H5B2_close(storage_src->u.btree2.bt2, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree")
storage_src->u.btree2.bt2 = NULL;
/* Close v2 B-tree for destination file */
if(H5B2_close(storage_dst->u.btree2.bt2, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree")
storage_dst->u.btree2.bt2 = NULL;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_copy_shutdown() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_size
*
* Purpose: Retrieve the amount of index storage for chunked dataset
*
* Return: Success: Non-negative
* Failure: negative
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size)
{
H5B2_t *bt2_cdset = NULL; /* Pointer to v2 B-tree structure */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(idx_info->storage);
HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
HDassert(index_size);
/* Open v2 B-tree */
if(H5D__bt2_idx_open(idx_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree")
/* Set convenience pointer to v2 B-tree structure */
bt2_cdset = idx_info->storage->u.btree2.bt2;
/* Get v2 B-tree size for indexing chunked dataset */
if(H5B2_size(bt2_cdset, idx_info->dxpl_id, index_size) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve v2 B-tree storage info for chunked dataset")
done:
/* Close v2 B-tree index */
if(bt2_cdset && H5B2_close(bt2_cdset, idx_info->dxpl_id) < 0)
HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for tracking chunked dataset")
idx_info->storage->u.btree2.bt2 = NULL;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_size() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_reset
*
* Purpose: Reset indexing information.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
{
FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(storage);
/* Reset index info */
if(reset_addr)
storage->idx_addr = HADDR_UNDEF;
storage->u.btree2.bt2 = NULL;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__bt2_idx_reset() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_dump
*
* Purpose: Dump indexing information to a stream.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
{
FUNC_ENTER_STATIC_NOERR
/* Sanity checks */
HDassert(storage);
HDassert(stream);
HDfprintf(stream, " Address: %a\n", storage->idx_addr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__bt2_idx_dump() */
/*-------------------------------------------------------------------------
* Function: H5D__bt2_idx_dest
*
* Purpose: Release indexing information in memory.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi; June 2010
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(idx_info->storage);
/* Check if the v2-btree is open */
if(idx_info->storage->u.btree2.bt2) {
/* Close v2 B-tree */
if(H5B2_close(idx_info->storage->u.btree2.bt2, idx_info->dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree")
idx_info->storage->u.btree2.bt2 = NULL;
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__bt2_idx_dest() */
| {
"content_hash": "a2d38ccc8224fd95736d19db50c41eab",
"timestamp": "",
"source": "github",
"line_count": 1576,
"max_line_length": 150,
"avg_line_length": 33.83692893401015,
"alnum_prop": 0.5716803870459617,
"repo_name": "aleph7/HDF5Kit",
"id": "363d57a9ce13a86b9e244f7c080310031239a750",
"size": "54433",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "dist/src/H5Dbtree2.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "857"
},
{
"name": "Ruby",
"bytes": "873"
},
{
"name": "Swift",
"bytes": "84654"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-GB" xml:lang="en-GB" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Statistics of root in UD_Spanish-PUD</title>
<link rel="root" href=""/> <!-- for JS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
<link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
<link rel="stylesheet" type="text/css" href="../../css/hint.css"/>
<script type="text/javascript" src="../../lib/ext/head.load.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.2/anchor.min.js"></script>
<script>document.addEventListener("DOMContentLoaded", function(event) {anchors.add();});</script>
<!-- Set up this custom Google search at https://cse.google.com/cse/business/settings?cx=001145188882102106025:dl1mehhcgbo -->
<!-- DZ 2021-01-22: I am temporarily hiding the search field to find out whether it slows down loading of the title page.
<script>
(function() {
var cx = '001145188882102106025:dl1mehhcgbo';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script> -->
<!-- <link rel="shortcut icon" href="favicon.ico"/> -->
</head>
<body>
<div id="main" class="center">
<div id="hp-header">
<table width="100%"><tr><td width="50%">
<span class="header-text"><a href="http://universaldependencies.org/#language-">home</a></span>
<span class="header-text"><a href="https://github.com/universaldependencies/docs/edit/pages-source/treebanks/es_pud/es_pud-dep-root.md" target="#">edit page</a></span>
<span class="header-text"><a href="https://github.com/universaldependencies/docs/issues">issue tracker</a></span>
</td><td>
<gcse:search></gcse:search>
</td></tr></table>
</div>
<hr/>
<div class="v2complete">
This page pertains to UD version 2.
</div>
<div id="content">
<noscript>
<div id="noscript">
It appears that you have Javascript disabled.
Please consider enabling Javascript for this page to see the visualizations.
</div>
</noscript>
<!-- The content may include scripts and styles, hence we must load the shared libraries before the content. -->
<script type="text/javascript">
console.time('loading libraries');
var root = '../../'; // filled in by jekyll
head.js(
// External libraries
// DZ: Copied from embedding.html. I don't know which one is needed for what, so I'm currently keeping them all.
root + 'lib/ext/jquery.min.js',
root + 'lib/ext/jquery.svg.min.js',
root + 'lib/ext/jquery.svgdom.min.js',
root + 'lib/ext/jquery.timeago.js',
root + 'lib/ext/jquery-ui.min.js',
root + 'lib/ext/waypoints.min.js',
root + 'lib/ext/jquery.address.min.js'
);
</script>
<h2 id="treebank-statistics-ud_spanish-pud-relations-root">Treebank Statistics: UD_Spanish-PUD: Relations: <code class="language-plaintext highlighter-rouge">root</code></h2>
<p>This relation is universal.</p>
<p>1000 nodes (4%) are attached to their parents as <code class="language-plaintext highlighter-rouge">root</code>.</p>
<p>1000 instances of <code class="language-plaintext highlighter-rouge">root</code> (100%) are left-to-right (parent precedes child).
Average distance between parent and child is 7.303.</p>
<p>The following 7 pairs of parts of speech are connected with <code class="language-plaintext highlighter-rouge">root</code>: -<tt><a href="es_pud-pos-VERB.html">VERB</a></tt> (837; 84% instances), -<tt><a href="es_pud-pos-NOUN.html">NOUN</a></tt> (85; 9% instances), -<tt><a href="es_pud-pos-ADJ.html">ADJ</a></tt> (72; 7% instances), -<tt><a href="es_pud-pos-DET.html">DET</a></tt> (3; 0% instances), -<tt><a href="es_pud-pos-NUM.html">NUM</a></tt> (1; 0% instances), -<tt><a href="es_pud-pos-PRON.html">PRON</a></tt> (1; 0% instances), -<tt><a href="es_pud-pos-PROPN.html">PROPN</a></tt> (1; 0% instances).</p>
<pre><code class="language-conllu"># visual-style 4 bgColor:blue
# visual-style 4 fgColor:white
# visual-style 0 bgColor:blue
# visual-style 0 fgColor:white
# visual-style 0 4 root color:blue
1 Los el DET DT Definite=Def|Gender=Masc|Number=Plur|PronType=Art 3 det _ _
2 nuevos _ ADJ JJ Gender=Masc|Number=Plur 3 amod _ _
3 gastos _ NOUN NN Gender=Masc|Number=Plur 4 nsubj _ _
4 corren _ VERB VBC Aspect=Imp|Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin|Voice=Act 0 root _ _
5 a a ADP IN _ 6 case _ _
6 cargo cargo NOUN NN Gender=Masc|Number=Sing 4 obl _ _
7 de de ADP IN _ 10 case _ _
8 la el DET DT Definite=Def|Gender=Fem|Number=Sing|PronType=Art 10 det _ _
9 gran _ ADJ JJ Gender=Fem|Number=Sing 10 amod _ _
10 cuenta cuenta NOUN NN Gender=Fem|Number=Sing 6 nmod _ _
11 bancaria _ ADJ JJ Gender=Fem|Number=Sing 10 amod _ _
12 de de ADP IN _ 13 case _ _
13 Clinton Clinton PROPN NNP Gender=Fem|Number=Sing 10 nmod _ SpaceAfter=No
14 . . PUNCT . _ 4 punct _ _
</code></pre>
<pre><code class="language-conllu"># visual-style 3 bgColor:blue
# visual-style 3 fgColor:white
# visual-style 0 bgColor:blue
# visual-style 0 fgColor:white
# visual-style 0 3 root color:blue
1 Un uno DET DT Definite=Ind|Gender=Masc|Number=Sing|PronType=Art 3 det _ _
2 completo completo ADJ JJ Gender=Masc|Number=Sing 3 amod _ _
3 descuido descuido NOUN NN Gender=Masc|Number=Sing 0 root _ _
4 de de ADP IN _ 7 case _ _
5 su _ PRON DTP$ Gender=Fem|Number=Sing|Person=3|Poss=Yes|PronType=Prs 7 det _ _
6 propia _ ADJ JJ Gender=Fem|Number=Sing 7 amod _ _
7 salud salud NOUN NN Gender=Fem|Number=Sing 3 nmod _ SpaceAfter=No
8 , , PUNCT , _ 9 punct _ _
9 afirmó _ VERB VBC Aspect=Perf|Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin|Voice=Act 3 parataxis _ _
10 Alice Alice PROPN NNP Gender=Fem|Number=Sing 9 nsubj _ SpaceAfter=No
11 , , PUNCT , _ 13 punct _ _
12 su _ PRON DTP$ Gender=Fem|Number=Sing|Person=3|Poss=Yes|PronType=Prs 13 det _ _
13 mujer mujer NOUN NN Gender=Fem|Number=Sing 10 appos _ SpaceAfter=No
14 . . PUNCT . _ 3 punct _ _
</code></pre>
<pre><code class="language-conllu"># visual-style 10 bgColor:blue
# visual-style 10 fgColor:white
# visual-style 0 bgColor:blue
# visual-style 0 fgColor:white
# visual-style 0 10 root color:blue
1 A a ADP IN _ 10 advmod _ _
2 lo él PRON DT Case=Acc|Gender=Masc|Number=Sing|Person=3|PrepCase=Npr|PronType=Prs 1 fixed _ _
3 mejor mejor NOUN NN Gender=Masc|Number=Sing 1 fixed _ _
4 el el DET DT Definite=Def|Gender=Masc|Number=Sing|PronType=Art 5 det _ _
5 código código NOUN NN Gender=Masc|Number=Sing 10 nsubj _ _
6 de de ADP IN _ 7 case _ _
7 vestimenta vestimenta NOUN NN Gender=Fem|Number=Sing 5 nmod _ _
8 era ser AUX VBC Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin|Voice=Act 10 cop _ _
9 muy muy ADV RB _ 10 advmod _ _
10 conservador conservador ADJ JJ Gender=Masc|Number=Sing 0 root _ SpaceAfter=No
11 . . PUNCT . _ 10 punct _ _
</code></pre>
</div>
<!-- support for embedded visualizations -->
<script type="text/javascript">
var root = '../../'; // filled in by jekyll
head.js(
// We assume that external libraries such as jquery.min.js have already been loaded outside!
// (See _layouts/base.html.)
// brat helper modules
root + 'lib/brat/configuration.js',
root + 'lib/brat/util.js',
root + 'lib/brat/annotation_log.js',
root + 'lib/ext/webfont.js',
// brat modules
root + 'lib/brat/dispatcher.js',
root + 'lib/brat/url_monitor.js',
root + 'lib/brat/visualizer.js',
// embedding configuration
root + 'lib/local/config.js',
// project-specific collection data
root + 'lib/local/collections.js',
// Annodoc
root + 'lib/annodoc/annodoc.js',
// NOTE: non-local libraries
'https://spyysalo.github.io/conllu.js/conllu.js'
);
var webFontURLs = [
// root + 'static/fonts/Astloch-Bold.ttf',
root + 'static/fonts/PT_Sans-Caption-Web-Regular.ttf',
root + 'static/fonts/Liberation_Sans-Regular.ttf'
];
var setupTimeago = function() {
jQuery("time.timeago").timeago();
};
head.ready(function() {
setupTimeago();
// mark current collection (filled in by Jekyll)
Collections.listing['_current'] = '';
// perform all embedding and support functions
Annodoc.activate(Config.bratCollData, Collections.listing);
});
</script>
<!-- google analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-55233688-1', 'auto');
ga('send', 'pageview');
</script>
<div id="footer">
<p class="footer-text">© 2014–2021
<a href="http://universaldependencies.org/introduction.html#contributors" style="color:gray">Universal Dependencies contributors</a>.
Site powered by <a href="http://spyysalo.github.io/annodoc" style="color:gray">Annodoc</a> and <a href="http://brat.nlplab.org/" style="color:gray">brat</a></p>.
</div>
</div>
</body>
</html>
| {
"content_hash": "7354dec5d925c73b82e9545758dc8ac1",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 614,
"avg_line_length": 44.62555066079295,
"alnum_prop": 0.6442250740375124,
"repo_name": "UniversalDependencies/universaldependencies.github.io",
"id": "74118fc84c25f83ffbe8a945c0bbf6eec72e1b44",
"size": "10136",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "treebanks/es_pud/es_pud-dep-root.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "64420"
},
{
"name": "HTML",
"bytes": "383191916"
},
{
"name": "JavaScript",
"bytes": "687350"
},
{
"name": "Perl",
"bytes": "7788"
},
{
"name": "Python",
"bytes": "21203"
},
{
"name": "Shell",
"bytes": "7253"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ This file is part of jTransfo, a library for converting to and from transfer objects.
~ Copyright (c) PROGS bvba, Belgium
~
~ The program is available in open source according to the Apache License, Version 2.0.
~ For full licensing details, see LICENSE.txt in the project root.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jtransfo</groupId>
<artifactId>jtransfo</artifactId>
<version>2.10-SNAPSHOT</version>
</parent>
<artifactId>jtransfo-core</artifactId>
<description>JTransfo core</description>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.zeroturnaround</groupId>
<artifactId>jr-sdk</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<!-- needed for spring-test -->
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project> | {
"content_hash": "b0543bb5a3e35cc90940ee55dcbbf36f",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 204,
"avg_line_length": 34.92,
"alnum_prop": 0.5899198167239404,
"repo_name": "joachimvda/jtransfo",
"id": "ddcb540913c11ed834b65c333fb4ba31869aaab2",
"size": "2619",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "489576"
}
],
"symlink_target": ""
} |
package com.gargoylesoftware.css.parser.media;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import com.gargoylesoftware.css.dom.CSSValueImpl;
import com.gargoylesoftware.css.dom.Property;
/**
* Testcases for {@link MediaQuery}.
* @author Ronald Brill
*/
public class MediaQueryTest {
/**
* @throws Exception if any error occurs
*/
@Test
public void testToString() throws Exception {
MediaQuery mq = new MediaQuery("test");
assertEquals("test", mq.toString());
mq = new MediaQuery("test", false, false);
assertEquals("test", mq.toString());
mq = new MediaQuery("test", true, false);
assertEquals("only test", mq.toString());
mq = new MediaQuery("test", false, true);
assertEquals("not test", mq.toString());
}
/**
* @throws Exception if any error occurs
*/
@Test
public void properties() throws Exception {
Property prop = new Property("prop", new CSSValueImpl(null), false);
MediaQuery mq = new MediaQuery("test");
mq.addMediaProperty(prop);
assertEquals("test and (prop: )", mq.toString());
final CSSValueImpl value = new CSSValueImpl(null);
value.setCssText("10dpi");
prop = new Property("prop", value, false);
mq = new MediaQuery("test", true, false);
mq.addMediaProperty(prop);
assertEquals("only test and (prop: 10dpi)", mq.toString());
assertEquals(1, mq.getProperties().size());
prop = new Property("min-foo", value, false);
mq.addMediaProperty(prop);
assertEquals("only test and (prop: 10dpi) and (min-foo: 10dpi)", mq.toString());
}
/**
* @throws Exception if any error occurs
*/
@Test
public void media() throws Exception {
final MediaQuery mq = new MediaQuery("test");
assertEquals("test", mq.getMedia());
}
}
| {
"content_hash": "0dc61ec0e60ba9fc9763b19ae15762bb",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 88,
"avg_line_length": 29.238805970149254,
"alnum_prop": 0.622766717713119,
"repo_name": "HtmlUnit/htmlunit-cssparser",
"id": "5ef59a913a8a6cddd2b54553a36486362e4c679d",
"size": "2557",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/com/gargoylesoftware/css/parser/media/MediaQueryTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1016357"
},
{
"name": "Java",
"bytes": "804610"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Devices.Components
{
[AttributeUsage(AttributeTargets.Method)]
public class ActionHelpAttribute: Attribute
{
public string HelpText { get; set; }
public ActionHelpAttribute(string helpText)
{
this.HelpText = helpText;
}
}
}
| {
"content_hash": "343d1973140624215942e634589b647d",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 51,
"avg_line_length": 21.736842105263158,
"alnum_prop": 0.6803874092009685,
"repo_name": "perpetualKid/UWP.Devices",
"id": "747540b676bf35c91917d8b0bb42e568b7b9a329",
"size": "415",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Devices.Components.Base/ActionHelpAttribute.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "157564"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/news_container_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
tools:showIn="@layout/fragment_news_list_details">
<LinearLayout
android:id="@+id/news_linear_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/news_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:scrollbarStyle="insideOverlay"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/layout_news_list_item" />
</LinearLayout>
<LinearLayout
android:id="@+id/no_news_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/no_news_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/no_news" />
</LinearLayout>
<include layout="@layout/layout_shadow" />
</RelativeLayout> | {
"content_hash": "35a106e824190e7993712b332e00c7b2",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 80,
"avg_line_length": 35.42307692307692,
"alnum_prop": 0.6487513572204126,
"repo_name": "mtransitapps/mtransit-for-android",
"id": "ad045ffd786646effb461956d281761e490bacdc",
"size": "1842",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/res/layout/layout_news_list.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "1249"
},
{
"name": "Java",
"bytes": "981176"
},
{
"name": "Kotlin",
"bytes": "660229"
}
],
"symlink_target": ""
} |
package com.googlecode.kanbanik.client.components.board;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.*;
import com.googlecode.kanbanik.client.KanbanikResources;
import com.googlecode.kanbanik.client.Modules;
import com.googlecode.kanbanik.client.api.DtoFactory;
import com.googlecode.kanbanik.client.api.Dtos;
import com.googlecode.kanbanik.client.components.task.TaskAddingComponent;
import com.googlecode.kanbanik.client.messaging.Message;
import com.googlecode.kanbanik.client.messaging.MessageBus;
import com.googlecode.kanbanik.client.messaging.MessageListener;
import com.googlecode.kanbanik.client.messaging.messages.project.GetAllProjectsRequestMessage;
import com.googlecode.kanbanik.client.messaging.messages.project.GetAllProjectsResponseMessage;
import com.googlecode.kanbanik.client.modules.lifecyclelisteners.ModulesLifecycleListener;
import com.googlecode.kanbanik.client.modules.lifecyclelisteners.ModulesLyfecycleListenerHandler;
import java.util.ArrayList;
import java.util.List;
public class ProjectHeader extends Composite implements ModulesLifecycleListener, MessageListener<Dtos.ProjectDto> {
interface MyUiBinder extends UiBinder<Widget, ProjectHeader> {
}
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
@UiField
Label projectName;
@UiField
PushButton addButton;
private Dtos.BoardDto board;
private Dtos.ProjectDto project;
public ProjectHeader(Dtos.BoardDto board, Dtos.ProjectDto project) {
this.board = board;
this.project = project;
initWidget(uiBinder.createAndBindUi(this));
projectName.setText(project.getName());
Dtos.WorkflowitemDto rootDto = board.getWorkflow().getWorkflowitems().size() > 0 ? board.getWorkflow().getWorkflowitems().get(0) : null;
if (rootDto != null) {
addButton.getUpFace().setImage(new Image(KanbanikResources.INSTANCE.addButtonImage()));
} else {
// the board has no workflow, disable add button
addButton.setEnabled(false);
addButton.setTitle("It is not possible to add a task to a board when the board has no workflow.");
addButton.getUpFace().setImage(new Image(KanbanikResources.INSTANCE.addDisabledButtonImage()));
}
new TaskAddingComponent(project, getInputQueue(rootDto), addButton, board);
MessageBus.registerListener(GetAllProjectsRequestMessage.class, this);
new ModulesLyfecycleListenerHandler(Modules.BOARDS, this);
}
private Dtos.WorkflowitemDto getInputQueue(Dtos.WorkflowitemDto root) {
if (root == null) {
return null;
}
if (root.getNestedWorkflow().getWorkflowitems().size() == 0) {
return root;
} else {
return getInputQueue(root.getNestedWorkflow().getWorkflowitems().get(0));
}
}
@Override
public void activated() {
if (!MessageBus.listens(GetAllProjectsRequestMessage.class, this)) {
MessageBus.registerListener(GetAllProjectsRequestMessage.class, this);
}
}
@Override
public void deactivated() {
MessageBus.unregisterListener(GetAllProjectsRequestMessage.class, this);
}
@Override
public void messageArrived(Message<Dtos.ProjectDto> message) {
Dtos.BoardWithProjectsDto boardWithProjectsDto = DtoFactory.boardWithProjectsDto();
boardWithProjectsDto.setBoard(board);
List<Dtos.ProjectDto> projects = new ArrayList<Dtos.ProjectDto>();
projects.add(project);
boardWithProjectsDto.setProjectsOnBoard(DtoFactory.projectsDto(projects));
MessageBus.sendMessage(new GetAllProjectsResponseMessage(boardWithProjectsDto, this));
}
public void init() {
if (getParent() != null) {
// hack for firefox
getParent().getElement().getStyle().setBackgroundColor("#e6e9ec");
}
}
}
| {
"content_hash": "b3f3f22c82fba4f8759684cefd55be6b",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 138,
"avg_line_length": 36.42056074766355,
"alnum_prop": 0.7554529124967924,
"repo_name": "nagyistoce/kanbanik",
"id": "9349f27bf51b87cb79d07782999e473acee9e4ae",
"size": "3897",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "kanbanik-web/src/main/java/com/googlecode/kanbanik/client/components/board/ProjectHeader.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "6035"
},
{
"name": "HTML",
"bytes": "997"
},
{
"name": "Java",
"bytes": "470392"
},
{
"name": "Scala",
"bytes": "174930"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Sp. Blancoan. 90. 1918
#### Original name
null
### Remarks
null | {
"content_hash": "96d005d08c853dedce039302abf32518",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 11.615384615384615,
"alnum_prop": 0.6887417218543046,
"repo_name": "mdoering/backbone",
"id": "01276e95a8ef2ec3d648a461581bb79c76583d50",
"size": "211",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Alismatales/Araceae/Pothos/Pothos scandens/ Syn. Pothos hermaphroditus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.eas.client.controls.geopane.actions;
import com.eas.client.controls.geopane.JGeoPane;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Action;
import javax.swing.KeyStroke;
/**
*
* @author mg
*/
public class LeftAction extends GeoPaneAction {
public LeftAction(JGeoPane aPane) {
super(aPane);
putValue(Action.NAME, " < ");
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0));
}
public void actionPerformed(ActionEvent e) {
try {
pane.translateGrid(2, 0);
pane.repaint();
} catch (Exception ex) {
Logger.getLogger(LeftAction.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| {
"content_hash": "d3c56bf01269fd3ddd6f99350a6899c4",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 86,
"avg_line_length": 26.37142857142857,
"alnum_prop": 0.6706392199349945,
"repo_name": "marat-gainullin/platypus-js",
"id": "ce235173e6b348b3ee8b18dd75e1dae699925375",
"size": "923",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "platypus-js-map-widget/src/main/java/com/eas/client/controls/geopane/actions/LeftAction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "45399"
},
{
"name": "HTML",
"bytes": "4781642"
},
{
"name": "Java",
"bytes": "6401554"
},
{
"name": "JavaScript",
"bytes": "474478"
},
{
"name": "PLSQL",
"bytes": "31351"
}
],
"symlink_target": ""
} |
import pints
import pints.toy
import unittest
import numpy as np
class TestGermanCreditHierarchicalLogPDF(unittest.TestCase):
"""
Tests the logpdf toy distribution from fitting a hierarchical logistic
model to German credit data.
"""
@classmethod
def setUpClass(cls):
""" Set up problem for tests. """
# download data
model = pints.toy.GermanCreditHierarchicalLogPDF(download=True)
x, y, z = model.data()
cls.y = y
cls.x = x
cls.model = model
def test_download(self):
# tests that method can download data from UCI repo
x, y, z = self.model.data()
self.assertEqual(x.shape[0], 1000)
self.assertEqual(x.shape[1], 25)
self.assertEqual(len(y), 1000)
def test_errors(self):
# tests errors of inapropriate function calls and inits
self.assertRaises(ValueError, pints.toy.GermanCreditHierarchicalLogPDF,
np.zeros((27, 27)), self.y)
self.assertRaises(ValueError, pints.toy.GermanCreditHierarchicalLogPDF,
self.x, np.ones(1000) * 2)
self.assertRaises(ValueError, pints.toy.GermanCreditHierarchicalLogPDF,
self.x, self.y, True)
self.assertRaises(ValueError, pints.toy.GermanCreditHierarchicalLogPDF,
None, self.y)
self.assertRaises(ValueError, pints.toy.GermanCreditHierarchicalLogPDF,
self.x, None)
def test_local(self):
# tests that model can be instantiated using local files
x, y, z = self.model.data()
model = pints.toy.GermanCreditHierarchicalLogPDF(x=x, y=y)
x1, y1, z1 = model.data()
self.assertTrue(np.array_equal(x, x1))
self.assertTrue(np.array_equal(y, y1))
self.assertTrue(np.array_equal(z, z1))
def test_values(self):
# tests calls
self.assertAlmostEqual(self.model(np.ones(326)),
-20174.077700157857,
places=6)
def test_sensitivities(self):
# test sensitivity values vs reference
val, dp = self.model.evaluateS1(np.ones(326))
self.assertEqual(val, self.model(np.ones(326)))
self.assertEqual(len(dp), 326)
self.assertAlmostEqual(dp[0], -1000.02)
self.assertAlmostEqual(dp[1], -700.8386959844057, places=6)
def test_givens(self):
# tests whether boundaries are correct and n_parameters
self.assertEqual(326, self.model.n_parameters())
borders = self.model.suggested_bounds()
self.assertEqual(borders[0][0], -100)
self.assertEqual(borders[1][0], 100)
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "d39541f81108f451ef55c5f3579fc09a",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 79,
"avg_line_length": 37.229729729729726,
"alnum_prop": 0.6127041742286752,
"repo_name": "martinjrobins/hobo",
"id": "1cb3e5071351154dad8e1bcc2326d135394eb626",
"size": "3025",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pints/tests/test_toy_german_credit_hierarchical_logpdf.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "278656"
},
{
"name": "C++",
"bytes": "86361"
},
{
"name": "CMake",
"bytes": "1710"
},
{
"name": "Cuda",
"bytes": "7890"
},
{
"name": "M",
"bytes": "2347"
},
{
"name": "Matlab",
"bytes": "437018"
},
{
"name": "Python",
"bytes": "1841329"
},
{
"name": "Stan",
"bytes": "8353"
},
{
"name": "TeX",
"bytes": "88007"
},
{
"name": "mupad",
"bytes": "73951"
}
],
"symlink_target": ""
} |
using System;
namespace CslaGenerator.Attributes
{
/// <summary>
/// This attribute is only valid on a field.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class UserFriendlyNameAttribute : Attribute
{
private string name;
public UserFriendlyNameAttribute(string name)
{
this.name = name;
}
//Define Name property.
//This is a read-only attribute.
public virtual string UserFriendlyName
{
get {return name;}
}
}
}
| {
"content_hash": "65a213ebcddd2e9ebee2b1026c1fca3f",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 51,
"avg_line_length": 21.166666666666668,
"alnum_prop": 0.6535433070866141,
"repo_name": "CslaGenFork/CslaGenFork",
"id": "0a805fcbd0d89583376156f093595958878228e4",
"size": "508",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tags/V4-0-1/Solutions/CslaGenFork/Attributes/UserFriendlyAttribute.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "4816094"
},
{
"name": "Assembly",
"bytes": "73066"
},
{
"name": "C#",
"bytes": "12314305"
},
{
"name": "C++",
"bytes": "313681"
},
{
"name": "HTML",
"bytes": "30950"
},
{
"name": "PHP",
"bytes": "35716"
},
{
"name": "PLpgSQL",
"bytes": "2164471"
},
{
"name": "Pascal",
"bytes": "1244"
},
{
"name": "PowerShell",
"bytes": "1687"
},
{
"name": "SourcePawn",
"bytes": "500196"
},
{
"name": "Visual Basic",
"bytes": "3027224"
}
],
"symlink_target": ""
} |
import {
randomString,
randomCharByTemplate
} from './utils'
export default class FluentGenerator {
constructor (options) {
this._amount = 1
this._debug = false
this._repeat = false
if (options) {
if (options.amount) {
this._amount = options.amount
}
if (options.length) {
this._length = options.length
}
if (options.char) {
this._char = options.char
}
if (options.template) {
this._template = options.template
}
if (options.syntax) {
this._syntax = options.syntax
}
if (options.debug) {
this._debug = options.debug
}
}
return this
};
get debug () {
return this._debug
};
set debug (fn) {
this._debug = fn
};
length (length) {
this._length = length
return this
};
char (char) {
this._char = char
return this
};
template (template) {
this._template = template
return this
};
syntax (syntax) {
this._syntax = syntax
return this
};
amount (amount) {
this._amount = amount
return this
};
generate () {
return this.gen()
};
gen () {
let result = []
let keygen = () => ''
if (this._length && this._length > 0) {
keygen = () => randomString(this._char, this._length)
} else if (this._template) {
keygen = () => randomCharByTemplate(this._template, this._syntax)
}
let errorCount = 0
for (let i = 0; i < this._amount; i++) {
let key = keygen()
if (result.indexOf(key) === -1) {
result.push(key)
} else {
errorCount++
if (errorCount > 1000) {
console.error('Ignored too many duplicate result, please decrease amount.')
break
}
i--
}
}
if (this._amount <= 1) {
if (this._debug) {
this._debug(result[0])
}
return result[0]
}
if (this._debug) {
this._debug(result)
}
return result
};
}
| {
"content_hash": "0a6f99d43905f8e43186d41cf63c279b",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 85,
"avg_line_length": 21,
"alnum_prop": 0.5258145363408522,
"repo_name": "up9cloud/node-cdkey",
"id": "f4a8ec64c94ec97e7483631882ac4c0bb5a815f6",
"size": "1995",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/FluentGenerator.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "95"
},
{
"name": "JavaScript",
"bytes": "15155"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html devsite>
<head>
<meta name="project_path" value="/web/tools/workbox/_project.yaml" />
<meta name="book_path" value="/web/tools/workbox/_book.yaml" />
<meta name="gtm_var" data-key="docType" data-value="reference">
<title>Class: NetworkFirst</title>
<link href="jsdoc.css" rel="stylesheet">
</head>
<body>
<div id="jsdoc-body-container">
<div id="jsdoc-content">
<div id="jsdoc-content-container">
<div id="jsdoc-main" role="main">
<header class="page-header">
<h1><small><a href="module-workbox-runtime-caching.html">workbox-runtime-caching</a>.<wbr></small><span class="symbol-name">NetworkFirst</span></h1>
<div class="symbol-detail-labels"><span class="label label-kind"><small>class</small></span> <span class="label label-static"><small>static</small></span></div>
<div class="symbol-detail-labels">
<span class="label label-kind"><small>Version</small></span>
<span class="label label-version"><small>v2.1.2</small></span>
</div>
<p>An implementation of a <a href="/web/fundamentals/instant-and-offline/offline-cookbook/#network-falling-back-to-cache">network first</a> request strategy.</p>
<p>By default, <code>NetworkFirst</code> will cache responses with a 200 status code as well as <a href="http://stackoverflow.com/q/39109789">opaque responses</a> (responses from cross-origin servers which don't support
<a href="https://enable-cors.org/">CORS</a>). You can override this default by passing in a <code>RequestWrapper</code> that includes an appropriately-configured
<code>CacheableResponsePlugin</code>.</p>
</header>
<section>
<h2>Constructor</h2>
<section>
<h3 id="NetworkFirst" class="symbol-name">NetworkFirst</h3>
<p class="type-signature"> new NetworkFirst(input)
</p>
<p>Constructor for a new NetworkFirst instance.</p>
<section>
<table class="function param responsive">
<tr>
<th colspan="2">
<h4>Parameter</h4>
</th>
</tr>
<tbody>
<tr>
<td class="details-table-name">
<p>input</p>
</td>
<td>
<p class="details-table-types">Object</p>
<p>Values in <code>input</code> have the following properties:</p>
<table class="function param responsive">
<tr>
<th colspan="2">
<h4>Parameter</h4>
</th>
</tr>
<tbody>
<tr>
<td class="details-table-name">
<p>networkTimeoutSeconds</p>
</td>
<td>
<p class="details-table-optional">Optional</p>
<p class="details-table-types">number</p>
<p>If set, and a valid network response isn't returned, then the cached response will be returned instead. If there is no previously cached response, then an <code>null</code> response will be returned. This option is meant
to combat "<a href="/web/fundamentals/performance/poor-connectivity/#lie-fi">lie-fi</a>" scenarios.
</p>
</td>
</tr>
<tr>
<td class="details-table-name">
<p>requestWrapper</p>
</td>
<td>
<p class="details-table-optional">Optional</p>
<p class="details-table-types">RequestWrapper</p>
<p>An optional <code>RequestWrapper</code> that is used to configure the cache name and request plugins. If not provided, a new <code>RequestWrapper</code> using the
<a href="#getDefaultCacheName">default cache name</a> will be used.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Extends</dt>
<dd><small><a href="module-workbox-runtime-caching.Handler.html">module:workbox-runtime-caching.Handler</a></small></dd>
</dl>
<section>
<h4>
Example
</h4>
<div>
<pre class="prettyprint"><code>// Set up a route to match any requests made for URLs that end in .txt.
// The requests are handled with a network-first strategy.
const route = new workbox.routing.RegExpRoute({
regExp: /\.txt$/,
handler: new workbox.runtimeCaching.NetworkFirst(),
});
const router = new workbox.routing.Router();
router.registerRoute({route});</code></pre>
</div>
</section>
</section>
</section>
<section>
<h2>Method</h2>
<section>
<h3 id="handle" class="symbol-name">handle</h3>
<div class="symbol-detail-labels"><span class="label label-async"><small>async</small></span></div>
<p class="type-signature"> handle(input) returns Promise containing Response</p>
<p>The handle method will be called by the
<a href="module-workbox-routing.Route.html">Route</a> class when a route matches a request.
</p>
<section>
<table class="function param responsive">
<tr>
<th colspan="2">
<h4>Parameter</h4>
</th>
</tr>
<tbody>
<tr>
<td class="details-table-name">
<p>input</p>
</td>
<td>
<p class="details-table-types">Object</p>
<p>Values in <code>input</code> have the following properties:</p>
<table class="function param responsive">
<tr>
<th colspan="2">
<h4>Parameter</h4>
</th>
</tr>
<tbody>
<tr>
<td class="details-table-name">
<p>event</p>
</td>
<td>
<p class="details-table-types">FetchEvent</p>
<p>The event that triggered the service worker's fetch handler.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</section>
<dl class="dl-compact">
<dt>Returns</dt>
<dd>
<p><code>Promise containing Response</code> The response from the network, or if that's not available, a previously cached response.</p>
</dd>
</dl>
</section>
</section>
</div>
</div>
<nav id="jsdoc-toc-nav" role="navigation"></nav>
</div>
</div>
</body>
</html> | {
"content_hash": "424abe2b7e47f6b229e2e673387b38ac",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 255,
"avg_line_length": 47.424418604651166,
"alnum_prop": 0.4494299374770136,
"repo_name": "agektmr/WebFundamentals",
"id": "b7a50facf0c814c3648752aea74f4ffbb88211bf",
"size": "8157",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/content/en/tools/workbox/reference-docs/v2.1.2/module-workbox-runtime-caching.NetworkFirst.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "46463"
},
{
"name": "HTML",
"bytes": "10845299"
},
{
"name": "JavaScript",
"bytes": "273658"
},
{
"name": "Python",
"bytes": "256072"
},
{
"name": "Shell",
"bytes": "4926"
},
{
"name": "Smarty",
"bytes": "3968"
}
],
"symlink_target": ""
} |
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="description">
<meta name="keywords" content="static content generator,static site generator,static site,HTML,web development,.NET,C#,Razor,Markdown,YAML">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/appveyor-api-client/assets/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="/appveyor-api-client/assets/img/favicon.ico" type="image/x-icon">
<title>Docs - API - Job.Started Property</title>
<link href="/appveyor-api-client/assets/css/mermaid.css" rel="stylesheet">
<link href="/appveyor-api-client/assets/css/highlight.css" rel="stylesheet">
<link href="/appveyor-api-client/assets/css/bootstrap/bootstrap.css" rel="stylesheet">
<link href="/appveyor-api-client/assets/css/adminlte/AdminLTE.css" rel="stylesheet">
<link href="/appveyor-api-client/assets/css/theme/theme.css" rel="stylesheet">
<link href="//fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,400i,700,700i" rel="stylesheet">
<link href="/appveyor-api-client/assets/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="/appveyor-api-client/assets/css/override.css" rel="stylesheet">
<script src="/appveyor-api-client/assets/js/jquery-2.2.3.min.js"></script>
<script src="/appveyor-api-client/assets/js/bootstrap.min.js"></script>
<script src="/appveyor-api-client/assets/js/app.min.js"></script>
<script src="/appveyor-api-client/assets/js/highlight.pack.js"></script>
<script src="/appveyor-api-client/assets/js/jquery.slimscroll.min.js"></script>
<script src="/appveyor-api-client/assets/js/jquery.sticky-kit.min.js"></script>
<script src="/appveyor-api-client/assets/js/mermaid.min.js"></script>
<!--[if lt IE 9]>
<script src="/appveyor-api-client/assets/js/html5shiv.min.js"></script>
<script src="/appveyor-api-client/assets/js/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition wyam layout-boxed ">
<div class="top-banner"></div>
<div class="wrapper with-container">
<!-- Header -->
<header class="main-header">
<a href="/appveyor-api-client/" class="logo">
<span>Docs</span>
</a>
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle visible-xs-block" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle side menu</span>
<i class="fa fa-chevron-circle-right"></i>
</a>
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
<span class="sr-only">Toggle side menu</span>
<i class="fa fa-chevron-circle-down"></i>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="/appveyor-api-client/api">API</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
<!-- Navbar Right Menu -->
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar ">
<section class="infobar" data-spy="affix" data-offset-top="60" data-offset-bottom="200">
<div id="infobar-headings"><h6>On This Page</h6><p><a href="#Summary">Summary</a></p>
<p><a href="#Syntax">Syntax</a></p>
<p><a href="#Attributes">Attributes</a></p>
<p><a href="#Value">Value</a></p>
<hr class="infobar-hidden">
</div>
</section>
<section class="sidebar">
<script src="/appveyor-api-client/assets/js/lunr.min.js"></script>
<script src="/appveyor-api-client/assets/js/searchIndex.js"></script>
<div class="sidebar-form">
<div class="input-group">
<input type="text" name="search" id="search" class="form-control" placeholder="Search Types...">
<span class="input-group-btn">
<button class="btn btn-flat"><i class="fa fa-search"></i></button>
</span>
</div>
</div>
<div id="search-results">
</div>
<script>
function runSearch(query){
$("#search-results").empty();
if( query.length < 2 ){
return;
}
var results = searchModule.search("*" + query + "*");
var listHtml = "<ul class='sidebar-menu'>";
listHtml += "<li class='header'>Type Results</li>";
if(results.length == 0 ){
listHtml += "<li>No results found</li>";
} else {
for(var i = 0; i < results.length; ++i){
var res = results[i];
listHtml += "<li><a href='" + res.url + "'>" + res.title + "</a></li>";
}
}
listHtml += "</ul>";
$("#search-results").append(listHtml);
}
$(document).ready(function(){
$("#search").on('input propertychange paste', function() {
runSearch($("#search").val());
});
});
</script>
<hr>
<ul class="sidebar-menu">
<li class="header">Namespace</li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model">AppVeyorClient<wbr>.Model</a></li>
<li class="header">Type</li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job">Job</a></li>
<li role="separator" class="divider"></li>
<li class="header">Constructors</li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/2B2CF2AE">Job<wbr>(string, <wbr>string, <wbr>JobStatus?, <wbr>DateTime?, <wbr>DateTime?)<wbr></a></li>
<li class="header">Property Members</li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/AB41AFD2">Created</a></li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/14789122">Finished</a></li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/5117022C">JobId</a></li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/8D605FE4">Name</a></li>
<li class="selected"><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/C96004D4">Started</a></li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/83A37859">Status</a></li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/E46009A6">Updated</a></li>
<li class="header">Method Members</li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/6398CA9A">Equals<wbr>(object)<wbr></a></li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/D32C7065">Equals<wbr>(Job)<wbr></a></li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/6B850CA4">GetHashCode<wbr>()<wbr></a></li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/44CC0CAA">ToJson<wbr>()<wbr></a></li>
<li><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job/3F18735E">ToString<wbr>()<wbr></a></li>
</ul>
</section>
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<section class="content-header">
<h3><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job">Job</a>.</h3>
<h1>Started <small>Property</small></h1>
</section>
<section class="content">
<h1 id="Summary">Summary</h1>
<div class="lead">
Gets or Sets Started
</div>
<div class="panel panel-default">
<div class="panel-body">
<dl class="dl-horizontal">
<dt>Namespace</dt>
<dd><a href="/appveyor-api-client/api/AppVeyorClient.Model">AppVeyorClient<wbr>.Model</a></dd>
<dt>Containing Type</dt>
<dd><a href="/appveyor-api-client/api/AppVeyorClient.Model/Job">Job</a></dd>
</dl>
</div>
</div>
<h1 id="Syntax">Syntax</h1>
<pre><code>[DataMember(Name = "started", EmitDefaultValue = false)]
public DateTime? Started { get; set; }</code></pre>
<h1 id="Attributes">Attributes</h1>
<div class="box">
<div class="box-body no-padding table-responsive">
<table class="table table-striped table-hover two-cols">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td>DataMember</td>
<td></td>
</tr>
</tbody></table>
</div>
</div>
<h1 id="Value">Value</h1>
<div class="box">
<div class="box-body no-padding table-responsive">
<table class="table table-striped table-hover two-cols">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td>DateTime?</td>
<td></td>
</tr>
</tbody></table>
</div>
</div>
</section>
</div>
<!-- Footer -->
<footer class="main-footer">
</footer>
</div>
<div class="wrapper bottom-wrapper">
<footer class="bottom-footer">
Generated by <a href="https://wyam.io">Wyam</a>
</footer>
</div>
<a href="javascript:" id="return-to-top"><i class="fa fa-chevron-up"></i></a>
<script>
// Close the sidebar if we select an anchor link
$(".main-sidebar a[href^='#']:not('.expand')").click(function(){
$(document.body).removeClass('sidebar-open');
});
$(document).load(function() {
mermaid.initialize(
{
flowchart:
{
htmlLabels: false,
useMaxWidth:false
}
});
mermaid.init(undefined, ".mermaid")
$('svg').addClass('img-responsive');
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
});
hljs.initHighlightingOnLoad();
// Back to top
$(window).scroll(function() {
if ($(this).scrollTop() >= 200) { // If page is scrolled more than 50px
$('#return-to-top').fadeIn(1000); // Fade in the arrow
} else {
$('#return-to-top').fadeOut(1000); // Else fade out the arrow
}
});
$('#return-to-top').click(function() { // When arrow is clicked
$('body,html').animate({
scrollTop : 0 // Scroll to top of body
}, 500);
});
</script>
</body></html> | {
"content_hash": "7dfe196330ed7dd0264fe9e7c69a6070",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 169,
"avg_line_length": 41.38461538461539,
"alnum_prop": 0.5238256167624198,
"repo_name": "antunesl/appveyor-api-client",
"id": "0c514ab39a73286bcd19a377b011f3749f457fc3",
"size": "11838",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/api/AppVeyorClient.Model/Job/C96004D4.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "176063"
}
],
"symlink_target": ""
} |
title: Product Management
localeTitle: Gestão de produtos
---
## Gestão de produtos
O gerenciamento de produtos é uma função organizacional que assume a responsabilidade por todo o ciclo de vida dos produtos que estão sendo vendidos. Como uma função de negócios, o gerenciamento de produtos é responsável pela criação de valor para o cliente e benefícios mensuráveis para os negócios.
Existem algumas responsabilidades básicas comuns à maioria das funções de gerenciamento de produtos, tanto em empresas corporativas estabelecidas quanto em startups. Na maioria das vezes, o gerenciamento de produtos é responsável por entender os requisitos do cliente, defini-los e priorizá-los e trabalhar com a equipe de engenharia para construí-los. Definir a estratégia e definir o roteiro é muitas vezes considerado trabalho de entrada e levar o produto ao mercado é muitas vezes considerado como "de saída".
É importante entender as diferenças entre o gerenciamento de produtos de entrada e de saída porque um ótimo gerente de produto tem o conjunto diversificado de habilidades para fazer as duas coisas bem.
A diferença entre o Gerenciamento de Produtos e o Gerenciamento de Projetos é a escala e o ciclo de vida. Os gerentes de projeto garantem que vários produtos / serviços / projetos sejam entregues a um cliente, enquanto os gerentes de produto vão além do desenvolvimento e trabalham em prol da longevidade e da operação de um produto / serviço.
No desenvolvimento de jogos, podemos ver a clara mudança de Projetos para Produtos devido a jogos com planos de lançamento e estratégias de monetização mais detalhados.
### Gerenciamento de produtos de entrada
O gerenciamento de produtos de entrada envolve a coleta de pesquisa do cliente, a inteligência competitiva e as tendências do setor, além de definir a estratégia e gerenciar o roteiro do produto.
Estratégia e definição do produto (entrada)
* Estratégia e visão
* Entrevistas com o cliente
* Definindo recursos e requisitos
* Roteiros de construção
* Gerenciamento de Liberação
* Ir para o recurso para engenharia
* Treinamento de vendas e suporte
### Gerenciamento de produtos de saída
O gerenciamento de produtos de saída envolve responsabilidades de marketing de produtos, tais como: mensagens e branding, comunicação com o cliente, lançamentos de novos produtos, publicidade, relações públicas e eventos. Dependendo da organização, esses papéis podem ser desempenhados pela mesma pessoa ou por duas pessoas ou grupos diferentes que trabalham em conjunto.
Marketing de Produtos e Go-to-Market (Saída)
* Diferenciação competitiva
* Posicionamento e mensagens
* Nomenclatura e branding
* Comunicação com o cliente
* Lançamentos de produtos
* Relações de imprensa e analista
### Gerente de Produto
O gerenciamento de produtos continua a se expandir como uma profissão. A demanda por gerentes de produto qualificados está crescendo em todos os níveis. Há uma variedade de funções e responsabilidades, dependendo do nível de experiência. As oportunidades variam de um gerente de produto associado até o CPO.
A maioria dos gerentes de produto tem desempenhado papéis diferentes no início de suas carreiras. Muitas vezes engenheiros de software, engenheiros de vendas ou consultores de serviços profissionais crescem para o papel de Gerente de Produto. Mas em algumas empresas (por exemplo, Google, Facebook, ...), gerentes de produto júnior são recrutados diretamente da escola, apoiados por programas de carreira para ensiná-los no trabalho.
#### Mais Informações:
Página da Wikipedia: https://en.wikipedia.org/wiki/Product\_management | {
"content_hash": "b1f7b20a1c52c5d688dac33c3d9f326c",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 513,
"avg_line_length": 71.23529411764706,
"alnum_prop": 0.8084227910817506,
"repo_name": "otavioarc/freeCodeCamp",
"id": "29de2bc4b9047f485afa5a40b2194d5321f7f9e9",
"size": "3737",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "guide/portuguese/agile/product-management/index.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "35491"
},
{
"name": "HTML",
"bytes": "17600"
},
{
"name": "JavaScript",
"bytes": "777274"
}
],
"symlink_target": ""
} |
#ifndef itkObjectToObjectMultiMetricv4_h
#define itkObjectToObjectMultiMetricv4_h
#include "itkObjectToObjectMetric.h"
#include "itkArray.h"
#include <deque>
namespace itk
{
/** \class ObjectToObjectMultiMetricv4
* \brief This class takes one ore more ObjectToObject metrics and assigns weights to their derivatives
* to compute a single result.
*
* This class takes N ObjectToObject-derived component metrics and assigns a weight to each of the metrics'
* derivatives. It then computes a weighted measure of the metric. The GetValue() and
* GetValueAndDerivative() methods compute the measure and derivative using the following calculation:
*
* metric value = Sum_j ( w_j * M_j ) (see important note below)
*
* and the GetDerivative() method computes the derivative by computing:
*
* derivative = Sum_j ( w_j * dM_j / ||dM_j|| ) * ( Sum_j( ||dM_j|| ) / J )
*
* \note The metric value is unit-less, and thus it is difficult to compute a combined metric.
* This metric returns the metric value in three ways:
* 1) GetValue() returns the computed value of only the *first* component metric. This result
* is stored in m_Value and also returned by GetCurrentValue().
* 2) GetValueArray() returns an itkArray of metric values, one for each component metric. It
* only has meaning after a call to GetValue(), GetDerivative() or GetValueAndDerivative().
* 3) GetWeightedValue() returns a combined metric value of all component metrics, using the
* assigned weights. It only has meaning after a call to GetValue(), GetDerivative()
* or GetValueAndDerivative().
*
* The assigned weights are normalized internally to sum to one before use, and the weights
* default to 1/N, where N is the number of component metrics.
*
* \note Each component metric must use the same transform parameters object. That is, each metric
* must be evaluating the same parameters by evaluating the same transform. Except, if a component
* transform is a CompositeTransform, in which case it must be set to optimize a single transform,
* and that transform must be the same as the transform in other component metrics.
*
* \note Each component metric must be setup independently, except for the metric transforms
* which can optionally be set from this class. That is, each component's images or point sets,
* fixed transforms and options must be set independently. The only methods in this metric for setting
* up the component metrics is SetMovingTransform(). The corresponding
* Set accesor is also available. When Set{Fixed/Moving}Transform() is not used
* this metric's m_{Fixed/Moving}Transform member is assigned to the
* fixed/moving transform assigned to the first component metric.
*
* Each component will be initialized by this metric in the call to Initialize().
*
* \note When used with an itkRegistrationParameterScalesEstimator estimator, and the multi-metric
* holds one or more point-set metrics, the user must assign a virtual domain point set for sampling
* to ensure proper sampling within the point set metrics. In order to generate valid shift estimations,
* such a virtual domain point set must include mapped points from the fixed point set.
* See RegistrationParameterScalesEstimator::SetVirtualDomainPointSet() and
* PointSetToPointSetMetricv4::GetVirtualTransformedPointSet(). If there are two different point sets,
* then the virtual domain point set should be a union of the two for completeness.
*
* \note If the user does not explicitly assign a virtual domain, then the first valid virtual
* domain found in the component metrics will be used a virtual domain for this multi-metric,
* which will be queried by classes such as registration parameter estimators.
* Each componenet metric will still use its own virtual domain for internal calculations when
* evaluated, so it is possible to use different virtual domains for each metric if desired.
* If no component metric has a virtual domain defined, then by default the virtual domain is
* unbounded.
* When the transform is high dimensional (e.g. DisplacementFieldTransform) then there must
* be a virtual domain that matches the space of the transform field. Note that when used
* with a DisplacementFieldTransform, both Image and PointSet metrics will automatically
* create a matching virtual domain during initialization if one has not been assigned by the user.
*
* \ingroup ITKMetricsv4
*/
template<unsigned int TFixedDimension, unsigned int TMovingDimension, typename TVirtualImage = Image<double, TFixedDimension>, class TInternalComputationValueType = double >
class ObjectToObjectMultiMetricv4:
public ObjectToObjectMetric<TFixedDimension, TMovingDimension, TVirtualImage, TInternalComputationValueType>
{
public:
/** Standard class typedefs */
typedef ObjectToObjectMultiMetricv4 Self;
typedef ObjectToObjectMetric<TFixedDimension, TMovingDimension, TVirtualImage, TInternalComputationValueType> Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** Run-time type information (and related methods). */
itkTypeMacro(ObjectToObjectMultiMetricv4, ObjectToObjectMetric);
/** New macro for creation of through a Smart Pointer */
itkNewMacro( Self );
/** Types inherited from Superclass. */
typedef typename Superclass::MeasureType MeasureType;
typedef typename Superclass::DerivativeType DerivativeType;
typedef typename Superclass::DerivativeValueType DerivativeValueType;
typedef typename Superclass::ParametersType ParametersType;
typedef typename Superclass::ParametersValueType ParametersValueType;
typedef typename Superclass::NumberOfParametersType NumberOfParametersType;
typedef typename Superclass::CoordinateRepresentationType CoordinateRepresentationType;
typedef typename Superclass::MovingTransformType MovingTransformType;
typedef typename Superclass::FixedTransformType FixedTransformType;
/** typedefs related to the metric queue */
typedef Superclass MetricType;
typedef typename MetricType::Pointer MetricBasePointer;
typedef typename MetricType::ConstPointer MetricBaseConstPointer;
typedef std::deque<MetricBasePointer> MetricQueueType;
typedef typename Superclass::ObjectType ObjectType;
typedef typename DerivativeType::ValueType WeightValueType;
typedef Array<WeightValueType> WeightsArrayType;
typedef Array<MeasureType> MetricValueArrayType;
itkSetMacro(MetricWeights,WeightsArrayType);
itkGetMacro(MetricWeights,WeightsArrayType);
/** Add a metric to the queue */
void AddMetric( MetricType* metric );
/** Clear the metric queue */
void ClearMetricQueue();
/** Get the number of metrics */
SizeValueType GetNumberOfMetrics() const;
void Initialize(void) throw ( itk::ExceptionObject ) ITK_OVERRIDE;
/** Set fixed object (image, point set, etc.)*/
virtual void SetFixedObject( const ObjectType *itkNotUsed( object ) ) ITK_OVERRIDE
{
itkExceptionMacro( "A single object should not be specified for the multi metric.");
}
/** Set moving object (image, point set, etc.)*/
virtual void SetMovingObject( const ObjectType *itkNotUsed( object ) ) ITK_OVERRIDE
{
itkExceptionMacro( "A single object should not be specified for the multi metric.");
}
/** Set each of the component metrics to use this moving transform. */
virtual void SetMovingTransform( MovingTransformType * ) ITK_OVERRIDE;
/** Set each of the component metrics to use this fixed transform. */
virtual void SetFixedTransform( FixedTransformType * ) ITK_OVERRIDE;
/** Evaluate the metrics and return the value of only the *first* metric.
* \sa GetValueArray
* \sa GetWeightedValue
*/
MeasureType GetValue() const ITK_OVERRIDE;
virtual void GetDerivative( DerivativeType & ) const ITK_OVERRIDE;
/** Evaluate the metric value and derivative.
* \note \param value will contain the value of only the *first* metric on return.
* \param derivative holds the combined derivative on return.
*
* \sa GetValueArray
* \sa GetWeightedValue */
void GetValueAndDerivative(MeasureType & value, DerivativeType & derivative) const ITK_OVERRIDE;
/** Returns an itkArray of metric values, one for each component metric. It
* only has meaning after a call to GetValue(), GetDerivative() or GetValueAndDerivative(). */
MetricValueArrayType GetValueArray() const;
/** Returns a combined metric value of all component metrics, using the
* assigned weights. It only has meaning after a call to GetValue(), GetDerivative() or GetValueAndDerivative(). */
MeasureType GetWeightedValue() const;
/** Get the metrics queue */
const MetricQueueType & GetMetricQueue() const;
virtual bool SupportsArbitraryVirtualDomainSamples( void ) const ITK_OVERRIDE;
typedef typename Superclass::MetricCategoryType MetricCategoryType;
/** Get metric category */
virtual MetricCategoryType GetMetricCategory() const ITK_OVERRIDE
{
return Superclass::MULTI_METRIC;
}
protected:
ObjectToObjectMultiMetricv4();
virtual ~ObjectToObjectMultiMetricv4();
void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
private:
//purposely not implemented
ObjectToObjectMultiMetricv4(const Self &);
void operator=(const Self &);
MetricQueueType m_MetricQueue;
WeightsArrayType m_MetricWeights;
mutable MetricValueArrayType m_MetricValueArray;
};
} //end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkObjectToObjectMultiMetricv4.hxx"
#endif
#endif
| {
"content_hash": "bc8c4d1441513a2a923097dbd047a417",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 173,
"avg_line_length": 48.30769230769231,
"alnum_prop": 0.7334792993630573,
"repo_name": "BlueBrain/ITK",
"id": "a5623d25fa113973fc4f5544d99ec7a6a2757a9d",
"size": "10823",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "Modules/Registration/Metricsv4/include/itkObjectToObjectMultiMetricv4.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "306"
},
{
"name": "C",
"bytes": "29474934"
},
{
"name": "C++",
"bytes": "50000734"
},
{
"name": "CMake",
"bytes": "2170454"
},
{
"name": "CSS",
"bytes": "24960"
},
{
"name": "DIGITAL Command Language",
"bytes": "709"
},
{
"name": "FORTRAN",
"bytes": "2241251"
},
{
"name": "HTML",
"bytes": "208088"
},
{
"name": "Io",
"bytes": "1833"
},
{
"name": "Java",
"bytes": "28598"
},
{
"name": "Lex",
"bytes": "6877"
},
{
"name": "Makefile",
"bytes": "13192"
},
{
"name": "Objective-C",
"bytes": "49378"
},
{
"name": "Objective-C++",
"bytes": "6591"
},
{
"name": "OpenEdge ABL",
"bytes": "85139"
},
{
"name": "Perl",
"bytes": "19692"
},
{
"name": "Prolog",
"bytes": "4406"
},
{
"name": "Python",
"bytes": "845236"
},
{
"name": "Ruby",
"bytes": "296"
},
{
"name": "Shell",
"bytes": "131214"
},
{
"name": "Tcl",
"bytes": "74786"
},
{
"name": "XSLT",
"bytes": "195448"
},
{
"name": "Yacc",
"bytes": "20428"
}
],
"symlink_target": ""
} |
Some useful scripts
`merge-branch.sh` - Script to merge git branch and ignore changes in branch specific files
| {
"content_hash": "8ecd640e40548d4190f60648bfdb2068",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 90,
"avg_line_length": 37.333333333333336,
"alnum_prop": 0.7946428571428571,
"repo_name": "artemkin/scripts",
"id": "177a64ec41febed00d5e643138f4c410b2140513",
"size": "122",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Shell",
"bytes": "1369"
}
],
"symlink_target": ""
} |
//
// RBQFetchRequest.h
// RBQFetchedResultsControllerTest
//
// Created by Adam Fish on 1/2/15.
// Copyright (c) 2015 Roobiq. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Realm/Realm.h>
@class RBQFetchRequest;
/**
* This class is used by the RBQFetchedResultsController to represent the properties of the fetch. The RBQFetchRequest is specific to one RLMObject and uses an NSPredicate and array of RLMSortDescriptors to define the query.
*/
@interface RBQFetchRequest : NSObject
/**
* RLMObject class name for the fetch request
*/
@property (nonatomic, readonly) NSString *entityName;
/**
* The Realm in which the entity for the fetch request is persisted.
*/
@property (nonatomic, readonly) RLMRealm *realm;
/**
* Path for the Realm associated with the fetch request
*/
@property (nonatomic, readonly) NSString *realmPath;
/**
* The identifier of the in-memory Realm.
*
* @warning return nil if fetch request initialized without in-memory Realm
*/
@property (nonatomic, readonly) NSString *inMemoryRealmId;
/**
* Predicate supported by Realm
*
* http://realm.io/docs/cocoa/0.89.2/#querying-with-predicates
*/
@property (nonatomic, strong) NSPredicate *predicate;
/**
* Array of RLMSortDescriptors
*
* http://realm.io/docs/cocoa/0.89.2/#ordering-results
*/
@property(nonatomic, strong) NSArray *sortDescriptors;
/**
* Constructor method to create a fetch request for a given entity name in a specific Realm.
*
* @param entityName Class name for the RLMObject
* @param realm RLMRealm in which the RLMObject is persisted (if passing in-memory Realm, make sure to keep a strong reference elsewhere since fetch request only stores the path)
* @param predicate NSPredicate that represents the search query
*
* @return A new instance of RBQFetchRequest
*/
+ (RBQFetchRequest *)fetchRequestWithEntityName:(NSString *)entityName
inRealm:(RLMRealm *)realm
predicate:(NSPredicate *)predicate;
/**
* Constructor method to create a fetch request for a given entity name in an in-memory Realm.
*
* @param entityName Class name for the RLMObject
* @param inMemoryRealm In-memory RLMRealm in which the RLMObject is persisted (caller must retain strong reference as fetch request does not)
* @param predicate NSPredicate that represents the search query
*
* @return A new instance of RBQFetchRequest
*/
+ (RBQFetchRequest *)fetchRequestWithEntityName:(NSString *)entityName
inMemoryRealm:(RLMRealm *)inMemoryRealm
predicate:(NSPredicate *)predicate;
/**
* Retrieve all the RLMObjects for this fetch request in its realm.
*
* @return RLMResults for all the objects in the fetch request (not thread-safe).
*/
- (RLMResults *)fetchObjects;
/**
* Retrieve all the RLMObjects for this fetch request in the specified realm.
*
* @param realm RLMRealm in which the RLMObjects are persisted
*
* @return RLMResults for all the objects in the fetch request (not thread-safe).
*/
- (RLMResults *)fetchObjectsInRealm:(RLMRealm *)realm;
/**
* Should this object be in our fetch results?
*
* Intended to be used by the RBQFetchedResultsController to evaluate incremental changes. For
* simple fetch requests this just evaluates the NSPredicate, but subclasses may have a more
* complicated implementaiton.
*
* @param object Realm object of appropriate type
*
* @return YES if performing fetch would include this object
*/
- (BOOL)evaluateObject:(RLMObject *)object;
/**
* Create RBQFetchRequest in RLMRealm instance with an entity name
*
* @param entityName Class name for the RLMObject
* @param realm RLMRealm in which the RLMObject is persisted
*
* @return A new instance of RBQFetchRequest
*/
- (instancetype)initWithEntityName:(NSString *)entityName
inRealm:(RLMRealm *)realm;
@end
| {
"content_hash": "46a6e491ec790345f2a0fc43eb102faf",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 225,
"avg_line_length": 32.67213114754098,
"alnum_prop": 0.7109884596086302,
"repo_name": "azfx/RBQFetchedResultsController",
"id": "d187c482c44e6e81fa506cf9043bcdc8ff9b0958",
"size": "3986",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "RBQFetchedResultsController/RBQFetchRequest.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "167168"
},
{
"name": "Ruby",
"bytes": "1565"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('workflow', '0032_auto_20190127_1536'),
('tola_management', '0002_indicatorauditlog'),
]
operations = [
migrations.CreateModel(
name='ProgramAdminAuditLog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateTimeField(auto_now_add=True, verbose_name='Modification Date')),
('change_type', models.CharField(max_length=255, verbose_name='Modification Type')),
('previous_entry', models.TextField()),
('new_entry', models.TextField()),
('admin_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='workflow.TolaUser')),
('program', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='workflow.Program')),
],
),
]
| {
"content_hash": "1c34e8d3b1b6c4169e4abf696ade0c5a",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 137,
"avg_line_length": 41.851851851851855,
"alnum_prop": 0.6132743362831858,
"repo_name": "mercycorps/TolaActivity",
"id": "faab5dd6e20c1594857df62fb2ef70aad60eff03",
"size": "1203",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tola_management/migrations/0003_programadminauditlog.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "432462"
},
{
"name": "Dockerfile",
"bytes": "109"
},
{
"name": "HTML",
"bytes": "437661"
},
{
"name": "JavaScript",
"bytes": "5654491"
},
{
"name": "Python",
"bytes": "1741812"
},
{
"name": "Shell",
"bytes": "4752"
}
],
"symlink_target": ""
} |
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
</resources>
| {
"content_hash": "bfbd3f8baaf05222c691ab25f08a6c83",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 89,
"avg_line_length": 34.9,
"alnum_prop": 0.669054441260745,
"repo_name": "eliseomartelli/Logarithms",
"id": "6ebe5f79ee9510459ae0a0462a46434c256c3173",
"size": "698",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/src/main/res/values/styles.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "3296"
}
],
"symlink_target": ""
} |
package test;
public class Maison {
}
| {
"content_hash": "626f34582a81d0669a40f2f5ce72bed3",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 21,
"avg_line_length": 12.666666666666666,
"alnum_prop": 0.7368421052631579,
"repo_name": "FranckW/projet1_opl",
"id": "b69bd8be25cd312998e4477358e5247890f89612",
"size": "38",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/repositoryTest/test/Maison.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "36836"
},
{
"name": "CSS",
"bytes": "13299"
},
{
"name": "HTML",
"bytes": "2817088"
},
{
"name": "Java",
"bytes": "1433227"
},
{
"name": "JavaScript",
"bytes": "21796"
},
{
"name": "Shell",
"bytes": "47486"
},
{
"name": "XSLT",
"bytes": "4598"
}
],
"symlink_target": ""
} |
package logging
import (
"context"
"net/http"
"github.com/vmware/govmomi/vapi/rest"
)
const applianceLoggingForwardingPath = "/appliance/logging/forwarding"
// Manager provides convenience methods to configure appliance logging forwarding.
type Manager struct {
*rest.Client
}
// NewManager creates a new Manager with the given client
func NewManager(client *rest.Client) *Manager {
return &Manager{
Client: client,
}
}
// Forwarding represents configuration for log message forwarding.
type Forwarding struct {
Hostname string `json:"hostname,omitempty"`
Port int `json:"port,omitempty"`
Protocol string `json:"protocol,omitempty"`
}
func (m *Manager) getManagerResource() *rest.Resource {
return m.Resource(applianceLoggingForwardingPath)
}
// Forwarding returns all logging forwarding config.
func (m *Manager) Forwarding(ctx context.Context) ([]Forwarding, error) {
r := m.getManagerResource()
var res []Forwarding
return res, m.Do(ctx, r.Request(http.MethodGet), &res)
}
| {
"content_hash": "24ce3832be6385a4d8af10de26fb728f",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 82,
"avg_line_length": 24,
"alnum_prop": 0.7529761904761905,
"repo_name": "bruceadowns/govmomi",
"id": "cab70d3130aac05c89d7c6af29a1215002840e56",
"size": "1564",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "vapi/appliance/logging/forwarding.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Emacs Lisp",
"bytes": "69806"
},
{
"name": "Go",
"bytes": "9696931"
},
{
"name": "Makefile",
"bytes": "7387"
},
{
"name": "Ruby",
"bytes": "26104"
},
{
"name": "Shell",
"bytes": "240973"
}
],
"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 (1.8.0_162) on Sat Feb 02 18:57:43 CET 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class com.communote.plugins.api.rest.resource.note.property.PropertyResourceHelper (Communote 3.5 API)</title>
<meta name="date" content="2019-02-02">
<link rel="stylesheet" type="text/css" href="../../../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.communote.plugins.api.rest.resource.note.property.PropertyResourceHelper (Communote 3.5 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../../../com/communote/plugins/api/rest/resource/note/property/PropertyResourceHelper.html" title="class in com.communote.plugins.api.rest.resource.note.property">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../../index.html?com/communote/plugins/api/rest/resource/note/property/class-use/PropertyResourceHelper.html" target="_top">Frames</a></li>
<li><a href="PropertyResourceHelper.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class com.communote.plugins.api.rest.resource.note.property.PropertyResourceHelper" class="title">Uses of Class<br>com.communote.plugins.api.rest.resource.note.property.PropertyResourceHelper</h2>
</div>
<div class="classUseContainer">No usage of com.communote.plugins.api.rest.resource.note.property.PropertyResourceHelper</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../../../com/communote/plugins/api/rest/resource/note/property/PropertyResourceHelper.html" title="class in com.communote.plugins.api.rest.resource.note.property">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../../index.html?com/communote/plugins/api/rest/resource/note/property/class-use/PropertyResourceHelper.html" target="_top">Frames</a></li>
<li><a href="PropertyResourceHelper.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2019 <a href="https://communote.github.io/">Communote team</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "b4cfc377240fa7ae6805b270c7056b1f",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 215,
"avg_line_length": 41.57936507936508,
"alnum_prop": 0.615957243748807,
"repo_name": "Communote/communote.github.io",
"id": "abf60ccda8755cfeb9ed09c33d76ddde448e41c1",
"size": "5239",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "generated/javadoc/com/communote/plugins/api/rest/resource/note/property/class-use/PropertyResourceHelper.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "213611"
},
{
"name": "HTML",
"bytes": "526693"
},
{
"name": "JavaScript",
"bytes": "16683"
},
{
"name": "Ruby",
"bytes": "6917"
},
{
"name": "Shell",
"bytes": "513"
}
],
"symlink_target": ""
} |
<?php
namespace AddingComposerBlocks;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new C33s\ConstructionKitBundle\C33sConstructionKitBundle(),
new C33s\SymfonyConfigManipulatorBundle\C33sSymfonyConfigManipulatorBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}
| {
"content_hash": "af0838f1639c4111b6b9d30159b9db23",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 92,
"avg_line_length": 40.05,
"alnum_prop": 0.6803995006242197,
"repo_name": "vworldat/C33sConstructionKitBundle",
"id": "9c7a30acd38c1fe09e07e5cebd1882779a4a6854",
"size": "1602",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Tests/Fixtures/refresh-blocks/adding-composer-blocks/expected/AppKernel.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "77454"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">
<chapter>
<header>
<copyright>
<year>2007</year><year>2013</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</legalnotice>
<title>EDoc Release Notes</title>
<prepared>otp_appnotes</prepared>
<docno>nil</docno>
<date>nil</date>
<rev>nil</rev>
<file>notes.xml</file>
</header>
<p>This document describes the changes made to the EDoc
application.</p>
<section><title>Edoc 0.7.18</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p> Assign correct names to list arguments. </p>
<p>
Own Id: OTP-13234 Aux Id: ERL-63 </p>
</item>
</list>
</section>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>
Unless the <c>sort_functions</c> option is <c>true</c>,
<c>edoc_layout</c> does not sort functions.</p>
<p>
Own Id: OTP-13302</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.17</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>
Remove functionality related to packages</p>
<p>
Own Id: OTP-12431</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.16</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p>
Maps: Properly align union typed assoc values in
documentation</p>
<p>
Own Id: OTP-12190</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.15</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p>
Fix spec to doc generation from erl_docgen and edoc for
maps</p>
<p>
Own Id: OTP-12058</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.14</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p> The default encoding for Erlang source files is now
UTF-8. As a temporary measure to ease the transition from
the old default of Latin-1, if EDoc encounters byte
sequences that are not valid UTF-8 sequences, EDoc will
re-try in Latin-1 mode. This workaround will be removed
in a future release. </p>
<p>
Own Id: OTP-12008</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.13</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p>
Application upgrade (appup) files are corrected for the
following applications: </p>
<p>
<c>asn1, common_test, compiler, crypto, debugger,
dialyzer, edoc, eldap, erl_docgen, et, eunit, gs, hipe,
inets, observer, odbc, os_mon, otp_mibs, parsetools,
percept, public_key, reltool, runtime_tools, ssh,
syntax_tools, test_server, tools, typer, webtool, wx,
xmerl</c></p>
<p>
A new test utility for testing appup files is added to
test_server. This is now used by most applications in
OTP.</p>
<p>
(Thanks to Tobias Schlager)</p>
<p>
Own Id: OTP-11744</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.12.1</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>
The encoding of the <c>notes.xml</c> file has been
changed from latin1 to utf-8 to avoid future merge
problems.</p>
<p>
Own Id: OTP-11310</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.12</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p>EDoc sometimes failed to associate a comment with the
preceding type declaration. This bug has been fixed.
(Thanks to Serge Aleynikov for reporting the bug.) </p>
<p>
Own Id: OTP-10866</p>
</item>
</list>
</section>
<section><title>Improvements and New Features</title>
<list>
<item>
<p> Miscellaneous updates due to Unicode support. </p>
<p>
Own Id: OTP-10820</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.11</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p> Since EDoc 0.7.7 (R14B02) separate values of union
types can be annotated. However, the parser has hitherto
chosen not to add the necessary parentheses due to
backwards compatibility. </p> <p> From this release on
code traversing the output of <c>edoc_parser</c> needs to
take care of parentheses around separate values of union
types. Examples of such code are layout modules and
doclet modules. </p>
<p>
*** POTENTIAL INCOMPATIBILITY ***</p>
<p>
Own Id: OTP-10195</p>
</item>
<item>
<p> Support for Unicode has been implemented. </p>
<p>
Own Id: OTP-10302</p>
</item>
<item>
<p>Where necessary a comment stating encoding has been
added to Erlang files. The comment is meant to be removed
in Erlang/OTP R17B when UTF-8 becomes the default
encoding. </p>
<p>
Own Id: OTP-10630</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.10</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p>
List behaviour callbacks in Edoc when using -callback
attribute. (Thanks to Magnus Henoch.)</p>
<p>
Added special case for file names under Windows. (Thanks
to Beads Land-Trujillo.)</p>
<p>
Own Id: OTP-10174</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.9.1</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>
Miscellaneous documentation build updates</p>
<p>
Own Id: OTP-9813</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.9</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p><c>no_return</c> is a new built-in type. </p>
<p>
Own Id: OTP-9350</p>
</item>
<item>
<p>
synchronized with edoc development version</p>
<p>
forgot to ensure that xmerl is found in path for
include_lib to work</p>
<p>
fix -spec declaration that doesn't work in R13B04</p>
<p>
eliminate warnings about unused imports</p>
<p>
removed CVS-keywords from source files (Thanks to Richard
Carlsson )</p>
<p>
Own Id: OTP-9463</p>
</item>
<item>
<p>
Add a proplist() type</p>
<p>
Recently I was adding specs to an API and found that
there is no canonical proplist() type defined. (Thanks to
Ryan Zezeski)</p>
<p>
Own Id: OTP-9499</p>
</item>
<item>
<p>
Removed some never-matching clauses reported by dialyzer
Fix macro expansion in comments following Erlang types
URI-escape bytes as two hex digits always (reported by
Alfonso De Gregorio) Updated author e-mail Recognize some
more URI schemas in wiki text, in particular https
(Thanks to Richard Carlsson)</p>
<p>
Own Id: OTP-9590</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.8</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p>
Fix infinite loop for malformed edoc input</p>
<p>
When processing an edoc comment with ``` in it, if the
comment ends without a matching ''' then an infinite loop
occurs in the function edoc_wiki:strip_empty_lines/2.
This change fixes that by adding a clause to return from
the function upon the end of the comment input. This
allows an error to be thrown to indicate the problem,
which is the same behaviour as leaving either `` or `
unmatched. (Thanks to Taylor Venable)</p>
<p>
Own Id: OTP-9165</p>
</item>
<item>
<p> Bugs concerning the option
<c>report_missing_types</c> that was added in EDoc-0.7.7
have been corrected: the option was misspelled in the
source, and local definitions as well as the function
tags <c>@private</c> and <c>@hidden</c> were not handled
correctly. (Thanks to Manolis Papadakis.) </p>
<p>
Own Id: OTP-9301</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.7</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p> Add encoding when parsing Wiki text. EDoc used to
fail on strings such as "äåö". (Thanks to Richard
Carlsson.) </p>
<p>
Own Id: OTP-9109</p>
</item>
</list>
</section>
<section><title>Improvements and New Features</title>
<list>
<item>
<p> It is now possible to use Erlang specifications and
types in EDoc documentation. Erlang specifications and
types will be used unless there is also a function
specification (<c>@spec</c>) or a type alias
(<c>@type</c>) with the same name. In the current
implementation the placement of <c>-spec</c> matters: it
should be placed where the <c>@spec</c> would otherwise
have been placed. </p>
<p>Not all Erlang types are included in the
documentation, but only those exported by some
<c>export_type</c> declaration or used by some documented
Erlang specification (<c>-spec</c>). </p>
<p> There is currently no support for overloaded Erlang
specifications. </p>
<p> The syntax definitions of EDoc have been augmented to
cope with most of the Erlang types. (But we recommend
that Erlang types should be used instead.) </p>
<p> <c>edoc:read_source()</c> takes one new option,
<c>report_missing_types</c>. <c>edoc_layout:module()</c>
takes one new option, <c>pretty_printer</c>. </p>
<p>
Own Id: OTP-8525</p>
</item>
<item>
<p> The <c>edoc_lib</c> module is meant to be private,
but since it is referred to from other man pages it has
been included in the OTP documentation. The modifications
introduced in this ticket make all functions private
except those referred to from other pages. </p>
<p>
Own Id: OTP-9110</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.6.8</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>
Compiler warnings were eliminated.</p>
<p>
Own Id: OTP-8855</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.6.7</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p>Edoc now uses the new API functions to <c>inets</c>
instead of the deprecated ones.</p>
<p>
Own Id: OTP-8749</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.6.6</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>The documentation is now possible to build in an open
source environment after a number of bugs are fixed and
some features are added in the documentation build
process. </p>
<p>- The arity calculation is updated.</p>
<p>- The module prefix used in the function names for
bif's are removed in the generated links so the links
will look like
"http://www.erlang.org/doc/man/erlang.html#append_element-2"
instead of
"http://www.erlang.org/doc/man/erlang.html#erlang:append_element-2".</p>
<p>- Enhanced the menu positioning in the html
documentation when a new page is loaded.</p>
<p>- A number of corrections in the generation of man
pages (thanks to Sergei Golovan)</p>
<p>- The legal notice is taken from the xml book file so
OTP's build process can be used for non OTP
applications.</p>
<p>
Own Id: OTP-8343</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.6.5</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>
The documentation is now built with open source tools
(xsltproc and fop) that exists on most platforms. One
visible change is that the frames are removed.</p>
<p>
Own Id: OTP-8201</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.6.4</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>
Miscellaneous updates.</p>
<p>
Own Id: OTP-8190</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.6.3</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>The copyright notices have been updated.</p>
<p>
Own Id: OTP-7851</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.6.2</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>
Minor updates.</p>
<p>
Own Id: OTP-7642</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.6.1</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
<p>
Correction to work with new versions of STDLIB that no
longer has the <c>erl_internal:obsolete/3</c> function.</p>
<p>
Own Id: OTP-7539</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.6</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>
Minor changes.</p>
<p>
Own Id: OTP-7388</p>
</item>
</list>
</section>
</section>
<section><title>Edoc 0.7.5</title>
<section><title>Improvements and New Features</title>
<list>
<item>
<p>
Minor updates, mostly cosmetic.</p>
<p>
Own Id: OTP-7243</p>
</item>
</list>
</section>
</section>
<section>
<title>Edoc 0.7.3</title>
<section>
<title>Improvements and New Features</title>
<list type="bulleted">
<item>
<p>Minor Makefile changes.</p>
<p>Own Id: OTP-6689</p>
</item>
<item>
<p>Dialyzer warnings were eliminated.</p>
<p>Own Id: OTP-6737</p>
</item>
</list>
</section>
</section>
<section>
<title>EDoc 0.7.2</title>
<section>
<title>Fixed Bugs and Malfunctions</title>
<list type="bulleted">
<item>
<p>Some missing files have been added:
<c><![CDATA[~/include/edoc_doclet.hrl]]></c>, <c><![CDATA[~/priv/edoc.dtd]]></c>,
<c><![CDATA[~/priv/erlang.png]]></c></p>
<p>Own Id: OTP-6457</p>
</item>
</list>
</section>
<section>
<title>Improvements and New Features</title>
<list type="bulleted">
<item>
<list type="bulleted">
<item>Undefined macros only cause warnings, not errors.</item>
<item>New, built-in <c><![CDATA[@version]]></c> macro.</item>
<item>Documented the <c><![CDATA[@docfile]]></c> and <c><![CDATA[@headerfile]]></c>
generic tags.</item>
<item>Added recognition of <c><![CDATA["TODO:"]]></c> as a wiki
equivalent for <c><![CDATA[@todo]]></c> tags.</item>
<item>Added documentation about overview pages.</item>
<item><c><![CDATA['where']]></c> and <c><![CDATA[',']]></c> are allowed as
separators in specs.</item>
<item>Corrected ambiguity in spec grammar (possible
incompatibility issue - parentheses may need to be added
in some cases, in existing code).</item>
<item>Experimental (and undocumented) support for
<c><![CDATA[@param]]></c> and <c><![CDATA[@return]]></c> tags and corresponding
<c><![CDATA["..."]]></c> annotations on <c><![CDATA[@spec]]></c> parameters.</item>
</list>
<p>*** POTENTIAL INCOMPATIBILITY ***</p>
<p>Own Id: OTP-6568</p>
</item>
</list>
</section>
</section>
<section>
<title>EDoc 0.7.1</title>
<section>
<title>Fixed Bugs and Malfunctions</title>
<list type="bulleted">
<item>
<p>Fixed some broken links in the documentation.</p>
<p>Own Id: OTP-6419</p>
</item>
</list>
</section>
</section>
<section>
<title>EDoc 0.7.0</title>
<p>Miscellaneous changes.</p>
</section>
</chapter>
| {
"content_hash": "9d6a72c428ce77ce2350b3cec8b31571",
"timestamp": "",
"source": "github",
"line_count": 659,
"max_line_length": 95,
"avg_line_length": 27.088012139605464,
"alnum_prop": 0.5773346031034676,
"repo_name": "johanclaesson/otp",
"id": "3f9d26796a6d97814eec94a7bb853e74232ba951",
"size": "17854",
"binary": false,
"copies": "3",
"ref": "refs/heads/maint",
"path": "lib/edoc/doc/src/notes.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "30356"
},
{
"name": "Assembly",
"bytes": "134967"
},
{
"name": "Batchfile",
"bytes": "1186"
},
{
"name": "C",
"bytes": "13602405"
},
{
"name": "C++",
"bytes": "1673501"
},
{
"name": "CSS",
"bytes": "12282"
},
{
"name": "DIGITAL Command Language",
"bytes": "21"
},
{
"name": "DTrace",
"bytes": "230095"
},
{
"name": "Emacs Lisp",
"bytes": "378956"
},
{
"name": "Erlang",
"bytes": "73296097"
},
{
"name": "Groff",
"bytes": "1954"
},
{
"name": "HTML",
"bytes": "433110"
},
{
"name": "Java",
"bytes": "661941"
},
{
"name": "JavaScript",
"bytes": "33014"
},
{
"name": "Logos",
"bytes": "8702"
},
{
"name": "M4",
"bytes": "343729"
},
{
"name": "Makefile",
"bytes": "1492666"
},
{
"name": "NSIS",
"bytes": "27847"
},
{
"name": "Objective-C",
"bytes": "4115"
},
{
"name": "Perl",
"bytes": "96949"
},
{
"name": "Python",
"bytes": "117380"
},
{
"name": "Shell",
"bytes": "399538"
},
{
"name": "Standard ML",
"bytes": "545"
},
{
"name": "Tcl",
"bytes": "9372"
},
{
"name": "XSLT",
"bytes": "221867"
}
],
"symlink_target": ""
} |
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include "FrictionContactProblem_as_ConvexQP.h"
#include "FrictionContactProblem.h"
#include "ConvexQP.h"
#include "projectionOnCone.h"
#include "projectionOnCylinder.h"
#include "projectionOnDisk.h"
#include "numerics_verbose.h"
#include "SiconosBlas.h"
#include "NumericsMatrix.h"
#include "SolverOptions.h"
/* #define DEBUG_STDOUT */
/* #define DEBUG_MESSAGES */
#include "debug.h"
void Projection_ConvexQP_FC3D_Cylinder(void *cqpIn, double *x, double *PX)
{
DEBUG_PRINT("Projection_ConvexQP_FC3D_Cylinder(void *cqpIn, double *x, double *PX)\n")
ConvexQP * cqp = (ConvexQP *) cqpIn;
FrictionContactProblem_as_ConvexQP* pb = (FrictionContactProblem_as_ConvexQP*)cqp->env;
FrictionContactProblem * fc3d = pb->fc3d;
SolverOptions * options = pb->options;
//frictionContact_display(fc3d);
int contact =0;
int nLocal = fc3d->dimension;
int n = fc3d->numberOfContacts* nLocal;
cblas_dcopy(n , x , 1 , PX, 1);
for (contact = 0 ; contact < fc3d->numberOfContacts ; ++contact)
{
projectionOnCylinder(&PX[ contact * nLocal ], options->dWork[contact]);
}
}
void Projection_ConvexQP_FC3D_Disk(void *cqpIn, double *x, double *PX)
{
DEBUG_PRINT("Projection_ConvexQP_FC3D_Cylinder(void *cqpIn, double *x, double *PX)\n")
ConvexQP * cqp = (ConvexQP *) cqpIn;
FrictionContactProblem_as_ConvexQP* pb = (FrictionContactProblem_as_ConvexQP*)cqp->env;
FrictionContactProblem * fc3d = pb->fc3d;
SolverOptions * options = pb->options;
//frictionContact_display(fc3d);
int nLocal = 2;
int n = fc3d->numberOfContacts* nLocal;
cblas_dcopy(n , x , 1 , PX, 1);
for (int contact = 0 ; contact < fc3d->numberOfContacts ; ++contact)
{
projectionOnDisk(&PX[ contact * nLocal ], options->dWork[contact]);
}
}
| {
"content_hash": "ce7fd93dda147ded61fd8185d05fd2de",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 89,
"avg_line_length": 29.704918032786885,
"alnum_prop": 0.7041942604856513,
"repo_name": "fperignon/siconos",
"id": "2410fe6b73c036fa0531c2839ec823f3b04c5c9f",
"size": "2502",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "numerics/src/FrictionContact/FrictionContactProblem_as_ConvexQP.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2725"
},
{
"name": "C",
"bytes": "4861202"
},
{
"name": "C++",
"bytes": "9363519"
},
{
"name": "CMake",
"bytes": "514834"
},
{
"name": "CSS",
"bytes": "12791"
},
{
"name": "Dockerfile",
"bytes": "233"
},
{
"name": "Fortran",
"bytes": "2539066"
},
{
"name": "GAMS",
"bytes": "5614"
},
{
"name": "HTML",
"bytes": "4331842"
},
{
"name": "Makefile",
"bytes": "12197"
},
{
"name": "Nix",
"bytes": "3086"
},
{
"name": "Python",
"bytes": "1479527"
},
{
"name": "Shell",
"bytes": "50594"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.