text
stringlengths 4
5.48M
| meta
stringlengths 14
6.54k
|
---|---|
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
inventory: yaml
version_added: "2.4"
short_description: Uses a specifically YAML file as inventory source.
description:
- "YAML based inventory, starts with the 'all' group and has hosts/vars/children entries."
- Host entries can have sub-entries defined, which will be treated as variables.
- Vars entries are normal group vars.
- "Children are 'child groups', which can also have their own vars/hosts/children and so on."
- File MUST have a valid extension, defined in configuration
notes:
- It takes the place of the previously hardcoded YAML inventory.
- To function it requires being whitelisted in configuration.
options:
yaml_extensions:
description: list of 'valid' extensions for files containing YAML
type: list
default: ['.yaml', '.yml', '.json']
'''
EXAMPLES = '''
all: # keys must be unique, i.e. only one 'hosts' per group
hosts:
test1:
test2:
var1: value1
vars:
group_var1: value2
children: # key order does not matter, indentation does
other_group:
children:
group_x:
hosts:
test5
vars:
g2_var2: value3
hosts:
test4:
ansible_host: 127.0.0.1
last_group:
hosts:
test1 # same host as above, additional group membership
vars:
last_var: MYVALUE
'''
import os
from collections import MutableMapping
from ansible import constants as C
from ansible.errors import AnsibleParserError
from ansible.module_utils.six import string_types
from ansible.module_utils._text import to_native
from ansible.parsing.utils.addresses import parse_address
from ansible.plugins.inventory import BaseFileInventoryPlugin, detect_range, expand_hostname_range
class InventoryModule(BaseFileInventoryPlugin):
NAME = 'yaml'
def __init__(self):
super(InventoryModule, self).__init__()
def verify_file(self, path):
valid = False
if super(InventoryModule, self).verify_file(path):
file_name, ext = os.path.splitext(path)
if not ext or ext in C.YAML_FILENAME_EXTENSIONS:
valid = True
return valid
def parse(self, inventory, loader, path, cache=True):
''' parses the inventory file '''
super(InventoryModule, self).parse(inventory, loader, path)
try:
data = self.loader.load_from_file(path)
except Exception as e:
raise AnsibleParserError(e)
if not data:
raise AnsibleParserError('Parsed empty YAML file')
elif not isinstance(data, MutableMapping):
raise AnsibleParserError('YAML inventory has invalid structure, it should be a dictionary, got: %s' % type(data))
elif data.get('plugin'):
raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
# We expect top level keys to correspond to groups, iterate over them
# to get host, vars and subgroups (which we iterate over recursivelly)
if isinstance(data, MutableMapping):
for group_name in data:
self._parse_group(group_name, data[group_name])
else:
raise AnsibleParserError("Invalid data from file, expected dictionary and got:\n\n%s" % to_native(data))
def _parse_group(self, group, group_data):
self.inventory.add_group(group)
if isinstance(group_data, MutableMapping):
# make sure they are dicts
for section in ['vars', 'children', 'hosts']:
if section in group_data:
# convert strings to dicts as these are allowed
if isinstance(group_data[section], string_types):
group_data[section] = {group_data[section]: None}
if not isinstance(group_data[section], MutableMapping):
raise AnsibleParserError('Invalid %s entry for %s group, requires a dictionary, found %s instead.' %
(section, group, type(group_data[section])))
if group_data.get('vars', False):
for var in group_data['vars']:
self.inventory.set_variable(group, var, group_data['vars'][var])
if group_data.get('children', False):
for subgroup in group_data['children']:
self._parse_group(subgroup, group_data['children'][subgroup])
self.inventory.add_child(group, subgroup)
if group_data.get('hosts', False):
for host_pattern in group_data['hosts']:
hosts, port = self._parse_host(host_pattern)
self.populate_host_vars(hosts, group_data['hosts'][host_pattern] or {}, group, port)
def _parse_host(self, host_pattern):
'''
Each host key can be a pattern, try to process it and add variables as needed
'''
(hostnames, port) = self._expand_hostpattern(host_pattern)
return hostnames, port
def _expand_hostpattern(self, hostpattern):
'''
Takes a single host pattern and returns a list of hostnames and an
optional port number that applies to all of them.
'''
# Can the given hostpattern be parsed as a host with an optional port
# specification?
try:
(pattern, port) = parse_address(hostpattern, allow_ranges=True)
except:
# not a recognizable host pattern
pattern = hostpattern
port = None
# Once we have separated the pattern, we expand it into list of one or
# more hostnames, depending on whether it contains any [x:y] ranges.
if detect_range(pattern):
hostnames = expand_hostname_range(pattern)
else:
hostnames = [pattern]
return (hostnames, port)
| {'content_hash': 'a57de84a0063c5b7480b1c315205fd2e', 'timestamp': '', 'source': 'github', 'line_count': 163, 'max_line_length': 125, 'avg_line_length': 37.987730061349694, 'alnum_prop': 0.6007751937984496, 'repo_name': 'e-gob/plataforma-kioscos-autoatencion', 'id': 'f991a973478919257f49e0854c00f028c6f00a67', 'size': '6323', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/inventory/yaml.py', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '41110'}, {'name': 'C++', 'bytes': '3804'}, {'name': 'CSS', 'bytes': '34823'}, {'name': 'CoffeeScript', 'bytes': '8521'}, {'name': 'HTML', 'bytes': '61168'}, {'name': 'JavaScript', 'bytes': '7206'}, {'name': 'Makefile', 'bytes': '1347'}, {'name': 'PowerShell', 'bytes': '584344'}, {'name': 'Python', 'bytes': '25506593'}, {'name': 'Ruby', 'bytes': '245726'}, {'name': 'Shell', 'bytes': '5075'}]} |
/**
* Created by King Lee on 15-3-26.
*/
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res) {
res.render('announcement_240_000020', { title: 'Express' });
});
module.exports = router;
| {'content_hash': '40b9ebafed66151f58cc2563730c3100', 'timestamp': '', 'source': 'github', 'line_count': 12, 'max_line_length': 64, 'avg_line_length': 22.833333333333332, 'alnum_prop': 0.5985401459854015, 'repo_name': 'HelloKevinTian/notice_server', 'id': '44943a1796d6245f607493612e0e83b8719c700b', 'size': '274', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'routes/announcement_240_000020.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '251816'}, {'name': 'HTML', 'bytes': '711288'}, {'name': 'JavaScript', 'bytes': '103222'}]} |
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/* -------------------------------------------------------------------------
ATS
License: see $ATS_DIR/COPYRIGHT
Author: Ethan Coon
Standard base for most diffusion-dominated PKs, this combines both
domains/meshes of PKPhysicalBase and Explicit methods of PKExplicitBase.
------------------------------------------------------------------------- */
#ifndef AMANZI_PK_PHYSICAL_EXPLICIT_DEFAULT_HH_
#define AMANZI_PK_PHYSICAL_EXPLICIT_DEFAULT_HH_
#include "errors.hh"
#include "PK.hh"
#include "pk_explicit_default.hh"
#include "pk_physical_default.hh"
namespace Amanzi {
class PK_Physical_Explicit_Default : public PK_Explicit_Default, public PK_Physical_Default {
public:
PK_Physical_Explicit_Default(Teuchos::ParameterList& pk_tree,
const Teuchos::RCP<Teuchos::ParameterList>& glist,
const Teuchos::RCP<State>& S,
const Teuchos::RCP<TreeVector>& solution)
: PK(pk_tree, glist, S, solution),
PK_Explicit_Default(pk_tree, glist, S, solution),
PK_Physical_Default(pk_tree, glist, S, solution) {}
virtual void Setup() override {
PK_Physical_Default::Setup();
PK_Explicit_Default::Setup();
}
// initialize. Note both ExplicitBase and PhysicalBase have initialize()
// methods, so we need a unique overrider.
virtual void Initialize() override {
PK_Physical_Default::Initialize();
PK_Explicit_Default::Initialize();
}
// -- Advance from state S0 to state S1 at time S0.time + dt.
virtual bool AdvanceStep(double t_old, double t_new, bool reinit) override {
PK_Explicit_Default::AdvanceStep(t_old, t_new, reinit);
ChangedSolutionPK(tag_next_);
return false;
}
virtual void FailStep(double t_old, double t_new, const Tag& tag) override {
PK_Physical_Default::FailStep(t_old, t_new, tag);
}
};
}
#endif
| {'content_hash': '23e74ff0e68825933fa1e20004f5ca86', 'timestamp': '', 'source': 'github', 'line_count': 62, 'max_line_length': 93, 'avg_line_length': 30.806451612903224, 'alnum_prop': 0.6261780104712041, 'repo_name': 'amanzi/ats-dev', 'id': '6c9a39cd026d1d152abfdf20334add1b7706a602', 'size': '1910', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/pks/pk_physical_explicit_default.hh', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '3360'}, {'name': 'C++', 'bytes': '2842879'}, {'name': 'CMake', 'bytes': '97837'}, {'name': 'Fortran', 'bytes': '8905'}, {'name': 'Python', 'bytes': '6272'}]} |
import abc
from typing import Dict, Generic, List, Union
from backend.common.consts.api_version import ApiMajorVersion
from backend.common.helpers.listify import delistify, listify
from backend.common.profiler import Span
from backend.common.queries.types import DictQueryReturn, QueryReturn
class ConverterBase(abc.ABC, Generic[QueryReturn, DictQueryReturn]):
# Used to version cached outputs
SUBVERSIONS: Dict[ApiMajorVersion, int]
_query_return: QueryReturn
def __init__(self, query_return: QueryReturn):
self._query_return = query_return
def convert(
self, version: ApiMajorVersion
) -> Union[None, DictQueryReturn, List[DictQueryReturn]]:
with Span("{}.convert".format(self.__class__.__name__)):
if self._query_return is None:
return None
converted_query_return = self._convert_list(
listify(self._query_return), version
)
if isinstance(self._query_return, list):
return converted_query_return
else:
return delistify(converted_query_return)
@classmethod
@abc.abstractmethod
def _convert_list(
cls, model_list: List, version: ApiMajorVersion
) -> List[DictQueryReturn]:
return [{} for model in model_list]
@classmethod
def constructLocation_v3(cls, model) -> Dict:
"""
Works for teams and events
"""
has_nl = (
model.nl
and model.nl.city
and model.nl.state_prov_short
and model.nl.country_short_if_usa
)
return {
"city": model.nl.city if has_nl else model.city,
"state_prov": model.nl.state_prov_short if has_nl else model.state_prov,
"country": model.nl.country_short_if_usa if has_nl else model.country,
"postal_code": model.nl.postal_code if has_nl else model.postalcode,
"lat": model.nl.lat_lng.lat if has_nl else None,
"lng": model.nl.lat_lng.lon if has_nl else None,
"location_name": model.nl.name if has_nl else None,
"address": model.nl.formatted_address if has_nl else None,
"gmaps_place_id": model.nl.place_id if has_nl else None,
"gmaps_url": model.nl.place_details.get("url") if has_nl else None,
}
| {'content_hash': 'b4dd0bb7e395d5a571ba7661aca57239', 'timestamp': '', 'source': 'github', 'line_count': 63, 'max_line_length': 84, 'avg_line_length': 37.46031746031746, 'alnum_prop': 0.6194915254237288, 'repo_name': 'the-blue-alliance/the-blue-alliance', 'id': 'bac7f5ea73694d4fbdc66df92af13c582b17f1b8', 'size': '2360', 'binary': False, 'copies': '1', 'ref': 'refs/heads/py3', 'path': 'src/backend/common/queries/dict_converters/converter_base.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '359032'}, {'name': 'Dockerfile', 'bytes': '2503'}, {'name': 'HTML', 'bytes': '5877313'}, {'name': 'JavaScript', 'bytes': '755910'}, {'name': 'Less', 'bytes': '244218'}, {'name': 'PHP', 'bytes': '10727'}, {'name': 'Pug', 'bytes': '1857'}, {'name': 'Python', 'bytes': '4321885'}, {'name': 'Ruby', 'bytes': '4677'}, {'name': 'Shell', 'bytes': '27698'}]} |
The repo maintains my course projects/assignments of Computer Networks course delivered by SDU in spring, 2017.
## Assignment 1
See [here](assignment-1/README.md).
## Assignment 2
See [here](assignment-2/README.md).
## Co-authors
Zhang Yinan and [Zhao Yue](https://github.com/z-jack).
## License
[MIT](LICENSE)
| {'content_hash': '1233dc53943030a5fc59f71ed779a38e', 'timestamp': '', 'source': 'github', 'line_count': 17, 'max_line_length': 111, 'avg_line_length': 18.764705882352942, 'alnum_prop': 0.7272727272727273, 'repo_name': 'chengluyu/SDU-Computer-Networks', 'id': 'f0c2a6848ef2c1da7281dc7526e8e77df3490fac', 'size': '340', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'README.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Python', 'bytes': '17952'}]} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>gappa: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.15.0 / gappa - 1.4.4</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
gappa
<small>
1.4.4
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-01 08:46:06 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-01 08:46:06 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-gmp 4 Virtual package relying on a GMP lib system installation
coq 8.15.0 Formal proof management system
dune 3.4.1 Fast, portable, and opinionated build system
ocaml 4.06.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.06.1 Official 4.06.1 release
ocaml-config 1 OCaml Switch Configuration
ocaml-secondary-compiler 4.08.1-1 OCaml 4.08.1 Secondary Switch Compiler
ocamlfind 1.9.1 A library manager for OCaml
ocamlfind-secondary 1.9.1 Adds support for ocaml-secondary-compiler to ocamlfind
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://gappa.gitlabpages.inria.fr/"
dev-repo: "git+https://gitlab.inria.fr/gappa/coq.git"
bug-reports: "https://gitlab.inria.fr/gappa/coq/issues"
license: "LGPL-3.0-or-later"
patches: [
"remake.patch"
]
build: [
["autoconf"] {dev}
["./configure"]
["./remake" "-j%{jobs}%"]
]
install: ["./remake" "install"]
depends: [
"ocaml"
"coq" {>= "8.8.1" & < "8.13~"}
"coq-flocq" {>= "3.0" & < "4~"}
"conf-autoconf" {build & dev}
("conf-g++" {build} | "conf-clang" {build})
]
tags: [
"keyword:floating-point arithmetic"
"keyword:interval arithmetic"
"keyword:decision procedure"
"category:Computer Science/Decision Procedures and Certified Algorithms/Decision procedures"
"logpath:Gappa"
"date:2020-06-13"
]
authors: [ "Guillaume Melquiond <[email protected]>" ]
synopsis: "A Coq tactic for discharging goals about floating-point arithmetic and round-off errors using the Gappa prover"
url {
src: "https://gappa.gitlabpages.inria.fr/releases/gappalib-coq-1.4.4.tar.gz"
checksum: "sha512=910cb7d8f084fc93a8e59c2792093f252f1c8e9f7b63aa408c03de41dced1ff64b4cf2c9ee9610729f7885bdf42dd68c85a9a844c63781ba9fe8cfdfc5192665"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-gappa.1.4.4 coq.8.15.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.15.0).
The following dependencies couldn't be met:
- coq-gappa -> coq < 8.13~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-gappa.1.4.4</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {'content_hash': '9d19ef07cede800f4136339bbbf4ac9c', 'timestamp': '', 'source': 'github', 'line_count': 180, 'max_line_length': 159, 'avg_line_length': 42.19444444444444, 'alnum_prop': 0.5526003949967083, 'repo_name': 'coq-bench/coq-bench.github.io', 'id': '0bd65c7ab53c8d08a01c5fdb9c461c1801589ce5', 'size': '7620', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'clean/Linux-x86_64-4.06.1-2.0.5/released/8.15.0/gappa/1.4.4.html', 'mode': '33188', 'license': 'mit', 'language': []} |
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.Web;
using System.Data;
using System.IO;
using Zenntrix_Silverlight_Toolkit;
[assembly: TagPrefix("Zenntrix", "Zenntrix")]
namespace Zenntrix_Toolkit
{
/// <summary>
/// To Do:
///
/// 1. Create Context menu with the items as shown below
/// 1. Download
/// 2. New Foler
/// 3. Upload Document
/// 4. Rename
/// 5. Move
/// 6. Delete
/// 2. Create file uploader control
/// 3. Reduce Viewstate usage
/// </summary>
[ToolboxData("<{0}:Zenntrix_Directory_View ID=\"ZDV_{0}\" runat=\"server\" ShowFoldersInViewer=\"true\"></{0}:Zenntrix_Directory_View>")]
public class Zenntrix_Directory_Viewer : System.Web.UI.Control
{
public event FileSelectedEventHandler FileSelected;
public event FolderSelectedEventHandler FolderSelected;
#region /* Controls */
HtmlGenericControl DivDirectoryContainer = new HtmlGenericControl();
Panel PanelFolderStructureContainer = new Panel();
HtmlGenericControl DivFolderStructureContainerContainer = new HtmlGenericControl();
HtmlGenericControl DivClear = new HtmlGenericControl();
TreeView TreeViewFolderView = new TreeView();
Panel PanelFileContainer = new Panel();
Repeater RepeaterFiles = new Repeater();
Zenntrix_File_Uploader FileUploader = new Zenntrix_File_Uploader();
HtmlGenericControl DivContextMenuTitle = new HtmlGenericControl();
Button ContextButtonUploadFiles = new Button();
Button ContextButtonNewFolder = new Button();
Panel PanelContextMenu = new Panel();
Zenntrix_ContextMenu_Extender ZCE_ContextMenu = new Zenntrix_ContextMenu_Extender();
#endregion
#region /* Variables */
private Files FilesMapping
{
get
{
Files FilesSaved = new Files();
FilesSaved.DataSource = ((DataSet)ViewState["DsFiles"]).Tables[0];
FilesSaved.Name = ViewState["DsFilesName"].ToString();
FilesSaved.Size = ViewState["DsFilesSize"].ToString();
FilesSaved.DateCreated = ViewState["DsFilesDateCreated"].ToString();
FilesSaved.DateModified = ViewState["DsFilesDateModified"].ToString();
FilesSaved.StructureId = ViewState["DsFilesStructureID"].ToString();
return FilesSaved;
}
set
{
Files FilesSaved = new Files();
FilesSaved = value;
DataSet DsFiles = new DataSet();
DsFiles.Tables.Add(FilesSaved.DataSource);
ViewState["DsFiles"] = DsFiles;
ViewState["DsFilesName"] = FilesSaved.Name;
ViewState["DsFilesSize"] = FilesSaved.Size;
ViewState["DsFilesDateCreated"] = FilesSaved.DateCreated;
ViewState["DsFilesDateModified"] = FilesSaved.DateModified;
ViewState["DsFilesStructureID"] = FilesSaved.StructureId;
}
}
private Directories DirectoriesMapping
{
get
{
Directories DirectoriesSaved = new Directories();
DirectoriesSaved.DataSource = ((DataSet)ViewState["DsDirs"]).Tables[0];
DirectoriesSaved.Name = ViewState["DsDirsName"].ToString();
DirectoriesSaved.StructureId = ViewState["DsDirsStructureId"].ToString();
DirectoriesSaved.ParentStructureId = ViewState["DsDirsParentStructureId"].ToString();
DirectoriesSaved.Path = ViewState["DsDirsPath"].ToString();
return DirectoriesSaved;
}
set
{
Directories DirectoriesSaved = new Directories();
DirectoriesSaved = value;
DataSet DsDirs = new DataSet();
DsDirs.Tables.Add(DirectoriesSaved.DataSource);
ViewState["DsDirs"] = DsDirs;
ViewState["DsDirsName"] = DirectoriesSaved.Name;
ViewState["DsDirsStructureId"] = DirectoriesSaved.StructureId;
ViewState["DsDirsParentStructureId"] = DirectoriesSaved.ParentStructureId;
ViewState["DsDirsPath"] = DirectoriesSaved.Path;
}
}
private string currentPath
{
get
{
if (ViewState["_currentPath"] != null)
{
return ViewState["_currentPath"].ToString();
}
else
{
return rootPath;
}
}
set
{
ViewState["_currentPath"] = value;
}
}
private string rootPath
{
get
{
if (ViewState["_rootPath"] != null)
{
return ViewState["_rootPath"].ToString();
}
else
{
return "";
}
}
set
{
ViewState["_rootPath"] = value;
}
}
private string SortDirection
{
get
{
if (ViewState["_SortDirection"] != null)
{
return ViewState["_SortDirection"].ToString();
}
else
{
return "ASC";
}
}
set
{
ViewState["_SortDirection"] = value;
}
}
private string SortOrder
{
get
{
if (ViewState["_SortOrder"] != null)
{
return ViewState["_SortOrder"].ToString();
}
else
{
return "LinkButtonSortName";
}
}
set
{
ViewState["_SortOrder"] = value;
}
}
private string CurrentFolderId
{
get
{
if (ViewState["_CurrentFolderId"] != null)
{
return ViewState["_CurrentFolderId"].ToString();
}
else
{
return "";
}
}
set
{
ViewState["_CurrentFolderId"] = value;
}
}
public string Width
{
get
{
if (ViewState["_Width"] != null)
{
return ViewState["_Width"].ToString();
}
else
{
return Unit.Pixel(900).ToString() + "px";
}
}
set
{
if (Unit.Parse(value).Type == UnitType.Pixel)
{
if (int.Parse(value.ToLower().Replace("px", "")) < 600)
{
ViewState["_Width"] = "600px";
}
else
{
ViewState["_Width"] = value;
}
}
else
{
ViewState["_Width"] = value;
}
}
}
public Unit Height
{
get
{
if (ViewState["_height"] != null)
{
return ((Unit)ViewState["_height"]);
}
else
{
return Unit.Pixel(440);
}
}
set
{
ViewState["_height"] = value;
}
}
public bool ShowFoldersInViewer
{
get
{
if (ViewState["_ShowFoldersInView"] != null)
{
return ((bool)ViewState["_ShowFoldersInView"]);
}
else
{
return false;
}
}
set
{
ViewState["_ShowFoldersInView"] = value;
}
}
#endregion
protected void Format_Controls()
{
FileUploader.ID = "ZFU_FileUpload";
FileUploader.UploadCompleted += new UploadCompletedHandler(FileUploader_Completed);
FileUploader.Title = "Zenntrix File Uploader";
FileUploader.FileTypes = "*";
FileUploader.UploadFileSizeLimit = 0;
FileUploader.TotalUploadSizeLimit = 0;
FileUploader.FileSaveDirectory = currentPath;
DivDirectoryContainer.TagName = "div";
DivDirectoryContainer.Style["width"] = Width;
DivDirectoryContainer.Attributes.Add("class", "ZDV_DirectoryContainer");
PanelFolderStructureContainer.Style.Value = "height:" + Height.Value + "px;";
PanelFolderStructureContainer.ID = "PanelFolderStructureContainer";
PanelFolderStructureContainer.CssClass = "ZDV_FolderStructureContainer";
DivFolderStructureContainerContainer.TagName = "div";
DivFolderStructureContainerContainer.Attributes.Add("class", "ZDV_Left ZDV_FolderStructureContainerWidth");
DivFolderStructureContainerContainer.ID = "DivFolderStructureContainerContainer";
DivFolderStructureContainerContainer.Attributes.Add("oncontextmenu", "return false;");
TreeViewFolderView.ID = "TreeViewFolderView";
TreeViewFolderView.SelectedNodeStyle.CssClass = "Zenntrix_AdminTreeView_Selected";
TreeViewFolderView.SelectedNodeChanged += new EventHandler(TreeViewFolderView_SelectedNodeChanged);
PanelFileContainer.ID = "PanelFileContainer";
PanelFileContainer.CssClass = "ZDV_Left ZDV_FileContainerWidth";
PanelFileContainer.Attributes.Add("oncontextmenu", "return false;");
RepeaterFiles.ID = "RepeaterFiles";
Repeater_Files_ITemplate FilesITemplate = new Repeater_Files_ITemplate();
FilesITemplate.FolderSelected += new FolderSelectedEventHandler(OnFolderSelected);
FilesITemplate.FileSelected += new FileSelectedEventHandler(OnFileSelected);
FilesITemplate.FileMap(FilesMapping);
RepeaterFiles.ItemTemplate = FilesITemplate;
Repeater_Files_HeaderITemplate FilesHeaderITemplate = new Repeater_Files_HeaderITemplate();
FilesHeaderITemplate.ColumnSorted += new EventHandler(OnColumnSorted);
FilesHeaderITemplate.Set_SortOrder(SortOrder, SortDirection);
RepeaterFiles.HeaderTemplate = FilesHeaderITemplate;
RepeaterFiles.FooterTemplate = new Repeater_Files_FooterITemplate();
DivClear.TagName = "div";
DivClear.Attributes.Add("class", "ZDV_Clear");
}
protected void FileUploader_Completed(object sender, EventArgs e)
{
}
protected void OnColumnSorted(object sender, EventArgs e)
{
if (SortDirection == "ASC" && SortOrder == ((LinkButton)sender).ID)
SortDirection = "DESC";
else
SortDirection = "ASC";
SortOrder = ((LinkButton)sender).ID;
Format_Controls();
Load_Files(CurrentFolderId);
}
protected void Add_Controls()
{
Literal LiteralCssLink = new Literal();
LiteralCssLink.Text = "<link href=\"" + this.Page.ClientScript.GetWebResourceUrl(typeof(Zenntrix_Directory_Viewer), "Zenntrix_Toolkit.Zenntrix_Directory_Viewer_Resources.main.css") + "\" type=\"text/css\" media=\"all\" rel=\"Stylesheet\"/>";
this.Page.Header.Controls.Add(LiteralCssLink);
PanelFolderStructureContainer.Controls.Add(TreeViewFolderView);
PanelFileContainer.Controls.Add(RepeaterFiles);
DivFolderStructureContainerContainer.Controls.Add(PanelFolderStructureContainer);
DivDirectoryContainer.Controls.Add(DivFolderStructureContainerContainer);
DivDirectoryContainer.Controls.Add(PanelFileContainer);
DivDirectoryContainer.Controls.Add(DivClear);
Controls.Add(DivDirectoryContainer);
Controls.Add(FileUploader);
}
protected void CreateContextMenu()
{
#region /* Context Menu Formatting */
DivContextMenuTitle.TagName = "div";
DivContextMenuTitle.Attributes.Add("class", "ZDV_ContextMenu_Header");
DivContextMenuTitle.InnerText = "Actions";
ZCE_ContextMenu.ID = "ZCE_ContextMenu";
ZCE_ContextMenu.ContextMenu = "PanelContextMenu";
ZCE_ContextMenu.TargetControl = "PanelFileContainer";
ZCE_ContextMenu.ContextMenuShown += new Zenntrix_ContextMenu_Extender.ContextMenuShownEventHandler(ZCE_ContextMenu_ContextMenuShown);
ContextButtonUploadFiles.ID = "ContextButtonUploadFiles";
ContextButtonUploadFiles.Text = "Upload file";
ContextButtonUploadFiles.CssClass = "ZDV_ContextMenu_Full";
ContextButtonUploadFiles.Click += new EventHandler(ContextButtonUploadFiles_Click);
ContextButtonNewFolder.ID = "ContextButtonNewFolder";
ContextButtonNewFolder.Text = "New folder";
ContextButtonNewFolder.CssClass = "ZDV_ContextMenu_Full";
ContextButtonNewFolder.Click += new EventHandler(ContextButtonNewFolder_Click);
PanelContextMenu.ID = "PanelContextMenu";
PanelContextMenu.CssClass = "ZDV_ContextMenu_Container";
#endregion
PanelContextMenu.Controls.Add(DivContextMenuTitle);
PanelContextMenu.Controls.Add(ContextButtonUploadFiles);
PanelContextMenu.Controls.Add(ContextButtonNewFolder);
Controls.Add(PanelContextMenu);
Controls.Add(ZCE_ContextMenu);
}
protected override void OnInit(EventArgs e)
{
CreateContextMenu();
base.OnInit(e);
}
protected override void OnLoad(EventArgs e)
{
Format_Controls();
Add_Controls();
base.OnLoad(e);
}
protected override void Render(HtmlTextWriter writer)
{
this.Page.ClientScript.RegisterForEventValidation(ContextButtonUploadFiles.UniqueID);
base.Render(writer);
}
protected void ZCE_ContextMenu_ContextMenuShown(object sender, EventArgs e)
{
}
protected void ContextButtonUploadFiles_Click(object sender, EventArgs e)
{
Upload();
}
protected void ContextButtonNewFolder_Click(object sender, EventArgs e)
{
//Show popup for new folder name entry
}
protected void Upload()
{
FileUploader.FileSaveDirectory = currentPath;
FileUploader.Show();
}
public void Load_Structure(Directories Directories, Files Files, string RootPath)
{
if (RootPath.EndsWith("//") == false)
{
rootPath = RootPath + "//";
}
else
{
rootPath = RootPath;
}
rootPath = RootPath;
FilesMapping = Files;
DataTable DataTableFiles = FilesMapping.DataSource;
if (Files.DataSource.Columns["Zenntrix_Directory_Viewer_File_Type"] == null)
{
DataTableFiles.Columns.Add("Zenntrix_Directory_Viewer_File_Type");
}
FilesMapping.DataSource = DataTableFiles;
Format_Controls();
Add_Controls();
Load_Directories(Directories);
Load_Files("0");
}
public void Load_Structure(string FullPath)
{
Directories GetDirectories = new Directories();
GetDirectories.DataSource = Scan_Directory(FullPath);
GetDirectories.Name = "Name";
GetDirectories.ParentStructureId = "Parent";
GetDirectories.StructureId = "Location";
GetDirectories.Path = "Location";
Files GetFiles = new Files();
GetFiles.DataSource = Scan_Directory_For_Files(FullPath);
GetFiles.Name = "Name";
GetFiles.Size = "Size";
GetFiles.StructureId = "Location";
GetFiles.DateCreated = "CreatedDate";
GetFiles.DateModified = "ModifiedDate";
Load_Structure(GetDirectories, GetFiles, rootPath);
}
public DataTable Scan_Directory(string FileDirectory)
{
DataTable DataTableNewDirectory = new DataTable();
DataTableNewDirectory.Columns.Add("Location");
DataTableNewDirectory.Columns.Add("Parent");
DataTableNewDirectory.Columns.Add("Name");
DataTableNewDirectory.Columns.Add("Status");
DirectoryInfo DirectoryToScan = new DirectoryInfo(FileDirectory);
foreach (DirectoryInfo D in DirectoryToScan.GetDirectories())
{
DataRow NewDataRow = DataTableNewDirectory.NewRow();
NewDataRow["Name"] = D.Name;
NewDataRow["Parent"] = D.Parent.FullName.Replace(FileDirectory, "");
NewDataRow["Location"] = D.FullName.Replace(FileDirectory, "");
DataTableNewDirectory.Rows.Add(NewDataRow);
Get_Children_Directories(DataTableNewDirectory, D, FileDirectory);
}
return DataTableNewDirectory;
}
protected void Get_Children_Directories(DataTable DataTableToLoadInto, DirectoryInfo DirectoryToScan, string RootFileDirectory)
{
foreach (DirectoryInfo D in DirectoryToScan.GetDirectories())
{
DataRow NewDataRow = DataTableToLoadInto.NewRow();
NewDataRow["Name"] = D.Name;
NewDataRow["Parent"] = D.Parent.FullName.Replace(RootFileDirectory, "");
NewDataRow["Location"] = D.FullName.Replace(RootFileDirectory, "");
DataTableToLoadInto.Rows.Add(NewDataRow);
Get_Children_Directories(DataTableToLoadInto, D, RootFileDirectory);
}
}
#region /* Directories */
protected void Load_Directories(Directories Directories)
{
DataTable DirectoryStructure = Directories.DataSource;
TreeViewFolderView.Nodes.Clear();
DirectoryStructure.PrimaryKey = new DataColumn[] { DirectoryStructure.Columns[Directories.StructureId] };
Directories.DataSource = DirectoryStructure;
DirectoriesMapping = Directories;
TreeNode TNRoot = new TreeNode();
TNRoot.Text = "..root";
TNRoot.Value = "0";
TNRoot.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(Zenntrix_Directory_Viewer), "Zenntrix_Toolkit.Zenntrix_Directory_Viewer_Resources.Folder.png");
TNRoot.Selected = true;
TNRoot.Expanded = true;
TNRoot.SelectAction = TreeNodeSelectAction.SelectExpand;
foreach (DataRow R in DirectoriesMapping.DataSource.Rows)
{
if (R[Directories.ParentStructureId].ToString() == "0" || R[Directories.ParentStructureId].ToString() == "")
{
TreeNode TNNodes = new TreeNode();
TNNodes.Text = R[Directories.Name].ToString();
TNNodes.Value = R[Directories.StructureId].ToString();
TNNodes.Expanded = false;
TNNodes.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(Zenntrix_Directory_Viewer), "Zenntrix_Toolkit.Zenntrix_Directory_Viewer_Resources.Folder.png");
TNNodes.SelectAction = TreeNodeSelectAction.SelectExpand;
Add_Children_Structure(TNNodes, Directories);
TNRoot.ChildNodes.Add(TNNodes);
}
}
TreeViewFolderView.Nodes.Add(TNRoot);
}
protected void Add_Children_Structure(TreeNode Parent, Directories Directories)
{
DataTable DirectoryStructure = Directories.DataSource;
foreach (DataRow R in DirectoryStructure.Rows)
{
if (R[Directories.ParentStructureId].ToString() == Parent.Value)
{
TreeNode TNChildNode = new TreeNode();
TNChildNode.Text = R[Directories.Name].ToString();
TNChildNode.Value = R[Directories.StructureId].ToString();
TNChildNode.Expanded = false;
TNChildNode.SelectAction = TreeNodeSelectAction.SelectExpand;
TNChildNode.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(Zenntrix_Directory_Viewer), "Zenntrix_Toolkit.Zenntrix_Directory_Viewer_Resources.Folder.png");
Add_Children_Structure(TNChildNode, Directories);
Parent.ChildNodes.Add(TNChildNode);
}
}
}
public class Directories
{
private DataTable _Directories;
private string _Name;
private string _Id;
private string _Path;
private string _ParentId;
/// <summary>
/// The datatable holding the directories
/// </summary>
public DataTable DataSource
{
get
{
return _Directories;
}
set
{
_Directories = value;
}
}
/// <summary>
/// The column name that contains the name to be displayed
/// </summary>
public string Name
{
get
{
return _Name;
}
set
{
_Name = value;
}
}
public string Path
{
get
{
return _Path;
}
set
{
_Path = value;
}
}
/// <summary>
/// The Id of the current directory
/// </summary>
public string StructureId
{
get
{
return _Id;
}
set
{
_Id = value;
}
}
/// <summary>
/// The parent id of the current directory
/// </summary>
public string ParentStructureId
{
get
{
return _ParentId;
}
set
{
_ParentId = value;
}
}
}
#endregion
#region /* Files */
protected void Set_Selected_TreeNode(TreeView TV, string SelectedValue)
{
foreach (TreeNode TN in TV.Nodes)
{
if (TN.Value == SelectedValue)
{
TN.Parent.Expanded = true;
TN.Select();
TN.Selected = true;
break;
}
else
{
Set_Selected_TreeNode(TN, SelectedValue);
}
}
}
public void Set_Selected_Directory(string SelectedValue)
{
foreach (TreeNode TN in TreeViewFolderView.Nodes)
{
if (TN.Value == SelectedValue)
{
TN.Parent.Expanded = true;
TN.Select();
TN.Selected = true;
Load_Files(TN.Value);
break;
}
else
{
Set_Selected_TreeNode(TN, SelectedValue);
}
}
}
protected void Set_Selected_TreeNode(TreeNode TN, string SelectedValue)
{
foreach (TreeNode CTN in TN.ChildNodes)
{
if (CTN.Value == SelectedValue)
{
CTN.Parent.Expanded = true;
CTN.Select();
CTN.Selected = true;
break;
}
else
{
Set_Selected_TreeNode(CTN, SelectedValue);
}
}
}
protected void Load_Files(string ID)
{
DataTable DataTableFilesToOutput = FilesMapping.DataSource.Clone();
DataTableFilesToOutput.Columns[FilesMapping.Size].DataType = typeof(int);
#region /* Set Sort */
string stringSort = string.Empty;
switch (SortOrder)
{
case "LinkButtonSortName":
stringSort = FilesMapping.Name + " " + SortDirection;
break;
case "LinkButtonSortSize":
stringSort = FilesMapping.Size + " " + SortDirection;
break;
case "LinkButtonSortCreated":
stringSort = FilesMapping.DateCreated + " " + SortDirection;
break;
case "LinkButtonSortModified":
stringSort = FilesMapping.DateModified + " " + SortDirection;
break;
}
#endregion
#region /* Load Files */
foreach (DataRow R in FilesMapping.DataSource.Rows)
{
if (ID == "0")
{
if (R[FilesMapping.StructureId].ToString() == "")
{
DataRow NewDataRow = DataTableFilesToOutput.NewRow();
NewDataRow[FilesMapping.StructureId] = R[FilesMapping.StructureId];
NewDataRow[FilesMapping.Name] = R[FilesMapping.Name];
NewDataRow[FilesMapping.Size] = R[FilesMapping.Size];
NewDataRow[FilesMapping.DateModified] = R[FilesMapping.DateModified];
NewDataRow[FilesMapping.DateCreated] = R[FilesMapping.DateCreated];
DataTableFilesToOutput.Rows.Add(NewDataRow);
}
}
if (R[FilesMapping.StructureId].ToString() == ID)
{
DataRow NewDataRow = DataTableFilesToOutput.NewRow();
NewDataRow[FilesMapping.StructureId] = R[FilesMapping.StructureId];
NewDataRow[FilesMapping.Name] = R[FilesMapping.Name];
NewDataRow[FilesMapping.Size] = R[FilesMapping.Size];
NewDataRow[FilesMapping.DateModified] = R[FilesMapping.DateModified];
NewDataRow[FilesMapping.DateCreated] = R[FilesMapping.DateCreated];
DataTableFilesToOutput.Rows.Add(NewDataRow);
}
}
#endregion
#region /* Load Folders */
if (ShowFoldersInViewer)
{
foreach (DataRow R in DirectoriesMapping.DataSource.Rows)
{
if (R[DirectoriesMapping.ParentStructureId].ToString() == ID)
{
DataRow NewDataRow = DataTableFilesToOutput.NewRow();
NewDataRow[FilesMapping.StructureId] = R[DirectoriesMapping.StructureId];
NewDataRow[FilesMapping.Name] = R[DirectoriesMapping.Name];
NewDataRow[FilesMapping.Size] = Get_Folder_Size(R[DirectoriesMapping.StructureId].ToString());
NewDataRow["Zenntrix_Directory_Viewer_File_Type"] = "Folder";
DataTableFilesToOutput.Rows.Add(NewDataRow);
}
else if (ID == "0" && R[DirectoriesMapping.ParentStructureId].ToString() == "")
{
DataRow NewDataRow = DataTableFilesToOutput.NewRow();
NewDataRow[FilesMapping.StructureId] = R[DirectoriesMapping.StructureId];
NewDataRow[FilesMapping.Name] = R[DirectoriesMapping.Name];
NewDataRow[FilesMapping.Size] = Get_Folder_Size(R[DirectoriesMapping.StructureId].ToString());
NewDataRow["Zenntrix_Directory_Viewer_File_Type"] = "Folder";
DataTableFilesToOutput.Rows.Add(NewDataRow);
}
}
}
#endregion
DataTable DataTableSorted = FilesMapping.DataSource.Clone();
foreach (DataRow R in DataTableFilesToOutput.Select("", "Zenntrix_Directory_Viewer_File_Type desc," + stringSort))
{
DataRow NewDataRow = DataTableSorted.NewRow();
NewDataRow[FilesMapping.StructureId] = R[FilesMapping.StructureId];
NewDataRow[FilesMapping.Name] = R[FilesMapping.Name];
NewDataRow[FilesMapping.Size] = R[FilesMapping.Size];
NewDataRow[FilesMapping.DateCreated] = R[FilesMapping.DateCreated];
NewDataRow[FilesMapping.DateModified] = R[FilesMapping.DateModified];
NewDataRow["Zenntrix_Directory_Viewer_File_Type"] = R["Zenntrix_Directory_Viewer_File_Type"];
DataTableSorted.Rows.Add(NewDataRow);
}
RepeaterFiles.DataSource = DataTableSorted;
RepeaterFiles.DataBind();
}
protected int Get_Folder_Size(string ID)
{
int intFolderSize = 0;
foreach (DataRow R in FilesMapping.DataSource.Rows)
{
if (ID == "0")
{
if (R[FilesMapping.StructureId].ToString() == "")
{
intFolderSize += int.Parse(R[FilesMapping.Size].ToString());
}
}
if (R[FilesMapping.StructureId].ToString() == ID)
{
intFolderSize += int.Parse(R[FilesMapping.Size].ToString());
}
}
foreach (DataRow R in DirectoriesMapping.DataSource.Rows)
{
if (R[DirectoriesMapping.ParentStructureId].ToString() == ID)
{
intFolderSize += Get_Folder_Size(R[DirectoriesMapping.StructureId].ToString());
}
}
return intFolderSize;
}
public DataTable Scan_Directory_For_Files(string FileDirectory)
{
DataTable DataTableFiles = new DataTable();
DataTableFiles.Columns.Add("Name");
DataTableFiles.Columns.Add("Extension");
DataTableFiles.Columns.Add("ModifiedDate");
DataTableFiles.Columns.Add("CreatedDate");
DataTableFiles.Columns.Add("Size");
DataTableFiles.Columns.Add("Location");
DataTableFiles.Columns.Add("LocationAndFile");
DataTableFiles.Columns.Add("Status");
DirectoryInfo DirectoryToSearch = new DirectoryInfo(FileDirectory);
foreach (FileInfo Fi in DirectoryToSearch.GetFiles())
{
DataRow NewDataRow = DataTableFiles.NewRow();
NewDataRow["Name"] = Fi.Name;
NewDataRow["Extension"] = Fi.Extension;
NewDataRow["ModifiedDate"] = Fi.LastWriteTime;
NewDataRow["CreatedDate"] = Fi.CreationTime;
NewDataRow["Size"] = (Fi.Length / 1024);
NewDataRow["Location"] = Fi.Directory.FullName.Replace(FileDirectory, "");
NewDataRow["LocationAndFile"] = Fi.Directory.FullName.Replace(FileDirectory, "") + "\\" + Fi.Name;
DataTableFiles.Rows.Add(NewDataRow);
}
foreach (DirectoryInfo D in DirectoryToSearch.GetDirectories())
{
Get_Children_Files(DataTableFiles, D, FileDirectory);
}
return DataTableFiles;
}
protected void Get_Children_Files(DataTable DataTableToLoadInto, DirectoryInfo DirectoryToScan, string RootFileDirectory)
{
foreach (FileInfo Fi in DirectoryToScan.GetFiles())
{
DataRow NewDataRow = DataTableToLoadInto.NewRow();
NewDataRow["Name"] = Fi.Name;
NewDataRow["Extension"] = Fi.Extension;
NewDataRow["ModifiedDate"] = Fi.LastWriteTime;
NewDataRow["CreatedDate"] = Fi.CreationTime;
NewDataRow["Size"] = (Fi.Length / 1024);
NewDataRow["Location"] = Fi.Directory.FullName.Replace(RootFileDirectory, "");
NewDataRow["LocationAndFile"] = Fi.Directory.FullName.Replace(RootFileDirectory, "") + "\\" + Fi.Name;
DataTableToLoadInto.Rows.Add(NewDataRow);
}
foreach (DirectoryInfo D in DirectoryToScan.GetDirectories())
{
Get_Children_Files(DataTableToLoadInto, D, RootFileDirectory);
}
}
public class Files
{
private DataTable _Files;
private string _StructureId;
private string _Name;
private string _Size;
private string _DateCreated;
private string _DateModified;
/// <summary>
/// The datatable holding the files
/// </summary>
public DataTable DataSource
{
get
{
return _Files;
}
set
{
_Files = value;
}
}
/// <summary>
/// The column that contains the structure id it is linked to.
/// </summary>
public string StructureId
{
get
{
return _StructureId;
}
set
{
_StructureId = value;
}
}
/// <summary>
/// The column name that contains the name to be displayed
/// </summary>
public string Name
{
get
{
return _Name;
}
set
{
_Name = value;
}
}
/// <summary>
/// The column that contains the file size in KiloBytes. (Interger Field)
/// </summary>
public string Size
{
get
{
return _Size;
}
set
{
_Size = value;
}
}
/// <summary>
/// The column that contains the date created (DateTime Field)
/// </summary>
public string DateCreated
{
get
{
return _DateCreated;
}
set
{
_DateCreated = value;
}
}
/// <summary>
/// The column that contains the date modified (DateTime Field)
/// </summary>
public string DateModified
{
get
{
return _DateModified;
}
set
{
_DateModified = value;
}
}
}
#endregion
protected void OnFileSelected(object sender, ZentrixDirectoryViewFileSelected e)
{
if (FileSelected != null)
{
foreach (DataRow R in FilesMapping.DataSource.Rows)
{
if (e.FileName == R[FilesMapping.Name].ToString() && e.FileStructureID == R[FilesMapping.StructureId].ToString())
{
e.FileSize = int.Parse(R[FilesMapping.Size].ToString());
e.FileCreated = DateTime.Parse(R[FilesMapping.DateCreated].ToString());
e.FileModified = DateTime.Parse(R[FilesMapping.DateModified].ToString());
string stringFolderPath = "";
if (e.FileStructureID != "")
stringFolderPath = DirectoriesMapping.DataSource.Rows.Find(e.FileStructureID)[DirectoriesMapping.Path].ToString();
e.FilePath = rootPath + "\\" + stringFolderPath + "\\" + e.FileName;
FileStream MyFileStream = new FileStream(e.FilePath, FileMode.Open);
byte[] Buffer = new byte[(int)MyFileStream.Length];
MyFileStream.Read(Buffer, 0, (int)MyFileStream.Length);
MyFileStream.Close();
this.Page.Response.ContentType = "application/octet-stream";
this.Page.Response.AddHeader("content-disposition", "attachment; filename=\"" + e.FileName + "\"");
this.Page.Response.BinaryWrite(Buffer);
this.Page.Response.End();
break;
}
}
FileSelected(sender, e);
}
}
protected void SetCurrentFilePath(string stringCurrentFolderId)
{
if (stringCurrentFolderId != "0" && stringCurrentFolderId != "")
{
DataTable DataTableFolders = DirectoriesMapping.DataSource;
DataTableFolders.PrimaryKey = new DataColumn[] { DataTableFolders.Columns[DirectoriesMapping.StructureId] };
currentPath = rootPath + DataTableFolders.Rows.Find(CurrentFolderId)[DirectoriesMapping.Path].ToString();
}
else
{
currentPath = rootPath;
}
FileUploader.FileSaveDirectory = currentPath;
}
protected void OnFolderSelected(object sender, ZentrixDirectoryViewFolderSelected e)
{
CurrentFolderId = ((LinkButton)sender).CommandArgument.ToString();
Set_Selected_TreeNode(TreeViewFolderView, CurrentFolderId);
SetCurrentFilePath(CurrentFolderId);
Load_Files(CurrentFolderId);
if (FolderSelected != null)
{
e.FolderSize = Get_Folder_Size(CurrentFolderId);
FolderSelected(sender, e);
}
}
protected void TreeViewFolderView_SelectedNodeChanged(object sender, EventArgs e)
{
CurrentFolderId = TreeViewFolderView.SelectedNode.Value;
ZentrixDirectoryViewFolderSelected Event = new ZentrixDirectoryViewFolderSelected();
Event.FolderName = TreeViewFolderView.SelectedNode.Text;
Event.FolderId = CurrentFolderId;
Event.FolderSize = Get_Folder_Size(CurrentFolderId);
SetCurrentFilePath(CurrentFolderId);
FolderSelected(sender, Event);
Load_Files(TreeViewFolderView.SelectedNode.Value);
}
protected class Repeater_Files_ITemplate : ITemplate
{
private Zenntrix_Directory_Viewer.Files FileMapping;
public void FileMap(Zenntrix_Directory_Viewer.Files FileMap)
{
FileMapping = FileMap;
}
public void InstantiateIn(Control ControlSender)
{
RepeaterItem RepeaterItemContainer = ((RepeaterItem)ControlSender);
HtmlGenericControl Container = new HtmlGenericControl();
Container.TagName = "div";
Container.Attributes.Add("class", "ZDV_RepeaterFilesContainer");
if (RepeaterItemContainer.ItemType == ListItemType.Item || RepeaterItemContainer.ItemType == ListItemType.AlternatingItem)
{
#region /* File Name Column */
HtmlGenericControl DivNameColumn = new HtmlGenericControl();
DivNameColumn.TagName = "div";
DivNameColumn.Attributes.Add("class", "ZDV_Left ZDV_RepeaterFilesNameContainer");
HtmlGenericControl DivImageContainer = new HtmlGenericControl();
DivImageContainer.TagName = "div";
DivImageContainer.Attributes.Add("class", "ZDV_Left ZDV_RepeaterFilesImage");
HtmlImage FileImage = new HtmlImage();
FileImage.Attributes.Add("FileNameColumn", FileMapping.Name);
FileImage.DataBinding += new EventHandler(FileImage_Bound);
HtmlGenericControl DivFileNameContainer = new HtmlGenericControl();
DivFileNameContainer.TagName = "div";
DivFileNameContainer.Attributes.Add("class", "ZDV_Left ZDV_RepeaterFilesName");
LinkButton LinkButtonFilename = new LinkButton();
LinkButtonFilename.ID = "LinkButtonFilename";
LinkButtonFilename.Attributes.Add("ColumnName", FileMapping.Name);
LinkButtonFilename.Attributes.Add("IdColumnName", FileMapping.StructureId);
LinkButtonFilename.DataBinding += new EventHandler(LinkButtonFilename_Bound);
LinkButtonFilename.Click += new EventHandler(LinkButtonFilename_Click);
DivImageContainer.Controls.Add(FileImage);
DivFileNameContainer.Controls.Add(LinkButtonFilename);
DivNameColumn.Controls.Add(DivImageContainer);
DivNameColumn.Controls.Add(DivFileNameContainer);
Container.Controls.Add(DivNameColumn);
#endregion
#region /* Size Column */
HtmlGenericControl DivSizeColumn = new HtmlGenericControl();
DivSizeColumn.TagName = "div";
DivSizeColumn.Attributes.Add("class", "ZDV_Left ZDV_RepeaterFilesSize");
DivSizeColumn.Attributes.Add("ColumnName", FileMapping.Size);
DivSizeColumn.DataBinding += new EventHandler(Size_Bound);
Container.Controls.Add(DivSizeColumn);
#endregion
#region /* Date Created Column */
HtmlGenericControl DivDateCreatedColumn = new HtmlGenericControl();
DivDateCreatedColumn.TagName = "div";
DivDateCreatedColumn.Attributes.Add("class", "ZDV_Left ZDV_RepeaterFilesDateCreated");
DivDateCreatedColumn.Attributes.Add("ColumnName", FileMapping.DateCreated);
DivDateCreatedColumn.DataBinding += new EventHandler(Field_Bound);
Container.Controls.Add(DivDateCreatedColumn);
#endregion
#region /* Date Modified Column */
HtmlGenericControl DivDateModifiedColumn = new HtmlGenericControl();
DivDateModifiedColumn.TagName = "div";
DivDateModifiedColumn.Attributes.Add("class", "ZDV_Left ZDV_RepeaterFilesDateModified");
DivDateModifiedColumn.Attributes.Add("ColumnName", FileMapping.DateModified);
DivDateModifiedColumn.DataBinding += new EventHandler(Field_Bound);
Container.Controls.Add(DivDateModifiedColumn);
#endregion
#region /* Div Cleaner */
HtmlGenericControl DivClean = new HtmlGenericControl();
DivClean.TagName = "div";
DivClean.Attributes.Add("class", "ZDV_Clear");
Container.Controls.Add(DivClean);
#endregion
RepeaterItemContainer.Controls.Add(Container);
}
}
public event FolderSelectedEventHandler FolderSelected;
public event FileSelectedEventHandler FileSelected;
protected void Size_Bound(object sender, EventArgs e)
{
HtmlGenericControl DivColumn = (HtmlGenericControl)sender;
RepeaterItem RepeaterItemContainer = ((RepeaterItem)DivColumn.NamingContainer);
string stringFileSize = string.Empty;
int intFileSize = 0;
int.TryParse(DataBinder.Eval(RepeaterItemContainer.DataItem, DivColumn.Attributes["ColumnName"].ToString()).ToString(), out intFileSize);
if (intFileSize >= 1048576)
stringFileSize = (intFileSize / 1048576).ToString() + " GB";
else if (intFileSize >= 1024)
stringFileSize = (intFileSize / 1024).ToString() + " MB";
else stringFileSize = intFileSize.ToString() + " KB";
DivColumn.InnerText = stringFileSize;
}
protected void Field_Bound(object sender, EventArgs e)
{
string ControlType = sender.GetType().Name;
RepeaterItem RepeaterItemContainer = ((RepeaterItem)((Control)sender).NamingContainer);
switch (ControlType)
{
case "HtmlGenericControl":
HtmlGenericControl Column = (HtmlGenericControl)sender;
if (Column.Attributes["ColumnName"] != null)
{
Column.InnerText = DataBinder.Eval(RepeaterItemContainer.DataItem, Column.Attributes["ColumnName"].ToString()).ToString();
}
break;
case "LinkButton":
LinkButton LinkButtonColumn = (LinkButton)sender;
if (LinkButtonColumn.Attributes["ColumnName"] != null)
{
LinkButtonColumn.Text = DataBinder.Eval(RepeaterItemContainer.DataItem, LinkButtonColumn.Attributes["ColumnName"].ToString()).ToString();
}
break;
}
}
protected void LinkButtonFilename_Bound(object sender, EventArgs e)
{
RepeaterItem RepeaterItemContainer = ((RepeaterItem)((LinkButton)sender).NamingContainer);
LinkButton Column = (LinkButton)sender;
if (Column.Attributes["ColumnName"] != null)
{
Column.ToolTip = DataBinder.Eval(RepeaterItemContainer.DataItem, Column.Attributes["ColumnName"].ToString()).ToString();
Column.Text = DataBinder.Eval(RepeaterItemContainer.DataItem, Column.Attributes["ColumnName"].ToString()).ToString();
Column.CommandArgument = DataBinder.Eval(RepeaterItemContainer.DataItem, Column.Attributes["IdColumnName"].ToString()).ToString();
Column.CommandName = DataBinder.Eval(RepeaterItemContainer.DataItem, "Zenntrix_Directory_Viewer_File_Type").ToString();
}
}
protected void FileImage_Bound(object sender, EventArgs e)
{
RepeaterItem RepeaterItemContainer = ((RepeaterItem)((HtmlImage)sender).NamingContainer);
HtmlImage Column = (HtmlImage)sender;
string stringFileExtension = string.Empty;
if (Column.Attributes["FileNameColumn"] != null && DataBinder.Eval(RepeaterItemContainer.DataItem, "Zenntrix_Directory_Viewer_File_Type").ToString() == "")
{
FileInfo FileInfoGetExtension = new FileInfo(DataBinder.Eval(RepeaterItemContainer.DataItem, Column.Attributes["FileNameColumn"].ToString()).ToString());
stringFileExtension = FileInfoGetExtension.Extension.ToString();
}
string stringImageLocation = string.Empty;
if (stringFileExtension == "" && DataBinder.Eval(RepeaterItemContainer.DataItem, "Zenntrix_Directory_Viewer_File_Type").ToString() == "Folder")
{
stringImageLocation = RepeaterItemContainer.Page.ClientScript.GetWebResourceUrl(typeof(Zenntrix_Directory_Viewer), "Zenntrix_Toolkit.Zenntrix_Directory_Viewer_Resources.Folder.png");
}
else
{
stringImageLocation = stringFileExtension;
if (!File.Exists(stringImageLocation))
{
stringImageLocation = RepeaterItemContainer.Page.ClientScript.GetWebResourceUrl(typeof(Zenntrix_Directory_Viewer), "Zenntrix_Toolkit.Zenntrix_Directory_Viewer_Resources.File.png");
}
}
Column.Src = stringImageLocation;
}
protected void LinkButtonFilename_Click(object sender, EventArgs e)
{
if (((LinkButton)sender).CommandName == "Folder")
{
if (FolderSelected != null)
{
ZentrixDirectoryViewFolderSelected Event = new ZentrixDirectoryViewFolderSelected();
Event.FolderName = ((LinkButton)sender).Text;
Event.FolderId = ((LinkButton)sender).CommandArgument;
FolderSelected(sender, Event);
}
}
else
{
if (FileSelected != null)
{
ZentrixDirectoryViewFileSelected Event = new ZentrixDirectoryViewFileSelected();
Event.FileName = ((LinkButton)sender).Text;
Event.FileStructureID = ((LinkButton)sender).CommandArgument;
FileSelected(sender, Event);
}
}
}
}
protected class Repeater_Files_HeaderITemplate : ITemplate
{
public event EventHandler ColumnSorted;
public string SortOrder = "";
public string SortDirection = "";
public void Set_SortOrder(string Order, string Direction)
{
SortOrder = Order;
SortDirection = Direction;
}
public void InstantiateIn(Control ControlSender)
{
RepeaterItem RepeaterItemContainer = ((RepeaterItem)ControlSender);
HtmlGenericControl Container = new HtmlGenericControl();
Container.TagName = "div";
Container.Attributes.Add("class", "ZDV_RepeaterFilesHeaderContainer");
if (RepeaterItemContainer.ItemType == ListItemType.Header)
{
LinkButton LinkButtonSortName = new LinkButton();
LinkButtonSortName.Text = "Name";
LinkButtonSortName.ID = "LinkButtonSortName";
LinkButtonSortName.CssClass = "ZDV_RepeaterFilesSortButton";
LinkButtonSortName.Click += new EventHandler(Column_Sort);
LinkButtonSortName.DataBinding += new EventHandler(ColumnHeader_Bound);
HtmlGenericControl NameContainer = new HtmlGenericControl();
NameContainer.TagName = "div";
NameContainer.Attributes.Add("class", "ZDV_Left ZDV_RepeaterFilesHeaderName");
NameContainer.Controls.Add(LinkButtonSortName);
LinkButton LinkButtonSortSize = new LinkButton();
LinkButtonSortSize.Text = "Size";
LinkButtonSortSize.ID = "LinkButtonSortSize";
LinkButtonSortSize.CssClass = "ZDV_RepeaterFilesSortButton";
LinkButtonSortSize.Click += new EventHandler(Column_Sort);
LinkButtonSortSize.DataBinding += new EventHandler(ColumnHeader_Bound);
HtmlGenericControl SizeContainer = new HtmlGenericControl();
SizeContainer.TagName = "div";
SizeContainer.Attributes.Add("class", "ZDV_Left ZDV_RepeaterFilesHeaderSize");
SizeContainer.Controls.Add(LinkButtonSortSize);
LinkButton LinkButtonSortCreated = new LinkButton();
LinkButtonSortCreated.Text = "Date Created";
LinkButtonSortCreated.ID = "LinkButtonSortCreated";
LinkButtonSortCreated.CssClass = "ZDV_RepeaterFilesSortButton";
LinkButtonSortCreated.Click += new EventHandler(Column_Sort);
LinkButtonSortCreated.DataBinding += new EventHandler(ColumnHeader_Bound);
HtmlGenericControl DateCreatedContainer = new HtmlGenericControl();
DateCreatedContainer.TagName = "div";
DateCreatedContainer.Attributes.Add("class", "ZDV_Left ZDV_RepeaterFilesHeaderDateCreated");
DateCreatedContainer.Controls.Add(LinkButtonSortCreated);
LinkButton LinkButtonSortModified = new LinkButton();
LinkButtonSortModified.Text = "Date Modified";
LinkButtonSortModified.ID = "LinkButtonSortModified";
LinkButtonSortModified.CssClass = "ZDV_RepeaterFilesSortButton";
LinkButtonSortModified.Click += new EventHandler(Column_Sort);
LinkButtonSortModified.DataBinding += new EventHandler(ColumnHeader_Bound);
HtmlGenericControl DateModifiedContainer = new HtmlGenericControl();
DateModifiedContainer.TagName = "div";
DateModifiedContainer.Attributes.Add("class", "ZDV_Left ZDV_RepeaterFilesHeaderDateModified");
DateModifiedContainer.Controls.Add(LinkButtonSortModified);
HtmlGenericControl DivClear = new HtmlGenericControl();
DivClear.TagName = "div";
DivClear.Attributes.Add("class", "ZDV_Clear");
Literal DivOpenItems = new Literal();
DivOpenItems.Text = "<div style=\"height:419px;\" class=\"ZDV_RepeaterFilesOpenItems\">";
Container.Controls.Add(NameContainer);
Container.Controls.Add(SizeContainer);
Container.Controls.Add(DateCreatedContainer);
Container.Controls.Add(DateModifiedContainer);
Container.Controls.Add(DivClear);
RepeaterItemContainer.Controls.Add(Container);
RepeaterItemContainer.Controls.Add(DivOpenItems);
}
}
protected void ColumnHeader_Bound(object sender, EventArgs e)
{
LinkButton LinkButtonSelected = (LinkButton)sender;
if (LinkButtonSelected.ID == SortOrder)
{
if (SortDirection == "ASC")
LinkButtonSelected.Style["background-image"] = "url('" + LinkButtonSelected.Page.ClientScript.GetWebResourceUrl(typeof(Zenntrix_Directory_Viewer), "Zenntrix_Toolkit.Zenntrix_Directory_Viewer_Resources.Arrow_Down.png") + "');";
else
LinkButtonSelected.Style["background-image"] = "url('" + LinkButtonSelected.Page.ClientScript.GetWebResourceUrl(typeof(Zenntrix_Directory_Viewer), "Zenntrix_Toolkit.Zenntrix_Directory_Viewer_Resources.Arrow_Up.png") + "');";
LinkButtonSelected.Style["background-position"] = "right";
LinkButtonSelected.Style["background-repeat"] = "no-repeat";
}
else
{
LinkButtonSelected.Style.Remove("background-image");
}
}
public void Column_Sort(object sender, EventArgs e)
{
if (ColumnSorted != null)
{
ColumnSorted(sender, e);
}
}
}
protected class Repeater_Files_FooterITemplate : ITemplate
{
public void InstantiateIn(Control ControlSender)
{
RepeaterItem RepeaterItemContainer = ((RepeaterItem)ControlSender);
if (RepeaterItemContainer.ItemType == ListItemType.Footer)
{
Literal DivCloseItems = new Literal();
DivCloseItems.Text = "</div>";
RepeaterItemContainer.Controls.Add(DivCloseItems);
}
}
}
}
public delegate void FolderSelectedEventHandler(object sender, ZentrixDirectoryViewFolderSelected e);
public class ZentrixDirectoryViewFolderSelected : EventArgs
{
new public static ZentrixDirectoryViewFolderSelected Empty = new ZentrixDirectoryViewFolderSelected();
public string FolderName = "";
public string FolderId = "";
public string FolderPath = "";
/// <summary>
/// Returns the selected folder size in KB
/// </summary>
public int FolderSize;
public ZentrixDirectoryViewFolderSelected()
{
}
}
public delegate void FileSelectedEventHandler(object sender, ZentrixDirectoryViewFileSelected e);
public class ZentrixDirectoryViewFileSelected : EventArgs
{
new public static ZentrixDirectoryViewFileSelected Empty = new ZentrixDirectoryViewFileSelected();
public string FileName = "";
public string FileStructureID = "";
public string FilePath = "";
public DateTime FileCreated;
public DateTime FileModified;
/// <summary>
/// Returns the selected file size in KB
/// </summary>
public int FileSize;
public ZentrixDirectoryViewFileSelected()
{
}
}
}
| {'content_hash': '4347d99f6d0b389143bc192a032529a4', 'timestamp': '', 'source': 'github', 'line_count': 1355, 'max_line_length': 253, 'avg_line_length': 43.29594095940959, 'alnum_prop': 0.5418470664439369, 'repo_name': 'zenntrix/Web_Toolkit', 'id': '0966ef9e1efb933ad7fb54ca7ea1366ce11c8e6d', 'size': '58668', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Zenntrix_Directory_Viewer/Zenntrix_Directory_Viewer/Zenntrix_Directory_Viewer.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '223786'}, {'name': 'CSS', 'bytes': '3785'}, {'name': 'JavaScript', 'bytes': '6077'}, {'name': 'Shell', 'bytes': '780'}]} |
from test_framework.test_framework import PresidentielcoinTestFramework
from test_framework.util import *
import zmq
import struct
import http.client
import urllib.parse
class ZMQTest (PresidentielcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 4
port = 28370
def setup_nodes(self):
self.zmqContext = zmq.Context()
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock")
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx")
self.zmqSubSocket.connect("tcp://127.0.0.1:%i" % self.port)
return start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[
['-zmqpubhashtx=tcp://127.0.0.1:'+str(self.port), '-zmqpubhashblock=tcp://127.0.0.1:'+str(self.port)],
[],
[],
[]
])
def run_test(self):
self.sync_all()
genhashes = self.nodes[0].generate(1)
self.sync_all()
print("listen...")
msg = self.zmqSubSocket.recv_multipart()
topic = msg[0]
assert_equal(topic, b"hashtx")
body = msg[1]
nseq = msg[2]
msgSequence = struct.unpack('<I', msg[-1])[-1]
assert_equal(msgSequence, 0) #must be sequence 0 on hashtx
msg = self.zmqSubSocket.recv_multipart()
topic = msg[0]
body = msg[1]
msgSequence = struct.unpack('<I', msg[-1])[-1]
assert_equal(msgSequence, 0) #must be sequence 0 on hashblock
blkhash = bytes_to_hex_str(body)
assert_equal(genhashes[0], blkhash) #blockhash from generate must be equal to the hash received over zmq
n = 10
genhashes = self.nodes[1].generate(n)
self.sync_all()
zmqHashes = []
blockcount = 0
for x in range(0,n*2):
msg = self.zmqSubSocket.recv_multipart()
topic = msg[0]
body = msg[1]
if topic == b"hashblock":
zmqHashes.append(bytes_to_hex_str(body))
msgSequence = struct.unpack('<I', msg[-1])[-1]
assert_equal(msgSequence, blockcount+1)
blockcount += 1
for x in range(0,n):
assert_equal(genhashes[x], zmqHashes[x]) #blockhash from generate must be equal to the hash received over zmq
#test tx from a second node
hashRPC = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1.0)
self.sync_all()
# now we should receive a zmq msg because the tx was broadcast
msg = self.zmqSubSocket.recv_multipart()
topic = msg[0]
body = msg[1]
hashZMQ = ""
if topic == b"hashtx":
hashZMQ = bytes_to_hex_str(body)
msgSequence = struct.unpack('<I', msg[-1])[-1]
assert_equal(msgSequence, blockcount+1)
assert_equal(hashRPC, hashZMQ) #blockhash from generate must be equal to the hash received over zmq
if __name__ == '__main__':
ZMQTest ().main ()
| {'content_hash': '6836605ffe7188faf1b60098ae766a24', 'timestamp': '', 'source': 'github', 'line_count': 91, 'max_line_length': 121, 'avg_line_length': 33.417582417582416, 'alnum_prop': 0.5830318974021703, 'repo_name': 'presidentielcoin/presidentielcoin', 'id': 'dec14f5f9d58e3d91a694d9885872e89eb05476d', 'size': '3291', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'qa/rpc-tests/zmq_test.py', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Assembly', 'bytes': '133972'}, {'name': 'Batchfile', 'bytes': '3647'}, {'name': 'C', 'bytes': '729310'}, {'name': 'C++', 'bytes': '9505273'}, {'name': 'CSS', 'bytes': '99380'}, {'name': 'HTML', 'bytes': '50621'}, {'name': 'Java', 'bytes': '32471'}, {'name': 'M4', 'bytes': '187790'}, {'name': 'Makefile', 'bytes': '125005'}, {'name': 'Objective-C', 'bytes': '5974'}, {'name': 'Objective-C++', 'bytes': '7276'}, {'name': 'Protocol Buffer', 'bytes': '2825'}, {'name': 'Python', 'bytes': '1032557'}, {'name': 'QMake', 'bytes': '2020'}, {'name': 'Roff', 'bytes': '31176'}, {'name': 'Shell', 'bytes': '95914'}]} |
<!-- Post Layout Start -->
<!DOCTYPE html>
<html lang="{{ site.lang }}">
{% include head.html %}
<body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top" data-offset="151">
{% include navigation.html %}
{% include post.html %}
{% include footer.html %}
{% include js.html %}
</body>
</html>
<!-- Post Layout End -->
| {'content_hash': 'a94c7f6c08bb6d143eb92331c6eb4f15', 'timestamp': '', 'source': 'github', 'line_count': 19, 'max_line_length': 91, 'avg_line_length': 18.894736842105264, 'alnum_prop': 0.5766016713091922, 'repo_name': 'alexandrucoman/labs.cloudbase.it', 'id': 'a8624a85632860c4e813ea6e4f098f0dc1d7cca2', 'size': '359', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '_layouts/post.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '442014'}, {'name': 'HTML', 'bytes': '39852'}, {'name': 'Ruby', 'bytes': '3280'}]} |
require 'OpenNebulaJSON/JSONUtils'
module OpenNebulaJSON
class HostJSON < OpenNebula::Host
include JSONUtils
def create(template_json)
host_hash = parse_json(template_json, 'host')
if OpenNebula.is_error?(host_hash)
return host_hash
end
self.allocate(host_hash['name'],
host_hash['im_mad'],
host_hash['vm_mad'],
host_hash['vnm_mad'],
host_hash['cluster_id'].to_i)
end
def delete
if self['HOST_SHARE/RUNNING_VMS'].to_i != 0
OpenNebula::Error.new("Host still has associated VMs, aborting delete.")
else
super
end
end
def perform_action(template_json)
action_hash = parse_json(template_json, 'action')
if OpenNebula.is_error?(action_hash)
return action_hash
end
rc = case action_hash['perform']
when "enable" then self.enable
when "disable" then self.disable
when "update" then self.update(action_hash['params'])
else
error_msg = "#{action_hash['perform']} action not " <<
" available for this resource"
OpenNebula::Error.new(error_msg)
end
end
def update(params=Hash.new)
super(params['template_raw'])
end
end
end
| {'content_hash': '2ce28e507ce682fd8ec9a07879a6a050', 'timestamp': '', 'source': 'github', 'line_count': 50, 'max_line_length': 88, 'avg_line_length': 31.22, 'alnum_prop': 0.4875080076873799, 'repo_name': 'bcec/opennebula3.4.1', 'id': '3ca11ecb0beb20deb3efb30614255bd048174eb5', 'size': '2747', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/sunstone/models/OpenNebulaJSON/HostJSON.rb', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '721757'}, {'name': 'C++', 'bytes': '1502569'}, {'name': 'Java', 'bytes': '262511'}, {'name': 'JavaScript', 'bytes': '906638'}, {'name': 'Python', 'bytes': '2832'}, {'name': 'Ruby', 'bytes': '1090866'}, {'name': 'Shell', 'bytes': '154875'}]} |
<?php
namespace app\models\db;
use Yii;
/**
* Admin model
*
* @property AdminAuthLog[] $authLogs
*/
class Admin extends Identity
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'Admin';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return array_merge(parent::rules(), [
// add extra validation here
]);
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return array_merge(parent::attributeLabels(), [
// add extra labels here
]);
}
/**
* {@inheritdoc}
*/
public function afterSave($insert, $changedAttributes)
{
parent::afterSave($insert, $changedAttributes);
if ($insert) {
$this->sendNewAdminEmail();
}
}
// Relations :
/**
* @return \yii\db\ActiveQuery
*/
public function getAuthLogs()
{
return $this->hasMany(AdminAuthLog::class, ['adminId' => 'id']);
}
// Logic :
/**
* Sends email notification about account creation.
* @return boolean success.
*/
public function sendNewAdminEmail()
{
return Yii::$app->mailer->compose('newAdmin', ['admin' => $this])
->setTo($this->email)
->setFrom([Yii::$app->params['appEmail'] => Yii::$app->name])
->setSubject(Yii::t('admin', 'Your administration account at {appName}', ['appName' => Yii::$app->name]))
->send();
}
/**
* {@inheritdoc}
*/
public function sendSuspendEmail()
{
return Yii::$app->mailer->compose('suspendAdmin', ['admin' => $this])
->setTo($this->email)
->setFrom([Yii::$app->params['appEmail'] => Yii::$app->name])
->setSubject(Yii::t('admin', 'Your administration account at {appName} has been suspended', ['appName' => Yii::$app->name]))
->send();
}
} | {'content_hash': 'e29b32bbd9d866a4980930d1a12a9882', 'timestamp': '', 'source': 'github', 'line_count': 89, 'max_line_length': 136, 'avg_line_length': 22.235955056179776, 'alnum_prop': 0.5194542698332492, 'repo_name': 'yii2tech/project-template', 'id': 'bae26ca8f13866d10ddabb939a95ec78e145b1e7', 'size': '1979', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'models/db/Admin.php', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Batchfile', 'bytes': '1030'}, {'name': 'CSS', 'bytes': '3244'}, {'name': 'PHP', 'bytes': '188077'}]} |
<?php
namespace hnr\sircimBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class RolOpcionSistemaControllerTest extends WebTestCase
{
/*
public function testCompleteScenario()
{
// Create a new client to browse the application
$client = static::createClient();
// Create a new entry in the database
$crawler = $client->request('GET', '/rolopcionsistema/');
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /rolopcionsistema/");
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
// Fill in the form and submit it
$form = $crawler->selectButton('Create')->form(array(
'hnr_sircimbundle_rolopcionsistematype[field_name]' => 'Test',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check data in the show view
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
// Edit the entity
$crawler = $client->click($crawler->selectLink('Edit')->link());
$form = $crawler->selectButton('Edit')->form(array(
'hnr_sircimbundle_rolopcionsistematype[field_name]' => 'Foo',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check the element contains an attribute with value equals "Foo"
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
// Delete the entity
$client->submit($crawler->selectButton('Delete')->form());
$crawler = $client->followRedirect();
// Check the entity has been delete on the list
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
}
*/
} | {'content_hash': '657d1849d76ae5513769e287effdda8a', 'timestamp': '', 'source': 'github', 'line_count': 55, 'max_line_length': 132, 'avg_line_length': 36.07272727272727, 'alnum_prop': 0.6129032258064516, 'repo_name': 'B9lly/TG2013', 'id': '0b6aed5d9f94c8636efb3f2614a1e3896dc7ca9b', 'size': '1984', 'binary': False, 'copies': '1', 'ref': 'refs/heads/billy', 'path': 'src/hnr/sircimBundle/Tests/Controller/RolOpcionSistemaControllerTest.php', 'mode': '33188', 'license': 'mit', 'language': []} |
<!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_151) on Wed Jul 17 13:50:52 MST 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface org.wildfly.swarm.undertow.WARArchive (BOM: * : All 2.5.0.Final API)</title>
<meta name="date" content="2019-07-17">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface org.wildfly.swarm.undertow.WARArchive (BOM: * : All 2.5.0.Final 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="../../../../../org/wildfly/swarm/undertow/WARArchive.html" title="interface in org.wildfly.swarm.undertow">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Thorntail API, 2.5.0.Final</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/wildfly/swarm/undertow/class-use/WARArchive.html" target="_top">Frames</a></li>
<li><a href="WARArchive.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 Interface org.wildfly.swarm.undertow.WARArchive" class="title">Uses of Interface<br>org.wildfly.swarm.undertow.WARArchive</h2>
</div>
<div class="classUseContainer">No usage of org.wildfly.swarm.undertow.WARArchive</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/wildfly/swarm/undertow/WARArchive.html" title="interface in org.wildfly.swarm.undertow">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Thorntail API, 2.5.0.Final</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/wildfly/swarm/undertow/class-use/WARArchive.html" target="_top">Frames</a></li>
<li><a href="WARArchive.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="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| {'content_hash': '6614f195380ee557c977bb58296d80ba', 'timestamp': '', 'source': 'github', 'line_count': 128, 'max_line_length': 145, 'avg_line_length': 37.546875, 'alnum_prop': 0.614856429463171, 'repo_name': 'wildfly-swarm/wildfly-swarm-javadocs', 'id': 'fc3422d3d78bece4bddf2a92af35725c9165c445', 'size': '4806', 'binary': False, 'copies': '1', 'ref': 'refs/heads/gh-pages', 'path': '2.5.0.Final/apidocs/org/wildfly/swarm/undertow/class-use/WARArchive.html', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
!External articles
* [[Retail example|http://philip.greenspun.com/sql/data-warehousing.html]]
* [[Star vs Snowflake|http://www.simple-talk.com/content/print.aspx?article=592]]
*[[Download|http://sourceforge.net/projects/pentaho/files/]]
*[[Dashboard Tools - Webdetails|http://www.webdetails.pt/]]
*[[Pentaho HTML5 Integration|http://forums.pentaho.com/archive/index.php/t-78268.html]]
*[[Classic dashboards|http://wiki.pentaho.com/display/COM/A+Dashboard+Framework+for+the+Pentaho+BI+Platform]]
*[[Run Kettle Job for each Row|http://type-exit.org/adventures-with-open-source-bi/2010/06/run-kettle-job-for-each-row/]]
*[[Loops in Kettle Jobs|http://type-exit.org/adventures-with-open-source-bi/2010/06/kettle-quick-hint-loops-in-kettle-jobs/]]
*[[Develop Dashboards with CDE|http://www.tikalk.com/incubator/blog/creating-bugzilla-dashboard-%E2%80%93-hands-cde-tutorial-%E2%80%93-fuse-day-3-session-summary]]
!My cheat sheets
[[Install-Pentaho|install-pentaho-server]]
[[Manual configuration Hibernate|pentaho-hibernate-configuration]]
[[Publish Mondrian Schemas|publish-pentaho-mondrian-schemes]]
[[Change Password in Admin Console|change-pentaho-password-admin-console]]
# getting started #
Set your directories of work `/opt/pentaho/administration-console/resource/config/console.xml`
<console>
<solution-path>../biserver-ce/pentaho-solutions</solution-path>
<war-path>../biserver-ce/tomcat/webapps/pentaho</war-path>
...
Add your IP server in /opt/pentaho/biserver-ce/tomcat/webapps/pentaho/WEB-INF/web.xml
<param-name>solution-path</param-name>
<param-value>/opt/pentaho/biserver-ce/pentaho-solutions/</param-value>
...
<param-name>fully-qualified-server-url</param-name>
<param-value>http://localhost:8080/pentaho/</param-value>
...
<param-name>TrustedIpAddrs</param-name>
<param-value>10.0.0.138,127.0.0.1</param-value>
...
You have to login with the same user/pass on both bi-server and admin-console
Config MySQL Driver/URL in `/opt/pentaho/biserver-ce/pentaho-solutions/system/applicationContext-spring-security-jdbc.xml`
org.hsqldb.jdbcDriver --> com.mysql.jdbc.Driver
jdbc:hsqldb:hsql://localhost:9001/hibernate --> jdbc:mysql://localhost:3306/hibernate
At the end it should look like this:
<!-- This is only for Hypersonic. Please update this section for any other database you are using -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url"
value="jdbc:mysql://localhost:3306/hibernate" />
<property name="username" value="hibuser" />
<property name="password" value="password" />
</bean>
Change the file `/opt/pentaho/biserver-ce/pentaho-solutions/system/applicationContext-spring-security-hibernate.properties`
jdbc.driver==com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/hibernate
jdbc.username=hibuser
jdbc.password=password
hibernate.dialect=org.hibernate.dialect.MySQLDialect
Change to MySQL driver in `/opt/pentaho/biserver-ce/pentaho-solutions/system/hibernate/hibernate-settings.xml`
<config-file>system/hibernate/mysql5.hibernate.cfg.xml</config-file>
Change `/opt/pentaho/biserver-ce/tomcat/webapps/pentaho/META-INF/context.xml`
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/pentaho" docbase="webapps/pentaho/">
<Resource name="jdbc/Hibernate" auth="Container" type="javax.sql.DataSource"
factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxActive="20" maxIdle="5"
maxWait="10000" username="hibuser" password="password"
driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/hibernate"
validationQuery="select 1" />
<Resource name="jdbc/Quartz" auth="Container" type="javax.sql.DataSource"
factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxActive="20" maxIdle="5"
maxWait="10000" username="pentaho_user" password="password"
driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/quartz"
validationQuery="select 1"/>
</Context>
Config Email in `/opt/pentaho/bi-server/pentaho-solutions/system/smtp-email/email_config.xml`
Disable HSQLDB: Comment in `/opt/pentaho/biserver-ce/tomcat/webapps/pentaho/WEB-INF/web.xml`
<context-param>
<param-name>hsqldb-databases</param-name>
<param-value>sampledata@../../data/hsqldb/sampledata,hibernate@../../data/hsqldb/hibernate,quartz@../../data/hsqldb/quartz</param-value>
</context-param>
...
<listener>
<listener-class>org.pentaho.platform.web.http.context.HsqldbStartupListener</listener-class>
</listener>
...
* Disable Login List
1. In the file `/opt/pentaho/biserver-ce/tomcat/webapps/pentaho/mantleLogin/loginsettings.properties`
2. Change `#showUsersList=true` to `showUsersList=false`
| {'content_hash': '819026d309d585f16ef578f8eb570378', 'timestamp': '', 'source': 'github', 'line_count': 104, 'max_line_length': 167, 'avg_line_length': 49.81730769230769, 'alnum_prop': 0.7006369426751592, 'repo_name': 'iwxfer/wikitten', 'id': '84da2393b51f727661d3329343bd2795d5e347a8', 'size': '5181', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'library/pentaho/pentaho.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '168'}, {'name': 'C', 'bytes': '2393'}, {'name': 'C++', 'bytes': '6927'}, {'name': 'CSS', 'bytes': '12370'}, {'name': 'CoffeeScript', 'bytes': '1043'}, {'name': 'Erlang', 'bytes': '2982'}, {'name': 'HTML', 'bytes': '2410'}, {'name': 'JavaScript', 'bytes': '24553'}, {'name': 'PHP', 'bytes': '139733'}, {'name': 'Python', 'bytes': '37939'}, {'name': 'Ruby', 'bytes': '2472'}, {'name': 'Shell', 'bytes': '43175'}]} |
package main
import (
"encoding/json"
"log"
"strings"
"text/template"
"../../../gen"
)
func main() {
t, err := template.New("").Parse(tmpl)
if err != nil {
log.Fatal(err)
}
var j js
if err := gen.Gen("clock", &j, t); err != nil {
log.Fatal(err)
}
}
// The JSON structure we expect to be able to umarshal into
type js struct {
Groups []testGroup `json:"Cases"`
}
type testGroup struct {
Description string
Cases []json.RawMessage `property:"RAW"`
CreateCases []struct {
Description string
Hour, Minute int
Expected string
} `property:"create"`
AddCases []struct {
Description string
Hour, Minute, Add int
Expected string
} `property:"add"`
EqCases []struct {
Description string
Clock1, Clock2 struct{ Hour, Minute int }
Expected bool
} `property:"equal"`
}
func (groups testGroup) GroupShortName() string {
return strings.ToLower(strings.Fields(groups.Description)[0])
}
var tmpl = `package clock
{{.Header}}
{{range .J.Groups}}
// {{ .Description }}
{{- if .CreateCases }}
var timeTests = []struct {
h, m int
want string
}{
{{- range .CreateCases }}
{ {{.Hour}}, {{.Minute}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
{{- end }}
}
{{- end }}
{{- if .AddCases }}
var {{ .GroupShortName }}Tests = []struct {
h, m, a int
want string
}{
{{- range .AddCases }}
{ {{.Hour}}, {{.Minute}}, {{.Add}}, {{.Expected | printf "%#v"}}}, // {{.Description}}
{{- end }}
}
{{- end }}
{{- if .EqCases }}
type hm struct{ h, m int }
var eqTests = []struct {
c1, c2 hm
want bool
}{
{{- range .EqCases }}
// {{.Description}}
{
hm{ {{.Clock1.Hour}}, {{.Clock1.Minute}}},
hm{ {{.Clock2.Hour}}, {{.Clock2.Minute}}},
{{.Expected}},
},
{{- end }}
}
{{- end }}
{{end}}
`
| {'content_hash': 'bb7b0b401de66b76b6cfa0ef23805741', 'timestamp': '', 'source': 'github', 'line_count': 98, 'max_line_length': 90, 'avg_line_length': 18.79591836734694, 'alnum_prop': 0.5564603691639523, 'repo_name': 'robphoenix/exercism-go', 'id': '0dc2dc73199a290ff3b1606c86cc185c563c396d', 'size': '1842', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'exercises/clock/.meta/gen.go', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Go', 'bytes': '463409'}, {'name': 'Shell', 'bytes': '2482'}]} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_loop_66b.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE805.string.label.xml
Template File: sources-sink-66b.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Allocate using malloc() and set data pointer to a small buffer
* GoodSource: Allocate using malloc() and set data pointer to a large buffer
* Sinks: loop
* BadSink : Copy string to data using a loop
* Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_loop_66b_badSink(wchar_t * dataArray[])
{
/* copy data out of dataArray */
wchar_t * data = dataArray[2];
{
size_t i;
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if source is larger than data */
for (i = 0; i < 100; i++)
{
data[i] = source[i];
}
data[100-1] = L'\0'; /* Ensure the destination buffer is null terminated */
printWLine(data);
free(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_loop_66b_goodG2BSink(wchar_t * dataArray[])
{
wchar_t * data = dataArray[2];
{
size_t i;
wchar_t source[100];
wmemset(source, L'C', 100-1); /* fill with L'C's */
source[100-1] = L'\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if source is larger than data */
for (i = 0; i < 100; i++)
{
data[i] = source[i];
}
data[100-1] = L'\0'; /* Ensure the destination buffer is null terminated */
printWLine(data);
free(data);
}
}
#endif /* OMITGOOD */
| {'content_hash': '86325c9a2431a8f268084112edb439cf', 'timestamp': '', 'source': 'github', 'line_count': 67, 'max_line_length': 109, 'avg_line_length': 31.91044776119403, 'alnum_prop': 0.5958840037418148, 'repo_name': 'JianpingZeng/xcc', 'id': '3c2d0b7dc0142206574e0faa702a37957bc110a3', 'size': '2138', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'xcc/test/juliet/testcases/CWE122_Heap_Based_Buffer_Overflow/s08/CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_loop_66b.c', 'mode': '33188', 'license': 'bsd-3-clause', 'language': []} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
</head>
<body bgcolor="white">
This package presents a framework that allows application developers to
make use of security services like authentication, data integrity and
data confidentiality from a variety of underlying security mechanisms
like Kerberos, using a unified API. The security mechanisms that an
application can
chose to use are identified with unique object identifiers. One example
of such a mechanism is the Kerberos v5 GSS-API mechanism (object
identifier 1.2.840.113554.1.2.2). This mechanism is available through
the default instance of the GSSManager class.<p>
The GSS-API is defined in a language independent way in
<a href=http://www.ietf.org/rfc/rfc2743.txt>RFC 2743</a>. The Java
language bindings are defined in
<a href=http://www.ietf.org/rfc/rfc2853.txt>RFC 2853</a><p>
An application starts out by instantiating a <code>GSSManager</code>
which then serves as a factory for a security context. An application
can use specific principal names and credentials that are also created
using the GSSManager; or it can instantiate a
context with system defaults. It then goes through a context
establishment loop. Once a context is established with the
peer, authentication is complete. Data protection such as integrity
and confidentiality can then be obtained from this context.<p>
The GSS-API does not perform any communication with the peer. It merely
produces tokens that the application must somehow transport to the
other end.<p>
<h3>Credential Acquisition</h3>
<a name=useSubjectCredsOnly>
The GSS-API itself does not dictate how an underlying mechanism
obtains the credentials that are needed for authentication. It is
assumed that prior to calling the GSS-API, these credentials are
obtained and stored in a location that the mechanism provider is
aware of. However, the default model in the Java platform will be
that mechanism providers must obtain credentials only from the private
or public credential sets associated with the
{@link javax.security.auth.Subject Subject} in the
current access control context. The Kerberos v5
mechanism will search for the required INITIATE and ACCEPT credentials
({@link javax.security.auth.kerberos.KerberosTicket KerberosTicket} and
{@link javax.security.auth.kerberos.KerberosKey KerberosKey}) in
the private credential set where as some other mechanism might look
in the public set or in both. If the desired credential is not
present in the appropriate sets of the current Subject, the GSS-API
call must fail.<p>
This model has the advantage that credential management
is simple and predictable from the applications point of view. An
application, given the right permissions, can purge the credentials in
the Subject or renew them using standard Java API's. If it purged
the credentials, it would be sure that the JGSS mechanism would fail,
or if it renewed a time based credential it would be sure that a JGSS
mechanism would succeed.<p>
This model does require that a {@link
javax.security.auth.login JAAS login} be performed in order to
authenticate and populate a Subject that the JGSS mechnanism can later
utilize. However, applications have the ability to relax this
restiction by means of a system property:
<code>javax.security.auth.useSubjectCredsOnly</code>. By default
this system property will be assumed to be <code>true</code> (even when
it is unset) indicating that providers must only use the credentials
that are present in the current Subject. However, if this property is
explicitly set to false by the application, then it indicates that
the provider is free to use any credentials cache of its choice. Such
a credential cache might be a disk cache, an in-memory cache, or even
just the current Subject itself.
</a>
<h2>Related Documentation</h2>
<p>
For an online tutorial on using Java GSS-API, please see
<a href="../../../../technotes/guides/security/jgss/tutorials/index.html">Introduction to JAAS and Java GSS-API</a>.
</p>
<!--
<h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
</ul>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
</ul>
-->
@since 1.4
</body>
</html>
| {'content_hash': 'e2f1f80b36d1b0edf37304474f70c28a', 'timestamp': '', 'source': 'github', 'line_count': 127, 'max_line_length': 116, 'avg_line_length': 45.874015748031496, 'alnum_prop': 0.7518022657054583, 'repo_name': 'andreagenso/java2scala', 'id': '098b1cce4f2b4b237cd29accbfe7cf5f494d01e3', 'size': '5826', 'binary': False, 'copies': '34', 'ref': 'refs/heads/master', 'path': 'test/J2s/java/openjdk-6-src-b27/jdk/src/share/classes/org/ietf/jgss/package.html', 'mode': '33261', 'license': 'apache-2.0', 'language': [{'name': 'Assembly', 'bytes': '8983'}, {'name': 'Awk', 'bytes': '26041'}, {'name': 'Batchfile', 'bytes': '1796'}, {'name': 'C', 'bytes': '20159882'}, {'name': 'C#', 'bytes': '7630'}, {'name': 'C++', 'bytes': '4513460'}, {'name': 'CSS', 'bytes': '5128'}, {'name': 'DTrace', 'bytes': '68220'}, {'name': 'HTML', 'bytes': '1302117'}, {'name': 'Haskell', 'bytes': '244134'}, {'name': 'Java', 'bytes': '129267130'}, {'name': 'JavaScript', 'bytes': '182900'}, {'name': 'Makefile', 'bytes': '711241'}, {'name': 'Objective-C', 'bytes': '66163'}, {'name': 'Python', 'bytes': '137817'}, {'name': 'Roff', 'bytes': '2630160'}, {'name': 'Scala', 'bytes': '25599'}, {'name': 'Shell', 'bytes': '888136'}, {'name': 'SourcePawn', 'bytes': '78'}]} |
package com.networknt.eventuate.account.view.handler;
import com.networknt.exception.ApiException;
import com.networknt.exception.ClientException;
import org.junit.ClassRule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HealthGetHandlerTest {
@ClassRule
public static TestServer server = TestServer.getInstance();
static final Logger logger = LoggerFactory.getLogger(HealthGetHandlerTest.class);
static final boolean enableHttp2 = server.getServerConfig().isEnableHttp2();
static final boolean enableHttps = server.getServerConfig().isEnableHttps();
static final int httpPort = server.getServerConfig().getHttpPort();
static final int httpsPort = server.getServerConfig().getHttpsPort();
static final String url = enableHttp2 || enableHttps ? "https://localhost:" + httpsPort : "http://localhost:" + httpPort;
@Test
public void testHealthGetHandlerTest() throws ClientException, ApiException {
/*
final Http2Client client = Http2Client.getInstance();
final CountDownLatch latch = new CountDownLatch(1);
final ClientConnection connection;
try {
connection = client.connect(new URI(url), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get();
} catch (Exception e) {
throw new ClientException(e);
}
final AtomicReference<ClientResponse> reference = new AtomicReference<>();
try {
ClientRequest request = new ClientRequest().setPath("/v1/health").setMethod(Methods.GET);
connection.sendRequest(request, client.createClientCallback(reference, latch));
latch.await();
} catch (Exception e) {
logger.error("Exception: ", e);
throw new ClientException(e);
} finally {
IoUtils.safeClose(connection);
}
int statusCode = reference.get().getResponseCode();
String body = reference.get().getAttachment(Http2Client.RESPONSE_BODY);
Assert.assertEquals(200, statusCode);
Assert.assertNotNull(body);
*/
}
}
| {'content_hash': 'e0249668c295c19c90b2a3777bcb6ddf', 'timestamp': '', 'source': 'github', 'line_count': 54, 'max_line_length': 207, 'avg_line_length': 41.166666666666664, 'alnum_prop': 0.692757534862798, 'repo_name': 'networknt/light-java-example', 'id': 'fa2588fb819283a1279e39d5491738fedddc5dc6', 'size': '2223', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'eventuate/account-management/account-view-service/src/test/java/com/networknt/eventuate/account/view/handler/HealthGetHandlerTest.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '1251'}, {'name': 'Java', 'bytes': '562730'}, {'name': 'JavaScript', 'bytes': '20118'}, {'name': 'PLSQL', 'bytes': '1936'}]} |
package com.s4game.server.io;
/**
* @Author [email protected]
* @sine 2015年5月5日 下午9:56:13
*
*/
public class IoConstants {
public static final String ROLE_KEY = "role_key";
public static final String IP_KEY = "ip_key";
public static final String SESSION_KEY = "session_key";
}
| {'content_hash': '9d5e0fde805614002c565f6033dd76db', 'timestamp': '', 'source': 'github', 'line_count': 16, 'max_line_length': 56, 'avg_line_length': 18.75, 'alnum_prop': 0.68, 'repo_name': 'zuesgooogle/HappyCard', 'id': 'e31212fd2a6a63f032dab541896d239d6828e3f3', 'size': '310', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'card-server/src/main/java/com/s4game/server/io/IoConstants.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '976104'}]} |
RubbishRelease::RubbishRelease(SSDB *ssdb){
this->ssdb = ssdb;
this->thread_quit = false;
this->list_name = RUBBISH_LIST_KEY;
this->queue_first_version = 0;
this->start();
}
RubbishRelease::~RubbishRelease(){
Locking l(&this->mutex);
this->stop();
ssdb = NULL;
}
void RubbishRelease::start(){
thread_quit = false;
pthread_t tid;
int err = pthread_create(&tid, NULL, &RubbishRelease::thread_func, this);
if(err != 0){
log_fatal("can't create clear rubbishrelese thread: %s", strerror(err));
exit(0);
}
}
void RubbishRelease::stop(){
thread_quit = true;
for(int i=0; i<100; i++){
if(!thread_quit){
break;
}
usleep(10 * 1000);
}
}
int RubbishRelease::push_clear_queue(TMH &metainfo, const Bytes &name){
std::string s_ver = str(metainfo.version);
std::string s_key = encode_release_key(metainfo.datatype, name);
//尝试将那么name加入垃圾收集队列中
int ret = this->ssdb->hset_rubbish_queue(this->list_name, s_key, s_ver);
//log_debug("push_clear_queue key:%s, hset_rubbish_queue ret:%d", name.data(), ret);
if(ret < 0){
return -1;
}
//成功就删除meta信息
std::string metalkey = EncodeMetaKey(name);
ssdb->getBinlog()->Delete(metalkey);
static_cast<SSDBImpl *>(ssdb)->expiration->del_ttl(name);
//是否发送同步信息,函数外配置TODO:slot不准
//ssdb->calculateSlotRefer(Slots::encode_slot_id(name), -1);
if(metainfo.version < queue_first_version){
queue_first_version = metainfo.version;
}
return 1;
}
int RubbishRelease::push_clear_queue(const Bytes &name, const char log_type,
const char cmd_type, bool clearttl){
Transaction trans(ssdb->getBinlog());
//找出name的meta信息
TMH metainfo = {0};
//ignore ttl,del_ttl will called this function
if (ssdb->loadobjectbyname(&metainfo, name, 0, false) <= 0){
return 0;
}
std::string s_ver = str(metainfo.version);
std::string s_key = encode_release_key(metainfo.datatype, name);
//尝试将那么name加入垃圾收集队列中
int ret = this->ssdb->hset_rubbish_queue(this->list_name, s_key, s_ver);
//log_debug("push_clear_queue key:%s, hset_rubbish_queue ret:%d", name.data(), ret);
if(ret < 0){
return -1;
}
//成功就删除meta信息
std::string metalkey = EncodeMetaKey(name);
ssdb->getBinlog()->Delete(metalkey);
if (clearttl){
static_cast<SSDBImpl *>(ssdb)->expiration->del_ttl(name);
}
//是否发送同步信息,函数外配置
ssdb->calculateSlotRefer(Slots::encode_slot_id(name), -1);
ssdb->getBinlog()->add_log(log_type, cmd_type, metalkey);
leveldb::Status s = ssdb->getBinlog()->commit();
if(!s.ok()){
return 0;
}else if(!s.ok()){
return -1;
}
if(metainfo.version < queue_first_version){
queue_first_version = metainfo.version;
}
// //不为空才进入,否则还会操作一次,在load_expiration_keys_from_db中
// if(!fast_queues.empty() && fast_queues.size() < BATCH_SIZE){
// //因为是队列.不需要pop最后一个判断,后进入的肯定版本高
// fast_queues.add(s_key, metainfo.version);
// }
return 1;
}
void RubbishRelease::load_expiration_keys_from_db(int num){
Iterator *it = nullptr;
int ret = ssdb->hscan(&it, this->list_name, "", "\xff", num);
int n = 0;
if (ret > 0){
while(it->next()){
n ++;
const std::string &key = it->key();
int64_t version = str_to_int64(it->value());
fast_queues.add(key, version);
char type = 0;
std::string name;
decode_release_key(key, &type, &name);
log_debug("add clear queue:%s:%c", name.c_str(), type);
}
delete it;
}
log_debug("load %d keys into clear queue", n);
}
void RubbishRelease::expire_loop(){
//Locking l(&this->mutex);
if(!this->ssdb){
return;
}
if(this->fast_queues.empty()){
this->load_expiration_keys_from_db(BATCH_SIZE);
if(this->fast_queues.empty()){
this->queue_first_version = INT64_MAX;
return;
}
}
int64_t version;
std::string key;
if(this->fast_queues.front(&key, &version)){
log_debug("clear name: %s, version: %llu", hexmem(key.c_str(), key.size()).data(), version);
if (lazy_clear(key, version) > 0){
log_debug("continue clear key:%s,%llu", key.c_str(), version);
}else{
fast_queues.pop_front();
this->ssdb->hdel(this->list_name, key, BinlogType::NONE);
}
}
}
void* RubbishRelease::thread_func(void *arg){
RubbishRelease *handler = (RubbishRelease *)arg;
while(!handler->thread_quit){
usleep(10000);
if(handler->queue_first_version > time_us()){
continue;
}
handler->expire_loop();
}
log_debug("rubbishrelease thread quit");
handler->thread_quit = false;
return (void *)NULL;
}
int RubbishRelease::lazy_clear(const Bytes &raw_key, int64_t version)
{
char type;
std::string name;
if (decode_release_key(raw_key, &type, &name)){
return -1;
}
std::string key_start = encode_data_key_start(type, name, version);
std::string key_end = encode_data_key_end(type, name, version);
Iterator *it = IteratorFactory::iterator(this->ssdb, dataType2IterType2(type), name,
version, key_start, key_end, 500);
int num = 0;
leveldb::WriteBatch batch;
while(it->next()){
//log_debug("-----------del:%s, %llu, value:%s", it->key().c_str(), it->seq(), it->value().c_str());
switch(type){
case DataType::ZSIZE:{
batch.Delete(EncodeSortSetScoreKey(name, it->key(), it->score(), version));
batch.Delete(EncodeSortSetKey(name, it->key(), version));
break;
}
case DataType::HSIZE:{
batch.Delete(EncodeHashKey(name, it->key(), version));
break;
}
case DataType::LSIZE:{
batch.Delete(EncodeListKey(name, it->seq(), version));
break;
}
case DataType::TABLE:{
batch.Delete(it->key());
//log_debug("clear version: %lld, key: %s", it->version(), hexmem(it->key().c_str(), it->key().size()).data());
break;
}
}
num++;
}
delete it;
leveldb::Status s = ssdb->getlDb()->Write(leveldb::WriteOptions(), &batch);
if(!s.ok()){
log_error("clear_rubbish_queue error:%s", s.ToString().data());
return -1;
}
//清除数据应该CompactRange一次,但是如果CompactRange时间超过100毫秒就应该报警,并且可配停止CompactRange动作。
int64_t ts = time_us();
leveldb::Slice slice_s(key_start);
leveldb::Slice slice_e(key_end);
ssdb->getlDb()->CompactRange(&slice_s, &slice_e);
int64_t te = time_us();
if ( te-ts > 100000 ) {
log_info("rubbish compactRange time to long :%s -> %lld", key_start.data(), te - ts);
}
return num;
}
std::string RubbishRelease::encode_data_key_start(const char type, const Bytes &name, int64_t version){
std::string key_s;
switch(type){
case DataType::ZSIZE:{
key_s = EncodeSortSetScoreKey(name, "", SSDB_SCORE_MIN, version);
break;
}
case DataType::LSIZE:{
key_s = EncodeListKey(name, "", version);
break;
}
case DataType::HSIZE:{
key_s = EncodeHashKey(name, "", version);
break;
}
}
return key_s;
}
std::string RubbishRelease::encode_data_key_end(const char type, const Bytes &name, int64_t version){
std::string key_e;
switch(type){
case DataType::ZSIZE:{
key_e = EncodeSortSetScoreKey(name, "\xff", SSDB_SCORE_MAX, version);
break;
}
case DataType::LSIZE:{
key_e = EncodeListKey(name, "\xff", version);
break;
}
case DataType::HSIZE:{
key_e = EncodeHashKey(name, "\xff", version);
break;
}
}
return key_e;
}
| {'content_hash': '5125c0c945c527fb907c23e0952565b6', 'timestamp': '', 'source': 'github', 'line_count': 271, 'max_line_length': 124, 'avg_line_length': 26.800738007380073, 'alnum_prop': 0.6288035247143053, 'repo_name': 'carryLabs/carrydb', 'id': 'c76cc73a55b62edc8280c30ee4ff0468e9d8273a', 'size': '7695', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/db/rubbish_release.cpp', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '12538'}, {'name': 'C++', 'bytes': '575941'}, {'name': 'COBOL', 'bytes': '27584'}, {'name': 'Makefile', 'bytes': '6950'}, {'name': 'PHP', 'bytes': '36293'}, {'name': 'Python', 'bytes': '280578'}, {'name': 'Shell', 'bytes': '4898'}]} |
"""
Test Manager / Suite Self Test #4 - Testing result overflow handling.
"""
__copyright__ = \
"""
Copyright (C) 2010-2015 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and/or modify it under the terms of the GNU
General Public License (GPL) as published by the Free Software
Foundation, in version 2 as it comes in the "COPYING" file of the
VirtualBox OSE distribution. VirtualBox OSE is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
The contents of this file may alternatively be used under the terms
of the Common Development and Distribution License Version 1.0
(CDDL) only, as it comes in the "COPYING.CDDL" file of the
VirtualBox OSE distribution, in which case the provisions of the
CDDL are applicable instead of those of the GPL.
You may elect to license modified versions of this file under the
terms and conditions of either the GPL or the CDDL or both.
"""
__version__ = "$Revision: 100880 $"
# Standard Python imports.
import os;
import sys;
# Only the main script needs to modify the path.
try: __file__
except: __file__ = sys.argv[0];
g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
sys.path.append(g_ksValidationKitDir);
# Validation Kit imports.
from testdriver import reporter;
from testdriver.base import TestDriverBase, InvalidOption;
class tdSelfTest4(TestDriverBase):
"""
Test Manager / Suite Self Test #4 - Testing result overflow handling.
"""
## Valid tests.
kasValidTests = [ 'immediate-sub-tests', 'total-sub-tests', 'immediate-values', 'total-values', 'immediate-messages'];
def __init__(self):
TestDriverBase.__init__(self);
self.sOptWhich = 'immediate-sub-tests';
def parseOption(self, asArgs, iArg):
if asArgs[iArg] == '--test':
iArg = self.requireMoreArgs(1, asArgs, iArg);
if asArgs[iArg] not in self.kasValidTests:
raise InvalidOption('Invalid test name "%s". Must be one of: %s'
% (asArgs[iArg], ', '.join(self.kasValidTests),));
self.sOptWhich = asArgs[iArg];
else:
return TestDriverBase.parseOption(self, asArgs, iArg);
return iArg + 1;
def actionExecute(self):
# Too many immediate sub-tests.
if self.sOptWhich == 'immediate-sub-tests':
reporter.testStart('Too many immediate sub-tests (negative)');
for i in range(1024):
reporter.testStart('subsub%d' % i);
reporter.testDone();
# Too many sub-tests in total.
elif self.sOptWhich == 'total-sub-tests':
reporter.testStart('Too many sub-tests (negative)');
# 32 * 256 = 2^(5+8) = 2^13 = 8192.
for i in range(32):
reporter.testStart('subsub%d' % i);
for j in range(256):
reporter.testStart('subsubsub%d' % j);
reporter.testDone();
reporter.testDone();
# Too many immediate values.
elif self.sOptWhich == 'immediate-values':
reporter.testStart('Too many immediate values (negative)');
for i in range(512):
reporter.testValue('value%d' % i, i, 'times');
# Too many values in total.
elif self.sOptWhich == 'total-values':
reporter.testStart('Too many sub-tests (negative)');
for i in range(256):
reporter.testStart('subsub%d' % i);
for j in range(64):
reporter.testValue('value%d' % j, i * 10000 + j, 'times');
reporter.testDone();
# Too many failure reasons (only immediate since the limit is extremely low).
elif self.sOptWhich == 'immediate-messages':
reporter.testStart('Too many immediate messages (negative)');
for i in range(16):
reporter.testFailure('Detail %d' % i);
else:
reporter.testStart('Unknown test %s' % (self.sOptWhich,));
reporter.error('Invalid test selected: %s' % (self.sOptWhich,));
reporter.testDone();
return True;
if __name__ == '__main__':
sys.exit(tdSelfTest4().main(sys.argv));
| {'content_hash': '4e88c40e4ff25fa2e63c48472477c424', 'timestamp': '', 'source': 'github', 'line_count': 111, 'max_line_length': 122, 'avg_line_length': 39.630630630630634, 'alnum_prop': 0.6203682655148898, 'repo_name': 'egraba/vbox_openbsd', 'id': '3eccb9e73b5b7086e48ede6a0d1973d65acac46d', 'size': '4470', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'VirtualBox-5.0.0/src/VBox/ValidationKit/tests/selftests/tdSelfTest4.py', 'mode': '33261', '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'}]} |
pjlong-home
===========
My Home Site
| {'content_hash': 'ee9abe7ac1feb97e37c6114faa37d305', 'timestamp': '', 'source': 'github', 'line_count': 4, 'max_line_length': 12, 'avg_line_length': 9.5, 'alnum_prop': 0.5263157894736842, 'repo_name': 'pjlong/pjlong-home', 'id': '28424dc1ac6d152367491ecc72ed0f65442e6abf', 'size': '38', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'README.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '17477'}, {'name': 'HTML', 'bytes': '11675'}, {'name': 'JavaScript', 'bytes': '8921'}, {'name': 'Python', 'bytes': '5855'}, {'name': 'Shell', 'bytes': '103'}]} |
<!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_102) on Wed Nov 02 19:52:52 IST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Uses of Class org.apache.solr.client.solrj.io.stream.TopicStream (Solr 6.3.0 API)</title>
<meta name="date" content="2016-11-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 org.apache.solr.client.solrj.io.stream.TopicStream (Solr 6.3.0 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="../../../../../../../../org/apache/solr/client/solrj/io/stream/TopicStream.html" title="class in org.apache.solr.client.solrj.io.stream">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="../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../index.html?org/apache/solr/client/solrj/io/stream/class-use/TopicStream.html" target="_top">Frames</a></li>
<li><a href="TopicStream.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.solr.client.solrj.io.stream.TopicStream" class="title">Uses of Class<br>org.apache.solr.client.solrj.io.stream.TopicStream</h2>
</div>
<div class="classUseContainer">No usage of org.apache.solr.client.solrj.io.stream.TopicStream</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../../org/apache/solr/client/solrj/io/stream/TopicStream.html" title="class in org.apache.solr.client.solrj.io.stream">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="../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../index.html?org/apache/solr/client/solrj/io/stream/class-use/TopicStream.html" target="_top">Frames</a></li>
<li><a href="TopicStream.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<i>Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.</i>
<script src='../../../../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</small></p>
</body>
</html>
| {'content_hash': '4b4856dea8d67f9e39716e6f507bdd5c', 'timestamp': '', 'source': 'github', 'line_count': 140, 'max_line_length': 164, 'avg_line_length': 37.65, 'alnum_prop': 0.583760197306014, 'repo_name': 'johannesbraun/clm_autocomplete', 'id': '438536c289b8e661600b62baa023f8e4773d15bc', 'size': '5271', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'docs/solr-solrj/org/apache/solr/client/solrj/io/stream/class-use/TopicStream.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'AMPL', 'bytes': '291'}, {'name': 'Batchfile', 'bytes': '63061'}, {'name': 'CSS', 'bytes': '238996'}, {'name': 'HTML', 'bytes': '230318'}, {'name': 'JavaScript', 'bytes': '1224188'}, {'name': 'Jupyter Notebook', 'bytes': '638688'}, {'name': 'Python', 'bytes': '3829'}, {'name': 'Roff', 'bytes': '34741083'}, {'name': 'Shell', 'bytes': '96828'}, {'name': 'XSLT', 'bytes': '124838'}]} |
package ie.kieranhogan.dayvinrosssoundboard;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import java.io.IOException;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
MediaPlayer a_theme, b_roundbrush, c_time, d_welcome, e_bother,
f_brush, g_nomistakes, h_colours, i_noise1, j_whack;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MediaPlayer intro = MediaPlayer.create(getApplicationContext(), R.raw.b_roundbrush);
intro.start();
a_theme = MediaPlayer.create(this, R.raw.a_theme);
b_roundbrush = MediaPlayer.create(this, R.raw.b_roundbrush);
c_time = MediaPlayer.create(this, R.raw.c_time);
d_welcome = MediaPlayer.create(this, R.raw.d_welcome);
e_bother = MediaPlayer.create(this, R.raw.e_bother);
f_brush = MediaPlayer.create(this, R.raw.f_brush);
g_nomistakes = MediaPlayer.create(this, R.raw.g_nomistakes);
h_colours = MediaPlayer.create(this, R.raw.h_colours);
i_noise1 = MediaPlayer.create(this, R.raw.i_noise1);
j_whack = MediaPlayer.create(this, R.raw.j_whack);
}
public void a_theme(View view) {
if (a_theme.isPlaying()){
a_theme.seekTo(0); }
else {
a_theme.start();
}
}
public void b_roundbrush(View view) {
if (b_roundbrush.isPlaying()){
b_roundbrush.seekTo(0); }
else {
b_roundbrush.start();
}
}
public void c_time(View view) {
if (c_time.isPlaying()){
c_time.seekTo(0); }
else {
c_time.start();
}
}
public void d_welcome(View view) {
if (d_welcome.isPlaying()){
d_welcome.seekTo(0); }
else {
d_welcome.start();
}
}
public void e_bother(View view) {
if (e_bother.isPlaying()){
e_bother.seekTo(0); }
else {
e_bother.start();
}
}
public void f_brush(View view) {
if (f_brush.isPlaying()){
f_brush.seekTo(0); }
else {
f_brush.start();
}
}
public void g_nomistakes(View view) {
if (g_nomistakes.isPlaying()){
g_nomistakes.seekTo(0); }
else {
g_nomistakes.start();
}
}
public void h_colours(View view) {
if (h_colours.isPlaying()){
h_colours.seekTo(0); }
else {
h_colours.start();
}
}
public void i_noise1(View view) {
if (i_noise1.isPlaying()){
i_noise1.seekTo(0); }
else {
i_noise1.start();
} }
public void j_whack(View view) {
if (j_whack.isPlaying()){
j_whack.seekTo(0); }
else {
j_whack.start();
}
}
}
| {'content_hash': 'e1bc56a404d6acf6d9445575f5902bdf', 'timestamp': '', 'source': 'github', 'line_count': 109, 'max_line_length': 92, 'avg_line_length': 27.91743119266055, 'alnum_prop': 0.5514295103516267, 'repo_name': 'kieranhogan13/Java', 'id': '291dc3353382775d1a389d71c5907d17ed2edeb5', 'size': '3043', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Android Development/DayvinRossSoundboard/app/src/main/java/ie/kieranhogan/dayvinrosssoundboard/MainActivity.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '799'}, {'name': 'CSS', 'bytes': '23981'}, {'name': 'HTML', 'bytes': '265575'}, {'name': 'Java', 'bytes': '328051'}, {'name': 'JavaScript', 'bytes': '827'}]} |
classdef (Sealed) HebiJoystick < handle
% HebiJoystick creates a joystick object
%
% HebiJoystick is an alternative to MATLAB's built-in 'vrjoystick'
% for users who don't have access to the Simulink 3D Modelling
% Toolbox. The API is identical to 'vrjoystick' and can serve mostly
% as a drop-in replacement.
%
% Note that the ordering of axes and buttons may be different on
% various operating systems, and that it may also be different from
% vrjoystick.
%
% HebiJoystick Methods:
%
% loadLibs - loads the required Java library
%
% read - reads the status of axes, buttons, and POVs
% axis - reads the status of selected axes
% button - reads the status of selected buttons
% pov - reads the status of selected POV (point of view)
% caps - returns a structure of joystick capabilities
% close - closes and invalidates the joystick object
% force - applies force feedback to selected axes
%
% Example:
% % Connect to the first joystick and read its state
% joy = HebiJoystick(1);
% [axes, buttons, povs] = read(joy);
%
% See also vrjoystick, loadLibs, read
% Copyright (c) 2016-2017 HEBI Robotics
properties (SetAccess = private)
Name
Axes
Buttons
POVs
Forces
end
properties (Access = private)
joy
end
methods (Static, Access = public)
function loadLibs()
% Loads the backing Java files and native binaries. This
% method assumes that the jar file is located in the same
% directory as this class-script, and that the file name
% matches the string below.
jarFileName = 'matlab-input-1.2.jar';
% Load only once
if ~exist('us.hebi.matlab.input.HebiJoystick', 'class')
localDir = fileparts(mfilename('fullpath'));
% Add binary libs
java.lang.System.setProperty(...
'net.java.games.input.librarypath', ...
fullfile(localDir, 'lib'));
% Add Java library
javaaddpath(fullfile(localDir, jarFileName));
end
end
end
methods (Access = public)
function this = HebiJoystick(index, ~)
% creates a joystick object
if nargin < 2
% be compatible with the original API
end
% Create backing Java object
HebiJoystick.loadLibs();
this.joy = us.hebi.matlab.input.HebiJoystick(index);
if ~ismac()
% Increase event queue to not have to poll as often.
% Doesn't work on mac.
this.joy.setEventQueueSize(200);
end
% Set properties
caps = this.caps();
this.Name = this.joy.getName();
this.Axes = caps.Axes;
this.Buttons = caps.Buttons;
this.POVs = caps.POVs;
this.Forces = caps.Forces;
end
function varargout = read(this)
% reads the status of axes, buttons, and POVs
%
% Example
% joy = HebiJoystick(1);
% [axes, buttons, povs] = read(joy);
varargout = read(this.joy);
end
function axes = axis(this, mask)
% reads the status of selected axes
[axes, ~, ~] = read(this);
if nargin > 1
axes = axes(mask);
end
end
function buttons = button(this, mask)
% reads the status of selected buttons
[~, buttons, ~] = read(this);
if nargin > 1
buttons = buttons(mask);
end
end
function povs = pov(this, mask)
% reads the status of selected POV (point of view)
[~, ~, povs] = read(this);
if nargin > 1
povs = povs(mask);
end
end
function out = caps(this)
% returns a structure of joystick capabilities
out = struct(caps(this.joy));
end
function [] = close(this)
% closes and invalidates the joystick object
close(this.joy);
end
function [] = force(this, indices, value)
% applies force feedback to selected axes
force(this.joy, indices, value);
end
end
% Hide inherited methods (handle) from auto-complete
% and docs
methods(Access = public, Hidden = true)
function [] = delete(this)
% destructor disposes this instance
close(this);
end
function varargout = addlistener(varargin)
varargout{:} = addlistener@handle(varargin{:});
end
function varargout = eq(varargin)
varargout{:} = eq@handle(varargin{:});
end
function varargout = findobj(varargin)
varargout{:} = findobj@handle(varargin{:});
end
function varargout = findprop(varargin)
varargout{:} = findprop@handle(varargin{:});
end
function varargout = ge(varargin)
varargout{:} = ge@handle(varargin{:});
end
function varargout = gt(varargin)
varargout{:} = gt@handle(varargin{:});
end
function varargout = le(varargin)
varargout{:} = le@handle(varargin{:});
end
function varargout = lt(varargin)
varargout{:} = lt@handle(varargin{:});
end
function varargout = ne(varargin)
varargout{:} = ne@handle(varargin{:});
end
function varargout = notify(varargin)
varargout{:} = notify@handle(varargin{:});
end
end
end | {'content_hash': 'c632228e1f2e0faed5429d1c03f35bc6', 'timestamp': '', 'source': 'github', 'line_count': 190, 'max_line_length': 74, 'avg_line_length': 32.526315789473685, 'alnum_prop': 0.5158576051779935, 'repo_name': 'HebiRobotics/hebi-matlab-examples', 'id': '71cdccd605875a66ab7d8e55b19e9b603cee5d1a', 'size': '6180', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'kits/igor/tools/input/HebiJoystick.m', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '126'}, {'name': 'MATLAB', 'bytes': '665332'}, {'name': 'Shell', 'bytes': '1677'}]} |
#import "ThoMoNetworkStub.h"
#import <arpa/inet.h>
#import "ThoMoTCPConnection.h"
#import <pthread.h>
NSString *const kThoMoNetworkInfoKeyUserMessage = @"kThoMoNetworkInfoKeyUserMessage";
NSString *const kThoMoNetworkInfoKeyData = @"kThoMoNetworkInfoKeyData";
NSString *const kThoMoNetworkInfoKeyRemoteConnectionIdString = @"kThoMoNetworkInfoKeyRemoteConnectionIdString";
NSString *const kThoMoNetworkInfoKeyLocalNetworkStub = @"kThoMoNetworkInfoKeyLocalNetworkStub";
NSString *const kThoMoNetworkPrefScopeSpecifierKey = @"kThoMoNetworkPrefScopeSpecifierKey";
// interface category for main thread relay methods
@interface ThoMoNetworkStub (RelayMethods)
-(void)networkStubDidShutDownRelayMethod;
-(void)netServiceProblemRelayMethod:(NSDictionary *)infoDict;
-(void)didReceiveDataRelayMethod:(NSDictionary *)infoDict;
-(void)connectionEstablishedRelayMethod:(NSDictionary *)infoDict;
-(void)connectionLostRelayMethod:(NSDictionary *)infoDict;
-(void)connectionClosedRelayMethod:(NSDictionary *)infoDict;
@end
@interface ThoMoNetworkStub ()
-(void)sendDataWithInfoDict:(NSDictionary *)theInfoDict;
@end
// =====================================================================================================================
#pragma mark -
#pragma mark Public Methods
// ---------------------------------------------------------------------------------------------------------------------
@implementation ThoMoNetworkStub
#pragma mark Housekeeping
-(id)initWithProtocolIdentifier:(NSString *)theProtocolIdentifier;
{
self = [super init];
if (self != nil)
{
// check if there is a scope specifier present in the user defaults and add it to the protocolId
NSString *scopeSpecifier = [[NSUserDefaults standardUserDefaults] stringForKey:kThoMoNetworkPrefScopeSpecifierKey];
if (scopeSpecifier)
{
protocolIdentifier = [scopeSpecifier stringByAppendingFormat:@"-%@", theProtocolIdentifier];
NSLog(@"Warning: ThoMo Networking Protocol Prefix in effect! If your app cannot connect to its counterpart that may be the reason.");
}
else
{
protocolIdentifier = [theProtocolIdentifier copy];
}
if ([protocolIdentifier length] > 14)
{
// clean up internally
[NSException raise:@"ThoMoInvalidArgumentException"
format:@"The protocol identifier plus the optional scoping prefix (\"%@\") exceed"
" Bonjour's maximum allowed length of fourteen characters!", protocolIdentifier];
}
connections = [[NSMutableDictionary alloc] init];
}
return self;
}
-(id)init;
{
return [self initWithProtocolIdentifier:@"thoMoNetworkStubDefaultIdentifier"];
}
// these methods are called on the main thread
#pragma mark Control
-(void) start;
{
if ([networkThread isExecuting])
{
[NSException raise:@"ThoMoStubAlreadyRunningException"
format:@"The client stub had already been started before and cannot be started twice."];
}
// TODO: check if we cannot run a start-stop-start cycle
NSAssert(networkThread == nil, @"Network thread not released properly");
networkThread = [[NSThread alloc] initWithTarget:self selector:@selector(networkThreadEntry) object:nil];
[networkThread start];
}
-(void) stop;
{
[networkThread cancel];
// TODO: check if we can release the networkthread here
}
-(NSArray *)activeConnections;
{
NSArray *result;
@synchronized(self)
{
result = [[connections allKeys] copy];
}
return result;
}
-(void)send:(id<NSCoding>)theData toConnection:(NSString *)theConnectionIdString;
{
NSData *sendData = [NSKeyedArchiver archivedDataWithRootObject:theData];
[self sendByteData:sendData toConnection:theConnectionIdString];
}
-(void)sendByteData:(NSData *)sendData toConnection:(NSString *)theConnectionIdString;
{
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
sendData, @"DATA",
theConnectionIdString, @"ID",
nil];
[self performSelector:@selector(sendDataWithInfoDict:) onThread:networkThread withObject:infoDict waitUntilDone:NO];
}
#pragma mark Send Data Relay
// only call on network thread
-(void)sendDataWithInfoDict:(NSDictionary *)theInfoDict;
{
NSData *sendData = [theInfoDict objectForKey:@"DATA"];
NSString *theConnectionIdString = [theInfoDict objectForKey:@"ID"];
ThoMoTCPConnection *connection = nil;
@synchronized(self)
{
connection = [connections valueForKey:theConnectionIdString];
}
if (!connection)
{
[NSException raise:@"ThoMoInvalidArgumentException"
format:@"No connection found for id %@", theConnectionIdString];
}
else
{
[connection enqueueNextSendObject:sendData];
}
}
#pragma mark Threading Methods
-(void)networkThreadEntry
{
#ifndef NDEBUG
#ifdef THOMO_PTHREAD_NAMING_AVAILABLE
pthread_setname_np("ThoMoNetworking Dispatch Thread");
#endif
#endif
@autoreleasepool {
if([self setup])
{
while (![networkThread isCancelled])
{
NSDate *inOneSecond = [[NSDate alloc] initWithTimeIntervalSinceNow:1];
// catch exceptions and propagate to main thread
@try {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:inOneSecond];
}
@catch (NSException * e) {
[e performSelectorOnMainThread:@selector(raise) withObject:nil waitUntilDone:YES];
}
}
[self teardown];
}
[self performSelectorOnMainThread:@selector(networkStubDidShutDownRelayMethod) withObject:nil waitUntilDone:NO];
}
}
#pragma mark -
#pragma mark Connection Delegate Methods
/// Delegate method that gets called from ThoMoTCPConnections whenever they did receive data.
/**
Takes the received data and relays it to a method on the main thread.
This method is typically overridden in the subclasses of ThoMoNetworkStub and then directly called from there.
\param[in] theData reference to the received data
\param[in] theConnection reference to the connection that received the data
*/
-(void)didReceiveData:(NSData *)theData onConnection:(ThoMoTCPConnection *)theConnection;
{
// look up the connection
NSString *connectionKey = [self keyForConnection:theConnection];
// unarchive the data
id receivedData = [NSKeyedUnarchiver unarchiveObjectWithData:theData];
// package the parameters into an info dict and relay them to the main thread
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
connectionKey, kThoMoNetworkInfoKeyRemoteConnectionIdString,
self, kThoMoNetworkInfoKeyLocalNetworkStub,
receivedData, kThoMoNetworkInfoKeyData,
nil];
[self performSelectorOnMainThread:@selector(didReceiveDataRelayMethod:) withObject:infoDict waitUntilDone:NO];
}
-(void)streamsDidOpenOnConnection:(ThoMoTCPConnection *)theConnection;
{
// look up the connection
NSString *connectionKey = [self keyForConnection:theConnection];
// package the parameters into an info dict and relay them to the main thread
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
self, kThoMoNetworkInfoKeyLocalNetworkStub,
connectionKey, kThoMoNetworkInfoKeyRemoteConnectionIdString,
nil];
[self performSelectorOnMainThread:@selector(connectionEstablishedRelayMethod:) withObject:infoDict waitUntilDone:NO];
}
-(void)streamEndEncountered:(NSStream *)theStream onConnection:(ThoMoTCPConnection *)theConnection;
{
NSString *connectionKey = [self keyForConnection:theConnection];
NSString *userMessage = [NSString stringWithFormat:@"Stream end event encountered on stream to %@! Closing connection.", connectionKey];
[theConnection close];
@synchronized(self)
{
[connections removeObjectForKey:connectionKey];
}
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
self, kThoMoNetworkInfoKeyLocalNetworkStub,
connectionKey, kThoMoNetworkInfoKeyRemoteConnectionIdString,
userMessage, kThoMoNetworkInfoKeyUserMessage,
nil];
[self performSelectorOnMainThread:@selector(connectionClosedRelayMethod:) withObject:infoDict waitUntilDone:NO];
}
-(void)streamErrorEncountered:(NSStream *)theStream onConnection:(ThoMoTCPConnection *)theConnection;
{
NSString *connectionKey = [self keyForConnection:theConnection];
NSError *theError = [theStream streamError];
NSString *userMessage = [NSString stringWithFormat:@"Error %li: \"%@\" on stream to %@! Terminating connection.", (long)[theError code], [theError localizedDescription], connectionKey];
[theConnection close];
@synchronized(self)
{
[connections removeObjectForKey:connectionKey];
}
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:
self, kThoMoNetworkInfoKeyLocalNetworkStub,
connectionKey, kThoMoNetworkInfoKeyRemoteConnectionIdString,
userMessage, kThoMoNetworkInfoKeyUserMessage,
nil];
[self performSelectorOnMainThread:@selector(connectionLostRelayMethod:) withObject:infoDict waitUntilDone:NO];
}
// =====================================================================================================================
#pragma mark -
#pragma mark Protected Methods
// ---------------------------------------------------------------------------------------------------------------------
-(BOOL)setup
{
return YES;
}
-(void)teardown
{
// close all open connections
@synchronized(self)
{
for (ThoMoTCPConnection *connection in [connections allValues]) {
[connection close];
}
[connections removeAllObjects];
}
}
-(NSString *)keyStringFromAddress:(NSData *)addr;
{
// get the peer socket address from the NSData object
// NOTE: there actually is a struct sockaddr in there, NOT a struct sockaddr_in!
// I heard from beej (<http://www.retran.com/beej/sockaddr_inman.html>) that they share the same 15 first bytes so casting should not be a problem.
// You've been warned, though...
struct sockaddr_in *peerSocketAddress = (struct sockaddr_in *)[addr bytes];
// convert in_addr to ascii (note: returns a pointer to a statically allocated buffer inside inet_ntoa! calling again will overwrite)
char *humanReadableAddress = inet_ntoa(peerSocketAddress->sin_addr);
NSString *peerAddress = [NSString stringWithCString:humanReadableAddress encoding:NSUTF8StringEncoding];
NSString *peerPort = [NSString stringWithFormat:@"%d", ntohs(peerSocketAddress->sin_port)];
NSString *peerKey = [NSString stringWithFormat:@"%@:%@", peerAddress, peerPort];
return peerKey;
}
-(NSString *)keyForConnection:(ThoMoTCPConnection *)theConnection;
{
NSString *connectionKey;
NSArray *keys;
@synchronized(self)
{
keys = [connections allKeysForObject:theConnection];
NSAssert([keys count] == 1, @"More than one connection record in dict for a single connection.");
connectionKey = [[keys objectAtIndex:0] copy];
}
return connectionKey;
}
-(void) openNewConnection:(NSString *)theConnectionKey inputStream:(NSInputStream *)istr outputStream:(NSOutputStream *)ostr;
{
// create a new ThoMoTCPConnection object and set ourselves as the delegate to forward the incoming data to our own delegate
ThoMoTCPConnection *newConnection = [[ThoMoTCPConnection alloc] initWithDelegate:self inputStream:istr outputStream:ostr];
// store in our dictionary, open, and release our copy
@synchronized(self)
{
// it should never happen that we overwrite a connection
NSAssert(![connections valueForKey:theConnectionKey], @"ERROR: Tried to create a connection with an IP and port that we already have a connection for.");
[connections setValue:newConnection forKey:theConnectionKey];
}
[newConnection open];
}
@end
#pragma mark -
#pragma mark Main Thread Relay Methods
@implementation ThoMoNetworkStub (RelayMethods)
-(void)networkStubDidShutDownRelayMethod
{
NSLog(@"%@ :: %@", [self description], NSStringFromSelector(_cmd));
}
-(void)netServiceProblemRelayMethod:(NSDictionary *)infoDict
{
NSLog(@"%@ :: %@", [self description], NSStringFromSelector(_cmd));
}
-(void)didReceiveDataRelayMethod:(NSDictionary *)infoDict;
{
NSLog(@"%@ :: %@", [self description], NSStringFromSelector(_cmd));
}
-(void)connectionEstablishedRelayMethod:(NSDictionary *)infoDict;
{
NSLog(@"%@ :: %@", [self description], NSStringFromSelector(_cmd));
}
-(void)connectionLostRelayMethod:(NSDictionary *)infoDict;
{
NSLog(@"%@ :: %@", [self description], NSStringFromSelector(_cmd));
}
-(void)connectionClosedRelayMethod:(NSDictionary *)infoDict;
{
NSLog(@"%@ :: %@", [self description], NSStringFromSelector(_cmd));
}
#pragma mark -
#pragma mark Debugging
@end
| {'content_hash': 'bc4e762d833ebf42e367c0a37f77f3b7', 'timestamp': '', 'source': 'github', 'line_count': 399, 'max_line_length': 186, 'avg_line_length': 31.340852130325814, 'alnum_prop': 0.7266693322670932, 'repo_name': 'i10/ThoMoNetworking', 'id': '9eb6fab97c3b8ab810a6d310cd39e34cbd652464', 'size': '13780', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Classes/ThoMoNetworkStub.m', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Objective-C', 'bytes': '86966'}]} |
/**
* \addtogroup pubsub
* @{
*/
#ifndef __M2ETIS_PUBSUB_FILTER_FILTEREXPRESSIONS_LESSTHANATTRIBUTEFILTER_H__
#define __M2ETIS_PUBSUB_FILTER_FILTEREXPRESSIONS_LESSTHANATTRIBUTEFILTER_H__
#include "m2etis/pubsub/filter/filterexpressions/AttributeFilter.h"
namespace m2etis {
namespace pubsub {
namespace filter {
template<typename EventType, typename AttributeType> class EqualsAttributeFilter;
template<typename EventType, typename AttributeType> class NotEqualsAttributeFilter;
template<typename EventType, typename AttributeType> class GreaterThanAttributeFilter;
template<typename EventType, typename AttributeType>
class LessThanAttributeFilter : public AttributeFilter<EventType, AttributeType> {
public:
typedef EventType schema; // needed for operator overloading
LessThanAttributeFilter() : AttributeFilter<EventType, AttributeType>(-1, {}) {} // needed for boost serialization
LessThanAttributeFilter(const AttributeName attribute_id, const AttributeType & constants) : AttributeFilter<EventType, AttributeType>(attribute_id, {constants}) {}
virtual ~LessThanAttributeFilter() {}
virtual void getAttributeType(FilterVisitor<EventType> & visitor) const override {
visitor.getAttributeType(this);
}
// function called to match against an event
virtual bool matchAttribute(const AttributeType & attribute) const override {
return attribute < this->get_constants()[0]; // attribute type has to implement "<"-operator
}
using AttributeFilter<EventType, AttributeType>::overlaps;
virtual bool overlaps(const AttributeFilter<EventType, AttributeType> * other_filter) const override {
if (this->get_attribute_id() != other_filter->get_attribute_id()) {
return true; // AttributeFilters for different attributes overlap
}
if (typeid(EqualsAttributeFilter<EventType, AttributeType>) == typeid(*other_filter)) {
return other_filter->overlaps(this);
}
if (typeid(NotEqualsAttributeFilter<EventType, AttributeType>) == typeid(*other_filter)) {
return other_filter->overlaps(this);
}
if (typeid(GreaterThanAttributeFilter<EventType, AttributeType>) == typeid(*other_filter)) {
return other_filter->overlaps(this); // TODO: (Roland) check for numeric_limits
}
if (typeid(LessThanAttributeFilter<EventType, AttributeType>) == typeid(*other_filter)) {
return true;
}
return true;
}
private:
friend class boost::serialization::access;
template<typename Archive>
void serialize(Archive & ar, const unsigned int) {
ar & boost::serialization::base_object<AttributeFilter<EventType, AttributeType>>(*this);
}
}; // LessThanAttributeFilter
} /* namespace filter */
} /* namespace pubsub */
} /* namespace m2etis */
#endif /* __M2ETIS_PUBSUB_FILTER_FILTEREXPRESSIONS_LESSTHANATTRIBUTEFILTER_H__ */
/**
* @}
*/
| {'content_hash': 'b630a95e6d33de5a71db00ea6e97365a', 'timestamp': '', 'source': 'github', 'line_count': 77, 'max_line_length': 166, 'avg_line_length': 36.62337662337662, 'alnum_prop': 0.7531914893617021, 'repo_name': 'ClockworkOrigins/m2etis', 'id': '7b7a778d241f4813a65348e233a3d01cff2cbfba', 'size': '3425', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'library/include/m2etis/pubsub/filter/filterexpressions/LessThanAttributeFilter.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '13275'}, {'name': 'C++', 'bytes': '1044746'}, {'name': 'CMake', 'bytes': '187386'}, {'name': 'Python', 'bytes': '136028'}, {'name': 'Shell', 'bytes': '1079'}]} |
/**
* @fileoverview Prevent missing parentheses around multilines JSX
* @author Yannick Croissant
*/
'use strict';
// ------------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------------
var DEFAULTS = {
declaration: true,
assignment: true,
return: true
};
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
module.exports = {
meta: {
docs: {},
fixable: 'code',
schema: [{
type: 'object',
properties: {
declaration: {
type: 'boolean'
},
assignment: {
type: 'boolean'
},
return: {
type: 'boolean'
}
},
additionalProperties: false
}]
},
create: function(context) {
var sourceCode = context.getSourceCode();
function isParenthesised(node) {
var previousToken = sourceCode.getTokenBefore(node);
var nextToken = sourceCode.getTokenAfter(node);
return previousToken && nextToken &&
previousToken.value === '(' && previousToken.range[1] <= node.range[0] &&
nextToken.value === ')' && nextToken.range[0] >= node.range[1];
}
function isMultilines(node) {
return node.loc.start.line !== node.loc.end.line;
}
function check(node) {
if (!node || node.type !== 'JSXElement') {
return;
}
if (!isParenthesised(node) && isMultilines(node)) {
context.report({
node: node,
message: 'Missing parentheses around multilines JSX',
fix: function(fixer) {
return fixer.replaceText(node, '(' + sourceCode.getText(node) + ')');
}
});
}
}
function isEnabled(type) {
var userOptions = context.options[0] || {};
if (({}).hasOwnProperty.call(userOptions, type)) {
return userOptions[type];
}
return DEFAULTS[type];
}
// --------------------------------------------------------------------------
// Public
// --------------------------------------------------------------------------
return {
VariableDeclarator: function(node) {
if (isEnabled('declaration')) {
check(node.init);
}
},
AssignmentExpression: function(node) {
if (isEnabled('assignment')) {
check(node.right);
}
},
ReturnStatement: function(node) {
if (isEnabled('return')) {
check(node.argument);
}
}
};
}
};
| {'content_hash': 'e7042691a107b355128e6a110251b7b4', 'timestamp': '', 'source': 'github', 'line_count': 110, 'max_line_length': 81, 'avg_line_length': 24.327272727272728, 'alnum_prop': 0.44170403587443946, 'repo_name': 'lencioni/eslint-plugin-react', 'id': 'bca54662dda45c5038c738bdf2f0287a454959eb', 'size': '2676', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/rules/jsx-wrap-multilines.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '495876'}]} |
using System.Reflection;
[assembly: AssemblyTitle("Effort.Extra")]
[assembly: AssemblyKeyFile("../Effort.Extra.snk")] | {'content_hash': 'eb1908157dc9698a8adf44d59c564383', 'timestamp': '', 'source': 'github', 'line_count': 4, 'max_line_length': 50, 'avg_line_length': 29.75, 'alnum_prop': 0.7563025210084033, 'repo_name': 'christophano/Effort.Extra', 'id': '67eee67b645b101c5ba46a6db9ff68313a9a47fc', 'size': '121', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'Effort.Extra.StrongName/Properties/AssemblyInfo.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C#', 'bytes': '44318'}]} |
const express = require('express'),
router = express.Router(),
service = require('./services/book');
router.get('/', service.find);
router.get('/:id', service.show);
router.post('/', service.create);
router.put('/:id', service.update);
router.patch('/:id', service.update);
router.delete('/:id', service.destroy);
module.exports = router; | {'content_hash': '92f32bf92bb677f062f58c45a0d1e76d', 'timestamp': '', 'source': 'github', 'line_count': 12, 'max_line_length': 43, 'avg_line_length': 29.416666666666668, 'alnum_prop': 0.660056657223796, 'repo_name': 'leonanluppi/express-mongo', 'id': '5462a88d0cac0e63a996ad9d00074b4f653d8512', 'size': '353', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'api/books/index.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '7932'}]} |
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Foundation for Sites</title>
<link rel="stylesheet" href="css/foundation.css">
<link rel="stylesheet" href="css/app.css">
</head>
<body>
<div class="row">
<div class="large-12 columns">
<a href="">[email protected]</a>
</div>
</div>
<script src="js/vendor/jquery.js"></script>
<script src="js/vendor/what-input.js"></script>
<script src="js/vendor/foundation.js"></script>
<script src="js/app.js"></script>
<script>
</script>
</body>
</html>
| {'content_hash': '9fa6b8531a901dfd21bd7b3c5ba720a3', 'timestamp': '', 'source': 'github', 'line_count': 34, 'max_line_length': 78, 'avg_line_length': 24.88235294117647, 'alnum_prop': 0.541371158392435, 'repo_name': 'surendias/Replace-on-page-emails-with-a-popup-form', 'id': 'ff530d63b01e46f754c56b82eadbfc5b0f537aac', 'size': '846', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'index.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '846'}, {'name': 'JavaScript', 'bytes': '5625'}]} |
package com.lin.web.service.impl;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
import com.google.api.ads.dfp.jaxws.factory.DfpServices;
import com.google.api.ads.dfp.jaxws.utils.v201403.StatementBuilder;
import com.google.api.ads.dfp.jaxws.v201403.ComputedStatus;
import com.google.api.ads.dfp.jaxws.v201403.DateTime;
import com.google.api.ads.dfp.jaxws.v201403.Forecast;
import com.google.api.ads.dfp.jaxws.v201403.ForecastServiceInterface;
import com.google.api.ads.dfp.jaxws.v201403.LineItem;
import com.google.api.ads.dfp.jaxws.v201403.LineItemPage;
import com.google.api.ads.dfp.jaxws.v201403.LineItemServiceInterface;
import com.google.api.ads.dfp.jaxws.v201403.Money;
import com.google.api.ads.dfp.jaxws.v201403.Statement;
import com.google.api.ads.dfp.jaxws.v201403.TargetPlatform;
import com.google.api.ads.dfp.lib.client.DfpSession;
import com.google.api.client.util.Lists;
import com.google.visualization.datasource.base.TypeMismatchException;
import com.google.visualization.datasource.datatable.ColumnDescription;
import com.google.visualization.datasource.datatable.DataTable;
import com.google.visualization.datasource.datatable.value.DateValue;
import com.google.visualization.datasource.datatable.value.NumberValue;
import com.google.visualization.datasource.datatable.value.ValueType;
import com.google.visualization.datasource.render.JsonRenderer;
import com.lin.persistance.dao.ILinMobileDAO;
import com.lin.persistance.dao.IUserDetailsDAO;
import com.lin.persistance.dao.impl.LinMobileDAO;
import com.lin.persistance.dao.impl.UserDetailsDAO;
import com.lin.server.Exception.DataServiceException;
import com.lin.server.bean.ActualAdvertiserObj;
import com.lin.server.bean.AdvertiserByLocationObj;
import com.lin.server.bean.AdvertiserByMarketObj;
import com.lin.server.bean.AdvertiserReportObj;
import com.lin.server.bean.AgencyAdvertiserObj;
import com.lin.server.bean.CompanyObj;
import com.lin.server.bean.CustomLineItemObj;
import com.lin.server.bean.ForcastedAdvertiserObj;
import com.lin.server.bean.OrderLineItemObj;
import com.lin.server.bean.PerformanceMetricsObj;
import com.lin.server.bean.PublisherChannelObj;
import com.lin.server.bean.PublisherInventoryRevenueObj;
import com.lin.server.bean.PublisherPropertiesObj;
import com.lin.server.bean.PublisherSummaryObj;
import com.lin.server.bean.ReallocationDataObj;
import com.lin.server.bean.SellThroughDataObj;
import com.lin.web.dto.AdvertiserPerformerDTO;
import com.lin.web.dto.CommonDTO;
import com.lin.web.dto.ForcastLineItemDTO;
import com.lin.web.dto.LeftMenuDTO;
import com.lin.web.dto.LineChartDTO;
import com.lin.web.dto.LineItemDTO;
import com.lin.web.dto.PopUpDTO;
import com.lin.web.dto.PropertyDropDownDTO;
import com.lin.web.dto.PublisherReallocationHeaderDTO;
import com.lin.web.dto.PublisherReportChannelPerformanceDTO;
import com.lin.web.dto.PublisherReportComputedValuesDTO;
import com.lin.web.dto.PublisherReportHeaderDTO;
import com.lin.web.dto.PublisherReportPerformanceByPropertyDTO;
import com.lin.web.dto.PublisherTrendAnalysisHeaderDTO;
import com.lin.web.dto.PublisherViewDTO;
import com.lin.web.dto.QueryDTO;
import com.lin.web.dto.ReconciliationDataDTO;
import com.lin.web.service.ILinMobileBusinessService;
import com.lin.web.service.IQueryService;
import com.lin.web.service.IUserService;
import com.lin.web.util.AdvertiserViewMostActiveComparator;
import com.lin.web.util.AdvertiserViewNonPerformerComparator;
import com.lin.web.util.AdvertiserViewPerformerComparator;
import com.lin.web.util.DateUtil;
import com.lin.web.util.EncriptionUtil;
import com.lin.web.util.LinMobileConstants;
import com.lin.web.util.LinMobileVariables;
import com.lin.web.util.MemcacheUtil;
import com.lin.web.util.StringUtil;
public class LinMobileBusinessService implements ILinMobileBusinessService{
private static final Logger log = Logger.getLogger(LinMobileBusinessService.class.getName());
public List<LineItemDTO> getLineItems(long orderId){
List<LineItemDTO> lineItemDTOList=null;
return lineItemDTOList;
}
private String ChannelsInQString(List<String> allChannelName, StringBuilder memcacheKeySubstring) {
String Channel = "";
if (allChannelName.size() != 0) {
int channelListSize = allChannelName.size();
int i = 0;
if (channelListSize == 1) {
Channel = Channel + "channel_name = '"
+ allChannelName.get(i) + "' ";
memcacheKeySubstring.append(allChannelName.get(i));
} else {
Channel = Channel + "(";
for (i = 0; i < channelListSize; i++) {
Channel = Channel + "channel_name = '" + allChannelName.get(i) + "'";
memcacheKeySubstring.append(allChannelName.get(i));
if (i != channelListSize - 1) {
Channel = Channel + " OR ";
}
}
Channel = Channel + " ) ";
}
}
log.info("Channels:"+Channel);
return Channel;
}
@Override
public String getPublisherBQId(String publisherName) {
log.info("publisherName : "+publisherName);
Map<String, String> publisherMap = new HashMap<>();
String publisherIdInBQ = "";
publisherMap.put(LinMobileConstants.LIN_MEDIA_PUBLISHER_NAME, LinMobileConstants.LIN_MEDIA_PUBLISHER_ID);
publisherMap.put(LinMobileConstants.TRIBUNE_DFP_PUBLISHER_NAME, LinMobileConstants.TRIBUNE_DFP_PUBLISHER_ID);
publisherMap.put(LinMobileConstants.LIN_DIGITAL_PUBLISHER_NAME, LinMobileConstants.LIN_DIGITAL_PUBLISHER_ID);
publisherMap.put(LinMobileConstants.LIN_MOBILE_PUBLISHER_NAME, LinMobileConstants.LIN_MOBILE_PUBLISHER_ID);
publisherIdInBQ = publisherMap.get(publisherName);
log.info("publisherIdInBQ : "+publisherIdInBQ);
return publisherIdInBQ;
}
public String getChannelsBQId(String channels) {
log.info("channels : "+channels);
Map<String, String> channelMap = new HashMap<>();
StringBuilder channelIdString = new StringBuilder();
channelMap.put("Google Ad exchange", "7");
channelMap.put("House", "8");
channelMap.put("LSN", "10");
channelMap.put("Local Sales Direct", "4");
channelMap.put("Mojiva", "3");
channelMap.put("National Sales Direct", "5");
channelMap.put("Nexage", "2");
channelMap.put("Undertone", "6");
if(channels != null && channels.trim().length() > 0) {
String[] channelArray = channels.split(",");
for(String channel : channelArray){
channel = channel.replaceAll("'", "");
channel = channelMap.get(channel.trim());
if(channel.length() > 0) {
if((channelIdString.toString()).length() > 0) {
channelIdString.append(","+channel);
}
else {
channelIdString.append(channel);
}
}
}
}
log.info("channelIdString : "+channelIdString);
return channelIdString.toString();
}
public QueryDTO getQueryDTO(String publisherIdInBQ, String startDate, String endDate, String schema) {
log.info("publisherId : "+ publisherIdInBQ+", startDate : "+ startDate+", endDate : "+ endDate+", schema : "+ schema);
QueryDTO queryDTO = null;
if(publisherIdInBQ.length() > 0) {
IQueryService queryService = (IQueryService) BusinessServiceLocator.locate(IQueryService.class);
if(startDate.contains("00:00:00")) {
startDate = startDate.replaceAll("00:00:00", "");
}
if(endDate.contains("00:00:00")) {
endDate = endDate.replaceAll("00:00:00", "");
}
startDate = startDate.trim();
endDate = endDate.trim();
queryDTO = queryService.createQueryFromClause(publisherIdInBQ, startDate, endDate, schema);
}
if(queryDTO != null && !queryDTO.getQueryData().isEmpty()) {
log.info("queryDTO.getQueryData() : "+queryDTO.getQueryData());
}
else {
log.info("queryDTO : null or queryDTO.getQueryData() is empty");
log.info("putting dummy data");
String projectId=null;
String serviceAccountEmail=null;
String servicePrivateKey=null;
String dataSetId=LinMobileVariables.GOOGLE_BIGQUERY_DATASET_ID;
StringBuffer queryData=new StringBuffer();
if(schema.equals(LinMobileConstants.BQ_CORE_PERFORMANCE)) {
queryData.append("LIN_QA.CorePerformance_2014_01,LIN_QA.CorePerformance_2014_02,LIN_QA.CorePerformance_2014_03");
}
else if(schema.equals(LinMobileConstants.BQ_DFP_TARGET)) {
queryData.append("LIN_QA.DFPTarget_2014_01,LIN_QA.DFPTarget_2014_02,LIN_QA.DFPTarget_2014_03");
}
else if(schema.equals(LinMobileConstants.BQ_PERFORMANCE_BY_LOCATION)) {
queryData.append("LIN_QA.PerformanceByLocation_2014_01,LIN_QA.PerformanceByLocation_2014_02,LIN_QA.PerformanceByLocation_2014_03");
}
else if(schema.equals(LinMobileConstants.BQ_SELL_THROUGH)) {
queryData.append("LIN.Sell_Through");
}
switch(publisherIdInBQ) {
case "1":
projectId=LinMobileConstants.LIN_MEDIA_GOOGLE_API_PROJECT_ID;
serviceAccountEmail=LinMobileConstants.LIN_MEDIA_GOOGLE_API_SERVICE_ACCOUNT_EMAIL_ADDRESS;
servicePrivateKey=LinMobileConstants.LIN_MEDIA_GOOGLE_BQ_SERVICE_ACCOUNT_PRIVATE_KEY;
break;
case "2":
projectId=LinMobileConstants.LIN_DIGITAL_GOOGLE_API_PROJECT_ID;
serviceAccountEmail=LinMobileConstants.LIN_DIGITAL_GOOGLE_API_SERVICE_ACCOUNT_EMAIL_ADDRESS;
servicePrivateKey=LinMobileConstants.LIN_DIGITAL_GOOGLE_BQ_SERVICE_ACCOUNT_PRIVATE_KEY;
break;
case "5":
projectId=LinMobileConstants.LIN_MOBILE_GOOGLE_API_PROJECT_ID;
serviceAccountEmail=LinMobileConstants.LIN_MOBILE_GOOGLE_API_SERVICE_ACCOUNT_EMAIL_ADDRESS;
servicePrivateKey=LinMobileConstants.LIN_MOBILE_GOOGLE_BQ_SERVICE_ACCOUNT_PRIVATE_KEY;
break;
default:
log.warning("There is no project configured for this publisherId :"+publisherIdInBQ);
return queryDTO;
}
queryDTO=new QueryDTO(serviceAccountEmail, servicePrivateKey, projectId,dataSetId, queryData.toString());
log.info("queryDTO.getQueryData() : "+queryDTO.getQueryData());
//
}
return queryDTO;
}
public String getChannelAndDataSourceQuery(List<String> selectedChannelName, StringBuilder memcacheKeySubstring, boolean allChannels) throws Exception {
log.info("Inside getChannelAndDataSourceQuery in LinMobileDAO");
String QUERY = " and (( data_source = '' and channel_name = ''))";
int length = 0;
IUserDetailsDAO userDetailsDAO = new UserDetailsDAO();
List<CompanyObj> demandPartnersList = userDetailsDAO.getAllDemandPartners(MemcacheUtil.getAllCompanyList());
if(allChannels && demandPartnersList != null) {
length = demandPartnersList.size();
}
else if(!allChannels && selectedChannelName != null && selectedChannelName.size() > 0) {
length = selectedChannelName.size();
}
QUERY = "";
for (int i=0; i<length; i++) {
CompanyObj demandPartnerCompany = null;
if(allChannels && demandPartnersList != null) {
demandPartnerCompany = demandPartnersList.get(i);
}
else if(!allChannels && selectedChannelName != null && selectedChannelName.size() > 0) {
demandPartnerCompany = userDetailsDAO.getCompanyByName(selectedChannelName.get(i).trim(), demandPartnersList);
}
if(demandPartnerCompany!=null && demandPartnerCompany.getStatus().equals(LinMobileConstants.STATUS_ARRAY[0]) && demandPartnerCompany.getCompanyName() != null && !demandPartnerCompany.getCompanyName().trim().equalsIgnoreCase("") && demandPartnerCompany.getDataSource() != null && !demandPartnerCompany.getDataSource().trim().equalsIgnoreCase("")){
memcacheKeySubstring.append(demandPartnerCompany.getCompanyName().trim());
if(i==0 && length == 1) {
QUERY = QUERY+" and (( data_source = '"+demandPartnerCompany.getDataSource().trim()+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"'))";
}
else if(i==0) {
QUERY = QUERY+" and (( data_source = '"+demandPartnerCompany.getDataSource().trim()+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"')";
}
else if(i == length-1) {
QUERY = QUERY+" or ( data_source = '"+demandPartnerCompany.getDataSource().trim()+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"'))";
}
else {
QUERY = QUERY+" or ( data_source = '"+demandPartnerCompany.getDataSource().trim()+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"')";
}
}
}
return QUERY;
}
/*public String getAllChannelAndDataSourceQuery(StringBuilder memcacheKeySubstring) throws Exception {
log.info("Inside getAllChannelAndDataSourceQuery in LinMobileDAO");
String QUERY = "";
IUserDetailsDAO userDetailsDAO = new UserDetailsDAO();
List<CompanyObj> demandPartnersList = userDetailsDAO.getAllDemandPartners(MemcacheUtil.getAllCompanyList());
if(demandPartnersList != null && demandPartnersList.size() > 0) {
int length = demandPartnersList.size();
for (int i=0; i<length; i++) {
CompanyObj demandPartnerCompany = demandPartnersList.get(i);
if(demandPartnerCompany!=null && demandPartnerCompany.getStatus().equals(LinMobileConstants.STATUS_ARRAY[0]) && demandPartnerCompany.getCompanyName() != null && !demandPartnerCompany.getCompanyName().trim().equalsIgnoreCase("") && demandPartnerCompany.getDataSource() != null && !demandPartnerCompany.getDataSource().trim().equalsIgnoreCase("")){
memcacheKeySubstring.append(demandPartnerCompany.getCompanyName().trim());
if(i==0 && length == 1) {
QUERY = QUERY+" and (( data_source = '"+demandPartnerCompany.getDataSource().trim()+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"'))";
}
else if(i==0) {
QUERY = QUERY+" and (( data_source = '"+demandPartnerCompany.getDataSource().trim()+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"')";
}
else if(i == length-1) {
QUERY = QUERY+" or ( data_source = '"+demandPartnerCompany.getDataSource().trim()+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"'))";
}
else {
QUERY = QUERY+" or ( data_source = '"+demandPartnerCompany.getDataSource().trim()+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"')";
}
}
}
}
return QUERY;
}*/
/*public String getChannelWithDataSourceDFPQuery(StringBuilder memcacheKeySubstring) throws Exception {
log.info("Inside getAllChannelAndDataSourceQuery in LinMobileDAO");
String QUERY = "";
IUserDetailsDAO userDetailsDAO = new UserDetailsDAO();
List<CompanyObj> demandPartnersList = userDetailsDAO.getAllDemandPartners(MemcacheUtil.getAllCompanyList());
if(demandPartnersList != null && demandPartnersList.size() > 0) {
int length = demandPartnersList.size();
for (int i=0; i<length; i++) {
CompanyObj demandPartnerCompany = demandPartnersList.get(i);
if(demandPartnerCompany!=null && demandPartnerCompany.getStatus().equals(LinMobileConstants.STATUS_ARRAY[0]) && demandPartnerCompany.getCompanyName() != null && !demandPartnerCompany.getCompanyName().trim().equalsIgnoreCase("") && demandPartnerCompany.getDataSource() != null && !demandPartnerCompany.getDataSource().trim().equalsIgnoreCase("")){
memcacheKeySubstring.append(demandPartnerCompany.getCompanyName().trim());
if(i==0 && length == 1) {
QUERY = QUERY+" and (( data_source = '"+LinMobileConstants.DEFAULT_DATASOURE_NAME+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"'))";
}
else if(i==0) {
QUERY = QUERY+" and (( data_source = '"+LinMobileConstants.DEFAULT_DATASOURE_NAME+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"')";
}
else if(i == length-1) {
QUERY = QUERY+" or ( data_source = '"+LinMobileConstants.DEFAULT_DATASOURE_NAME+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"'))";
}
else {
QUERY = QUERY+" or ( data_source = '"+LinMobileConstants.DEFAULT_DATASOURE_NAME+"' and channel_name = '"+demandPartnerCompany.getCompanyName().trim()+"')";
}
}
}
}
return QUERY;
}*/
public String getSelectedDFPPropertiesQuery(long publisherId, long userId, StringBuilder memcacheKeySubstring) throws Exception {
/*log.info("Inside getSelectedDFPPropertiesQuery in LinMobileDAO");
StringBuilder QUERY = new StringBuilder();
QUERY.append(" and ( site_name = '' )");
IUserDetailsDAO userDetailsDAO = new UserDetailsDAO();
List<PropertyEntityObj> propertyObjList = userDetailsDAO.getSelectedPropertiesByUserIdAndPublisherId(userId, (Long.valueOf(publisherId)).toString().trim());
if(propertyObjList != null && propertyObjList.size() > 0) {
int length = propertyObjList.size();
if(length > 0) {
QUERY = new StringBuilder();
for (int i=0; i<length; i++) {
PropertyEntityObj propertyObj = propertyObjList.get(i);
if(propertyObj != null && propertyObj.getStatus().equals(LinMobileConstants.STATUS_ARRAY[0]) && propertyObj.getDFPPropertyName() != null && !propertyObj.getDFPPropertyName().trim().equalsIgnoreCase("")) {
memcacheKeySubstring.append(propertyObj.getDFPPropertyName().trim());
if(i==0) {
QUERY.append(" and ( site_name = '"+propertyObj.getDFPPropertyName().trim()+"' ");
}
else {
QUERY.append(" or site_name = '"+propertyObj.getDFPPropertyName().trim()+"' ");
}
}
}
QUERY.append(" ) ");
}
}
return QUERY.toString();*/
return "";
}
public List<AdvertiserReportObj> loadPerformingLineItems(String lowerDate,String upperDate){
List<AdvertiserReportObj> advertiserReportList=null;
List<AdvertiserReportObj> subList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
advertiserReportList=linDAO.loadPerformingLineItemsForAdvertiser(5,lowerDate,upperDate);
if(advertiserReportList !=null){
log.info("Found objects from datastore :"+advertiserReportList.size()+" , going to sort by CTR using comperator.");
AdvertiserViewPerformerComparator performerComperator= new AdvertiserViewPerformerComparator();
Collections.sort(advertiserReportList, performerComperator);
if(advertiserReportList.size()>5){
subList=advertiserReportList.subList(0, 5);
log.info("fetched sorted subList with 5 objects from advertiserReportList.");
return subList;
}else{
return advertiserReportList;
}
}else{
log.info("Found objects from datastore :null");
return advertiserReportList;
}
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<AdvertiserReportObj> loadNonPerformingLineItems(String lowerDate,String upperDate){
List<AdvertiserReportObj> advertiserReportList=null;
List<AdvertiserReportObj> subList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
advertiserReportList=linDAO.loadNonPerformingLineItemsForAdvertiser(5,lowerDate,upperDate);
if(advertiserReportList !=null){
log.info("Found objects from datastore :"+advertiserReportList.size()+" , going to sort by delivery indicator using comparator.");
double upperCap=100;
Iterator itr=advertiserReportList.iterator();
AdvertiserReportObj obj=null;
while(itr.hasNext()){
obj=(AdvertiserReportObj) itr.next();
//log.info("obj.getDeliveryIndicator():"+obj.getDeliveryIndicator());
if(obj.getDeliveryIndicator() >= upperCap){
//log.info("Removing lineitem with delivery indicator ::"+obj.getDeliveryIndicator());
itr.remove();
}
}
AdvertiserViewNonPerformerComparator nonPerformerComperator= new AdvertiserViewNonPerformerComparator();
Collections.sort(advertiserReportList, nonPerformerComperator);
if(advertiserReportList !=null && advertiserReportList.size()>5){
subList=advertiserReportList.subList(0, 5);
log.info("fetched sorted subList with 5 objects from advertiserReportList.");
return subList;
}else{
return advertiserReportList;
}
}else{
log.info("Found objects from datastore :null");
return advertiserReportList;
}
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<String> loadAgencies(){
log.info("Service :loading agencies...");
List<AgencyAdvertiserObj> agencyAdvertiserList=null;
List<String> agencyList=new ArrayList<String>();
ILinMobileDAO linDAO=new LinMobileDAO();
try {
agencyAdvertiserList=linDAO.loadAllAgencies();
for(AgencyAdvertiserObj obj:agencyAdvertiserList){
String agencyName=obj.getAgencyName();
if(agencyName!=null && (!agencyName.equals("0")) && !agencyList.contains(agencyName)){
agencyList.add(agencyName);
}else{
//log.info("already added.."+agencyList);
}
}
} catch (DataServiceException e) {
log.severe("Falied to load all agencies: DataServiceException:"+e.getMessage());
}
return agencyList;
}
public List<AgencyAdvertiserObj> loadAdvertisers(String agencyName){
List<AgencyAdvertiserObj> agencyAdvertiserList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
agencyAdvertiserList=linDAO.loadAllAdvertisers(agencyName);
} catch (DataServiceException e) {
log.severe("Falied to load all advertisers: DataServiceException:"+e.getMessage());
}
return agencyAdvertiserList;
}
public List<CustomLineItemObj> getMostActiveLineItems(String lowerDate,String upperDate){
List<CustomLineItemObj> resultList=null;
List<CustomLineItemObj> subList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadMostActiveLineItem(5,lowerDate,upperDate);
if(resultList !=null){
log.info("Found objects from datastore :"+resultList.size()+" , going to sort by delivery indicator using comperator.");
AdvertiserViewMostActiveComparator mostActiveComparator= new AdvertiserViewMostActiveComparator();
Collections.sort(resultList, mostActiveComparator);
if(resultList.size()>5){
subList=resultList.subList(0, 5);
log.info("fetched sorted subList with 5 objects from mostActiveList.");
return subList;
}else{
return resultList;
}
}else{
log.info("Found objects from datastore :null");
return resultList;
}
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<CustomLineItemObj> getTopGainersLineItems(String lowerDate,String upperDate){
List<CustomLineItemObj> resultList=null;
List<CustomLineItemObj> subList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadMostActiveLineItem(5,lowerDate,upperDate);
if(resultList !=null){
log.info("Found objects from datastore :"+resultList.size()+" , going to sort by delivery indicator using comperator.");
AdvertiserViewMostActiveComparator mostActiveComparator= new AdvertiserViewMostActiveComparator();
Collections.sort(resultList, mostActiveComparator);
if(resultList.size()>5){
subList=resultList.subList(0, 5);
log.info("fetched sorted subList with 5 objects from mostActiveList.");
return subList;
}else{
return resultList;
}
}else{
log.info("Found objects from datastore :null");
return resultList;
}
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<CustomLineItemObj> getTopLosersLineItems(String lowerDate,String upperDate){
List<CustomLineItemObj> resultList=null;
List<CustomLineItemObj> subList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadMostActiveLineItem(5,lowerDate,upperDate);
if(resultList !=null){
log.info("Found objects from datastore :"+resultList.size()+" , going to sort by delivery indicator using comperator.");
AdvertiserViewMostActiveComparator mostActiveComparator= new AdvertiserViewMostActiveComparator();
Collections.sort(resultList, mostActiveComparator);
if(resultList.size()>5){
subList=resultList.subList(0, 5);
log.info("fetched sorted subList with 5 objects from mostActiveList.");
return subList;
}else{
return resultList;
}
}else{
log.info("Found objects from datastore :null");
return resultList;
}
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public void insertPublisherViewDTO(List<PublisherViewDTO> publisherViewList)
{
LinMobileDAO linDao = new LinMobileDAO();
for(PublisherViewDTO publisherView : publisherViewList)
{
try {
linDao.saveObject(publisherView);
} catch (DataServiceException e) {
// TODO Auto-generated catch block
}
}
}
public List<PublisherViewDTO> getPublisherViewDTO()
{
LinMobileDAO linDao = new LinMobileDAO();
try {
return linDao.getPublisherViewDTO();
} catch (DataServiceException e) {
log.info(":exception: "+e.getMessage());
return null;
}
}
public List<PublisherViewDTO> getPublisherViewDTO(int pageNo)
{
LinMobileDAO linDao = new LinMobileDAO();
try {
return linDao.getPublisherView(pageNo);
} catch (DataServiceException e) {
log.info(":exception: "+e.getMessage());
return null;
}
}
public void insertLeftMenuDTO(List<LeftMenuDTO> leftMenuItemList)
{
LinMobileDAO linDao = new LinMobileDAO();
for(LeftMenuDTO leftMenuDTO : leftMenuItemList)
{
try {
linDao.saveObject(leftMenuDTO);
} catch (DataServiceException e) {
// TODO Auto-generated catch block
}
}
}
public List<LeftMenuDTO> getLeftMenuList()
{
LinMobileDAO linDao = new LinMobileDAO();
try {
return linDao.getLeftMenuList();
} catch (DataServiceException e) {
log.info(":exception: "+e.getMessage());
return null;
}
}
public List<PerformanceMetricsObj> getAdvertiserPerformanceMetrics(int counter,String lowerDate,String upperDate){
List<PerformanceMetricsObj> resultList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadAdvertiserPerformanceMetrics(counter,lowerDate,upperDate);
return resultList;
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<PerformanceMetricsObj> getAdvertiserPerformanceMetrics(String lowerDate,String upperDate){
List<PerformanceMetricsObj> resultList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadAdvertiserPerformanceMetrics(lowerDate,upperDate);
return resultList;
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public void loadAdvertisersByLocationData(String lowerDate,String upperDate,StringBuilder sbStr ){
try{
List<AdvertiserByLocationObj> advertiserByLocationObjList =null;
LinMobileDAO linDao = new LinMobileDAO();
advertiserByLocationObjList = linDao.loadAdvertisersByLocationData(lowerDate, upperDate);
sbStr.append("[['State', 'Impression', 'CTR(%)']");
for (AdvertiserByLocationObj object : advertiserByLocationObjList) {
sbStr.append(",[");
sbStr.append("'"+object.getState()+"',"+object.getImpression()+","+object.getCtrPercent());
sbStr.append("]");
}
sbStr.append("]");
}catch(Exception e){
log.severe("Exception :"+e.getMessage());
}
}
public void loadAdvertisersByMarketData(String lowerDate,String upperDate,StringBuilder sbStr){
try{
List<AdvertiserByMarketObj> advertiserBymarketObjList =null;
LinMobileDAO linDao = new LinMobileDAO();
advertiserBymarketObjList = linDao.loadAdvertisersBymarketData(lowerDate, upperDate);
sbStr.append("[['State', 'lin-property', 'CTR(%)']");
for (AdvertiserByMarketObj object : advertiserBymarketObjList) {
sbStr.append(",[");
sbStr.append("'"+object.getState()+"','"+object.getLinProperty()+"',"+object.getCtrPercent());
sbStr.append("]");
}
sbStr.append("]");
}catch(Exception e){
log.severe("Exception :"+e.getMessage());
}
}
/*
* Load advertiser details by advertiserId
* @see com.lin.web.service.ILinMobileBusinessService#loadAdvertiserDetails(long)
*/
public List<AgencyAdvertiserObj> loadAdvertiserDetails(long advertiserId){
List<AgencyAdvertiserObj> agencyAdvertiserList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
agencyAdvertiserList=linDAO.loadAdvertiserById(advertiserId);
} catch (DataServiceException e) {
log.severe("Falied to load all advertisers: DataServiceException:"+e.getMessage());
}
return agencyAdvertiserList;
}
/* public List<PublisherChannelObj> getChannelPerformanceList(String lowerDate, String upperDate, String compareStartDate, String compareEndDate, String allChannelName, String publisher){
List<PublisherChannelObj> resultList=null;
List<PublisherChannelObj> publisherList=new ArrayList<PublisherChannelObj>();
List<String> channelNameList=new ArrayList<String>();
ILinMobileDAO linDAO=new LinMobileDAO();
List<String> channelArrList = new ArrayList<String>();
String[] str = allChannelName.split(",");
if(str!=null){
for (String channel : str) {
channelArrList.add(channel.trim());
}
}
try {
resultList=linDAO.loadChannelPerformanceList(lowerDate,upperDate,compareStartDate,compareEndDate, channelArrList,publisher );
if(resultList != null && resultList.size() > 0) {
for(PublisherChannelObj obj:resultList){
if(!channelNameList.contains(obj.getChannelName())){
channelNameList.add(obj.getChannelName());
publisherList.add(obj);
}
}
}
return publisherList;
} catch (Exception e) {
log.severe("Exception in getChannelPerformanceList in LinMobileBusinessService :"+e.getMessage());
return publisherList;
}
}*/
public List<PublisherPropertiesObj> getPerformanceByPropertyList(int limit,String lowerDate,String upperDate)
{
List<PublisherPropertiesObj> resultList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadPerformanceByPropertyList(limit,lowerDate,upperDate);
return resultList;
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<PublisherPropertiesObj> getPerformanceByPropertyList(String lowerDate,String upperDate){
List<PublisherPropertiesObj> resultList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadPerformanceByPropertyList(lowerDate,upperDate);
return resultList;
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<PublisherPropertiesObj> getPerformanceByPropertyList(String lowerDate,String upperDate, String compareStartDate, String compareEndDate, String channel, String publisher){
List<PublisherPropertiesObj> resultList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
IUserService userService = (IUserService) BusinessServiceLocator.locate(IUserService.class);
try {
StringBuilder memcacheKeysubstring = new StringBuilder();
String channelAndDataSourceQuery = getChannelAndDataSourceQuery(userService.CommaSeperatedStringToList(channel), memcacheKeysubstring, false);
resultList=linDAO.loadPerformanceByPropertyList(lowerDate,upperDate,compareStartDate,compareEndDate, channel, publisher, channelAndDataSourceQuery);
return resultList;
} catch (Exception e) {
log.severe("Exception :"+e.getMessage());
return null;
}
}
public List<SellThroughDataObj> getSellThroughDataList(String lowerDate,String upperDate, String publisherName, long publisherId, long userId)
{
List<SellThroughDataObj> resultList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
String publisherBQId = getPublisherBQId(publisherName);
StringBuilder DFP_Properties_MemcacheKeyPart = new StringBuilder();
String selectedDFPPropertiesQuery = getSelectedDFPPropertiesQuery(publisherId, userId, DFP_Properties_MemcacheKeyPart);
resultList = MemcacheUtil.getSellThroughData(lowerDate, upperDate, publisherBQId, DFP_Properties_MemcacheKeyPart.toString());
if(resultList == null || resultList.size() <= 0) {
QueryDTO queryDTO = getQueryDTO(publisherBQId, lowerDate, upperDate, LinMobileConstants.BQ_SELL_THROUGH);
log.info("Sell through data not found in memcache, get from bigquery..");
resultList=linDAO.loadSellThroughDataList(lowerDate,upperDate, selectedDFPPropertiesQuery, queryDTO);
if(resultList != null && resultList.size()>0) {
MemcacheUtil.setSellThroughData(resultList, lowerDate, upperDate, publisherBQId, DFP_Properties_MemcacheKeyPart.toString());
}
}
return resultList;
} catch (Exception e) {
log.severe("Exception : "+e.getMessage());
return null;
}
}
/*
* Get LineItem by id
* @Param - String lowerDate,String upperDate,long lineItemId
* @Return - PopUpDTO popUpObj
*/
public PopUpDTO getLineItemForPopUP(String lowerDate,String upperDate,long lineItemId){
List<AdvertiserReportObj> resultList=null;
PopUpDTO popUpObj=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
popUpObj=new PopUpDTO();
resultList=linDAO.loadLineItem(lowerDate,upperDate,lineItemId);
popUpObj.setId(String.valueOf(lineItemId));
if(resultList !=null && resultList.size()>0){
log.info("Got lineItems:"+resultList.size());
AdvertiserReportObj obj=resultList.get(0);
popUpObj.setBookedImpression(String.valueOf(obj.getGoalQuantity()));
popUpObj.setImpressionDeliveredLifeTime(String.valueOf(obj.getLineItemLifeItemImpressions()));
popUpObj.setImpressionDeliveredInSelectedTime(String.valueOf(obj.getAdServerImpressions()));
popUpObj.setClicksInSelectedTime(String.valueOf(obj.getAdServerClicks()));
popUpObj.setClicksLifeTime(String.valueOf(obj.getLineItemLifeTimeClicks()));
popUpObj.setCtrLifeTime(String.valueOf(obj.getAdServerCTR()));
popUpObj.setCtrInSelectedTime(String.valueOf(obj.getAdServerCTR()));
popUpObj.seteCPM(String.valueOf(obj.getAdServerECPM()));
popUpObj.setTitle(obj.getLineItemName());
StringBuffer strBuffer=new StringBuffer();
strBuffer.append("[['Days', 'Impression']");
for (AdvertiserReportObj object:resultList) {
strBuffer.append(",[");
strBuffer.append("'"+DateUtil.getFormatedDate(object.getDate(), "yyyy-MM-dd", "MM/dd")+"',"+object.getAdServerImpressions());
strBuffer.append("]");
}
strBuffer.append("]");
log.info("strBuffer.toString():"+strBuffer.toString());
popUpObj.setChartData(strBuffer.toString());
}else{
log.info("No lineitem found for lineItemId:"+lineItemId+" and time: lowerDate:"+lowerDate+" and upperDate:"+upperDate);
}
} catch (DataServiceException e) {
log.severe("Exception in loading lineItem with id:"+lineItemId+" : "+e.getMessage());
}
return popUpObj;
}
public List<String> getPublishers(){
List<PublisherChannelObj> resultList=null;
List<String> publisherList=new ArrayList<String>();
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadPublisherDataList();
for(PublisherChannelObj obj:resultList){
if(!publisherList.contains(obj.getPublisherName())){
publisherList.add(obj.getPublisherName());
}
}
return publisherList;
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<PublisherChannelObj> getPublisherDataList(String publisherName){
List<PublisherChannelObj> resultList=null;
List<String> publisherList=new ArrayList<String>();
List<PublisherChannelObj> publisherObjList=new ArrayList<PublisherChannelObj>();
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadPublisherDataList();
for(PublisherChannelObj obj:resultList){
if( (!publisherList.contains(obj.getPublisherName())) && (publisherName.equalsIgnoreCase(obj.getPublisherName())) ){
publisherList.add(obj.getPublisherName());
publisherObjList.add(obj);
break;
}
}
return publisherObjList;
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<PublisherChannelObj> loadChannelsByPublisher(String publisherName){
List<PublisherChannelObj> resultList=null;
List<PublisherChannelObj> channelObjList=new ArrayList<PublisherChannelObj>();
List<String> channelList=new ArrayList<String>();
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadChannels(publisherName);
for(PublisherChannelObj obj:resultList){
if(!channelList.contains(obj.getChannelName())){
channelList.add(obj.getChannelName());
channelObjList.add(obj);
}
}
return channelObjList;
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<PublisherChannelObj> loadChannelsByName(String channelName){
List<PublisherChannelObj> resultList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadChannelsByName(channelName);
return resultList;
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
/*
* Get LineItem by id
* @Param - String lowerDate,String upperDate,String lineItemName
* @Return - PopUpDTO popUpObj
*/
public PopUpDTO getLineItemForPopUP(String lowerDate,String upperDate,String lineItemName){
List<CustomLineItemObj> resultList=null;
PopUpDTO popUpObj=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
popUpObj=new PopUpDTO();
resultList=linDAO.loadLineItem(lowerDate,upperDate,lineItemName);
if(resultList !=null && resultList.size()>0){
log.info("Got lineItems:"+resultList.size());
CustomLineItemObj obj=resultList.get(0);
String bookedImpressions=(obj.getDeliveredImpressions()*2)+"";
popUpObj.setBookedImpression(bookedImpressions);
popUpObj.setImpressionDeliveredLifeTime(String.valueOf(obj.getDeliveredImpressions()*3/2));
popUpObj.setImpressionDeliveredInSelectedTime(String.valueOf(obj.getDeliveredImpressions()));
String clicks=(Math.round(obj.getDeliveredImpressions()/5))+"";
String clicksLifeTime=(Math.round((obj.getDeliveredImpressions()/5)))+"";
popUpObj.setClicksInSelectedTime(String.valueOf(clicks));
popUpObj.setClicksLifeTime(clicksLifeTime);
popUpObj.setCtrLifeTime(String.valueOf(obj.getCTR()*2));
popUpObj.setCtrInSelectedTime(String.valueOf(obj.getCTR()));
String cpm=String.valueOf(obj.getCTR()*20);
if(cpm.indexOf("-")>=0){
cpm=cpm.replace("-", "");
}
popUpObj.seteCPM(cpm);
popUpObj.setTitle(obj.getLineItemName());
String revenueDelivered=(Math.round(obj.getDeliveryIndicator()*1500)/100)+""; //dummy data
String revenueRemaining=(Math.round(obj.getDeliveryIndicator()*1000)/100)+""; //dummy data
String revenueDeliveredLifeTime=(Math.round(obj.getDeliveryIndicator()*2000)/100)+""; //dummy data
String revenueRemainingLifeTime=(Math.round((obj.getDeliveryIndicator()*1500)/100))+""; //dummy data
popUpObj.setRevenueDeliveredInSelectedTime(revenueDelivered);
popUpObj.setRevenueDeliveredLifeTime(revenueDeliveredLifeTime);
popUpObj.setRevenueRemainingInSelectedTime(revenueRemaining);
popUpObj.setRevenueRemainingLifeTime(revenueRemainingLifeTime);
StringBuffer strBuffer=new StringBuffer();
strBuffer.append("[['Days', 'Impression']");
for (CustomLineItemObj object:resultList) {
strBuffer.append(",[");
strBuffer.append("'"+DateUtil.getFormatedDate(object.getDate(), "yyyy-MM-dd", "MM/dd")+"',"+object.getDeliveredImpressions());
strBuffer.append("]");
}
strBuffer.append("]");
popUpObj.setChartData(strBuffer.toString());
log.info("strBuffer.toString():"+strBuffer.toString());
}else{
log.info("No lineitem found for lineItemName:"+lineItemName+" and time: lowerDate:"+lowerDate+" and upperDate:"+upperDate);
}
} catch (DataServiceException e) {
log.severe("Exception in loading lineItem with lineItemName:"+lineItemName+" : "+e.getMessage());
}
return popUpObj;
}
/*
* getPerformanceMetricLineItemForPopUP
* @Param - String lowerDate,String upperDate,String lineItemName
* @Return - PopUpDTO popUpObj
*/
public PopUpDTO getPerformanceMetricLineItemForPopUP(String lowerDate,String upperDate,String lineItemName){
List<PerformanceMetricsObj> resultList=null;
PopUpDTO popUpObj=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
popUpObj=new PopUpDTO();
resultList=linDAO.loadLineItemForPerformanceMetrics(lowerDate,upperDate,lineItemName);
if(resultList!=null && resultList.size()>0){
log.info("Got lineItems:"+resultList.size());
PerformanceMetricsObj obj=resultList.get(0);
String bookedImpressions=(obj.getImpressionsBooked())+"";
popUpObj.setBookedImpression(bookedImpressions);
popUpObj.setImpressionDeliveredLifeTime(String.valueOf(obj.getImpressionsDelivered()*3/2));
popUpObj.setImpressionDeliveredInSelectedTime(String.valueOf(obj.getImpressionsDelivered()));
String clicks=(Math.round(obj.getClicks()/5))+"";
String clicksLifeTime=(obj.getClicks())+"";
popUpObj.setClicksInSelectedTime(String.valueOf(clicks));
popUpObj.setClicksLifeTime(clicksLifeTime);
popUpObj.setCtrLifeTime(String.valueOf(obj.getCTR()));
popUpObj.setCtrInSelectedTime(String.valueOf(obj.getCTR()));
String cpm=String.valueOf(Math.round(obj.getCTR()*2000)/100);
if(cpm.indexOf("-")>=0){
cpm=cpm.replace("-", "");
}
popUpObj.seteCPM(cpm);
popUpObj.setTitle(obj.getLineItemName());
String revenueDelivered=(Math.round(obj.getRevenueRecoByDay()*100)/100)+""; //dummy data
String revenueRemaining=(Math.round(obj.getRevenueLeftByDay()*100)/100)+""; //dummy data
String revenueDeliveredLifeTime=(Math.round(obj.getRevenueRecoByDay()*200)/100)+""; //dummy data
String revenueRemainingLifeTime=(Math.round((obj.getRevenueLeftByDay()*150)/100))+""; //dummy data
popUpObj.setRevenueDeliveredInSelectedTime(revenueDelivered);
popUpObj.setRevenueDeliveredLifeTime(revenueDeliveredLifeTime);
popUpObj.setRevenueRemainingInSelectedTime(revenueRemaining);
popUpObj.setRevenueRemainingLifeTime(revenueRemainingLifeTime);
StringBuffer strBuffer=new StringBuffer();
strBuffer.append("[['Days', 'Impression']");
for (PerformanceMetricsObj metricsObj:resultList) {
strBuffer.append(",[");
strBuffer.append("'"+DateUtil.getFormatedDate(metricsObj.getDate(), "yyyy-MM-dd", "MM/dd")+"',"+metricsObj.getImpressionsDelivered());
strBuffer.append("]");
}
strBuffer.append("]");
popUpObj.setChartData(strBuffer.toString());
log.info("strBuffer.toString():"+strBuffer.toString());
}else{
log.info("No lineitem found for lineItemName:"+lineItemName+" and time: lowerDate:"+lowerDate+" and upperDate:"+upperDate);
}
} catch (DataServiceException e) {
log.severe("Exception in loading lineItem with lineItemName:"+lineItemName+" : "+e.getMessage());
}
return popUpObj;
}
public List<String> loadOrders(){
List<OrderLineItemObj> orderNameList=null;
List<String> orderList=new ArrayList<String>();
ILinMobileDAO linDAO=new LinMobileDAO();
try {
orderNameList=linDAO.loadAllOrders();
for(OrderLineItemObj obj:orderNameList){
String orderName=obj.getOrderName();
if(orderName!=null && (!orderName.equals("0")) && !orderList.contains(orderName)){
orderList.add(orderName);
log.info("order list....."+orderList.size());
}
}
} catch (DataServiceException e) {
log.severe("Falied to load all agencies: DataServiceException:"+e.getMessage());
}
return orderList;
}
public List<OrderLineItemObj> loadLineItemName(String orderName){
List<OrderLineItemObj> lineItemList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
lineItemList=linDAO.loadAllLineItems(orderName);
} catch (DataServiceException e) {
log.severe("Falied to load all advertisers: DataServiceException:"+e.getMessage());
}
return lineItemList;
}
public List<OrderLineItemObj> loadLineItemName(long orderId){
List<OrderLineItemObj> lineItemList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
lineItemList=linDAO.loadAllLineItems(orderId);
} catch (DataServiceException e) {
log.severe("Falied to load all advertisers: DataServiceException:"+e.getMessage());
}
return lineItemList;
}
public List<OrderLineItemObj> loadLineItem(long lineItemId){
List<OrderLineItemObj> lineItemList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
lineItemList=linDAO.loadLineItem(lineItemId);
} catch (DataServiceException e) {
log.severe("Falied to load all advertisers: DataServiceException:"+e.getMessage());
}
return lineItemList;
}
public List<ReallocationDataObj> loadReallocationItems(String lowerDate,String upperDate){
List<ReallocationDataObj> reallocationReportList=null;
List<ReallocationDataObj> subList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
reallocationReportList=linDAO.loadReallocationItemsForAdvertiser(5,lowerDate,upperDate);
if(reallocationReportList !=null){
log.info("Found objects from datastore :"+reallocationReportList.size()+" , going to sort by CTR using comperator.");
/*AdvertiserViewPerformerComparator performerComperator= new AdvertiserViewPerformerComparator();
Collections.sort(reallocationReportList, performerComperator);*/
if(reallocationReportList.size()>5){
subList=reallocationReportList.subList(0, 5);
log.info("fetched sorted subList with 5 objects from advertiserReportList.");
return subList;
}else{
return reallocationReportList;
}
}else{
log.info("Found objects from datastore :null");
return reallocationReportList;
}
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<ActualAdvertiserObj> loadActualAdvertiserData(String lowerDate,String upperDate){
List<ActualAdvertiserObj> actualAdvertiserList=null;
List<ActualAdvertiserObj> subList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
actualAdvertiserList=linDAO.loadActualDataForAdvertiser(5,lowerDate,upperDate);
if(actualAdvertiserList !=null){
log.info("Found objects from datastore :"+actualAdvertiserList.size()+" , going to sort by CTR using comperator.");
/*AdvertiserViewPerformerComparator performerComperator= new AdvertiserViewPerformerComparator();
Collections.sort(reallocationReportList, performerComperator);*/
if(actualAdvertiserList.size()>15){
subList=actualAdvertiserList.subList(0, 15);
log.info("fetched sorted subList with 5 objects from actualAdvertiserList.");
return subList;
}else{
return actualAdvertiserList;
}
}else{
log.info("Found objects from datastore :null");
return actualAdvertiserList;
}
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<ForcastedAdvertiserObj> loadForcastAdvertiserData(String lowerDate,String upperDate){
List<ForcastedAdvertiserObj> forcastAdvertiserList=null;
List<ForcastedAdvertiserObj> subList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
forcastAdvertiserList=linDAO.loadForcastDataForAdvertiser(5,lowerDate,upperDate);
if(forcastAdvertiserList !=null){
log.info("Found objects from datastore :"+forcastAdvertiserList.size()+" , going to sort by CTR using comperator.");
/*AdvertiserViewPerformerComparator performerComperator= new AdvertiserViewPerformerComparator();
Collections.sort(reallocationReportList, performerComperator);*/
if(forcastAdvertiserList.size()>15){
subList=forcastAdvertiserList.subList(0, 15);
log.info("fetched sorted subList with 5 objects from actualAdvertiserList.");
return subList;
}else{
return forcastAdvertiserList;
}
}else{
log.info("Found objects from datastore :null");
return forcastAdvertiserList;
}
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<PublisherChannelObj> loadActualPublisherData(String lowerDate,String upperDate,String publisherName,String channelName){
List<PublisherChannelObj> actualPublisherList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
//String channelAndDataSourceQuery = "";
//IUserService userService = (IUserService) BusinessServiceLocator.locate(IUserService.class);
//List<String> channelArrList = new ArrayList<String>();
try {
String replaceStr = "\\\\'";
if(channelName!=null){
//StringBuilder memcacheKeySubstring = new StringBuilder();
//channelAndDataSourceQuery = getChannelAndDataSourceQuery(userService.CommaSeperatedStringToList(channelName), memcacheKeySubstring, false);
channelName = channelName.replaceAll("'", replaceStr);
channelName = channelName.replaceAll(",", "','");
}else{
channelName = "";
}
String channelId = getChannelsBQId(channelName);
String publisherId = getPublisherBQId(publisherName);
actualPublisherList = MemcacheUtil.getTrendsAnalysisActualDataPublisher(lowerDate, upperDate, publisherId, channelId);
if(actualPublisherList==null || actualPublisherList.size()<=0) {
QueryDTO queryDTO = getQueryDTO(publisherId, lowerDate, upperDate, LinMobileConstants.BQ_CORE_PERFORMANCE);
if(queryDTO != null && queryDTO.getQueryData() != null && queryDTO.getQueryData().length() > 0) {
actualPublisherList=linDAO.loadActualDataForPublisher(lowerDate,upperDate,channelId, queryDTO);
MemcacheUtil.setTrendsAnalysisActualDataPublisher(lowerDate, upperDate, publisherId, channelId, actualPublisherList);
}
}
return actualPublisherList;
} catch (Exception e) {
log.severe("Exception :"+e.getMessage());
return null;
}
}
public List<PublisherChannelObj> loadReallocationPublisherData(String lowerDate,String upperDate,String publisherName){
List<PublisherChannelObj> reallocationPublisherList=null;
List<PublisherChannelObj> reallocationPublisherAlteredList= new ArrayList<PublisherChannelObj>();
List<String> networkList=new ArrayList<String>();
List<PublisherChannelObj> subList=null;
PublisherChannelObj channelObj = new PublisherChannelObj();
ILinMobileDAO linDAO=new LinMobileDAO();
try {
reallocationPublisherList=linDAO.loadReallocationDataForPublisher(5,lowerDate,upperDate,publisherName);
if(reallocationPublisherList !=null){
Iterator<PublisherChannelObj> iterator = reallocationPublisherList.iterator();
while(iterator.hasNext()){
channelObj = iterator.next();
double ecpm = channelObj.geteCPM();
double ctr = channelObj.getCTR();
double cpc = ecpm/(1000*ctr);
double floorCPM = 1000 * ctr * cpc;
channelObj.setCPC(cpc);
channelObj.setFloorCPM(floorCPM);
if(!networkList.contains(channelObj.getChannelName())){
reallocationPublisherAlteredList.add(channelObj);
networkList.add(channelObj.getChannelName());
}
}
log.info("Networks: "+networkList);
log.info("Found objects from datastore :"+reallocationPublisherAlteredList.size());
return reallocationPublisherAlteredList;
}else{
log.info("Found objects from datastore :null");
return reallocationPublisherAlteredList;
}
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
public List<PublisherChannelObj> loadReallocationGraphPublisherData(String lowerDate,String upperDate,String publisherName){
List<PublisherChannelObj> reallocationPublisherList= null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
reallocationPublisherList=linDAO.loadReallocationDataForPublisher(5,lowerDate,upperDate,publisherName);
return reallocationPublisherList;
} catch (DataServiceException e) {
log.severe("DataServiceException :"+e.getMessage());
return null;
}
}
/*
* Get ChannelPerformancePopUP
* @Param - String lowerDate,String upperDate,String channelName
* @Return - PopUpDTO popUpObj
*/
public PopUpDTO getChannelPerformancePopUP(String lowerDate,String upperDate,String channelName, String publisher){
String preUpperDate=DateUtil.getModifiedDateStringByDays(lowerDate, -1, "yyyy-MM-dd");
int days=(int)DateUtil.getDifferneceBetweenTwoDates(lowerDate, upperDate, "yyyy-MM-dd")+1;
String preLowerDate=DateUtil.getModifiedDateStringByDays(preUpperDate, -days, "yyyy-MM-dd");
String monthToDateEnd=DateUtil.getCurrentTimeStamp("yyyy-MM-dd");
String[] dayArray=monthToDateEnd.split("-");
int year=Integer.parseInt(dayArray[0]);
int month=Integer.parseInt(dayArray[1])-1; // subtract 1 from day String as day starts from 0 to 11 in Calender class
String monthToDateStart=DateUtil.getDateByYearMonthDays(year,month,1,"yyyy-MM-dd");;
log.info("Service: (startDate:"+lowerDate+" and endDate:"+upperDate+") and (preLowerDate="+preLowerDate+", preUpperDate="+preUpperDate+") and (monthToDateStart="+monthToDateStart+", monthToDateEnd="+monthToDateEnd+")");
PopUpDTO popUpObj = null;
String chartData = null;
try{
popUpObj=new PopUpDTO();
chartData=loadPerformanceChannelPopUpGraphDataFromBigQuery(lowerDate, upperDate, channelName, publisher);
popUpObj.setChartData(chartData);
}catch (Exception e) {
log.severe("Exception in loading channel:"+channelName+" : "+e.getMessage());
}
return popUpObj;
}
public String loadPerformanceChannelPopUpGraphDataFromBigQuery(String lowerDate,String upperDate,String channelName, String publisher){
List<PopUpDTO> resultList=null;
IUserService userService = (IUserService) BusinessServiceLocator.locate(IUserService.class);
StringBuilder memcacheKeysubstring = new StringBuilder();
String chartData = "";
try {
String channelId = getChannelsBQId(channelName);
String publisherId = getPublisherBQId(publisher);
chartData=MemcacheUtil.getPublisherChannelPopUpGraphData(lowerDate, upperDate, channelId, publisherId);
if(chartData == null ){
log.info("Chart data not found in memcache, going to fetch from bigquery..");
ILinMobileDAO linDAO=new LinMobileDAO();
try {
QueryDTO queryDTO = getQueryDTO(publisherId, lowerDate, upperDate, LinMobileConstants.BQ_CORE_PERFORMANCE);
if(queryDTO != null && queryDTO.getQueryData() != null && queryDTO.getQueryData().length() > 0) {
resultList=linDAO.loadChannelsPerformancePopUpGraphData(lowerDate, upperDate, channelId, publisherId, queryDTO);
StringBuffer strBuffer=new StringBuffer();
strBuffer.append("[['Days', 'Impression']");
for (PopUpDTO object:resultList) {
strBuffer.append(",[");
strBuffer.append("'"+DateUtil.getFormatedDate(object.getDate(), "yyyy-MM-dd", "MM/dd")+"',"+object.getImpressionDeliveredLifeTime());
strBuffer.append("]");
}
strBuffer.append("]");
chartData=strBuffer.toString();
log.info("Going to set this in memcache, chartData:"+chartData);
MemcacheUtil.setPublisherChannelPopUpGraphData(chartData,lowerDate, upperDate, channelId, publisherId);
}
} catch (Exception e) {
log.severe("Exception :"+e.getMessage());
}
}else{
log.info("Chart data found from memcache:"+chartData);
}
}catch (Exception e) {
log.severe("Exception in loadPerformanceChannelPopUpGraphDataFromBigQuery : "+e.getMessage());
}
return chartData;
}
/*
* loadActualPublisherData by channel name, selected time interval
* @see com.lin.web.service.ILinMobileBusinessService#loadActualPublisherData(java.lang.String, java.lang.String, java.lang.String)
*/
public List<PublisherChannelObj> loadActualPublisherData(String lowerDate,String upperDate,String channelName){
List<PublisherChannelObj> resultList=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
resultList=linDAO.loadChannels(lowerDate, upperDate, channelName);
}catch (DataServiceException e) {
log.severe("Exception in loadActualPublisherData :"+channelName+" : "+e.getMessage());
}
return resultList;
}
/*
* Get getSellThroughPopUP
* @Param - String lowerDate,String upperDate,String channelName
* @Return - PopUpDTO popUpObj
*/
public PopUpDTO getSellThroughPopUP(String lowerDate,String upperDate,String propertyName){
List<SellThroughDataObj> resultList=null;
PopUpDTO popUpObj=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
popUpObj=new PopUpDTO();
resultList=linDAO.loadSellThroughDataByProperty(lowerDate, upperDate, propertyName);
if(resultList !=null && resultList.size()>0){
log.info("Got property :"+resultList.size());
SellThroughDataObj obj=resultList.get(0);
popUpObj.setImpressionReserved(String.valueOf((obj.getReservedImpressions())));
popUpObj.setImpressionAvailable(String.valueOf((obj.getAvailableImpressions())) );
popUpObj.setImpressionForcasted(String.valueOf((obj.getForecastedImpressions())));
popUpObj.setSellThroughRate(String.valueOf((obj.getSellThroughRate())));
StringBuffer strBuffer=new StringBuffer();
strBuffer.append("[['Days', 'Impression']");
for (SellThroughDataObj object:resultList) {
strBuffer.append(",[");
strBuffer.append("'"+DateUtil.getFormatedDate(object.getDate(), "yyyy-MM-dd", "MM/dd")+"',"+object.getAvailableImpressions());
strBuffer.append("]");
}
strBuffer.append("]");
log.info("strBuffer.toString():"+strBuffer.toString());
popUpObj.setChartData(strBuffer.toString());
}else{
log.info("No property found:"+propertyName+" and time: lowerDate:"+lowerDate+" and upperDate:"+upperDate);
}
} catch (DataServiceException e) {
log.severe("Exception in loading property:"+propertyName+" : "+e.getMessage());
}
return popUpObj;
}
public PopUpDTO getPropertyPopup(String lowerDate,String upperDate,String propertyName){
List<PublisherPropertiesObj> resultList=null;
PopUpDTO popUpObj=null;
ILinMobileDAO linDAO=new LinMobileDAO();
try {
popUpObj=new PopUpDTO();
resultList=linDAO.loadPerformanceByPropertyList(lowerDate, upperDate, propertyName);
if(resultList !=null && resultList.size()>0){
log.info("Got property :"+resultList.size());
PublisherPropertiesObj obj=resultList.get(0);
popUpObj.seteCPM(String.valueOf(obj.geteCPM()));
popUpObj.setClicksInSelectedTime(String.valueOf(obj.getClicks()));
popUpObj.setImpressionDeliveredInSelectedTime(String.valueOf(obj.getImpressionsDelivered()));
popUpObj.setPayout(String.valueOf(obj.getPayout()));
popUpObj.setChangeCTRInSelectedTime(String.valueOf(obj.getCHG()));
StringBuffer strBuffer=new StringBuffer();
strBuffer.append("[['Days', 'Impression']");
for (PublisherPropertiesObj object:resultList) {
strBuffer.append(",[");
strBuffer.append("'"+DateUtil.getFormatedDate(object.getDate(), "yyyy-MM-dd", "MM/dd")+"',"+object.getImpressionsDelivered());
strBuffer.append("]");
}
strBuffer.append("]");
log.info("strBuffer.toString():"+strBuffer.toString());
popUpObj.setChartData(strBuffer.toString());
}else{
log.info("No property found:"+propertyName+" and time: lowerDate:"+lowerDate+" and upperDate:"+upperDate);
}
} catch (DataServiceException e) {
log.severe("Exception in loading property:"+propertyName+" : "+e.getMessage());
}
return popUpObj;
}
public List<PublisherTrendAnalysisHeaderDTO> loadTrendAnalysisHeaderData(String lowerDate,String upperDate,String publisherName,String channelName){
List<PublisherTrendAnalysisHeaderDTO> list = new ArrayList<PublisherTrendAnalysisHeaderDTO>();
ILinMobileDAO linDAO=new LinMobileDAO();
IUserService userService = (IUserService) BusinessServiceLocator.locate(IUserService.class);
String replaceStr = "\\\\'";
String channelAndDataSourceQuery = "";
try {
if(channelName!=null){
StringBuilder memcacheKeysubstring = new StringBuilder();
channelAndDataSourceQuery = getChannelAndDataSourceQuery(userService.CommaSeperatedStringToList(channelName), memcacheKeysubstring, false);
channelName = channelName.replaceAll("'", replaceStr);
channelName = channelName.replaceAll(",", "','");
}else{
channelName = "";
}
list = linDAO.loadTrendAnalysisHeaderData(lowerDate, upperDate, publisherName, channelName, channelAndDataSourceQuery);
} catch (Exception e) {
log.severe("Exception in loadTrendAnalysisHeaderData of LinMobileBusinessService : "+e.getMessage());
}
return list;
}
public List<PublisherInventoryRevenueObj> loadInventoryRevenueHeaderData(String lowerDate,String upperDate,String publisherName,String channelName){
List<PublisherInventoryRevenueObj> list = new ArrayList<PublisherInventoryRevenueObj>();
ILinMobileDAO linDAO=new LinMobileDAO();
IUserService userService = (IUserService) BusinessServiceLocator.locate(IUserService.class);
List<String> channelArrList = null;
try {
channelArrList = userService.CommaSeperatedStringToList(channelName);
StringBuilder memcacheKeysubstring = new StringBuilder();
String channelAndDataSourceQuery = getChannelAndDataSourceQuery(channelArrList, memcacheKeysubstring, false);
String ChannelsStr = ChannelsInQString(channelArrList, memcacheKeysubstring);
list = linDAO.loadInventoryRevenueHeaderData(lowerDate, upperDate, publisherName, ChannelsStr, channelAndDataSourceQuery);
} catch (Exception e) {
log.severe("Exception in loadInventoryRevenueHeaderData of LinMobileBusinessService : "+e.getMessage());
}
return list;
}
public List<PublisherSummaryObj> loadPublisherSummaryData(String lowerDate,String upperDate,String publisherName, long dataStorePublisherId, long userId, String channelNames)
{
List<PublisherSummaryObj> list = new ArrayList<PublisherSummaryObj>();
ILinMobileDAO linDAO=new LinMobileDAO();
//IUserService userService = (IUserService) BusinessServiceLocator.locate(IUserService.class);
try {
if(lowerDate == null && upperDate== null)
{ // get MTD data
String monthToDateEnd=DateUtil.getCurrentTimeStamp("yyyy-MM-dd");
String[] dayArray=monthToDateEnd.split("-");
int year=Integer.parseInt(dayArray[0]);
int month=Integer.parseInt(dayArray[1])-1; // subtract 1 from day String as day starts from 0 to 11 in Calender class
String monthToDateStart=DateUtil.getDateByYearMonthDays(year,month,1,"yyyy-MM-dd");
lowerDate = monthToDateStart;
upperDate = monthToDateEnd;
}
String channelIds = getChannelsBQId(channelNames);
String publisherId = getPublisherBQId(publisherName);
QueryDTO queryDTO = getQueryDTO(publisherId, lowerDate, upperDate, LinMobileConstants.BQ_CORE_PERFORMANCE);
if(queryDTO != null && queryDTO.getQueryData() != null && queryDTO.getQueryData().length() > 0) {
//StringBuilder allChannelAndDataSourceDFP_MemcacheKeyPart = new StringBuilder();
StringBuilder DFP_Properties_MemcacheKeyPart = new StringBuilder();
String selectedDFPPropertiesQuery = getSelectedDFPPropertiesQuery(dataStorePublisherId, userId, DFP_Properties_MemcacheKeyPart);
//String selectedDFPPropertiesQuery = "";
//String allChannelAndDataSourceQuery = getChannelAndDataSourceQuery(userService.CommaSeperatedStringToList(channelNames), allChannelAndDataSourceDFP_MemcacheKeyPart, true);
list = linDAO.loadPublisherSummaryData(lowerDate, upperDate, selectedDFPPropertiesQuery, channelIds, queryDTO);
}
} catch (Exception e) {
log.severe("Exception in loadPublisherSummaryData of LinMobileBusinessService : "+e.getMessage());
}
return list;
}
public Map<String,List<PublisherPropertiesObj>> loadAllPerformanceByProperty(String lowerDate,String upperDate,String publisherName, long dataStorePublisherId, long userId,String channels,String applyFlag) throws Exception
{
List<PublisherPropertiesObj> list = new ArrayList<PublisherPropertiesObj>();
List<PublisherPropertiesObj> allPerformanceByPropertyTempList = new ArrayList<PublisherPropertiesObj>();
List<PublisherPropertiesObj> allPerformanceByPropertyList = new ArrayList<PublisherPropertiesObj>();
List<PublisherPropertiesObj> allPerformanceByPropertyBySiteNameList = new ArrayList<PublisherPropertiesObj>();
List<PublisherPropertiesObj> performanceByPropertyDFPObjectList = new ArrayList<PublisherPropertiesObj>();
List<PublisherPropertiesObj> performanceByPropertyNonDFPObjectList = new ArrayList<PublisherPropertiesObj>();
ILinMobileDAO linDAO=new LinMobileDAO();
Map<String,Double> totalImpByChannelMap = new HashMap<String,Double>();
Map<String,PublisherPropertiesObj> dataBySiteMap = new HashMap<String,PublisherPropertiesObj>();
Map<String,List<PublisherPropertiesObj>> performanceByPropertyMap = new HashMap<String,List<PublisherPropertiesObj>>();
Map<String,PublisherPropertiesObj> DFPObjectMap = new HashMap<String,PublisherPropertiesObj>();
Map<String,PublisherPropertiesObj> nonDFPObjectMap = new HashMap<String,PublisherPropertiesObj>();
double totalImpDelByChannel = 0;
//StringBuilder allChannelAndDataSource_MemcacheKeyPart = new StringBuilder();
StringBuilder DFP_Properties_MemcacheKeyPart = new StringBuilder();
//StringBuilder channelWithDataSourceDFP_MemcacheKeyPart = new StringBuilder();
//String allChannelAndDataSourceQuery = getChannelAndDataSourceQuery(null, allChannelAndDataSource_MemcacheKeyPart, true);
String selectedDFPPropertiesQuery = getSelectedDFPPropertiesQuery(dataStorePublisherId, userId, DFP_Properties_MemcacheKeyPart);
//String selectedDFPSource = getChannelWithDataSourceDFPQuery(channelWithDataSourceDFP_MemcacheKeyPart);
String channelIds = getChannelsBQId(channels);
String publisherId = getPublisherBQId(publisherName);
list = MemcacheUtil.getAllPerformanceByPropertyList(lowerDate, upperDate,publisherId, channelIds, DFP_Properties_MemcacheKeyPart.toString());
if(list==null || list.size()<=0){
QueryDTO queryDTO = getQueryDTO(publisherId, lowerDate, upperDate, LinMobileConstants.BQ_CORE_PERFORMANCE);
if(queryDTO != null && queryDTO.getQueryData() != null && queryDTO.getQueryData().length() > 0) {
list = linDAO.loadAllPerformanceByProperty(lowerDate, upperDate, channelIds, selectedDFPPropertiesQuery, queryDTO);
MemcacheUtil.setAllPerformanceByPropertyList(list, lowerDate, upperDate,publisherId, channelIds, DFP_Properties_MemcacheKeyPart.toString());
}
}
if(list!=null && list.size()>0){
IUserDetailsDAO userDetailsDAO = new UserDetailsDAO();
List<CompanyObj> demandPartnersList = userDetailsDAO.getAllDemandPartners(MemcacheUtil.getAllCompanyList());
for (PublisherPropertiesObj publisherPropertiesObj : list) {
if(publisherPropertiesObj!=null){
CompanyObj demandPartnerCompany = userDetailsDAO.getCompanyByName(publisherPropertiesObj.getChannelName().trim(), demandPartnersList);
if(demandPartnerCompany!=null && demandPartnerCompany.getStatus().equals(LinMobileConstants.STATUS_ARRAY[0]) && demandPartnerCompany.getCompanyName() != null && !demandPartnerCompany.getCompanyName().trim().equalsIgnoreCase("") && demandPartnerCompany.getDataSource() != null && !demandPartnerCompany.getDataSource().trim().equalsIgnoreCase("")){
publisherPropertiesObj.setDataSource(demandPartnerCompany.getDataSource().trim());
}
if( !totalImpByChannelMap.containsKey(publisherPropertiesObj.getChannelName()) && !publisherPropertiesObj.getDataSource().equals(LinMobileConstants.DEFAULT_DATASOURE_NAME)){
totalImpByChannelMap.put(publisherPropertiesObj.getChannelName(), Math.round(publisherPropertiesObj.getImpressionsDelivered())+0.0);
}else if(totalImpByChannelMap.size()!=0 && totalImpByChannelMap.containsKey(publisherPropertiesObj.getChannelName())){
totalImpDelByChannel = totalImpByChannelMap.get(publisherPropertiesObj.getChannelName())+ Math.round(publisherPropertiesObj.getImpressionsDelivered());
totalImpByChannelMap.put(publisherPropertiesObj.getChannelName(), totalImpDelByChannel);
}
}
allPerformanceByPropertyTempList.add(publisherPropertiesObj);
}
}
if(allPerformanceByPropertyTempList!=null && allPerformanceByPropertyTempList.size()>0){
for (PublisherPropertiesObj publisherPropertiesObj : allPerformanceByPropertyTempList) {
if(publisherPropertiesObj!=null){
if(totalImpByChannelMap!=null && totalImpByChannelMap.containsKey(publisherPropertiesObj.getChannelName())){
publisherPropertiesObj.setTotalImpressionsDeliveredByChannelName(totalImpByChannelMap.get(publisherPropertiesObj.getChannelName()));
}
}
allPerformanceByPropertyList.add(publisherPropertiesObj);
}
performanceByPropertyMap.put("allData", allPerformanceByPropertyList);
}
MemcacheUtil.setAllPerformanceByPropertyCalculatedList(allPerformanceByPropertyList,lowerDate,upperDate,publisherId, channelIds, DFP_Properties_MemcacheKeyPart.toString());
if(allPerformanceByPropertyList!=null && allPerformanceByPropertyList.size()>0){
List<String> channelArrList = new ArrayList<String>();
String[] str = channels.split(",");
if(str!=null){
for (String channel : str) {
channelArrList.add(channel);
}
}
for (PublisherPropertiesObj publisherPropertiesObjBySiteName : allPerformanceByPropertyList) {
if( channelArrList!=null && channelArrList.contains(publisherPropertiesObjBySiteName.getChannelName())){
if(publisherPropertiesObjBySiteName!=null && publisherPropertiesObjBySiteName.getDataSource().equals(LinMobileConstants.DEFAULT_DATASOURE_NAME)){
performanceByPropertyDFPObjectList.add(publisherPropertiesObjBySiteName);
}else{
performanceByPropertyNonDFPObjectList.add(publisherPropertiesObjBySiteName);
}
}
}
}
if(performanceByPropertyDFPObjectList!=null && performanceByPropertyDFPObjectList.size()>0){
for (PublisherPropertiesObj publisherPropertiesObj : performanceByPropertyDFPObjectList) {
if(!DFPObjectMap.containsKey(publisherPropertiesObj.getSite())){
DFPObjectMap.put(publisherPropertiesObj.getSite(), publisherPropertiesObj);
}else{
PublisherPropertiesObj propertiesObj = copyObject(DFPObjectMap.get(publisherPropertiesObj.getSite()));
double impressions = publisherPropertiesObj.getImpressionsDelivered();
double payout = publisherPropertiesObj.getDFPPayout();
long clicks = publisherPropertiesObj.getClicks();
propertiesObj.setImpressionsDelivered(impressions + propertiesObj.getImpressionsDelivered());
propertiesObj.setClicks(clicks + propertiesObj.getClicks());
propertiesObj.setDFPPayout(payout + propertiesObj.getDFPPayout());
if(propertiesObj.getImpressionsDelivered()!=0){
double ecpm = (propertiesObj.getDFPPayout()/propertiesObj.getImpressionsDelivered())*1000;
propertiesObj.seteCPM(ecpm);
}
DFPObjectMap.put(propertiesObj.getSite(), propertiesObj);
}
}
Iterator iterator = DFPObjectMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry mapEntry = (Map.Entry) iterator.next();
allPerformanceByPropertyBySiteNameList.add((PublisherPropertiesObj) mapEntry.getValue());
}
}
if(performanceByPropertyNonDFPObjectList!=null && performanceByPropertyNonDFPObjectList.size()>0)
{
for (PublisherPropertiesObj publisherPropertiesObj : performanceByPropertyNonDFPObjectList) {
//PublisherPropertiesObj propertiesObj = copyObject(dataBySiteMap.get(publisherPropertiesObj.getSite()));
if(!nonDFPObjectMap.containsKey(publisherPropertiesObj.getSite())){
nonDFPObjectMap.put(publisherPropertiesObj.getSite(), publisherPropertiesObj);
double requestWeightage = 0.0;
double impressions = 0.0;
double payout = 0.0;
PublisherPropertiesObj propertiesObj = copyObject(nonDFPObjectMap.get(publisherPropertiesObj.getSite()));
if(propertiesObj.getTotalImpressionsDeliveredByChannelName()!=0){
requestWeightage = propertiesObj.getImpressionsDelivered()/propertiesObj.getTotalImpressionsDeliveredByChannelName();
}
long clicks = publisherPropertiesObj.getClicks();
impressions = (requestWeightage * propertiesObj.getTotalImpressionsDeliveredBySiteName());
payout = requestWeightage * propertiesObj.getPayout();
propertiesObj.setImpressionsDelivered((impressions));
propertiesObj.setPayout(payout);
propertiesObj.setClicks(clicks + propertiesObj.getClicks());
if(propertiesObj.getImpressionsDelivered()!=0){
double ecpm = (propertiesObj.getPayout()/propertiesObj.getImpressionsDelivered())*1000;
propertiesObj.seteCPM(ecpm);
}
nonDFPObjectMap.put(propertiesObj.getSite(), propertiesObj);
}else{
double requestWeightage = 0.0;
double impressions = 0.0;
double payout = 0.0;
PublisherPropertiesObj propertiesObj = copyObject(nonDFPObjectMap.get(publisherPropertiesObj.getSite()));
if(publisherPropertiesObj.getTotalImpressionsDeliveredByChannelName()!=0){
requestWeightage = publisherPropertiesObj.getImpressionsDelivered()/publisherPropertiesObj.getTotalImpressionsDeliveredByChannelName();
}
long clicks = publisherPropertiesObj.getClicks();
impressions = (requestWeightage * publisherPropertiesObj.getTotalImpressionsDeliveredBySiteName());
payout = requestWeightage * publisherPropertiesObj.getPayout();
propertiesObj.setImpressionsDelivered(impressions+propertiesObj.getImpressionsDelivered());
propertiesObj.setPayout(payout+propertiesObj.getPayout());
propertiesObj.setClicks(clicks + propertiesObj.getClicks());
if(propertiesObj.getImpressionsDelivered()!=0){
double ecpm = (propertiesObj.getPayout()/propertiesObj.getImpressionsDelivered())*1000;
propertiesObj.seteCPM(ecpm);
}
nonDFPObjectMap.put(propertiesObj.getSite(), propertiesObj);
}
}
Iterator iterator = nonDFPObjectMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry mapEntry = (Map.Entry) iterator.next();
allPerformanceByPropertyBySiteNameList.add((PublisherPropertiesObj) mapEntry.getValue());
}
}
if(allPerformanceByPropertyBySiteNameList!=null && allPerformanceByPropertyBySiteNameList.size()>0){
for (PublisherPropertiesObj publisherPropertiesObj : allPerformanceByPropertyBySiteNameList) {
if(!dataBySiteMap.containsKey(publisherPropertiesObj.getSite())){
dataBySiteMap.put(publisherPropertiesObj.getSite(), publisherPropertiesObj);
PublisherPropertiesObj propertiesObj = copyObject(dataBySiteMap.get(publisherPropertiesObj.getSite()));
if(propertiesObj.getDataSource().equals(LinMobileConstants.DEFAULT_DATASOURE_NAME)){
double payout = propertiesObj.getDFPPayout();
propertiesObj.setPayout(payout);
dataBySiteMap.put(publisherPropertiesObj.getSite(), propertiesObj);
}
}else{
double payout = 0.0;
double previousPayout = 0.0;
PublisherPropertiesObj propertiesObj = copyObject(dataBySiteMap.get(publisherPropertiesObj.getSite()));
long clicks = publisherPropertiesObj.getClicks();
double impressions = Math.round(publisherPropertiesObj.getImpressionsDelivered()) + 0.0;
if(!publisherPropertiesObj.getDataSource().equals(LinMobileConstants.DEFAULT_DATASOURE_NAME)){
payout = publisherPropertiesObj.getPayout();
}else{
payout = publisherPropertiesObj.getDFPPayout();
}
if(!propertiesObj.getDataSource().equals(LinMobileConstants.DEFAULT_DATASOURE_NAME)){
previousPayout = propertiesObj.getPayout();
}else{
previousPayout = propertiesObj.getDFPPayout();
}
propertiesObj.setImpressionsDelivered(impressions + Math.round(propertiesObj.getImpressionsDelivered())+0.0);
propertiesObj.setPayout(payout + previousPayout);
propertiesObj.setClicks(clicks + propertiesObj.getClicks());
if(propertiesObj.getImpressionsDelivered()!=0){
double ecpm = (propertiesObj.getPayout()/propertiesObj.getImpressionsDelivered())*1000;
propertiesObj.seteCPM(ecpm);
}
dataBySiteMap.put(propertiesObj.getSite(), propertiesObj);
}
}
Iterator iterator = dataBySiteMap.entrySet().iterator();
allPerformanceByPropertyBySiteNameList = new ArrayList<PublisherPropertiesObj>();
while (iterator.hasNext()) {
Map.Entry mapEntry = (Map.Entry) iterator.next();
allPerformanceByPropertyBySiteNameList.add((PublisherPropertiesObj) mapEntry.getValue());
}
performanceByPropertyMap.put("allDataBySiteName", allPerformanceByPropertyBySiteNameList);
}
return performanceByPropertyMap;
}
public List<PublisherReallocationHeaderDTO> loadReallocationHeaderData(String lowerDate,String upperDate,String publisherName,String channelName)
{
List<PublisherReallocationHeaderDTO> list = new ArrayList<PublisherReallocationHeaderDTO>();
ILinMobileDAO linDAO=new LinMobileDAO();
List<String> channelArrList = new ArrayList<String>();
String[] str = channelName.split(",");
if(str!=null){
for (String channel : str) {
channelArrList.add(channel);
}
}
list = linDAO.loadReallocationHeaderData(lowerDate, upperDate, publisherName, channelArrList);
return list;
}
public List<PropertyDropDownDTO> loadPublisherPropertyDropDownList(String publisherName,long userId,String str)
{
List<PropertyDropDownDTO> propertyList = new ArrayList<PropertyDropDownDTO>();
String replaceStr = "\\\\'";
if(str!=null){
str = str.replaceAll("'", replaceStr);
}
if(publisherName!=null){
publisherName = publisherName.replaceAll("'", replaceStr);
}
/*ILinMobileDAO linDAO=new LinMobileDAO(); 24.08.2013
propertyList = linDAO.loadPublisherPropertyDropDownList(publisherName,userId,str);*/
IUserDetailsDAO dao = new UserDetailsDAO();
propertyList = dao.loadPropertyDropDownList(publisherName,userId,str);
if(propertyList!=null && propertyList.size()>0){
return propertyList;
}
return new ArrayList<PropertyDropDownDTO>();
}
@Override
public List<CommonDTO> getAllPublishersByPublisherIdAndUserId(String selectedPublisherId, List<String> channelsNameList, long userId) {
log.info("Inside getAllPublishersByPublisherIdAndUserId in LinMobileBusinessService");
IUserDetailsDAO dao = new UserDetailsDAO();
List<String> publisherIdList = new ArrayList<String>();
List<CommonDTO> allPublishersList = new ArrayList<CommonDTO>(0);
try {
List<CompanyObj> companyObjList = MemcacheUtil.getAllCompanyList();
List<CompanyObj> publisherList = dao.getAllPublishers(companyObjList);
List<CompanyObj> selectedPublishersList = dao.getSelectedPublishersByUserId(userId, publisherIdList, publisherList);
if(!selectedPublisherId.trim().equalsIgnoreCase("")) {
CompanyObj publisherCompany = dao.getCompanyById(Long.valueOf(selectedPublisherId), publisherList);
if(publisherCompany != null && publisherIdList.contains(String.valueOf(publisherCompany.getId())) && publisherCompany.getStatus().trim().equals(LinMobileConstants.STATUS_ARRAY[0]) && publisherCompany.getCompanyName() != null) {
allPublishersList.add(new CommonDTO(selectedPublisherId.trim(), publisherCompany.getCompanyName().trim()));
}
}
if(selectedPublishersList != null && selectedPublishersList.size() > 0) {
for (CompanyObj publisherCompany : selectedPublishersList) {
if(publisherCompany != null && publisherCompany.getStatus().trim().equalsIgnoreCase(LinMobileConstants.STATUS_ARRAY[0]) && publisherCompany.getCompanyName() != null && !publisherCompany.getCompanyName().trim().equalsIgnoreCase("")) {
if(!selectedPublisherId.trim().equalsIgnoreCase("") && selectedPublisherId.trim().equals(String.valueOf(publisherCompany.getId()))) {
//do nothing
}
else {
allPublishersList.add(new CommonDTO(String.valueOf(publisherCompany.getId()),publisherCompany.getCompanyName().trim()));
}
}
}
}
if(allPublishersList != null && allPublishersList.size() > 0) {
selectedPublisherId = allPublishersList.get(0).getId();
String commaSeperatedChannelsName = getCommaSeperatedChannelsNameByPublisherIdAndUserId(selectedPublisherId, userId, companyObjList);
if(commaSeperatedChannelsName != null && !commaSeperatedChannelsName.trim().equalsIgnoreCase("")) {
channelsNameList.add(commaSeperatedChannelsName);
}
}
} catch (Exception e) {
log.severe("Exception in getAllPublishersByPublisherIdAndUserId of LinMobileBusinessService"+e.getMessage());
}
return allPublishersList;
}
@Override
public String getCommaSeperatedChannelsNameByPublisherIdAndUserId(String publisherId, long userId, List<CompanyObj> companyObjList) throws Exception {
log.info("Inside getCommaSeperatedChannelsNameByPublisherIdAndUserId in LinMobileBusinessService");
IUserDetailsDAO dao = new UserDetailsDAO();
List<String> commaSeperatedChannelsNameList = new ArrayList<String>(0);
String commaSeperatedChannelsName = "";
List<CompanyObj> demandPartnersList = dao.getActiveDemandPartnersByPublisherCompanyId(publisherId);
if(demandPartnersList != null && demandPartnersList.size() > 0) {
log.info("demandPartnersIdList.size : "+demandPartnersList.size());
for (CompanyObj demandPartner : demandPartnersList) {
if(demandPartner != null && !commaSeperatedChannelsNameList.contains(demandPartner.getCompanyName().trim())) {
commaSeperatedChannelsNameList.add(demandPartner.getCompanyName().trim());
commaSeperatedChannelsName = commaSeperatedChannelsName + demandPartner.getCompanyName().trim() + ",";
}
}
if(commaSeperatedChannelsName.lastIndexOf(",") != -1) {
commaSeperatedChannelsName = commaSeperatedChannelsName.substring(0, commaSeperatedChannelsName.lastIndexOf(","));
}
}
return commaSeperatedChannelsName;
}
public List<PropertyDropDownDTO> loadAdvertiserPropertyDropDownList(String publisherId,long userId,String str)
{
List<PropertyDropDownDTO> propertyList = new ArrayList<PropertyDropDownDTO>();
String replaceStr = "\\\\'";
if(str!=null){
str = str.replaceAll("'", replaceStr);
}
IUserDetailsDAO dao = new UserDetailsDAO();
propertyList = dao.loadPropertyDropDownList(publisherId,userId,str);
if(propertyList!=null && propertyList.size()>0){
return propertyList;
}
return new ArrayList<PropertyDropDownDTO>();
}
@Override
public String getCommaSeperatedChannelsNameByChannelIdList(List<String> channelIdList) throws Exception {
log.info("Inside getCommaSeperatedChannelsNameByChannelIdList of LinMobileBussinessService");
String commaSeperatedChannelNames = "";
IUserDetailsDAO userDetailsDAO = new UserDetailsDAO();
List<CompanyObj> demandPartnersList = userDetailsDAO.getAllDemandPartners(MemcacheUtil.getAllCompanyList());
if(channelIdList != null && channelIdList.size() > 0) {
for (String channelId : channelIdList) {
CompanyObj demandPartnerCompany = userDetailsDAO.getCompanyById(Long.valueOf(channelId), demandPartnersList);
if(demandPartnerCompany != null && demandPartnerCompany.getStatus().equals(LinMobileConstants.STATUS_ARRAY[0]) && demandPartnerCompany.getCompanyName() != null) {
commaSeperatedChannelNames = commaSeperatedChannelNames + demandPartnerCompany.getCompanyName().trim() + ",";
}
}
}
if(commaSeperatedChannelNames.lastIndexOf(",") != -1) {
commaSeperatedChannelNames = commaSeperatedChannelNames.substring(0, commaSeperatedChannelNames.lastIndexOf(","));
}
return commaSeperatedChannelNames;
}
@Override
public String getCommaSeperatedChannelsName(String publisherName) throws Exception {
log.info("Inside getCommaSeperatedChannelsName of LinMobileBussinessService");
String commaSeperatedChannelNames = "";
IUserDetailsDAO userDetailsDAO = new UserDetailsDAO();
List<CompanyObj> companyObjList = MemcacheUtil.getAllCompanyList();
List<CompanyObj> demandPartnersList = userDetailsDAO.getAllDemandPartners(companyObjList);
CompanyObj publisherCompany = userDetailsDAO.getCompanyObjByNameAndCompanyType(publisherName, LinMobileConstants.COMPANY_TYPE[0], companyObjList);
if(publisherCompany != null && publisherCompany.getStatus().trim().equalsIgnoreCase(LinMobileConstants.STATUS_ARRAY[0]) && publisherCompany.getDemandPartnerId() != null) {
List<String> channelIdList = publisherCompany.getDemandPartnerId();
if(channelIdList != null && channelIdList.size() > 0) {
for (String channelId : channelIdList) {
CompanyObj demandPartnerCompany = userDetailsDAO.getCompanyById(Long.valueOf(channelId), demandPartnersList);
if(demandPartnerCompany != null && demandPartnerCompany.getStatus().equals(LinMobileConstants.STATUS_ARRAY[0]) && demandPartnerCompany.getCompanyName() != null) {
commaSeperatedChannelNames = commaSeperatedChannelNames + demandPartnerCompany.getCompanyName().trim() + ",";
}
}
}
}
if(commaSeperatedChannelNames.lastIndexOf(",") != -1) {
commaSeperatedChannelNames = commaSeperatedChannelNames.substring(0, commaSeperatedChannelNames.lastIndexOf(","));
}
return commaSeperatedChannelNames;
}
public List<ReconciliationDataDTO> createSummaryData(List<ReconciliationDataDTO> reconciliationDataDTOList, String channelName, List<String> passBackList) {
log.info("Inside createSummaryData of LinMobileBussinessService");
List<ReconciliationDataDTO> tempReconciliationSummaryDataList = new ArrayList<ReconciliationDataDTO>();
long DFP_requests = 0;
long DFP_delivered = 0;
long DFP_passback = 0;
long demandPartnerRequests = 0;
long demandPartnerDelivered = 0;
long demandPartnerPassbacks = 0;
double varianceRequests = 0;
double varianceDelivered = 0;
double variancePassbacks = 0;
if(reconciliationDataDTOList != null && reconciliationDataDTOList.size() > 0) {
for (ReconciliationDataDTO reconciliationDataDTO : reconciliationDataDTOList) {
if(reconciliationDataDTO != null) {
DFP_requests = DFP_requests +reconciliationDataDTO.getDFP_requests();
DFP_delivered = DFP_delivered +reconciliationDataDTO.getDFP_delivered();
DFP_passback = DFP_passback +reconciliationDataDTO.getDFP_passback();
demandPartnerRequests = demandPartnerRequests +reconciliationDataDTO.getDemandPartnerRequests();
demandPartnerDelivered = demandPartnerDelivered +reconciliationDataDTO.getDemandPartnerDelivered();
demandPartnerPassbacks = demandPartnerPassbacks +reconciliationDataDTO.getDemandPartnerPassbacks();
}
}
if(DFP_requests != 0) {
varianceRequests = Double.valueOf((demandPartnerRequests - DFP_requests)*100)/DFP_requests;
}
if(DFP_delivered != 0) {
varianceDelivered = Double.valueOf((demandPartnerDelivered - DFP_delivered)*100)/DFP_delivered;
}
if(DFP_passback != 0) {
variancePassbacks = Double.valueOf((demandPartnerPassbacks - DFP_passback)*100)/DFP_passback;
}
if(DFP_requests == 0) {
DFP_delivered = 0;
varianceRequests = 0;
varianceDelivered = 0;
}
if(demandPartnerRequests == 0) {
demandPartnerPassbacks = 0;
varianceRequests = 0;
variancePassbacks = 0;
}
ReconciliationDataDTO dto = new ReconciliationDataDTO();
if(passBackList == null || passBackList.size() == 0) {
dto.setSiteType("NA");
}
dto.setChannelName(channelName);
dto.setDFP_requests(DFP_requests);
dto.setDFP_delivered(DFP_delivered);
dto.setDFP_passback(DFP_passback);
dto.setDemandPartnerRequests(demandPartnerRequests);
dto.setDemandPartnerDelivered(demandPartnerDelivered);
dto.setDemandPartnerPassbacks(demandPartnerPassbacks);
dto.setVarianceRequests(varianceRequests);
dto.setVarianceDelivered(varianceDelivered);
dto.setVariancePassbacks(variancePassbacks);
tempReconciliationSummaryDataList.add(dto);
}
return tempReconciliationSummaryDataList;
}
@Override
public void loadAllReconciliationData(String startDate, String endDate, String publisherId, long userId, List<ReconciliationDataDTO> reconciliationSummaryDataList, List<ReconciliationDataDTO> reconciliationDetailsDataList) throws Exception {
log.info("Inside loadAllReconciliationData of LinMobileBussinessService");
ILinMobileDAO linDAO=new LinMobileDAO();
IUserDetailsDAO userDetailsDAO = new UserDetailsDAO();
List<ReconciliationDataDTO> tempSubList = null;
List<Date> dateList = new ArrayList<Date>();
List<ReconciliationDataDTO> reconciliationDataDTOList = null;
List<ReconciliationDataDTO> resultList = null;
List<CommonDTO> channelsInfo = new ArrayList<CommonDTO>();
HashMap<String, List<String>> channelPassbackSiteTypeMap = new HashMap<String, List<String>>();
String publisherName = "";
int tempCount = 0;
List<CompanyObj> companyObjList = MemcacheUtil.getAllCompanyList();
CompanyObj publisherCompany = userDetailsDAO.getCompanyObjByIdAndCompanyType(publisherId, LinMobileConstants.COMPANY_TYPE[0], companyObjList);
if(publisherCompany != null && publisherCompany.getStatus().trim().equalsIgnoreCase(LinMobileConstants.STATUS_ARRAY[0]) && publisherCompany.getCompanyName() != null && !publisherCompany.getCompanyName().equalsIgnoreCase("")) {
List<CompanyObj> demandPartnersList = userDetailsDAO.getActiveDemandPartnersByPublisherCompanyId(publisherId);
if(demandPartnersList != null && demandPartnersList.size() > 0) {
List<String> passbackValues = userDetailsDAO.getPassbackValues(demandPartnersList);
String hashedPassbackValueString = "";
String lineItemQuery = "line_item =''";
if(passbackValues != null && passbackValues.size() > 0) {
lineItemQuery = "";
for(String passbackValue : passbackValues) {
hashedPassbackValueString = hashedPassbackValueString + passbackValue.trim();
lineItemQuery = lineItemQuery + "line_item ='"+passbackValue.trim()+"' or ";
}
if(lineItemQuery.lastIndexOf("or") != -1) {
lineItemQuery = lineItemQuery.substring(0, lineItemQuery.lastIndexOf("or"));
}
hashedPassbackValueString = EncriptionUtil.getEncriptedStrMD5(hashedPassbackValueString);
}
publisherName = publisherCompany.getCompanyName();
String publisherBQId = getPublisherBQId(publisherName);
QueryDTO queryDTO = getQueryDTO(publisherBQId, startDate, endDate, LinMobileConstants.BQ_CORE_PERFORMANCE);
resultList = MemcacheUtil.getReconciliationDataList(startDate, endDate, publisherBQId, hashedPassbackValueString);
if(resultList != null && resultList.size()> 0) {
reconciliationDataDTOList =resultList;
}
else {
resultList = linDAO.loadAllRecociliationData(startDate, endDate, lineItemQuery, queryDTO);
if(resultList != null && resultList.size()> 0) {
MemcacheUtil.setReconciliationDataList(resultList, startDate, endDate, publisherBQId, hashedPassbackValueString);
reconciliationDataDTOList =resultList;
}
}
if(reconciliationDataDTOList != null && reconciliationDataDTOList.size() > 0) {
for (CompanyObj demandPartner : demandPartnersList) {
if(demandPartner != null && !demandPartner.getDataSource().trim().equals(LinMobileConstants.DFP_DATA_SOURCE)) {
if(demandPartner.getPassback_Site_type() != null && demandPartner.getPassback_Site_type().size() > 0) {
channelPassbackSiteTypeMap.put(demandPartner.getCompanyName().trim(), demandPartner.getPassback_Site_type());
}
else {
channelPassbackSiteTypeMap.put(demandPartner.getCompanyName().trim(), new ArrayList<String>());
}
CommonDTO commonDTO = new CommonDTO();
commonDTO.setChannelName(demandPartner.getCompanyName().trim());
commonDTO.setChannelDataSource(demandPartner.getDataSource().trim());
channelsInfo.add(commonDTO);
}
}
if(channelsInfo != null && channelsInfo.size() > 0) {
List<String> tempDateList = new ArrayList<String>();
for (ReconciliationDataDTO reconciliationDataDTO : reconciliationDataDTOList) {
if(reconciliationDataDTO != null && reconciliationDataDTO.getDate() != null && !tempDateList.contains(reconciliationDataDTO.getFormattedDate().trim())) {
tempDateList.add(reconciliationDataDTO.getFormattedDate().trim());
dateList.add(reconciliationDataDTO.getDate());
}
}
if(dateList != null && dateList.size() > 0) {
for(CommonDTO channelInfo : channelsInfo) {
List<ReconciliationDataDTO> tempReconciliationDetailsDataList = new ArrayList<ReconciliationDataDTO>();
String channel = channelInfo.getChannelName().trim();
String channelDataSource = channelInfo.getChannelDataSource().trim();
List<String> passBackList = channelPassbackSiteTypeMap.get(channel);
tempSubList = reconciliationDataDTOList.subList(0, reconciliationDataDTOList.size()-1);
tempCount = 0;
for(Date date : dateList) {
long DFP_requests = 0;
long DFP_delivered = 0;
long DFP_passback = 0;
long demandPartnerRequests = 0;
long demandPartnerDelivered = 0;
long demandPartnerPassbacks = 0;
double varianceRequests = 0;
double varianceDelivered = 0;
double variancePassbacks = 0;
for (ReconciliationDataDTO reconciliationDataDTO : tempSubList) {
if(reconciliationDataDTO != null && reconciliationDataDTO.getDate() != null) {
if(reconciliationDataDTO.getDate().compareTo(date) > 0) {
// create detail data
if(passBackList == null || passBackList.size() == 0) {
DFP_requests = 0;
DFP_delivered = 0;
DFP_passback = 0;
demandPartnerRequests = 0;
demandPartnerDelivered = 0;
demandPartnerPassbacks = 0;
varianceRequests = 0;
varianceDelivered = 0;
variancePassbacks = 0;
}
DFP_delivered = DFP_requests - DFP_passback;
demandPartnerPassbacks = demandPartnerRequests - demandPartnerDelivered;
if(DFP_requests != 0) {
varianceRequests = Double.valueOf((demandPartnerRequests - DFP_requests)*100)/DFP_requests;
}
if(DFP_delivered != 0) {
varianceDelivered = Double.valueOf((demandPartnerDelivered - DFP_delivered)*100)/DFP_delivered;
}
if(DFP_passback != 0) {
variancePassbacks = Double.valueOf((demandPartnerPassbacks - DFP_passback)*100)/DFP_passback;
}
if(DFP_requests == 0) {
DFP_delivered = 0;
varianceRequests = 0;
varianceDelivered = 0;
}
if(demandPartnerRequests == 0) {
demandPartnerPassbacks = 0;
varianceRequests = 0;
variancePassbacks = 0;
}
ReconciliationDataDTO dto = new ReconciliationDataDTO();
dto.setChannelName(channel);
dto.setFormattedDate(DateUtil.getFormatedStringDateYYYYMMDD(date));
dto.setDFP_requests(DFP_requests);
dto.setDFP_delivered(DFP_delivered);
dto.setDFP_passback(DFP_passback);
dto.setDemandPartnerRequests(demandPartnerRequests);
dto.setDemandPartnerDelivered(demandPartnerDelivered);
dto.setDemandPartnerPassbacks(demandPartnerPassbacks);
dto.setVarianceRequests(varianceRequests);
dto.setVarianceDelivered(varianceDelivered);
dto.setVariancePassbacks(variancePassbacks);
tempReconciliationDetailsDataList.add(dto);
tempSubList = reconciliationDataDTOList.subList(tempCount, reconciliationDataDTOList.size()-1);
break;
}
tempCount++;
// calculate Data
if(reconciliationDataDTO.getDataSource().trim().equalsIgnoreCase(LinMobileConstants.DFP_DATA_SOURCE) && reconciliationDataDTO.getChannelName().trim().equals(channel)) {
DFP_requests = DFP_requests + reconciliationDataDTO.getRequests();
}
if(reconciliationDataDTO.getDataSource().trim().equalsIgnoreCase(LinMobileConstants.DFP_DATA_SOURCE) && passBackList.contains(reconciliationDataDTO.getSiteType().trim())) {
DFP_passback = DFP_passback + reconciliationDataDTO.getDelivered();
}
if(reconciliationDataDTO.getDataSource().trim().equals(channelDataSource) && reconciliationDataDTO.getChannelName().trim().equals(channel)) {
demandPartnerRequests = demandPartnerRequests + reconciliationDataDTO.getRequests();
demandPartnerDelivered = demandPartnerDelivered + reconciliationDataDTO.getDelivered();
}
if(tempCount == reconciliationDataDTOList.size()-1) {
if(passBackList == null || passBackList.size() == 0) {
DFP_requests = 0;
DFP_delivered = 0;
DFP_passback = 0;
demandPartnerRequests = 0;
demandPartnerDelivered = 0;
demandPartnerPassbacks = 0;
varianceRequests = 0;
varianceDelivered = 0;
variancePassbacks = 0;
}
DFP_delivered = DFP_requests - DFP_passback;
demandPartnerPassbacks = demandPartnerRequests - demandPartnerDelivered;
if(DFP_requests != 0) {
varianceRequests = Double.valueOf((demandPartnerRequests - DFP_requests)*100)/DFP_requests;
}
if(DFP_delivered != 0) {
varianceDelivered = Double.valueOf((demandPartnerDelivered - DFP_delivered)*100)/DFP_delivered;
}
if(DFP_passback != 0) {
variancePassbacks = Double.valueOf((demandPartnerPassbacks - DFP_passback)*100)/DFP_passback;
}
if(DFP_requests == 0) {
DFP_delivered = 0;
varianceRequests = 0;
varianceDelivered = 0;
}
if(demandPartnerRequests == 0) {
demandPartnerPassbacks = 0;
varianceRequests = 0;
variancePassbacks = 0;
}
ReconciliationDataDTO dto = new ReconciliationDataDTO();
dto.setChannelName(channel);
dto.setFormattedDate(DateUtil.getFormatedStringDateYYYYMMDD(date));
dto.setDFP_requests(DFP_requests);
dto.setDFP_delivered(DFP_delivered);
dto.setDFP_passback(DFP_passback);
dto.setDemandPartnerRequests(demandPartnerRequests);
dto.setDemandPartnerDelivered(demandPartnerDelivered);
dto.setDemandPartnerPassbacks(demandPartnerPassbacks);
dto.setVarianceRequests(varianceRequests);
dto.setVarianceDelivered(varianceDelivered);
dto.setVariancePassbacks(variancePassbacks);
tempReconciliationDetailsDataList.add(dto);
tempSubList = reconciliationDataDTOList.subList(tempCount, reconciliationDataDTOList.size()-1);
}
}
}
}
reconciliationDetailsDataList.addAll(tempReconciliationDetailsDataList);
// create summary data
List<ReconciliationDataDTO> tempReconciliationSummaryDataList = createSummaryData(tempReconciliationDetailsDataList, channel, passBackList);
if(tempReconciliationSummaryDataList !=null && tempReconciliationSummaryDataList.size() > 0) {
reconciliationSummaryDataList.addAll(tempReconciliationSummaryDataList);
}
}
}
}
}
}
}
}
public List<LineItemDTO> loadCampaignTraffickingData(DfpServices dfpServices,DfpSession session,String lowerDate, String upperDate,long userId)throws Exception
{
log.info("inside loadCampaignTraffickingData() of LinMobileBusinessService class");
LineItemServiceInterface lineItemService = dfpServices.get(session, LineItemServiceInterface.class);
List<LineItemDTO> totalLineItemDTOList=new ArrayList<LineItemDTO>();
List<LineItem> lineItemList=new ArrayList<LineItem>();
Statement lineItemStatement=new Statement();
LineItemPage page = null;
String query = "";
/*Getting DELIVERING lineitems*/
try
{
List<LineItemDTO> deliveringCampaignList = MemcacheUtil.getDeliveringCampaignList(lowerDate,upperDate);
if(deliveringCampaignList == null || deliveringCampaignList.size() <= 0)
{
query="WHERE status = '"+ComputedStatus.DELIVERING+"' AND targetPlatform = '"+TargetPlatform.MOBILE+"' AND startDateTime = '"+lowerDate+"' AND endDateTime = '"+upperDate+"'";
log.info("loadCampaignTraffickingData Query 1 (DELIVERING): "+query);
lineItemStatement.setQuery(query);
int j=0;
do{
page=lineItemService.getLineItemsByStatement(lineItemStatement);
List<LineItem> result = page.getResults();
if(result !=null && result.size()>0)
{
deliveringCampaignList = getLineItemDTOList(result);
log.info("Delivering Campaigns = "+deliveringCampaignList.size());
}
else
{
log.warning("No line items found for query (DELIVERING):"+query);
}
}while(page.getResults()== null && j<=3);
MemcacheUtil.setDeliveringCampaignList(deliveringCampaignList,lowerDate,upperDate);
}
if(deliveringCampaignList != null && deliveringCampaignList.size() > 0)
{
totalLineItemDTOList.addAll(deliveringCampaignList);
}
}catch(Exception e)
{
log.severe("exception in loadCampaignTraffickingData LinMobileBusinessService (DELIVERING): "+e.getMessage());
}
/*Getting READY lineitems*/
try
{
List<LineItemDTO> readyCampaignList = MemcacheUtil.getReadyCampaignList();
if(readyCampaignList == null || readyCampaignList.size() <= 0)
{
query="WHERE status = '"+ComputedStatus.READY+"' AND targetPlatform = '"+TargetPlatform.MOBILE+"'";
log.info("loadCampaignTraffickingData Query 2 (READY): "+query);
lineItemStatement.setQuery(query);
int j=0;
do{
page=lineItemService.getLineItemsByStatement(lineItemStatement);
List<LineItem> result = page.getResults();
if(result !=null && result.size()>0)
{
readyCampaignList = getLineItemDTOList(result);
log.info("Ready Campaigns = "+readyCampaignList.size());
}
else
{
log.warning("No line items found for quer (READY): "+query);
}
}while(page.getResults()== null && j<=3);
MemcacheUtil.setReadyCampaignList(readyCampaignList);
}
if(readyCampaignList != null && readyCampaignList.size() > 0)
{
totalLineItemDTOList.addAll(readyCampaignList);
}
}catch(Exception e)
{
log.severe("exception in loadCampaignTraffickingData LinMobileBusinessService (READY): "+e.getMessage());
}
/*Getting DRAFTS & NEEDS_CREATIVES lineitems*/
try
{
List<LineItemDTO> draftAndNeedCreativesCampaignList = MemcacheUtil.getDraftAndNeedCreativesCampaignList();
if(draftAndNeedCreativesCampaignList == null || draftAndNeedCreativesCampaignList.size() <= 0)
{
query="WHERE ( status = '"+ComputedStatus.DRAFT+"' " +
"or status = '"+ComputedStatus.NEEDS_CREATIVES+"'" +
")" +
" AND targetPlatform = '"+TargetPlatform.MOBILE+"'";
log.info("loadCampaignTraffickingData Query 3 (DRAFT & NEEDS_CREATIVES):"+query);
lineItemStatement.setQuery(query);
int j=0;
do{
page=lineItemService.getLineItemsByStatement(lineItemStatement);
List<LineItem> result = page.getResults();
if(result !=null && result.size()>0)
{
draftAndNeedCreativesCampaignList = getLineItemDTOList(result);
log.info("Draft and Need Creatives Campaigns = "+draftAndNeedCreativesCampaignList.size());
}
else
{
log.warning("No line items found for query (DRAFT & NEEDS_CREATIVES): "+query);
}
}while(page.getResults()== null && j<=3);
MemcacheUtil.setDraftAndNeedCreativesCampaignList(draftAndNeedCreativesCampaignList);
}
if(draftAndNeedCreativesCampaignList != null && draftAndNeedCreativesCampaignList.size() > 0)
{
totalLineItemDTOList.addAll(draftAndNeedCreativesCampaignList);
}
}catch(Exception e)
{
log.severe("exception in loadCampaignTraffickingData RichMediaAdvertiserService (DRAFT & NEEDS_CREATIVES): "+e.getMessage());
}
/*Getting PAUSED & PAUSED_INVENTORY_RELEASED lineitems*/
try
{
List<LineItemDTO> pausedAndInventoryReleasedCampaignList = MemcacheUtil.getPausedAndInventoryReleasedCampaignList();
if(pausedAndInventoryReleasedCampaignList == null || pausedAndInventoryReleasedCampaignList.size() <= 0)
{
query="WHERE (" +
"status = '"+ComputedStatus.PAUSED+"' " +
"or status = '"+ComputedStatus.PAUSED_INVENTORY_RELEASED+"' " +
") " +
"AND targetPlatform = '"+TargetPlatform.MOBILE+"'";
log.info("loadCampaignTraffickingData Query 4 (PAUSED & PAUSED_INVENTORY_RELEASED): "+query);
lineItemStatement.setQuery(query);
int j=0;
do{
page=lineItemService.getLineItemsByStatement(lineItemStatement);
List<LineItem> result = page.getResults();
if(result != null && result.size() > 0)
{
pausedAndInventoryReleasedCampaignList = getLineItemDTOList(result);
log.info("Paused And Inventory Released Campaigns = "+pausedAndInventoryReleasedCampaignList.size());
}
else
{
log.warning("No line items found for query 5 (PAUSED & PAUSED_INVENTORY_RELEASED):"+query);
}
}while(page.getResults()== null && j<=3);
MemcacheUtil.setPausedAndInventoryReleasedCampaignList(pausedAndInventoryReleasedCampaignList);
}
if(pausedAndInventoryReleasedCampaignList != null && pausedAndInventoryReleasedCampaignList.size() > 0)
{
totalLineItemDTOList.addAll(pausedAndInventoryReleasedCampaignList);
}
}catch(Exception e)
{
log.severe("exception in loadCampaignTraffickingData LinMobileBusinessService (PAUSED & PAUSED_INVENTORY_RELEASED): "+e.getMessage());
}
/*Getting PENDING_APPROVAL lineitems*/
try
{
List<LineItemDTO> pendingApprovalCampaignList = MemcacheUtil.getPendingApprovalCampaignList();
if(pendingApprovalCampaignList == null || pendingApprovalCampaignList.size() <= 0)
{
query="WHERE status = '"+ComputedStatus.PENDING_APPROVAL+"' AND targetPlatform = '"+TargetPlatform.MOBILE+"'";
log.info("loadCampaignTraffickingData Query 6 (PENDING_APPROVAL): "+query);
lineItemStatement.setQuery(query);
int j=0;
do{
page=lineItemService.getLineItemsByStatement(lineItemStatement);
List<LineItem> result = page.getResults();
if(result !=null && result.size()>0)
{
pendingApprovalCampaignList = getLineItemDTOList(result);
log.info("Pending Approval Campaigns = "+pendingApprovalCampaignList.size());
}
else
{
log.warning("No line items found for query (PENDING_APPROVAL) :"+query);
}
}while(page.getResults()== null && j<=3);
MemcacheUtil.setPendingApprovalCampaignList(pendingApprovalCampaignList);
}
if(pendingApprovalCampaignList != null && pendingApprovalCampaignList.size() > 0)
{
totalLineItemDTOList.addAll(pendingApprovalCampaignList);
}
}catch(Exception e)
{
log.severe("exception in loadCampaignTraffickingData LinMobileBusinessService (PENDING_APPROVAL): "+e.getMessage());
}
return totalLineItemDTOList;
}
private List<LineItemDTO> getLineItemDTOList(List<LineItem> lineItemList)
{
List<LineItemDTO> list = new ArrayList<LineItemDTO>();
try{
if(lineItemList!=null && lineItemList.size()>0){
Iterator<LineItem> iterator = lineItemList.iterator();
while(iterator.hasNext())
{
LineItem lineItemObj = iterator.next();
if(!lineItemObj.isIsArchived()){
LineItemDTO lineItem= new LineItemDTO();
lineItem.setLineItemId(lineItemObj.getId());
lineItem.setStatus(lineItemObj.getStatus().toString());
lineItem.setName(lineItemObj.getName());
lineItem.setGoalQuantity(lineItemObj.getUnitsBought());
Money money = lineItemObj.getCostPerUnit();
lineItem.setCpm(money.getMicroAmount() / 1000000);
if (lineItemObj.getStartDateTime()!= null){
com.google.api.ads.dfp.jaxws.v201403.Date startDateTime = lineItemObj.getStartDateTime().getDate();
lineItem.setStartDateTime(startDateTime.getMonth()+"/"+startDateTime.getDay()+"/"+startDateTime.getYear());
}
else{
lineItem.setStartDateTime(null);
}
if (lineItemObj.getEndDateTime()!= null){
com.google.api.ads.dfp.jaxws.v201403.Date endDateTime = lineItemObj.getEndDateTime().getDate();
lineItem.setEndDateTime(endDateTime.getMonth()+"/"+endDateTime.getDay()+"/"+endDateTime.getYear());
}
else{
lineItem.setEndDateTime(null);
}
list.add(lineItem);
}//end of if
}//end of while
}
}catch(Exception e)
{
log.severe("exception in loadCampaignTraffickingData LinMobileBusinessService : "+e.getMessage());
}
return list;
}
public List<ForcastLineItemDTO> getLineItemForcasts(DfpServices dfpServices,DfpSession session,String[] lineItemIds){
log.info("inside getLineItemForcasts of LinMobile Business Service");
List<ForcastLineItemDTO> forcastLineItemDTOList = new ArrayList<ForcastLineItemDTO>();
long deliveredImpressions = 0;
long bookedImpressions = 0;
long impressionsToBeDelivered = 0;
LineItemServiceInterface lineItemService = null;
ForecastServiceInterface forecastService = null;
try
{
int j=0;
do{
lineItemService = dfpServices.get(session, LineItemServiceInterface.class);
}while(lineItemService == null && j < 3);
}catch(Exception e)
{
}
try{
int k=0;
do{
forecastService = dfpServices.get(session, ForecastServiceInterface.class);
}while(forecastService == null && k < 3);
}catch(Exception e){
}
for(String id : lineItemIds){
log.info("IDs = "+id);
ForcastLineItemDTO forcastLineItemDTO = new ForcastLineItemDTO();
LineItem lineItem =null;
try{
StatementBuilder statementBuilder = new StatementBuilder()
.where(" id = :id")
.withBindVariableValue("id",Long.valueOf(id));
LineItemPage lineItemPage = lineItemService.getLineItemsByStatement(statementBuilder.toStatement());
if(lineItemPage != null && lineItemPage.getResults().size()>0){
List<LineItem> lineItemList=lineItemPage.getResults();
lineItem=lineItemList.get(0);
if(lineItem.getStats()!=null){
if(lineItem.getStats().getImpressionsDelivered().toString()!=null){
deliveredImpressions = lineItem.getStats().getImpressionsDelivered();
}
}
if(lineItem.getUnitsBought()!=0){
bookedImpressions = lineItem.getUnitsBought();
forcastLineItemDTO.setBookedImpressions(String.valueOf(lineItem.getUnitsBought()));
}
if(deliveredImpressions>=0 && bookedImpressions>=0 ){
impressionsToBeDelivered = bookedImpressions - deliveredImpressions;
}
if(lineItem.getCostPerUnit().toString()!=null){
double costPerUnit = ((double) lineItem.getCostPerUnit()
.getMicroAmount() / 1000000);
forcastLineItemDTO.setECPM(String.valueOf(costPerUnit));
}
if(lineItem.getName()!=null && !lineItem.getName().equals("")){
forcastLineItemDTO.setLineItem(lineItem.getName());
}
if(lineItem!=null && lineItem.getStartDateTime().toString()!=null){
forcastLineItemDTO.setStartDate(getCustomDate(lineItem.getStartDateTime()));
}
if(lineItem!=null && lineItem.getEndDateTime().toString()!=null){
forcastLineItemDTO.setEndDate(getCustomDate(lineItem.getEndDateTime()));
}
}
else
{
log.info("FOUND NULL from lineItemService.getLineItem(Long.valueOf(id))");
}
}catch(Exception e)
{
log.info("1. UPDATE_ARCHIVED_LINE_ITEM_NOT_ALLOWED Exception found");
}
log.info("Before getting lineitem forcast data");
Forecast forecast = null;
try{
forecast = forecastService.getForecastById(Long.valueOf(id));
if(forecast!=null)
{
if(forecast.getId()!=null)
{
forcastLineItemDTO.setLineItemId(forecast.getId());
log.info(forecast.getId().toString());
}
if(forecast.getAvailableUnits()!=null)
{
forcastLineItemDTO.setAvailableUnit(forecast.getAvailableUnits());
log.info("AvailableUnits : "+forecast.getAvailableUnits().toString());
}
if(forecast.getDeliveredUnits()!=null)
{
forcastLineItemDTO.setDeliveredUnit((forecast.getDeliveredUnits()));
log.info("DeliveredUnits : "+forecast.getDeliveredUnits().toString());
}
if(forecast.getMatchedUnits()!=null)
{
forcastLineItemDTO.setMatchedUnit(forecast.getMatchedUnits());
log.info("MatchedUnits : "+forecast.getMatchedUnits().toString());
}
if(forecast.getPossibleUnits()!=null)
{
forcastLineItemDTO.setPossibleUnit(forecast.getPossibleUnits());
log.info("PossibleUnits : "+forecast.getPossibleUnits().toString());
}
if(forcastLineItemDTO.getAvailableUnit()!=null && impressionsToBeDelivered>=0 )
{
if(forcastLineItemDTO.getAvailableUnit()>=impressionsToBeDelivered)
{
forcastLineItemDTO.setStatus(true);
}
}
else
{
forcastLineItemDTO.setStatus(false);
}
forcastLineItemDTO.setArchived("no");
}
else
{
log.info("FOUND NULL from forecastService.getForecastById(Long.valueOf(id))");
}
}catch(Exception e)
{
forcastLineItemDTO.setDeliveredUnit(impressionsToBeDelivered);
forcastLineItemDTO.setArchived("yes");
log.info("2. UPDATE_ARCHIVED_LINE_ITEM_NOT_ALLOWED Exception found");
}
forcastLineItemDTOList.add(forcastLineItemDTO);
}
lineItemService = null;
forecastService = null;
log.info("forcastLineItemDTOList.size() = "+forcastLineItemDTOList.size());
return forcastLineItemDTOList;
}
public static String getCustomDate(DateTime dfpDateTime) {
String customDateStr = "";
if (dfpDateTime != null) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, dfpDateTime.getDate().getYear());
calendar.set(Calendar.MONTH, dfpDateTime.getDate().getMonth() - 1);
calendar.set(Calendar.DAY_OF_MONTH, dfpDateTime.getDate().getDay());
//calendar.set(Calendar.HOUR, dfpDateTime.getHour());
//calendar.set(Calendar.MINUTE, dfpDateTime.getMinute());
//calendar.set(Calendar.SECOND, dfpDateTime.getSecond());
//calendar.setTimeZone(TimeZone.getTimeZone(dfpDateTime
// .getTimeZoneID()));
java.util.Date customDate = calendar.getTime();
customDateStr = DateUtil.getFormatedDate(customDate,
"yyyy-MM-dd");
}else{
customDateStr="NULL";
}
return customDateStr;
}
public PublisherPropertiesObj copyObject(PublisherPropertiesObj sourceObj){
PublisherPropertiesObj destinationObj=new PublisherPropertiesObj(sourceObj.getChannelName(),
sourceObj.getName(), sourceObj.geteCPM(), sourceObj.getImpressionsDelivered(),
sourceObj.getClicks(),sourceObj.getTotalImpressionsDeliveredBySiteName(),
sourceObj.getPayout(), sourceObj.getStateName(), sourceObj.getSite(),
sourceObj.getDFPPayout());
destinationObj.setDataSource(sourceObj.getDataSource());
destinationObj.setTotalImpressionsDeliveredByChannelName(sourceObj.getTotalImpressionsDeliveredByChannelName());
destinationObj.setLatitude(sourceObj.getLatitude());
destinationObj.setLongitude(sourceObj.getLongitude());
destinationObj.setClicks(sourceObj.getClicks());
return destinationObj;
}
public Map<String,List<AdvertiserPerformerDTO>> loadCampainTotalDataPublisherViewList(String lowerDate,String upperDate,String publisherName,String advertiser, String agency, String properties)
{
Map<String,List<AdvertiserPerformerDTO>> campainTotalDataPublisherMap = new HashMap<String,List<AdvertiserPerformerDTO>>();
Map<String,AdvertiserPerformerDTO> calculatedLineItemMap = new HashMap<String,AdvertiserPerformerDTO>();
//Map<String,AdvertiserPerformerDTO> nonDFPObjectMap = new HashMap<String,AdvertiserPerformerDTO>();
List<AdvertiserPerformerDTO> list = new ArrayList<AdvertiserPerformerDTO>();
List<AdvertiserPerformerDTO> lineItemCalculatedList = new ArrayList<AdvertiserPerformerDTO>();
//AdvertiserDAO advDAO=new AdvertiserDAO();
String replaceStr = "\\\\'";
if(advertiser != null && !advertiser.trim().equalsIgnoreCase("")) {
advertiser = advertiser.replaceAll("'", replaceStr);
}else {
advertiser = "";
}
if(agency != null && !agency.trim().equalsIgnoreCase("")) {
agency = agency.replaceAll("'", replaceStr);
}else {
agency = "";
}
if(lowerDate == null && upperDate== null)
{
String monthToDateEnd=DateUtil.getCurrentTimeStamp("yyyy-MM-dd");
String[] dayArray=monthToDateEnd.split("-");
int year=Integer.parseInt(dayArray[0]);
int month=Integer.parseInt(dayArray[1])-1; // subtract 1 from day String as day starts from 0 to 11 in Calender class
String monthToDateStart=DateUtil.getDateByYearMonthDays(year,month,1,"yyyy-MM-dd");
lowerDate = monthToDateStart;
upperDate = monthToDateEnd;
}
//list = advDAO.loadAdvertiserTotalDataList(lowerDate, upperDate, publisherName,advertiser,agency,properties);
list = MemcacheUtil.getPublisherCampaignTotalDataList(lowerDate, upperDate, publisherName,advertiser,agency,properties);
if(list == null || list.size() <= 0)
{
try
{
LinMobileDAO pubDAO=new LinMobileDAO();
list = pubDAO.loadCampainTotalDataPublisherViewList(lowerDate, upperDate, publisherName,advertiser,agency,properties);
MemcacheUtil.setPublisherCampaignTotalDataList(lineItemCalculatedList,lowerDate, upperDate, publisherName,advertiser,agency,properties);
}catch (Exception e) {
log.severe("DataServiceException :"+e.getMessage());
}
}else{
log.info("Advertiser Total Data found from memcache:");
}
try{
if(list!=null && list.size()>0){
campainTotalDataPublisherMap.put("campainTotal",list);
for (AdvertiserPerformerDTO advertiserPerformerDTO : list) {
if(!calculatedLineItemMap.containsKey(advertiserPerformerDTO.getCampaignLineItem())){
advertiserPerformerDTO.setLineItemCountFlag(1);
calculatedLineItemMap.put(advertiserPerformerDTO.getCampaignLineItem(), advertiserPerformerDTO);
}else{
long impressions = 0;
long clicks = 0;
long bookedImpressions = 0;
double ctr = 0.0;
int lineItemCountFlag = 0;
double deliveryIndicator = 0.0;
double revenue = 0.0;
AdvertiserPerformerDTO advertiserObj = copyObject(calculatedLineItemMap.get(advertiserPerformerDTO.getCampaignLineItem()));
lineItemCountFlag = advertiserObj.getLineItemCountFlag() + 1;
if(lineItemCountFlag!=0){
deliveryIndicator = (advertiserPerformerDTO.getDeliveryIndicator()+advertiserObj.getDeliveryIndicator())/lineItemCountFlag;
}
advertiserObj.setLineItemCountFlag(lineItemCountFlag);
impressions = advertiserPerformerDTO.getImpressionDelivered() + advertiserObj.getImpressionDelivered();
clicks = advertiserPerformerDTO.getClicks() + advertiserObj.getClicks();
bookedImpressions = advertiserPerformerDTO.getBookedImpressions() + advertiserObj.getBookedImpressions();
if(impressions!=0){
ctr = Double.valueOf(clicks*100)/impressions;
}
revenue = advertiserPerformerDTO.getRevenueDeliverd()+ advertiserObj.getRevenueDeliverd();
advertiserObj.setImpressionDelivered(impressions);
advertiserObj.setClicks(clicks);
advertiserObj.setCTR(ctr);
advertiserObj.setBookedImpressions(bookedImpressions);
advertiserObj.setDeliveryIndicator(deliveryIndicator);
advertiserObj.setRevenueDeliverd(revenue);
calculatedLineItemMap.put(advertiserObj.getCampaignLineItem(), advertiserObj);
}
}
}
Iterator iterator = calculatedLineItemMap.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry mapEntry = (Map.Entry) iterator.next();
lineItemCalculatedList.add((AdvertiserPerformerDTO) mapEntry.getValue());
}
campainTotalDataPublisherMap.put("lineItemCalculated",lineItemCalculatedList);
}catch(Exception e){
}
return campainTotalDataPublisherMap;
}
public List<AdvertiserPerformerDTO> loadCampainPerformanceDeliveryIndicatorData(String lowerDate,String upperDate,String publisherName,String advertiser, String agency, String properties)
{
List<AdvertiserPerformerDTO> list = new ArrayList<AdvertiserPerformerDTO>();
String replaceStr = "\\\\'";
if(advertiser != null && !advertiser.trim().equalsIgnoreCase("")) {
advertiser = advertiser.replaceAll("'", replaceStr);
}else {
advertiser = "";
}
if(agency != null && !agency.trim().equalsIgnoreCase("")) {
agency = agency.replaceAll("'", replaceStr);
}else {
agency = "";
}
//list = advDAO.loadDeliveryIndicatorData(lowerDate, upperDate, publisherName, advertiser, agency, properties);
//list = MemcacheUtil.getDeliveryIndicatorData(lowerDate, upperDate, publisherName, advertiser, agency, properties);
if(list == null || list.size() <= 0)
{
try
{
LinMobileDAO pubDAO=new LinMobileDAO();
list = pubDAO.loadCampainPerformanceDeliveryIndicatorData(lowerDate, upperDate, publisherName, advertiser, agency, properties);
//MemcacheUtil.setDeliveryIndicatorData(list,lowerDate, upperDate, publisherName,advertiser,agency,properties);
}catch (Exception e) {
log.severe("DataServiceException :"+e.getMessage());
}
}else{
log.info("Delivery Indicator Data found from memcache:");
}
return list;
}
public AdvertiserPerformerDTO copyObject(AdvertiserPerformerDTO sourceObj){
AdvertiserPerformerDTO destinationObj=new AdvertiserPerformerDTO(sourceObj.getCampaignIO(),
sourceObj.getLineItemId(), sourceObj.getCampaignLineItem(), sourceObj.getImpressionDelivered(),
sourceObj.getClicks(),sourceObj.getCTR(),sourceObj.getRevenueDeliverd(),sourceObj.getAgency(),
sourceObj.getAdvertiser(), sourceObj.getCreativeType(), sourceObj.getMarket(),
sourceObj.getDeliveryIndicator(),sourceObj.getSite(),sourceObj.getBookedImpressions(),sourceObj.getBudget(),sourceObj.getPublisherName(),sourceObj.getSiteName(),"");
destinationObj.setCampaignLineItem(sourceObj.getCampaignLineItem());
destinationObj.setImpressionDelivered(sourceObj.getImpressionDelivered());
destinationObj.setClicks(sourceObj.getClicks());
destinationObj.setCTR(sourceObj.getCTR());
destinationObj.setBookedImpressions(sourceObj.getBookedImpressions());
destinationObj.setLineItemCountFlag(sourceObj.getLineItemCountFlag());
destinationObj.setRevenueDeliverd((sourceObj.getRevenueDeliverd()));
return destinationObj;
}
@Override
public PublisherReportHeaderDTO getHeaderData(String allChannelName, List<PublisherSummaryObj> currentDateSummaryList, List<PublisherSummaryObj> compareDateSummaryList) {
int maxSite = 0;
double totalECPM = 0.0;
long totalEmpDelivered = 0;
long totalClicks = 0;
double totalCTR = 0.0;
double totalRPM = 0.0;
double totalPayouts = 0.0;
long totalRequests = 0;
long houseImpression = 0;
int newFlag = 0;
double fillPercentage = 0.0;
long allChannelsTotalEmpDelivered = 0;
PublisherReportHeaderDTO publisherReportHeaderDTO = new PublisherReportHeaderDTO();
try {
IUserService service = (IUserService) BusinessServiceLocator.locate(IUserService.class);
List<String> channelList = service.CommaSeperatedStringToList(allChannelName);
if(channelList != null && channelList.size() > 0 && currentDateSummaryList != null && compareDateSummaryList != null) {
List<String> totalEmpDeliveredCheckList = new ArrayList<String>();
for (PublisherSummaryObj dtoObject : currentDateSummaryList) {
newFlag++;
if(channelList.contains(dtoObject.getChannelName().trim())) {
if(dtoObject.getChannelName().equals("House")) {
houseImpression = dtoObject.getImpressionsDelivered();
}
if(dtoObject.getSite() > maxSite) {
maxSite = dtoObject.getSite();
}
totalEmpDelivered = totalEmpDelivered + dtoObject.getImpressionsDelivered();
totalClicks = totalClicks + dtoObject.getClicks();
totalPayouts = totalPayouts + dtoObject.getPayOuts();
totalRequests = totalRequests + dtoObject.getRequests();
}
if(!totalEmpDeliveredCheckList.contains(dtoObject.getChannelName().trim())){
totalEmpDeliveredCheckList.add(dtoObject.getChannelName().trim());
allChannelsTotalEmpDelivered = allChannelsTotalEmpDelivered + dtoObject.getImpressionsDelivered();
}
}
totalCTR = ((double)totalClicks / totalEmpDelivered) * 100;
totalECPM = (totalPayouts / totalEmpDelivered) * 1000;
if(totalRequests != 0) {
totalRPM = (totalPayouts / totalRequests) * 1000;
}
fillPercentage = ((double)((totalEmpDelivered - houseImpression)* 100) / allChannelsTotalEmpDelivered);
if(newFlag > 0) {
maxSite = 23;
}
publisherReportHeaderDTO.setSite(maxSite);
publisherReportHeaderDTO.setImpressionsDelivered(totalEmpDelivered);
publisherReportHeaderDTO.setClicks(totalClicks);
publisherReportHeaderDTO.setCtrPercentage(totalCTR/100);
publisherReportHeaderDTO.setEcpm(totalECPM);
publisherReportHeaderDTO.setRpm(totalRPM);
publisherReportHeaderDTO.setPayouts(totalPayouts);
publisherReportHeaderDTO.setFillPercentage(fillPercentage/100);
}
}catch (Exception e) {
log.severe("Exception in getHeaderData of LinMobileService : "+e.getMessage());
}
return publisherReportHeaderDTO;
}
@Override
public Map getChannelPerformanceData(String allChannelName, List<PublisherSummaryObj> currentDateSummaryList, List<PublisherSummaryObj> compareDateSummaryList) {
double totalECPMLast = 0.0;
double totalPayoutsLast = 0.0;
long totalEmpDeliveredLast = 0;
double totalECPM = 0.0;
long totalEmpDelivered = 0;
long totalClicks = 0;
double totalCTR = 0.0;
double totalPayouts = 0.0;
double totalChange = 0.0;
double totalChangePercentage = 0.0;
//int flg = 0;
Map channelperformanceMap = new HashMap();
List<PublisherReportChannelPerformanceDTO> pubReportChannelPerformanceDTOList = new ArrayList<PublisherReportChannelPerformanceDTO>();
List<PublisherReportComputedValuesDTO> publisherReportComputedValuesDTOList = new ArrayList<PublisherReportComputedValuesDTO>();
try {
IUserService service = (IUserService) BusinessServiceLocator.locate(IUserService.class);
List<String> channelList = service.CommaSeperatedStringToList(allChannelName);
if(channelList != null && channelList.size() > 0 && currentDateSummaryList != null && currentDateSummaryList.size() > 0) {
for(PublisherSummaryObj dtoObjectCurrent : currentDateSummaryList) {
if(channelList.contains(dtoObjectCurrent.getChannelName().trim())) {
int matchflag = 0;
if(compareDateSummaryList.size() > 0) {
int compareDateSummaryLength = compareDateSummaryList.size();
int compareCount = 0;
for (PublisherSummaryObj dtoObjectCompare : compareDateSummaryList) {
if(channelList.contains(dtoObjectCompare.getChannelName().trim())) {
PublisherReportChannelPerformanceDTO publisherReportChannelPerformanceDTO = new PublisherReportChannelPerformanceDTO();
if(dtoObjectCurrent.getChannelName().equals(dtoObjectCompare.getChannelName())) {
//flg ++;
double CHG = 0;
double percentageCHG = 0.0;
matchflag = 1;
CHG = dtoObjectCurrent.geteCPM() - dtoObjectCompare.geteCPM();
if(dtoObjectCompare.geteCPM() == 0) {
percentageCHG = 0.0;
}
else {
percentageCHG = (CHG / dtoObjectCompare.geteCPM()) * 100;
}
publisherReportChannelPerformanceDTO.setSalesChannel(dtoObjectCurrent.getChannelName());
publisherReportChannelPerformanceDTO.setEcpm(dtoObjectCurrent.geteCPM());
publisherReportChannelPerformanceDTO.setChange(CHG);
publisherReportChannelPerformanceDTO.setChangePercentage(percentageCHG/100);
publisherReportChannelPerformanceDTO.setImpressionsDelivered(dtoObjectCurrent.getImpressionsDelivered());
publisherReportChannelPerformanceDTO.setClicks(dtoObjectCurrent.getClicks());
publisherReportChannelPerformanceDTO.setCtrPercentage(dtoObjectCurrent.getCTR()/100);
publisherReportChannelPerformanceDTO.setPayouts(dtoObjectCurrent.getPayOuts());
totalPayoutsLast = totalPayoutsLast + dtoObjectCompare.getPayOuts();
totalEmpDeliveredLast = totalEmpDeliveredLast + dtoObjectCompare.getImpressionsDelivered();
totalEmpDelivered = totalEmpDelivered + dtoObjectCurrent.getImpressionsDelivered();
totalClicks = totalClicks + dtoObjectCurrent.getClicks();
totalPayouts = totalPayouts + dtoObjectCurrent.getPayOuts();
pubReportChannelPerformanceDTOList.add(publisherReportChannelPerformanceDTO);
}else if(compareDateSummaryLength-1 == compareCount && matchflag == 0) {
//flg ++;
double CHG = 0;
double percentageCHG = 0.0;
matchflag = 1;
CHG = dtoObjectCurrent.geteCPM();
percentageCHG = 0.0;
publisherReportChannelPerformanceDTO.setSalesChannel(dtoObjectCurrent.getChannelName());
publisherReportChannelPerformanceDTO.setEcpm(dtoObjectCurrent.geteCPM());
publisherReportChannelPerformanceDTO.setChange(CHG);
publisherReportChannelPerformanceDTO.setChangePercentage(percentageCHG/100);
publisherReportChannelPerformanceDTO.setImpressionsDelivered(dtoObjectCurrent.getImpressionsDelivered());
publisherReportChannelPerformanceDTO.setClicks(dtoObjectCurrent.getClicks());
publisherReportChannelPerformanceDTO.setCtrPercentage(dtoObjectCurrent.getCTR()/100);
publisherReportChannelPerformanceDTO.setPayouts(dtoObjectCurrent.getPayOuts());
totalEmpDelivered = totalEmpDelivered + dtoObjectCurrent.getImpressionsDelivered();
totalClicks = totalClicks + dtoObjectCurrent.getClicks();
totalPayouts = totalPayouts + dtoObjectCurrent.getPayOuts();
pubReportChannelPerformanceDTOList.add(publisherReportChannelPerformanceDTO);
}
compareCount++;
}
}
}else {
PublisherReportChannelPerformanceDTO publisherReportChannelPerformanceDTO = new PublisherReportChannelPerformanceDTO();
//flg ++;
double CHG = 0;
double percentageCHG = 0.0;
matchflag = 1;
CHG = dtoObjectCurrent.geteCPM();
percentageCHG = 0.0;
publisherReportChannelPerformanceDTO.setSalesChannel(dtoObjectCurrent.getChannelName());
publisherReportChannelPerformanceDTO.setEcpm(dtoObjectCurrent.geteCPM());
publisherReportChannelPerformanceDTO.setChange(CHG);
publisherReportChannelPerformanceDTO.setChangePercentage(percentageCHG/100);
publisherReportChannelPerformanceDTO.setImpressionsDelivered(dtoObjectCurrent.getImpressionsDelivered());
publisherReportChannelPerformanceDTO.setClicks(dtoObjectCurrent.getClicks());
publisherReportChannelPerformanceDTO.setCtrPercentage(dtoObjectCurrent.getCTR()/100);
publisherReportChannelPerformanceDTO.setPayouts(dtoObjectCurrent.getPayOuts());
pubReportChannelPerformanceDTOList.add(publisherReportChannelPerformanceDTO);
totalEmpDelivered = totalEmpDelivered + dtoObjectCurrent.getImpressionsDelivered();
totalClicks = totalClicks + dtoObjectCurrent.getClicks();
totalPayouts = totalPayouts + dtoObjectCurrent.getPayOuts();
}
}
}
totalCTR = (totalClicks / totalEmpDelivered) * 100;
totalECPM = (totalPayouts / totalEmpDelivered) * 1000;
totalECPMLast = (totalPayoutsLast / totalEmpDeliveredLast) * 1000;
totalChange = totalECPM - totalECPMLast;
totalChangePercentage = (totalChange / totalECPMLast) * 100;
PublisherReportComputedValuesDTO publisherReportComputedValuesDTO = new PublisherReportComputedValuesDTO();
publisherReportComputedValuesDTO.setChange(totalChange);
publisherReportComputedValuesDTO.setChangePercentage(totalChangePercentage/100);
publisherReportComputedValuesDTOList.add(publisherReportComputedValuesDTO);
for(PublisherReportChannelPerformanceDTO publisherReportChannelPerformanceDTO : pubReportChannelPerformanceDTOList) {
publisherReportChannelPerformanceDTO.setFillRate((double)publisherReportChannelPerformanceDTO.getImpressionsDelivered()/totalEmpDelivered);
}
}
}catch (Exception e) {
log.severe("Exception in getChannelPerformanceDate of LinMobileService : "+e.getMessage());
}
channelperformanceMap.put("PublisherReportChannelPerformanceDTO", pubReportChannelPerformanceDTOList);
channelperformanceMap.put("PublisherReportComputedValuesDTO", publisherReportComputedValuesDTOList);
return channelperformanceMap;
}
public Map getPerformanceByPropertyData(String channelName, List<PublisherPropertiesObj> performanceByPropertyCurrentDataBySiteName, List<PublisherPropertiesObj> performanceByPropertyCompareDataBySiteName) {
double payoutsTotalCompare = 0.0;
double impDeliveredTotalCompare = 0.0;
double clicksTotalCurrent = 0;
double payoutsTotalCurrent = 0.0;
double impDeliveredTotalCurrent = 0.0;
double eCPMTotalCompare = 0.0;
double eCPMTotalCurrent = 0.0;
double changeTotal = 0.0;
double percentageCHGTotal = 0.0;
double imprs =0.0;
long payout = 0;
int flg = 0;
Map performanceByPropertyMap = new HashMap();
List<PublisherReportPerformanceByPropertyDTO> publisherReportPerformanceByPropertyDTOList = new ArrayList<PublisherReportPerformanceByPropertyDTO>();
List<PublisherReportComputedValuesDTO> publisherReportComputedValuesDTOList = new ArrayList<PublisherReportComputedValuesDTO>();
try {
if(performanceByPropertyCurrentDataBySiteName != null && performanceByPropertyCurrentDataBySiteName.size() > 0) {
for(PublisherPropertiesObj objectCurrent : performanceByPropertyCurrentDataBySiteName) {
int matchflag = 0;
if(performanceByPropertyCompareDataBySiteName != null && performanceByPropertyCompareDataBySiteName.size() > 0) {
int compareCount = 0;
for(PublisherPropertiesObj objectCompare : performanceByPropertyCompareDataBySiteName) {
PublisherReportPerformanceByPropertyDTO publisherReportPerformanceByPropertyDTO = new PublisherReportPerformanceByPropertyDTO();
if(objectCurrent.getSite() != null && objectCompare.getSite() != null && objectCurrent.getSite().equals(objectCompare.getSite()) && objectCurrent.getChannelName().equals(objectCompare.getChannelName())) {
imprs = 0;
long clks = objectCurrent.getClicks();
imprs = objectCurrent.getImpressionsDelivered();
double ctr = (clks / imprs) * 100;
flg++;
matchflag = 1;
double eCPM = objectCurrent.geteCPM();
double CHG = 0.0;
double percentageCHG = 0.0;
if(objectCompare.geteCPM() == 0.0) {
CHG = objectCurrent.geteCPM();
percentageCHG = 0.0;
}
else {
CHG = objectCurrent.geteCPM() - objectCompare.geteCPM();
percentageCHG = (CHG / objectCompare.geteCPM()) * 100;
}
publisherReportPerformanceByPropertyDTO.setProperty(objectCurrent.getName());
publisherReportPerformanceByPropertyDTO.setEcpm(objectCurrent.geteCPM());
publisherReportPerformanceByPropertyDTO.setChange(CHG);
publisherReportPerformanceByPropertyDTO.setChangePercentage(percentageCHG/100);
publisherReportPerformanceByPropertyDTO.setImpressionsDelivered(Math.round(objectCurrent.getImpressionsDelivered()));
publisherReportPerformanceByPropertyDTO.setClicks(objectCurrent.getClicks());
publisherReportPerformanceByPropertyDTO.setPayouts(objectCurrent.getPayout());
publisherReportPerformanceByPropertyDTOList.add(publisherReportPerformanceByPropertyDTO);
payoutsTotalCompare = payoutsTotalCompare + objectCompare.getPayout();
impDeliveredTotalCompare = impDeliveredTotalCompare + objectCompare.getImpressionsDelivered();
clicksTotalCurrent = clicksTotalCurrent + objectCurrent.getClicks();
payoutsTotalCurrent = payoutsTotalCurrent + objectCurrent.getPayout();
impDeliveredTotalCurrent = impDeliveredTotalCurrent + Math.round(objectCurrent.getImpressionsDelivered());
}
else if(performanceByPropertyCompareDataBySiteName.size()-1 == compareCount && matchflag == 0 ) {
imprs = 0;
long clks = objectCurrent.getClicks();
imprs = objectCurrent.getImpressionsDelivered();
double ctr = (clks / imprs) * 100;
flg++;
matchflag = 1;
double eCPM = objectCurrent.geteCPM();
double CHG = 0.0;
double percentageCHG = 0.0;
CHG = objectCurrent.geteCPM();
percentageCHG = 0.0;
publisherReportPerformanceByPropertyDTO.setProperty(objectCurrent.getName());
publisherReportPerformanceByPropertyDTO.setEcpm(objectCurrent.geteCPM());
publisherReportPerformanceByPropertyDTO.setChange(CHG);
publisherReportPerformanceByPropertyDTO.setChangePercentage(percentageCHG/100);
publisherReportPerformanceByPropertyDTO.setImpressionsDelivered(Math.round(objectCurrent.getImpressionsDelivered()));
publisherReportPerformanceByPropertyDTO.setClicks(objectCurrent.getClicks());
publisherReportPerformanceByPropertyDTO.setPayouts(objectCurrent.getPayout());
publisherReportPerformanceByPropertyDTOList.add(publisherReportPerformanceByPropertyDTO);
clicksTotalCurrent = clicksTotalCurrent + objectCurrent.getClicks();
payoutsTotalCurrent = payoutsTotalCurrent + objectCurrent.getPayout();
impDeliveredTotalCurrent = impDeliveredTotalCurrent + Math.round(objectCurrent.getImpressionsDelivered());
}
compareCount++;
}
}
else {
PublisherReportPerformanceByPropertyDTO publisherReportPerformanceByPropertyDTO = new PublisherReportPerformanceByPropertyDTO();
imprs = 0;
long clks = objectCurrent.getClicks();
imprs = objectCurrent.getImpressionsDelivered();
double ctr = (clks / imprs) * 100;
flg++;
matchflag = 1;
double eCPM = objectCurrent.geteCPM();
double CHG = 0.0;
double percentageCHG = 0.0;
CHG = objectCurrent.geteCPM();
percentageCHG = 0.0;
publisherReportPerformanceByPropertyDTO.setProperty(objectCurrent.getName());
publisherReportPerformanceByPropertyDTO.setEcpm(objectCurrent.geteCPM());
publisherReportPerformanceByPropertyDTO.setChange(CHG);
publisherReportPerformanceByPropertyDTO.setChangePercentage(percentageCHG/100);
publisherReportPerformanceByPropertyDTO.setImpressionsDelivered(Math.round(objectCurrent.getImpressionsDelivered()));
publisherReportPerformanceByPropertyDTO.setClicks(objectCurrent.getClicks());
publisherReportPerformanceByPropertyDTO.setPayouts(objectCurrent.getPayout());
publisherReportPerformanceByPropertyDTOList.add(publisherReportPerformanceByPropertyDTO);
clicksTotalCurrent = clicksTotalCurrent + objectCurrent.getClicks();
payoutsTotalCurrent = payoutsTotalCurrent + objectCurrent.getPayout();
impDeliveredTotalCurrent = impDeliveredTotalCurrent + Math.round(objectCurrent.getImpressionsDelivered());
}
}
if(flg > 0) {
eCPMTotalCurrent = (payoutsTotalCurrent / impDeliveredTotalCurrent) * 1000;
eCPMTotalCompare = (payoutsTotalCompare / impDeliveredTotalCompare) * 1000;
changeTotal = (eCPMTotalCurrent - eCPMTotalCompare);
percentageCHGTotal = (changeTotal / eCPMTotalCompare) * 100;
}
PublisherReportComputedValuesDTO publisherReportComputedValuesDTO = new PublisherReportComputedValuesDTO();
publisherReportComputedValuesDTO.setChange(changeTotal);
publisherReportComputedValuesDTO.setChangePercentage(percentageCHGTotal/100);
publisherReportComputedValuesDTOList.add(publisherReportComputedValuesDTO);
}
}catch (Exception e) {
log.severe("Exception in getPerformanceByPropertyData of LinMobileService : "+e.getMessage());
}
performanceByPropertyMap.put("PublisherReportPerformanceByPropertyDTO", publisherReportPerformanceByPropertyDTOList);
performanceByPropertyMap.put("PublisherReportPerformanceComputedValuesDTO", publisherReportComputedValuesDTOList);
return performanceByPropertyMap;
}
/*
* This method will create json string for line chart
*/
@SuppressWarnings("unused")
private String createJsonResponseForLineChart(Map<String, Object> dateMap,
Map<String, Object> channelMap,Map<String, Object> perfDataMap,String chartType) throws TypeMismatchException{
DataTable linechartTable = new DataTable();
List<com.google.visualization.datasource.datatable.TableRow> rows;
ColumnDescription col0 = new ColumnDescription("date", ValueType.DATE, "Date");
//ColumnDescription col0 = new ColumnDescription("date", ValueType.TEXT, "Date");
linechartTable.addColumn(col0);
for (Entry<String, Object> channel : channelMap.entrySet()) {
String channelName = channel.getKey();
ColumnDescription channelcol = new ColumnDescription(channelName, ValueType.NUMBER, channelName);
linechartTable.addColumn(channelcol);
}
rows = Lists.newArrayList();
int year, month, day = 0;
for (Entry<String, Object> dates : dateMap.entrySet()) {
String date = dates.getKey();
String [] dtArray=date.split("-");
com.google.visualization.datasource.datatable.TableRow row = new com.google.visualization.datasource.datatable.TableRow();
year = Integer.parseInt(dtArray[0]);
month = Integer.parseInt(dtArray[1])-1;
day = Integer.parseInt(dtArray[2]);
DateValue dateValue= new DateValue(year,month,day);
row.addCell(new com.google.visualization.datasource.datatable.TableCell(dateValue));
//row.addCell(new com.google.visualization.datasource.datatable.TableCell(date));
for (Entry<String, Object> channel : channelMap.entrySet()) {
String channelName = channel.getKey();
String key=date+"_"+channelName;
LineChartDTO perData = (LineChartDTO) perfDataMap.get(key);
if ( perData != null){
//row.addCell(new com.google.visualization.datasource.datatable.TableCell(perData.getCtr()).);
if(chartType.equalsIgnoreCase("CTR")){
Double ctr=StringUtil.getDoubleValue(perData.getCtr(), 4);
row.addCell(new NumberValue(new Double(ctr)));
}else if(chartType.equalsIgnoreCase("Clicks")){
row.addCell(new NumberValue(new Long(perData.getClicks())));
}else if(chartType.equalsIgnoreCase("Impressions")){
row.addCell(new NumberValue(new Long(perData.getImpressions())));
}else if(chartType.equalsIgnoreCase("Revenue")){
Double revenue = StringUtil.getDoubleValue(perData.getRevenue(), 4);
row.addCell(new NumberValue(new Double(revenue)));
}else if(chartType.equalsIgnoreCase("Ecpm")){
Double ecpm=StringUtil.getDoubleValue(perData.geteCPM(), 4);
row.addCell(new NumberValue(new Double(ecpm)));
}else if(chartType.equalsIgnoreCase("FillRate")){
Double fillRate=StringUtil.getDoubleValue(perData.getFillRate(), 4);
row.addCell(new NumberValue(new Double(fillRate)));
}
}else{
row.addCell(new com.google.visualization.datasource.datatable.TableCell(0));
}
}
rows.add(row);
}
linechartTable.addRows(rows);
java.lang.CharSequence jsonStr = JsonRenderer.renderDataTable(linechartTable, true, false);
//System.out.println("LineChart Table JSON Data::" + jsonStr.toString());
return jsonStr.toString();
}
public Map<String,String> processPublisherLineChartData(String lowerDate,String upperDate,String publisherName,String channelName){
List<PublisherChannelObj> actualPublisherList=null;
Map<String, Object> dateMap = new LinkedHashMap<String, Object>();
Map<String, Object> perfDataMap = new LinkedHashMap<String, Object>();
Map<String, Object> channelMap = new LinkedHashMap<String, Object>();
ILinMobileDAO linDAO=new LinMobileDAO();
Map<String,String> jsonChartMap = null;
try {
String channelId = getChannelsBQId(channelName);
String publisherId = getPublisherBQId(publisherName);
jsonChartMap = MemcacheUtil.getLineChartMapFromCachePublisher(lowerDate, upperDate, publisherId, channelId);
if(jsonChartMap ==null || jsonChartMap.size()==0){
jsonChartMap = new LinkedHashMap<String,String>();
actualPublisherList = MemcacheUtil.getTrendsAnalysisActualDataPublisher(lowerDate, upperDate, publisherName, channelName);
if(actualPublisherList==null || actualPublisherList.size()<=0){
String replaceStr = "\\\\'";
if(channelName!=null){
channelName = channelName.replaceAll("'", replaceStr);
channelName = channelName.replaceAll(",", "','");
}else{
channelName = "";
}
QueryDTO queryDTO = getQueryDTO(publisherId, lowerDate, upperDate, LinMobileConstants.BQ_CORE_PERFORMANCE);
if(queryDTO != null && queryDTO.getQueryData() != null && queryDTO.getQueryData().length() > 0) {
actualPublisherList=linDAO.loadActualDataForPublisher(lowerDate,upperDate,channelId, queryDTO);
MemcacheUtil.setTrendsAnalysisActualDataPublisher(lowerDate, upperDate, publisherId, channelId, actualPublisherList);
}
for (PublisherChannelObj publisherChannelObj : actualPublisherList) {
String date = publisherChannelObj.getDate();
String channelNamekey = publisherChannelObj.getChannelName();
String revenue = publisherChannelObj.getRevenue()+"";
String impressions = publisherChannelObj.getImpressionsDelivered()+"";
String clicks = publisherChannelObj.getClicks()+"";
String ctr = publisherChannelObj.getCTR()+"";
String fillRate = publisherChannelObj.getFillRate()+"";
String ecpm = publisherChannelObj.geteCPM()+"";
LineChartDTO lineChartDTO = new LineChartDTO(impressions, clicks, ctr, date, fillRate, ecpm, revenue);
dateMap.put(date, null);
channelMap.put(channelNamekey, null);
String key=date+"_"+channelNamekey;
perfDataMap.put(key, lineChartDTO);
}
String ctrLineChartJson=createJsonResponseForLineChart(dateMap, channelMap, perfDataMap, "CTR");
jsonChartMap.put("CTR", ctrLineChartJson);
String clicksLineChartJson=createJsonResponseForLineChart(dateMap, channelMap, perfDataMap, "Clicks");
jsonChartMap.put("Clicks", clicksLineChartJson);
String impressionsLineChartJson=createJsonResponseForLineChart(dateMap, channelMap, perfDataMap, "Impressions");
jsonChartMap.put("Impressions", impressionsLineChartJson);
String revenueLineChartJson=createJsonResponseForLineChart(dateMap, channelMap, perfDataMap, "Revenue");
jsonChartMap.put("Revenue", revenueLineChartJson);
String ecpmLineChartJson=createJsonResponseForLineChart(dateMap, channelMap, perfDataMap, "Ecpm");
jsonChartMap.put("Ecpm", ecpmLineChartJson);
String fillRateLineChartJson=createJsonResponseForLineChart(dateMap, channelMap, perfDataMap, "FillRate");
jsonChartMap.put("FillRate", fillRateLineChartJson);
MemcacheUtil.setLineChartMapInCachePublisher(jsonChartMap, lowerDate, upperDate, publisherId, channelId);
}
}else{
log.info("Found line chart data in memcache..size:"+jsonChartMap.size());
}
}catch (Exception e) {
log.severe("Exception :"+e.getMessage());
return null;
}
return jsonChartMap;
}
}
| {'content_hash': 'fb76939f45babb395ff3d29532f356c3', 'timestamp': '', 'source': 'github', 'line_count': 3428, 'max_line_length': 351, 'avg_line_length': 44.25904317386231, 'alnum_prop': 0.7198391774321118, 'repo_name': 'nareshPokhriyal86/testing', 'id': '4785070b45e19bddec85c0fa1b9cf813329059bd', 'size': '151720', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/lin/web/service/impl/LinMobileBusinessService.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '1241396'}, {'name': 'HTML', 'bytes': '56004'}, {'name': 'Java', 'bytes': '6601853'}, {'name': 'JavaScript', 'bytes': '3910511'}]} |
'use strict';
angular.module('mean.users')
.controller('AuthCtrl', ['$scope', '$rootScope', '$http', '$location', 'Global',
function ($scope, $rootScope, $http, $location, Global) {
// This object will contain list of available social buttons to authorize
$scope.socialButtonsCounter = 0;
$scope.global = Global;
$http.get('/get-config')
.success(function (config) {
$scope.socialButtons = config;
});
}
])
.controller('LoginCtrl', ['$scope', '$rootScope', '$http', '$location', 'Global',
function ($scope, $rootScope, $http, $location, Global) {
// This object will be filled by the form
$scope.user = {};
$scope.global = Global;
$scope.global.registerForm = false;
$scope.input = {
type: 'password',
placeholder: 'Password',
confirmPlaceholder: 'Repeat Password',
iconClass: '',
tooltipText: 'Show password'
};
$scope.togglePasswordVisible = function () {
$scope.input.type = $scope.input.type === 'text' ? 'password' : 'text';
$scope.input.placeholder = $scope.input.placeholder === 'Password' ? 'Visible Password' : 'Password';
$scope.input.iconClass = $scope.input.iconClass === 'icon_hide_password' ? '' : 'icon_hide_password';
$scope.input.tooltipText = $scope.input.tooltipText === 'Show password' ? 'Hide password' : 'Show password';
};
// Register the login() function
$scope.login = function () {
$http.post('/login', {
email: $scope.user.email,
password: $scope.user.password
})
.success(function (response) {
// authentication OK
$scope.loginError = 0;
$rootScope.user = response.user;
$rootScope.$emit('loggedin');
if (response.redirect) {
if (window.location.href === response.redirect) {
//This is so an admin user will get full admin page
window.location.reload();
} else {
window.location = response.redirect;
}
} else {
$location.url('/');
}
})
.error(function () {
$scope.loginerror = 'Authentication failed.';
});
};
}
])
.controller('RegisterCtrl', ['$scope', '$rootScope', '$http', '$location', 'Global',
function ($scope, $rootScope, $http, $location, Global) {
$scope.user = {};
$scope.global = Global;
$scope.global.registerForm = true;
$scope.input = {
type: 'password',
placeholder: 'Password',
placeholderConfirmPass: 'Repeat Password',
iconClassConfirmPass: '',
tooltipText: 'Show password',
tooltipTextConfirmPass: 'Show password'
};
$scope.togglePasswordVisible = function () {
$scope.input.type = $scope.input.type === 'text' ? 'password' : 'text';
$scope.input.placeholder = $scope.input.placeholder === 'Password' ? 'Visible Password' : 'Password';
$scope.input.iconClass = $scope.input.iconClass === 'icon_hide_password' ? '' : 'icon_hide_password';
$scope.input.tooltipText = $scope.input.tooltipText === 'Show password' ? 'Hide password' : 'Show password';
};
$scope.togglePasswordConfirmVisible = function () {
$scope.input.type = $scope.input.type === 'text' ? 'password' : 'text';
$scope.input.placeholderConfirmPass = $scope.input.placeholderConfirmPass === 'Repeat Password' ? 'Visible Password' : 'Repeat Password';
$scope.input.iconClassConfirmPass = $scope.input.iconClassConfirmPass === 'icon_hide_password' ? '' : 'icon_hide_password';
$scope.input.tooltipTextConfirmPass = $scope.input.tooltipTextConfirmPass === 'Show password' ? 'Hide password' : 'Show password';
};
$scope.register = function () {
$scope.usernameError = null;
$scope.registerError = null;
$http.post('/register', {
email: $scope.user.email,
password: $scope.user.password,
confirmPassword: $scope.user.confirmPassword,
username: $scope.user.username,
name: $scope.user.name
})
.success(function () {
// authentication OK
$scope.registerError = 0;
$rootScope.user = $scope.user;
Global.user = $rootScope.user;
Global.authenticated = !!$rootScope.user;
$rootScope.$emit('loggedin');
$location.url('/');
})
.error(function (error) {
// Error: authentication failed
if (error === 'Username already taken') {
$scope.usernameError = error;
} else if (error === 'Email already taken') {
$scope.emailError = error;
} else
$scope.registerError = error;
});
};
}
])
.controller('ForgotPasswordCtrl', ['$scope', '$rootScope', '$http', '$location', 'Global',
function ($scope, $rootScope, $http, $location, Global) {
$scope.user = {};
$scope.global = Global;
$scope.global.registerForm = false;
$scope.forgotpassword = function () {
$http.post('/forgot-password', {
text: $scope.user.email
})
.success(function (response) {
$scope.response = response;
})
.error(function (error) {
$scope.response = error;
});
};
}
])
.controller('ResetPasswordCtrl', ['$scope', '$rootScope', '$http', '$location', '$stateParams', 'Global',
function ($scope, $rootScope, $http, $location, $stateParams, Global) {
$scope.user = {};
$scope.global = Global;
$scope.global.registerForm = false;
$scope.resetpassword = function () {
$http.post('/reset/' + $stateParams.tokenId, {
password: $scope.user.password,
confirmPassword: $scope.user.confirmPassword
})
.success(function (response) {
$rootScope.user = response.user;
$rootScope.$emit('loggedin');
if (response.redirect) {
if (window.location.href === response.redirect) {
//This is so an admin user will get full admin page
window.location.reload();
} else {
window.location = response.redirect;
}
} else {
$location.url('/');
}
})
.error(function (error) {
if (error.msg === 'Token invalid or expired')
$scope.resetpassworderror = 'Could not update password as token is invalid or may have expired';
else
$scope.validationError = error;
});
};
}
]);
| {'content_hash': '72a14eaae858f78d1b127ccc6cd16843', 'timestamp': '', 'source': 'github', 'line_count': 173, 'max_line_length': 157, 'avg_line_length': 52.31791907514451, 'alnum_prop': 0.41708098552646117, 'repo_name': 'iakomus/infographics', 'id': 'bec46778f35935c6d7795e3d6d9a7771ddb67607', 'size': '9051', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'packages/users/public/controllers/meanUser.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '81771'}, {'name': 'HTML', 'bytes': '79432'}, {'name': 'JavaScript', 'bytes': '266790'}]} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_80) on Thu Oct 15 19:27:36 UTC 2015 -->
<title>BootstrapActions.Daemon (AWS SDK for Java - 1.10.27)</title>
<meta name="date" content="2015-10-15">
<link rel="stylesheet" type="text/css" href="../../../../../JavaDoc.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="BootstrapActions.Daemon (AWS SDK for Java - 1.10.27)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em>
<!-- Scripts for Syntax Highlighter START-->
<script id="syntaxhighlight_script_core" type="text/javascript" src = "http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/resources/syntaxhighlight/scripts/shCore.js">
</script>
<script id="syntaxhighlight_script_java" type="text/javascript" src = "http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/resources/syntaxhighlight/scripts/shBrushJava.js">
</script>
<link id="syntaxhighlight_css_core" rel="stylesheet" type="text/css" href = "http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/resources/syntaxhighlight/styles/shCoreDefault.css"/>
<link id="syntaxhighlight_css_theme" rel="stylesheet" type="text/css" href = "http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/resources/syntaxhighlight/styles/shThemeDefault.css"/>
<!-- Scripts for Syntax Highlighter END-->
<div>
<!-- BEGIN-SECTION -->
<div id="divsearch" style="float:left;">
<span id="lblsearch" for="searchQuery">
<label>Search</label>
</span>
<form id="nav-search-form" target="_parent" method="get" action="http://docs.aws.amazon.com/search/doc-search.html#facet_doc_guide=API+Reference&facet_doc_product=AWS+SDK+for+Java">
<div id="nav-searchfield-outer" class="nav-sprite">
<div class="nav-searchfield-inner nav-sprite">
<div id="nav-searchfield-width">
<input id="nav-searchfield" name="searchQuery">
</div>
</div>
</div>
<div id="nav-search-button" class="nav-sprite">
<input alt="" id="nav-search-button-inner" type="image">
</div>
<input name="searchPath" type="hidden" value="documentation-guide" />
<input name="this_doc_product" type="hidden" value="AWS SDK for Java" />
<input name="this_doc_guide" type="hidden" value="API Reference" />
<input name="doc_locale" type="hidden" value="en_us" />
</form>
</div>
<!-- END-SECTION -->
<!-- BEGIN-FEEDBACK-SECTION -->
<div id="feedback-section">
<h3>Did this page help you?</h3>
<div id="feedback-link-sectioin">
<a id="feedback_yes" target="_blank" style="display:inline;">Yes</a>
<a id="feedback_no" target="_blank" style="display:inline;">No</a>
<a id="go_cti" target="_blank" style="display:inline;">Tell us about it...</a>
</div>
</div>
<script type="text/javascript">
window.onload = function(){
/* Dynamically add feedback links */
var javadoc_root_name = "/javadoc/";
var javadoc_path = location.href.substring(0, location.href.lastIndexOf(javadoc_root_name) + javadoc_root_name.length);
var file_path = location.href.substring(location.href.lastIndexOf(javadoc_root_name) + javadoc_root_name.length);
var feedback_yes_url = javadoc_path + "javadoc-resources/feedbackyes.html?topic_id=";
var feedback_no_url = javadoc_path + "javadoc-resources/feedbackno.html?topic_id=";
var feedback_tellmore_url = "https://aws-portal.amazon.com/gp/aws/html-forms-controller/documentation/aws_doc_feedback_04?service_name=Java-Ref&file_name=";
if(file_path != "overview-frame.html") {
var file_name = file_path.replace(/[/.]/g, '_');
document.getElementById("feedback_yes").setAttribute("href", feedback_yes_url + file_name);
document.getElementById("feedback_no").setAttribute("href", feedback_no_url + file_name);
document.getElementById("go_cti").setAttribute("href", feedback_tellmore_url + file_name);
} else {
// hide the search box and the feeback links in overview-frame page,
// show "AWS SDK for Java" instead.
document.getElementById("feedback-section").outerHTML = "AWS SDK for Java";
document.getElementById("divsearch").outerHTML = "";
}
};
</script>
<!-- END-FEEDBACK-SECTION -->
</div>
</em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.ConfigureHadoop.html" title="class in com.amazonaws.services.elasticmapreduce.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/ResizeJobFlowStep.html" title="class in com.amazonaws.services.elasticmapreduce.util"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" target="_top">Frames</a></li>
<li><a href="BootstrapActions.Daemon.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#enum_constant_summary">Enum Constants</a> | </li>
<li>Field | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#enum_constant_detail">Enum Constants</a> | </li>
<li>Field | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.amazonaws.services.elasticmapreduce.util</div>
<h2 title="Enum BootstrapActions.Daemon" class="title">Enum BootstrapActions.Daemon</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>java.lang.Enum<<a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a>></li>
<li>
<ul class="inheritance">
<li>com.amazonaws.services.elasticmapreduce.util.BootstrapActions.Daemon</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable, java.lang.Comparable<<a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a>></dd>
</dl>
<dl>
<dt>Enclosing class:</dt>
<dd><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.html" title="class in com.amazonaws.services.elasticmapreduce.util">BootstrapActions</a></dd>
</dl>
<hr>
<br>
<pre>public static enum <span class="strong">BootstrapActions.Daemon</span>
extends java.lang.Enum<<a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a>></pre>
<div class="block">List of Hadoop daemons which can be configured.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== ENUM CONSTANT SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="enum_constant_summary">
<!-- -->
</a>
<h3>Enum Constant Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Constant Summary table, listing enum constants, and an explanation">
<caption><span>Enum Constants</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Enum Constant and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html#Client">Client</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html#DataNode">DataNode</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html#JobTracker">JobTracker</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html#NameNode">NameNode</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html#TaskTracker">TaskTracker</a></strong></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html#valueOf(java.lang.String)">valueOf</a></strong>(java.lang.String name)</code>
<div class="block">Returns the enum constant of this type with the specified name.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html#values()">values</a></strong>()</code>
<div class="block">Returns an array containing the constants of this enum type, in
the order they are declared.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Enum">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Enum</h3>
<code>compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>getClass, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ ENUM CONSTANT DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="enum_constant_detail">
<!-- -->
</a>
<h3>Enum Constant Detail</h3>
<a name="NameNode">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>NameNode</h4>
<pre>public static final <a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a> NameNode</pre>
</li>
</ul>
<a name="DataNode">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DataNode</h4>
<pre>public static final <a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a> DataNode</pre>
</li>
</ul>
<a name="JobTracker">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>JobTracker</h4>
<pre>public static final <a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a> JobTracker</pre>
</li>
</ul>
<a name="TaskTracker">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>TaskTracker</h4>
<pre>public static final <a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a> TaskTracker</pre>
</li>
</ul>
<a name="Client">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Client</h4>
<pre>public static final <a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a> Client</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="values()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>values</h4>
<pre>public static <a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a>[] values()</pre>
<div class="block">Returns an array containing the constants of this enum type, in
the order they are declared. This method may be used to iterate
over the constants as follows:
<pre>
for (BootstrapActions.Daemon c : BootstrapActions.Daemon.values())
System.out.println(c);
</pre></div>
<dl><dt><span class="strong">Returns:</span></dt><dd>an array containing the constants of this enum type, in the order they are declared</dd></dl>
</li>
</ul>
<a name="valueOf(java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>valueOf</h4>
<pre>public static <a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" title="enum in com.amazonaws.services.elasticmapreduce.util">BootstrapActions.Daemon</a> valueOf(java.lang.String name)</pre>
<div class="block">Returns the enum constant of this type with the specified name.
The string must match <i>exactly</i> an identifier used to declare an
enum constant in this type. (Extraneous whitespace characters are
not permitted.)</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - the name of the enum constant to be returned.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the enum constant with the specified name</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if this enum type has no constant with the specified name</dd>
<dd><code>java.lang.NullPointerException</code> - if the argument is null</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em>
<div>
<!-- Script for Syntax Highlighter START -->
<script type="text/javascript">
SyntaxHighlighter.all()
</script>
<!-- Script for Syntax Highlighter END -->
</div>
<script src="http://a0.awsstatic.com/chrome/js/1.0.46/jquery.1.9.js" type="text/javascript"></script>
<script>jQuery.noConflict();</script>
<script>
jQuery(function ($) {
$("div.header").prepend('<!--REGION_DISCLAIMER_DO_NOT_REMOVE-->');
});
</script>
<!-- BEGIN-URCHIN-TRACKER -->
<script src="http://l0.awsstatic.com/js/urchin.js" type="text/javascript"></script>
<script type="text/javascript">urchinTracker();</script>
<!-- END-URCHIN-TRACKER -->
<!-- SiteCatalyst code version: H.25.2. Copyright 1996-2012 Adobe, Inc. All Rights Reserved.
More info available at http://www.omniture.com -->
<script language="JavaScript" type="text/javascript" src="https://media.amazonwebservices.com/js/sitecatalyst/s_code.min.js (view-source:https://media.amazonwebservices.com/js/sitecatalyst/s_code.min.js)" />
<script language="JavaScript" type="text/javascript">
<!--
// Documentation Service Name
s.prop66='AWS SDK for Java';
s.eVar66='D=c66';
// Documentation Guide Name
s.prop65='API Reference';
s.eVar65='D=c65';
var s_code=s.t();if(s_code)document.write(s_code)
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-')
//-->
</script>
<noscript>
<img src="http://amazonwebservices.d2.sc.omtrdc.net/b/ss/awsamazondev/1/H.25.2--NS/0" height="1" width="1" border="0" alt="" />
</noscript>
<!--/DO NOT REMOVE/-->
<!-- End SiteCatalyst code version: H.25.2. -->
</em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/BootstrapActions.ConfigureHadoop.html" title="class in com.amazonaws.services.elasticmapreduce.util"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../com/amazonaws/services/elasticmapreduce/util/ResizeJobFlowStep.html" title="class in com.amazonaws.services.elasticmapreduce.util"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html" target="_top">Frames</a></li>
<li><a href="BootstrapActions.Daemon.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#enum_constant_summary">Enum Constants</a> | </li>
<li>Field | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#enum_constant_detail">Enum Constants</a> | </li>
<li>Field | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.
</small></p>
</body>
</html>
| {'content_hash': '7771a05981295d4a5f57f8343f877a45', 'timestamp': '', 'source': 'github', 'line_count': 478, 'max_line_length': 258, 'avg_line_length': 45.49163179916318, 'alnum_prop': 0.6346286502644286, 'repo_name': 'TomNong/Project2-Intel-Edison', 'id': '0656aebc3178bf9b4c70ffb4909ba8625e364e83', 'size': '21745', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'documentation/javadoc/com/amazonaws/services/elasticmapreduce/util/BootstrapActions.Daemon.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '5522'}]} |
.. Auto-generated by help-rst from "mirtk open-scalars -h" output
.. |open-scalars-brief-description| replace::
Opens scalar data of an input point set by perfoming an erosion
followed by the same number of dilations. When the input data array
has more than one component, each component is processed separately.
| {'content_hash': '9ff0b21dd2ef010183259e1d462f97e3', 'timestamp': '', 'source': 'github', 'line_count': 7, 'max_line_length': 71, 'avg_line_length': 46.285714285714285, 'alnum_prop': 0.7623456790123457, 'repo_name': 'schuhschuh/MIRTK', 'id': '3d4ecdd5cf5c24114e4c0abb51bf746ef14626d1', 'size': '324', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'Documentation/commands/_summaries/open-scalars.rst', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '1226'}, {'name': 'C', 'bytes': '22955'}, {'name': 'C++', 'bytes': '14908108'}, {'name': 'CMake', 'bytes': '1262915'}, {'name': 'Dockerfile', 'bytes': '7098'}, {'name': 'Python', 'bytes': '232475'}, {'name': 'Shell', 'bytes': '24544'}]} |
<input name='button' ='' value="detect me"> | {'content_hash': 'c95dc94753f75e301c4a9e37517d25a2', 'timestamp': '', 'source': 'github', 'line_count': 1, 'max_line_length': 43, 'avg_line_length': 43.0, 'alnum_prop': 0.6511627906976745, 'repo_name': 'HtmlUnit/htmlunit-neko', 'id': 'ac368d5aba6e965e409e1c52454245d44f285f88', 'size': '43', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/test/resources/error-handling/test-broken-attribute1.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '51224'}, {'name': 'Java', 'bytes': '2509522'}]} |
package com.goodworkalan.spawn;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
/**
* Used when an output stream needs to be translated into an input stream to be
* read by code expecting an input stream of a pipline output. This is
* implemented using <code>PipedInputStream</code> and
* <code>PipedOutputStream</code> so the reader needs to be in a separate thread
* from the writer.
*
* @author Alan Gutierrez
*
*/
class MissingProcess extends AbstractProgram {
/** The piped input stream. */
private final PipedInputStream in;
/** The piped output stream. */
private final PipedOutputStream out;
/** Create a missing process. */
public MissingProcess() {
try {
this.in = new PipedInputStream();
this.out = new PipedOutputStream(this.in);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* Get the piped input stream.
*
* @return The piped input stream.
*/
public InputStream getInputStream() {
return in;
}
/**
* Get the piped output stream.
*
* @return The piped output stream.
*/
public OutputStream getOutputStream() {
return out;
}
}
| {'content_hash': 'ca0e717a62e33d0318e6efd97dafa9bb', 'timestamp': '', 'source': 'github', 'line_count': 53, 'max_line_length': 80, 'avg_line_length': 25.67924528301887, 'alnum_prop': 0.639235855988244, 'repo_name': 'defunct/spawn', 'id': 'b02f1c6859f667ad65ce5a10f8a579725821156b', 'size': '1361', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/goodworkalan/spawn/MissingProcess.java', 'mode': '33188', 'license': 'mit', 'language': []} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Opredelitel' trutovykh gribov Belorussii 89 (1964)
#### Original name
Tyromyces albellus f. aurantiacus Komarova
### Remarks
null | {'content_hash': '530afb0b88698eb71c5665de97b5a9e3', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 50, 'avg_line_length': 14.846153846153847, 'alnum_prop': 0.7512953367875648, 'repo_name': 'mdoering/backbone', 'id': '8f298b6de8a621d2a4b1c1a2bcbbecf008a8de37', 'size': '258', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Fungi/Basidiomycota/Agaricomycetes/Polyporales/Polyporaceae/Tyromyces/Tyromyces aurantiacus/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
| {'content_hash': '7eedcf6e8f0e819a6b2bb672179025b8', 'timestamp': '', 'source': 'github', 'line_count': 7, 'max_line_length': 60, 'avg_line_length': 16.857142857142858, 'alnum_prop': 0.7796610169491526, 'repo_name': 'gzios/SystemLearn', 'id': '42f55ead6bf34b296569f5d0a6304745051f6205', 'size': '264', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Block/Block/AppDelegate.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '2017844'}, {'name': 'Go', 'bytes': '1235'}, {'name': 'HTML', 'bytes': '1929'}, {'name': 'M4', 'bytes': '33730'}, {'name': 'Makefile', 'bytes': '13860'}, {'name': 'Objective-C', 'bytes': '851901'}, {'name': 'Python', 'bytes': '7805'}, {'name': 'Roff', 'bytes': '28115'}, {'name': 'Ruby', 'bytes': '2090'}, {'name': 'Shell', 'bytes': '11957'}, {'name': 'Swift', 'bytes': '72870'}]} |
<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
<status>OK</status>
<result>
<type>locality</type>
<type>political</type>
<formatted_address>8756 Sankt Georgen ob Judenburg, Austria</formatted_address>
<address_component>
<long_name>Sankt Georgen ob Judenburg</long_name>
<short_name>Sankt Georgen ob Judenburg</short_name>
<type>locality</type>
<type>political</type>
</address_component>
<address_component>
<long_name>Gemeinde Sankt Georgen ob Judenburg</long_name>
<short_name>Gemeinde St. Georgen ob Judenburg</short_name>
<type>administrative_area_level_3</type>
<type>political</type>
</address_component>
<address_component>
<long_name>Judenburg</long_name>
<short_name>Judenburg</short_name>
<type>administrative_area_level_2</type>
<type>political</type>
</address_component>
<address_component>
<long_name>Styria</long_name>
<short_name>Styria</short_name>
<type>administrative_area_level_1</type>
<type>political</type>
</address_component>
<address_component>
<long_name>Austria</long_name>
<short_name>AT</short_name>
<type>country</type>
<type>political</type>
</address_component>
<address_component>
<long_name>8756</long_name>
<short_name>8756</short_name>
<type>postal_code</type>
</address_component>
<geometry>
<location>
<lat>47.2060000</lat>
<lng>14.4984000</lng>
</location>
<location_type>APPROXIMATE</location_type>
<viewport>
<southwest>
<lat>47.1984191</lat>
<lng>14.4823926</lng>
</southwest>
<northeast>
<lat>47.2135798</lat>
<lng>14.5144074</lng>
</northeast>
</viewport>
</geometry>
<place_id>ChIJd4BzHt8HNhQREVGoPRATeNI</place_id>
</result>
</GeocodeResponse>
| {'content_hash': 'fc7e36391f215323f33f41cef45d43f3', 'timestamp': '', 'source': 'github', 'line_count': 62, 'max_line_length': 81, 'avg_line_length': 28.532258064516128, 'alnum_prop': 0.6823063877897118, 'repo_name': 'linkeddatalab/statspace', 'id': '65c587cdda1be64e019e1206a64b6fcddcaf130a', 'size': '1769', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'data/datasources/ogd.ifs.tuwien.ac.at_sparql/areas/62000_62026.xml', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '24977'}, {'name': 'HTML', 'bytes': '245851'}, {'name': 'Java', 'bytes': '1177495'}]} |
define(["three"], function(THREE) {
var renderer = new THREE.WebGLRenderer({
clearColor: 0x000000,
antialiasing: true
});
renderer.setSize(1920, 1080);
document.body.appendChild(renderer.domElement);
return renderer;
});
| {'content_hash': '1e62d3fee23ee871857b2c6fc6d04f76', 'timestamp': '', 'source': 'github', 'line_count': 10, 'max_line_length': 51, 'avg_line_length': 25.8, 'alnum_prop': 0.6511627906976745, 'repo_name': 'IndigoDemo/IndiWorks', 'id': '6a3f381294bfa0b4c0a03e8dc70cbbc8bde4c364', 'size': '258', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'js/app/renderer.js', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '145'}, {'name': 'GLSL', 'bytes': '452'}, {'name': 'HTML', 'bytes': '326'}, {'name': 'JavaScript', 'bytes': '62756'}, {'name': 'Python', 'bytes': '606'}]} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sentience.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sentience.Tests")]
[assembly: AssemblyCopyright("Copyright © Andreas Håkansson 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("901858e5-0f30-49a4-9e70-4bb78c3460f0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {'content_hash': '060e58611e6bd8c36fdb2f51383a9f70', 'timestamp': '', 'source': 'github', 'line_count': 36, 'max_line_length': 84, 'avg_line_length': 40.44444444444444, 'alnum_prop': 0.7287087912087912, 'repo_name': 'thecodejunkie/sentience', 'id': 'c1439255bd1db35b473347b737e466b0529efccd', 'size': '1460', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Sentience.Tests/Properties/AssemblyInfo.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '21278'}]} |
<?php if(!defined('KIRBY')) exit ?>
title: Section Cover
pages: false
files: true
fields:
title:
label: Title
type: text
coversubtitle:
label: Cover Subtitle
type: textarea
coverbtn:
label: Cover Button Text
type: text
coverbtnlink:
label: Cover Button Link
type: text
coverpic:
label: Cover Picture
type: select
options: images | {'content_hash': '535cc4913681210cefea12b96307de20', 'timestamp': '', 'source': 'github', 'line_count': 22, 'max_line_length': 35, 'avg_line_length': 17.454545454545453, 'alnum_prop': 0.6588541666666666, 'repo_name': 'dioptre/diym', 'id': 'c32d53cf246b979290f0befc77e15f6c37d8fdc7', 'size': '384', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'site/blueprints/sectioncover.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '1254'}, {'name': 'CSS', 'bytes': '1651345'}, {'name': 'HTML', 'bytes': '432116'}, {'name': 'JavaScript', 'bytes': '5635658'}, {'name': 'PHP', 'bytes': '1039710'}, {'name': 'Ruby', 'bytes': '6736'}]} |
/**
* This file/module contains all configuration for the build process.
*/
module.exports = {
/**
* The `build_dir` folder is where our projects are compiled during
* development and the `compile_dir` folder is where our app resides once it's
* completely built.
*/
build_dir: 'build',
compile_dir: 'dist',
mopidy_package_dir: 'mopidy_mopify',
/**
* This is a collection of file patterns that refer to our app code (the
* stuff in `src/`). These file paths are used in the configuration of
* build tasks. `js` is all project javascript, less tests. `ctpl` contains
* our reusable components' (`src/common`) template HTML files, while
* `atpl` contains the same, but for our app's code. `html` is just our
* main HTML file, `less` is our main stylesheet, and `unit` contains our
* app's unit tests.
*/
app_files: {
js: [ 'src/app/**/*.js' ],
css: [ 'src/css/**/*.css' ],
atpl: [ 'src/app/**/*.tmpl.html' ],
html: [ 'src/index.html' ]
},
/**
* This is the same as `app_files`, except it contains patterns that
* reference vendor code (`vendor/`) that we need to place into the build
* process somewhere. While the `app_files` property ensures all
* standardized files are collected for compilation, it is the user's job
* to ensure non-standardized (i.e. vendor-related) files are handled
* appropriately in `vendor_files.js`.
*
* The `vendor_files.js` property holds files to be automatically
* concatenated and minified with our project source files.
*
* The `vendor_files.css` property holds any CSS files to be automatically
* included in our app.
*
* The `vendor_files.assets` property holds any assets to be copied along
* with our app's assets. This structure is flattened, so it is not
* recommended that you use wildcards.
*/
vendor_files: {
js: [
'src/vendor/mopidy/mopidy.js',
'src/vendor/angular/angular.js',
'src/vendor/angular-route/angular-route.js',
'src/vendor/angular-local-storage/dist/angular-local-storage.js',
'src/vendor/angular-echonest/src/angular-echonest.js',
'src/vendor/angular-loading-bar/src/loading-bar.js',
'src/vendor/angular-sanitize/angular-sanitize.js',
'src/vendor/ng-context-menu/dist/ng-context-menu.js',
'src/vendor/angular-animate/angular-animate.min.js',
'src/vendor/angular-notifier/dist/angular-notifier.min.js',
'src/vendor/angular-spotify/src/angular-spotify.js',
'src/vendor/underscore/underscore-min.js',
'src/vendor/ngInfiniteScroll/build/ng-infinite-scroll.min.js',
'src/vendor/angular-bootstrap/ui-bootstrap-tpls.min.js',
'src/vendor/angular-prompt/dist/angular-prompt.js',
'src/vendor/angular-toggle-switch/angular-toggle-switch.min.js',
'src/vendor/hammerjs/hammer.js',
'src/vendor/ryanmullins-angular-hammer/angular.hammer.js',
'src/vendor/angular-hotkeys/build/hotkeys.js'
],
css: [
'src/vendor/html5-boilerplate/css/normalize.css',
'src/vendor/html5-boilerplate/css/main.css',
'src/vendor/angular-loading-bar/src/loading-bar.css',
'src/vendor/angular-notifier/dist/angular-notifier.css',
'src/vendor/angular-toggle-switch/angular-toggle-switch.css',
'src/vendor/angular-hotkeys/build/hotkeys.css'
],
assets: [
],
fonts: [
'src/assets/webfonts/ss-standard.*'
]
},
};
| {'content_hash': 'b0afda5bf0da721c28cad4cd49dd6463', 'timestamp': '', 'source': 'github', 'line_count': 87, 'max_line_length': 82, 'avg_line_length': 43.08045977011494, 'alnum_prop': 0.6189967982924226, 'repo_name': 'dbrgn/mopidy-mopify', 'id': '9838bb744df4795cefa87b6159685ab33b3fca67', 'size': '3748', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'build.config.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '199559'}, {'name': 'HTML', 'bytes': '310154'}, {'name': 'JavaScript', 'bytes': '537300'}, {'name': 'Python', 'bytes': '14635'}]} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("03. JSON Parse")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("03. JSON Parse")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("41bc9e5c-4ff9-4d12-b4fb-51aa67a7aa7e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {'content_hash': '0663c74d1871d9a1b874915d95c4a833', 'timestamp': '', 'source': 'github', 'line_count': 36, 'max_line_length': 84, 'avg_line_length': 38.77777777777778, 'alnum_prop': 0.744269340974212, 'repo_name': 'spiderbait90/Step-By-Step-In-Coding', 'id': '80f29b828a69457f383332ef08d73d15c7991817', 'size': '1399', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Programming Fundamentals/Strings and Text/03. JSON Parse/Properties/AssemblyInfo.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP', 'bytes': '106'}, {'name': 'C#', 'bytes': '1601570'}, {'name': 'CSS', 'bytes': '513'}, {'name': 'HTML', 'bytes': '5127'}, {'name': 'JavaScript', 'bytes': '10918'}, {'name': 'Smalltalk', 'bytes': '1516'}]} |
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/matplotlib2tikz.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/matplotlib2tikz.qhc"
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
| {'content_hash': 'b25b423f73d44f3bbaf83eac91c62fc3', 'timestamp': '', 'source': 'github', 'line_count': 85, 'max_line_length': 91, 'avg_line_length': 35.90588235294118, 'alnum_prop': 0.7031454783748362, 'repo_name': 'danielhkl/matplotlib2tikz', 'id': 'cb99cd76fec39cc09c6d6684161dd5c73e172331', 'size': '3144', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'doc/Makefile', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Makefile', 'bytes': '654'}, {'name': 'Python', 'bytes': '150161'}]} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2010 - 2014 JBoss by Red Hat
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
-->
<features name="fabric-${project.version}"
xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
<feature name="fabric8" version="${project.version}" resolver="(obr)">
<feature>curator</feature>
<feature>gravia</feature>
<bundle>mvn:io.fabric8.poc/fabric8-api/${project.version}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-container-karaf-attributes/${project.version}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-container-karaf-managed/${project.version}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-container-tomcat-managed/${project.version}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-container-wildfly-connector/${project.version}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-container-wildfly-managed/${project.version}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-core/${project.version}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-domain-agent/${project.version}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-git/${project.version}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-spi/${project.version}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-jolokia/${project.version}</bundle>
</feature>
<feature name="curator" version="${project.version}" resolver="(obr)">
<bundle dependency="true">mvn:com.google.guava/guava/${version.guava}</bundle>
<bundle>mvn:io.fabric8.poc/fabric8-zookeeper/${project.version}</bundle>
<bundle>mvn:org.apache.curator/curator-client/${version.apache.curator}</bundle>
<bundle>mvn:org.apache.curator/curator-framework/${version.apache.curator}</bundle>
<bundle>mvn:org.apache.curator/curator-recipes/${version.apache.curator}</bundle>
</feature>
<feature name="gravia" version="${project.version}" resolver="(obr)">
<bundle dependency="true">mvn:org.apache.commons/commons-compress/${version.apache.commons.compress}</bundle>
<bundle dependency="true">mvn:org.apache.felix/org.apache.felix.eventadmin/${version.apache.felix.eventadmin}</bundle>
<bundle dependency="true">mvn:org.apache.felix/org.apache.felix.scr/${version.apache.felix.scr}</bundle>
<bundle dependency="true">mvn:org.apache.felix/org.apache.felix.metatype/${version.apache.felix.metatype}</bundle>
<bundle dependency="true">mvn:org.apache.felix/org.apache.felix.http.bundle/${version.apache.felix.http}</bundle>
<bundle>mvn:org.jboss.gravia/gravia-provision/${version.jboss.gravia}</bundle>
<bundle>mvn:org.jboss.gravia/gravia-resolver/${version.jboss.gravia}</bundle>
<bundle>mvn:org.jboss.gravia/gravia-resource/${version.jboss.gravia}</bundle>
<bundle>mvn:org.jboss.gravia/gravia-repository/${version.jboss.gravia}</bundle>
<bundle>mvn:org.jboss.gravia/gravia-runtime-api/${version.jboss.gravia}</bundle>
<bundle>mvn:org.jboss.gravia/gravia-runtime-osgi/${version.jboss.gravia}</bundle>
</feature>
</features>
| {'content_hash': '0d52142c6e626ee29fac797b1f0157da', 'timestamp': '', 'source': 'github', 'line_count': 57, 'max_line_length': 126, 'avg_line_length': 62.89473684210526, 'alnum_prop': 0.7087866108786611, 'repo_name': 'tdiesler/fabric8poc', 'id': '59042bf61973022bdac1d54bf5c1f2c41a608952', 'size': '3585', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'container/karaf/features/src/main/resources/features.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '1142765'}, {'name': 'Shell', 'bytes': '2680'}]} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {'content_hash': 'c468265b44720a7d4f166720f87da78f', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 31, 'avg_line_length': 9.692307692307692, 'alnum_prop': 0.7063492063492064, 'repo_name': 'mdoering/backbone', 'id': 'f02ba78b1a3e0f7f3657152fe359c0cd0e58d05e', 'size': '179', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Saxifragales/Saxifragaceae/Micranthes/Micranthes sachalinensis/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
<idea-plugin version="2">
<id>com.behindthewires.intellij.fitnesse</id>
<name>Fitnesse Plugin</name>
<version>1.0</version>
<description><![CDATA[
Enter short description for your plugin here.<br>
<em>most HTML tags may be used</em>
]]></description>
<change-notes><![CDATA[
Add change notes here.<br>
<em>most HTML tags may be used</em>
]]>
</change-notes>
<!-- please see http://confluence.jetbrains.com/display/IDEADEV/Build+Number+Ranges for description -->
<idea-version since-build="131"/>
<!-- please see http://confluence.jetbrains.com/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
on how to target different products -->
<!-- uncomment to enable plugin in all products
<depends>com.intellij.modules.lang</depends>
-->
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<fileTypeFactory implementation="com.behindthewires.intellij.fitnesse.lang.FitnesseFileTypeFactory"/>
</extensions>
<application-components>
<!-- Add your application components here -->
</application-components>
<project-components>
<!-- Add your project components here -->
</project-components>
<actions>
<!-- Add your actions here -->
</actions>
</idea-plugin> | {'content_hash': '25be5e00abd00ea7d2bc2dc30eaf6f49', 'timestamp': '', 'source': 'github', 'line_count': 43, 'max_line_length': 118, 'avg_line_length': 30.348837209302324, 'alnum_prop': 0.6865900383141762, 'repo_name': 'chrisjgell/intj-fitnesse', 'id': '7109c4efa7c555629f8f3b26c8f304295c1c1ea9', 'size': '1305', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'META-INF/plugin.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '2784'}]} |
__version__=''' $Id$ '''
__doc__="""Experimental class to generate Tables of Contents easily
This module defines a single TableOfContents() class that can be used to
create automatically a table of tontents for Platypus documents like
this:
story = []
toc = TableOfContents()
story.append(toc)
# some heading paragraphs here...
doc = MyTemplate(path)
doc.multiBuild(story)
The data needed to create the table is a list of (level, text, pageNum)
triplets, plus some paragraph styles for each level of the table itself.
The triplets will usually be created in a document template's method
like afterFlowable(), making notification calls using the notify()
method with appropriate data like this:
(level, text, pageNum) = ...
self.notify('TOCEntry', (level, text, pageNum))
Optionally the list can contain four items in which case the last item
is a destination key which the entry should point to. A bookmark
with this key needs to be created first like this:
key = 'ch%s' % self.seq.nextf('chapter')
self.canv.bookmarkPage(key)
self.notify('TOCEntry', (level, text, pageNum, key))
As the table of contents need at least two passes over the Platypus
story which is why the moultiBuild0() method must be called.
The level<NUMBER>ParaStyle variables are the paragraph styles used
to format the entries in the table of contents. Their indentation
is calculated like this: each entry starts at a multiple of some
constant named delta. If one entry spans more than one line, all
lines after the first are indented by the same constant named
epsilon.
"""
from reportlab.lib import enums
from reportlab.lib.units import cm
from reportlab.lib.utils import commasplit, escapeOnce, encode_label, decode_label, strTypes
from reportlab.lib.styles import ParagraphStyle, _baseFontName
from reportlab.platypus.paragraph import Paragraph
from reportlab.platypus.doctemplate import IndexingFlowable
from reportlab.platypus.tables import TableStyle, Table
from reportlab.platypus.flowables import Spacer, Flowable
from reportlab.pdfbase.pdfmetrics import stringWidth
from reportlab.pdfgen import canvas
def unquote(txt):
from xml.sax.saxutils import unescape
return unescape(txt, {"'": "'", """: '"'})
try:
set
except:
class set(list):
def add(self,x):
if x not in self:
list.append(self,x)
def drawPageNumbers(canvas, style, pages, availWidth, availHeight, dot=' . '):
'''
Draws pagestr on the canvas using the given style.
If dot is None, pagestr is drawn at the current position in the canvas.
If dot is a string, pagestr is drawn right-aligned. If the string is not empty,
the gap is filled with it.
'''
pages.sort()
pagestr = ', '.join([str(p) for p, _ in pages])
x, y = canvas._curr_tx_info['cur_x'], canvas._curr_tx_info['cur_y']
fontSize = style.fontSize
pagestrw = stringWidth(pagestr, style.fontName, fontSize)
#if it's too long to fit, we need to shrink to fit in 10% increments.
#it would be very hard to output multiline entries.
#however, we impose a minimum size of 1 point as we don't want an
#infinite loop. Ultimately we should allow a TOC entry to spill
#over onto a second line if needed.
freeWidth = availWidth-x
while pagestrw > freeWidth and fontSize >= 1.0:
fontSize = 0.9 * fontSize
pagestrw = stringWidth(pagestr, style.fontName, fontSize)
if isinstance(dot, strTypes):
if dot:
dotw = stringWidth(dot, style.fontName, fontSize)
dotsn = int((availWidth-x-pagestrw)/dotw)
else:
dotsn = dotw = 0
text = '%s%s' % (dotsn * dot, pagestr)
newx = availWidth - dotsn*dotw - pagestrw
pagex = availWidth - pagestrw
elif dot is None:
text = ', ' + pagestr
newx = x
pagex = newx
else:
raise TypeError('Argument dot should either be None or an instance of basestring.')
tx = canvas.beginText(newx, y)
tx.setFont(style.fontName, fontSize)
tx.setFillColor(style.textColor)
tx.textLine(text)
canvas.drawText(tx)
commaw = stringWidth(', ', style.fontName, fontSize)
for p, key in pages:
if not key:
continue
w = stringWidth(str(p), style.fontName, fontSize)
canvas.linkRect('', key, (pagex, y, pagex+w, y+style.leading), relative=1)
pagex += w + commaw
# Default paragraph styles for tables of contents.
# (This could also be generated automatically or even
# on-demand if it is not known how many levels the
# TOC will finally need to display...)
delta = 1*cm
epsilon = 0.5*cm
defaultLevelStyles = [
ParagraphStyle(
name='Level 0',
fontName=_baseFontName,
fontSize=10,
leading=11,
firstLineIndent = 0,
leftIndent = epsilon)]
defaultTableStyle = \
TableStyle([
('VALIGN', (0,0), (-1,-1), 'TOP'),
('RIGHTPADDING', (0,0), (-1,-1), 0),
('LEFTPADDING', (0,0), (-1,-1), 0),
])
class TableOfContents(IndexingFlowable):
"""This creates a formatted table of contents.
It presumes a correct block of data is passed in.
The data block contains a list of (level, text, pageNumber)
triplets. You can supply a paragraph style for each level
(starting at zero).
Set dotsMinLevel to determine from which level on a line of
dots should be drawn between the text and the page number.
If dotsMinLevel is set to a negative value, no dotted lines are drawn.
"""
def __init__(self):
self.rightColumnWidth = 72
self.levelStyles = defaultLevelStyles
self.tableStyle = defaultTableStyle
self.dotsMinLevel = 1
self._table = None
self._entries = []
self._lastEntries = []
def beforeBuild(self):
# keep track of the last run
self._lastEntries = self._entries[:]
self.clearEntries()
def isIndexing(self):
return 1
def isSatisfied(self):
return (self._entries == self._lastEntries)
def notify(self, kind, stuff):
"""The notification hook called to register all kinds of events.
Here we are interested in 'TOCEntry' events only.
"""
if kind == 'TOCEntry':
self.addEntry(*stuff)
def clearEntries(self):
self._entries = []
def getLevelStyle(self, n):
'''Returns the style for level n, generating and caching styles on demand if not present.'''
try:
return self.levelStyles[n]
except IndexError:
prevstyle = self.getLevelStyle(n-1)
self.levelStyles.append(ParagraphStyle(
name='%s-%d-indented' % (prevstyle.name, n),
parent=prevstyle,
firstLineIndent = prevstyle.firstLineIndent+delta,
leftIndent = prevstyle.leftIndent+delta))
return self.levelStyles[n]
def addEntry(self, level, text, pageNum, key=None):
"""Adds one entry to the table of contents.
This allows incremental buildup by a doctemplate.
Requires that enough styles are defined."""
assert type(level) == type(1), "Level must be an integer"
self._entries.append((level, text, pageNum, key))
def addEntries(self, listOfEntries):
"""Bulk creation of entries in the table of contents.
If you knew the titles but not the page numbers, you could
supply them to get sensible output on the first run."""
for entryargs in listOfEntries:
self.addEntry(*entryargs)
def wrap(self, availWidth, availHeight):
"All table properties should be known by now."
# makes an internal table which does all the work.
# we draw the LAST RUN's entries! If there are
# none, we make some dummy data to keep the table
# from complaining
if len(self._lastEntries) == 0:
_tempEntries = [(0,'Placeholder for table of contents',0,None)]
else:
_tempEntries = self._lastEntries
def drawTOCEntryEnd(canvas, kind, label):
'''Callback to draw dots and page numbers after each entry.'''
label = label.split(',')
page, level, key = int(label[0]), int(label[1]), eval(label[2],{})
style = self.getLevelStyle(level)
if self.dotsMinLevel >= 0 and level >= self.dotsMinLevel:
dot = ' . '
else:
dot = ''
drawPageNumbers(canvas, style, [(page, key)], availWidth, availHeight, dot)
self.canv.drawTOCEntryEnd = drawTOCEntryEnd
tableData = []
for (level, text, pageNum, key) in _tempEntries:
style = self.getLevelStyle(level)
if key:
text = '<a href="#%s">%s</a>' % (key, text)
keyVal = repr(key).replace(',','\\x2c').replace('"','\\x2c')
else:
keyVal = None
para = Paragraph('%s<onDraw name="drawTOCEntryEnd" label="%d,%d,%s"/>' % (text, pageNum, level, keyVal), style)
if style.spaceBefore:
tableData.append([Spacer(1, style.spaceBefore),])
tableData.append([para,])
self._table = Table(tableData, colWidths=(availWidth,), style=self.tableStyle)
self.width, self.height = self._table.wrapOn(self.canv,availWidth, availHeight)
return (self.width, self.height)
def split(self, availWidth, availHeight):
"""At this stage we do not care about splitting the entries,
we will just return a list of platypus tables. Presumably the
calling app has a pointer to the original TableOfContents object;
Platypus just sees tables.
"""
return self._table.splitOn(self.canv,availWidth, availHeight)
def drawOn(self, canvas, x, y, _sW=0):
"""Don't do this at home! The standard calls for implementing
draw(); we are hooking this in order to delegate ALL the drawing
work to the embedded table object.
"""
self._table.drawOn(canvas, x, y, _sW)
def makeTuple(x):
if hasattr(x, '__iter__'):
return tuple(x)
return (x,)
class SimpleIndex(IndexingFlowable):
"""Creates multi level indexes.
The styling can be cutomized and alphabetic headers turned on and off.
"""
def __init__(self, **kwargs):
"""
Constructor of SimpleIndex.
Accepts the same arguments as the setup method.
"""
#keep stuff in a dictionary while building
self._entries = {}
self._lastEntries = {}
self._flowable = None
self.setup(**kwargs)
def getFormatFunc(self,format):
try:
D = {}
exec('from reportlab.lib.sequencer import _format_%s as formatFunc' % format, D)
return D['formatFunc']
except ImportError:
raise ValueError('Unknown format %r' % format)
def setup(self, style=None, dot=None, tableStyle=None, headers=True, name=None, format='123', offset=0):
"""
This method makes it possible to change styling and other parameters on an existing object.
style is the paragraph style to use for index entries.
dot can either be None or a string. If it's None, entries are immediatly followed by their
corresponding page numbers. If it's a string, page numbers are aligned on the right side
of the document and the gap filled with a repeating sequence of the string.
tableStyle is the style used by the table which the index uses to draw itself. Use this to
change properties like spacing between elements.
headers is a boolean. If it is True, alphabetic headers are displayed in the Index when the first
letter changes. If False, we just output some extra space before the next item
name makes it possible to use several indexes in one document. If you want this use this
parameter to give each index a unique name. You can then index a term by refering to the
name of the index which it should appear in:
<index item="term" name="myindex" />
format can be 'I', 'i', '123', 'ABC', 'abc'
"""
if style is None:
style = ParagraphStyle(name='index',
fontName=_baseFontName,
fontSize=11)
self.textStyle = style
self.tableStyle = tableStyle or defaultTableStyle
self.dot = dot
self.headers = headers
if name is None:
from reportlab.platypus.paraparser import DEFAULT_INDEX_NAME as name
self.name = name
self.formatFunc = self.getFormatFunc(format)
self.offset = offset
def __call__(self,canv,kind,label):
try:
terms, format, offset = decode_label(label)
except:
terms = label
format = offset = None
if format is None:
formatFunc = self.formatFunc
else:
formatFunc = self.getFormatFunc(format)
if offset is None:
offset = self.offset
terms = commasplit(terms)
pns = formatFunc(canv.getPageNumber()-offset)
key = 'ix_%s_%s_p_%s' % (self.name, label, pns)
info = canv._curr_tx_info
canv.bookmarkHorizontal(key, info['cur_x'], info['cur_y'] + info['leading'])
self.addEntry(terms, pns, key)
def getCanvasMaker(self, canvasmaker=canvas.Canvas):
def newcanvasmaker(*args, **kwargs):
from reportlab.pdfgen import canvas
c = canvasmaker(*args, **kwargs)
setattr(c,self.name,self)
return c
return newcanvasmaker
def isIndexing(self):
return 1
def isSatisfied(self):
return (self._entries == self._lastEntries)
def beforeBuild(self):
# keep track of the last run
self._lastEntries = self._entries.copy()
self.clearEntries()
def clearEntries(self):
self._entries = {}
def notify(self, kind, stuff):
"""The notification hook called to register all kinds of events.
Here we are interested in 'IndexEntry' events only.
"""
if kind == 'IndexEntry':
(text, pageNum) = stuff
self.addEntry(text, pageNum)
def addEntry(self, text, pageNum, key=None):
"""Allows incremental buildup"""
self._entries.setdefault(makeTuple(text),set([])).add((pageNum, key))
def split(self, availWidth, availHeight):
"""At this stage we do not care about splitting the entries,
we will just return a list of platypus tables. Presumably the
calling app has a pointer to the original TableOfContents object;
Platypus just sees tables.
"""
return self._flowable.splitOn(self.canv,availWidth, availHeight)
def _getlastEntries(self, dummy=[(['Placeholder for index'],enumerate((None,)*3))]):
'''Return the last run's entries! If there are none, returns dummy.'''
if not self._lastEntries:
if self._entries:
return list(self._entries.items())
return dummy
return list(self._lastEntries.items())
def _build(self,availWidth,availHeight):
_tempEntries = self._getlastEntries()
def getkey(seq):
return [x.upper() for x in seq[0]]
_tempEntries.sort(key=getkey)
leveloffset = self.headers and 1 or 0
def drawIndexEntryEnd(canvas, kind, label):
'''Callback to draw dots and page numbers after each entry.'''
style = self.getLevelStyle(leveloffset)
pages = decode_label(label)
drawPageNumbers(canvas, style, pages, availWidth, availHeight, self.dot)
self.canv.drawIndexEntryEnd = drawIndexEntryEnd
alpha = ''
tableData = []
lastTexts = []
alphaStyle = self.getLevelStyle(0)
for texts, pageNumbers in _tempEntries:
texts = list(texts)
#track when the first character changes; either output some extra
#space, or the first letter on a row of its own. We cannot do
#widow/orphan control, sadly.
nalpha = texts[0][0].upper()
if alpha != nalpha:
alpha = nalpha
if self.headers:
header = alpha
else:
header = ' '
tableData.append([Spacer(1, alphaStyle.spaceBefore),])
tableData.append([Paragraph(header, alphaStyle),])
tableData.append([Spacer(1, alphaStyle.spaceAfter),])
i, diff = listdiff(lastTexts, texts)
if diff:
lastTexts = texts
texts = texts[i:]
label = encode_label(list(pageNumbers))
texts[-1] = '%s<onDraw name="drawIndexEntryEnd" label="%s"/>' % (texts[-1], label)
for text in texts:
#Platypus and RML differ on how parsed XML attributes are escaped.
#e.g. <index item="M&S"/>. The only place this seems to bite us is in
#the index entries so work around it here.
text = escapeOnce(text)
style = self.getLevelStyle(i+leveloffset)
para = Paragraph(text, style)
if style.spaceBefore:
tableData.append([Spacer(1, style.spaceBefore),])
tableData.append([para,])
i += 1
self._flowable = Table(tableData, colWidths=[availWidth], style=self.tableStyle)
def wrap(self, availWidth, availHeight):
"All table properties should be known by now."
self._build(availWidth,availHeight)
self.width, self.height = self._flowable.wrapOn(self.canv,availWidth, availHeight)
return self.width, self.height
def drawOn(self, canvas, x, y, _sW=0):
"""Don't do this at home! The standard calls for implementing
draw(); we are hooking this in order to delegate ALL the drawing
work to the embedded table object.
"""
self._flowable.drawOn(canvas, x, y, _sW)
def draw(self):
t = self._flowable
ocanv = getattr(t,'canv',None)
if not ocanv:
t.canv = self.canv
try:
t.draw()
finally:
if not ocanv:
del t.canv
def getLevelStyle(self, n):
'''Returns the style for level n, generating and caching styles on demand if not present.'''
if not hasattr(self.textStyle, '__iter__'):
self.textStyle = [self.textStyle]
try:
return self.textStyle[n]
except IndexError:
self.textStyle = list(self.textStyle)
prevstyle = self.getLevelStyle(n-1)
self.textStyle.append(ParagraphStyle(
name='%s-%d-indented' % (prevstyle.name, n),
parent=prevstyle,
firstLineIndent = prevstyle.firstLineIndent+.2*cm,
leftIndent = prevstyle.leftIndent+.2*cm))
return self.textStyle[n]
AlphabeticIndex = SimpleIndex
def listdiff(l1, l2):
m = min(len(l1), len(l2))
for i in range(m):
if l1[i] != l2[i]:
return i, l2[i:]
return m, l2[m:]
class ReferenceText(IndexingFlowable):
"""Fakery to illustrate how a reference would work if we could
put it in a paragraph."""
def __init__(self, textPattern, targetKey):
self.textPattern = textPattern
self.target = targetKey
self.paraStyle = ParagraphStyle('tmp')
self._lastPageNum = None
self._pageNum = -999
self._para = None
def beforeBuild(self):
self._lastPageNum = self._pageNum
def notify(self, kind, stuff):
if kind == 'Target':
(key, pageNum) = stuff
if key == self.target:
self._pageNum = pageNum
def wrap(self, availWidth, availHeight):
text = self.textPattern % self._lastPageNum
self._para = Paragraph(text, self.paraStyle)
return self._para.wrap(availWidth, availHeight)
def drawOn(self, canvas, x, y, _sW=0):
self._para.drawOn(canvas, x, y, _sW)
| {'content_hash': '1b5c2577f7858da7217ad117dad184a3', 'timestamp': '', 'source': 'github', 'line_count': 551, 'max_line_length': 123, 'avg_line_length': 37.201451905626136, 'alnum_prop': 0.6104985852278271, 'repo_name': 'kitanata/resume', 'id': 'd3f685368eb460f5302713072e6071a83a97cfb9', 'size': '20696', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'env/lib/python2.7/site-packages/reportlab/platypus/tableofcontents.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '4224'}, {'name': 'CoffeeScript', 'bytes': '385'}, {'name': 'JavaScript', 'bytes': '37733'}]} |
/*global TimelineUrl*/
'use strict';
class TimelineUrlPane {
constructor() {
this.paneTitle = 'Generate Timeline URL';
this.createSidebar();
}
createSidebar() {
chrome.devtools.panels.sources.createSidebarPane(this.paneTitle, function (sidebar) {
sidebar.setPage('sidebar.html');
sidebar.onShown.addListener(this.bindEvents.bind(this));
}.bind(this));
}
bindEvents(win) {
win.generateBtn.addEventListener('click', function () {
new TimelineUrl(win);
});
}
}
// kick it off.
var tlpane = new TimelineUrlPane();
| {'content_hash': '742917a9f15df828f84d35166ad1da43', 'timestamp': '', 'source': 'github', 'line_count': 25, 'max_line_length': 87, 'avg_line_length': 21.64, 'alnum_prop': 0.7024029574861368, 'repo_name': 'ChromeDevTools/timeline-url', 'id': '6187d7a7006350e1d6f4c09cba98279a1c60047d', 'size': '541', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'app/scripts/panel.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '2082'}, {'name': 'JavaScript', 'bytes': '7945'}, {'name': 'Shell', 'bytes': '649'}]} |
<?php
/**
* @namespace
*/
namespace Yandex\Market\Partner;
use Psr\Http\Message\UriInterface;
use Yandex\Common\AbstractServiceClient;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Exception\ClientException;
use Yandex\Common\Exception\ForbiddenException;
use Yandex\Common\Exception\UnauthorizedException;
use Yandex\Market\Partner\Exception\PartnerRequestException;
use Yandex\Market\Partner\Models;
/**
* Class PartnerClient
*
* @category Yandex
* @package Market
*
* @author Alexander Khaylo <[email protected]>
* @created 04.11.13 12:48
*/
class PartnerClient extends AbstractServiceClient
{
/**
* Order is being processed
*/
const ORDER_STATUS_PROCESSING = 'PROCESSING';
/**
* Order submitted to the delivery
*/
const ORDER_STATUS_DELIVERY = 'DELIVERY';
/**
* Order delivered to the point of self-delivery
*/
const ORDER_STATUS_PICKUP = 'PICKUP';
/**
* The order is received by the buyer
*/
const ORDER_STATUS_DELIVERED = 'DELIVERED';
/**
* Order canceled.
*/
const ORDER_STATUS_CANCELLED = 'CANCELLED';
//Sub-statuses for status CANCELLED
// - the buyer is not finalized the reserved order on time
const ORDER_SUBSTATUS_RESERVATION_EXPIRED = 'RESERVATION_EXPIRED';
// - the buyer did not pay for the order ( for the type of payment PREPAID)
const ORDER_SUBSTATUS_USER_NOT_PAID = 'USER_NOT_PAID';
// - failed to communicate with the buyer
const ORDER_SUBSTATUS_USER_UNREACHABLE = 'USER_UNREACHABLE';
// - buyer canceled the order for cause
const ORDER_SUBSTATUS_USER_CHANGED_MIND = 'USER_CHANGED_MIND';
// - the buyer is not satisfied with the terms of delivery
const ORDER_SUBSTATUS_USER_REFUSED_DELIVERY = 'USER_REFUSED_DELIVERY';
// - the buyer did not fit the goods
const ORDER_SUBSTATUS_USER_REFUSED_PRODUCT = 'USER_REFUSED_PRODUCT';
// - shop can not fulfill the order
const ORDER_SUBSTATUS_SHOP_FAILED = 'SHOP_FAILED';
// - the buyer is not satisfied with the quality of the goods
const ORDER_SUBSTATUS_USER_REFUSED_QUALITY = 'USER_REFUSED_QUALITY';
// - buyer changes the composition of the order
const ORDER_SUBSTATUS_REPLACING_ORDER = 'REPLACING_ORDER';
//- store does not process orders on time
const ORDER_SUBSTATUS_PROCESSING_EXPIRED = 'PROCESSING_EXPIRED';
//Способ оплаты заказа
//предоплата через Яндекс;
const PAYMENT_METHOD_YANDEX = 'YANDEX';
//предоплата напрямую магазину,
//не принимающему предоплату через Яндекс.
const PAYMENT_METHOD_SHOP_PREPAID = 'SHOP_PREPAID';
// наличный расчет при получении заказа;
const PAYMENT_METHOD_CASH_ON_DELIVERY = 'CASH_ON_DELIVERY';
// оплата банковской картой при получении заказа.
const PAYMENT_METHOD_CARD_ON_DELIVERY = 'CARD_ON_DELIVERY';
//Типы доставки
//курьерская доставка
const DELIVERY_TYPE_DELIVERY = 'DELIVERY';
//самовывоз
const DELIVERY_TYPE_PICKUP = 'PICKUP';
//почта
const DELIVERY_TYPE_POST = 'POST';
const ORDER_DECLINE_REASON_OUT_OF_DATE= 'OUT_OF_DATE';
/**
* Requested version of API
* @var string
*/
private $version = 'v2';
/**
* Application id
*
* @var string
*/
protected $clientId;
/**
* User login
*
* @var string
*/
protected $login;
/**
* Campaign Id
*
* @var string
*/
protected $campaignId;
/**
* API domain
*
* @var string
*/
protected $serviceDomain = 'api.partner.market.yandex.ru';
/**
* Get url to service resource with parameters
*
* @param string $resource
* @see http://api.yandex.ru/market/partner/doc/dg/concepts/method-call.xml
* @return string
*/
public function getServiceUrl($resource = '')
{
return $this->serviceScheme . '://' . $this->serviceDomain . '/'
. $this->version . '/' . $resource;
}
/**
* @param string $token access token
*/
public function __construct($token = '')
{
$this->setAccessToken($token);
}
/**
* @param string $clientId
*/
public function setClientId($clientId)
{
$this->clientId = $clientId;
}
/**
* @param string $login
*/
public function setLogin($login)
{
$this->login = $login;
}
/**
* @param string $campaignId
*/
public function setCampaignId($campaignId)
{
$this->campaignId = $campaignId;
}
/**
* @return string
*/
public function getClientId()
{
return $this->clientId;
}
/**
* @return string
*/
public function getLogin()
{
return $this->login;
}
/**
* Sends a request
*
* @param string $method HTTP method
* @param string|UriInterface $uri URI object or string.
* @param array $options Request options to apply.
*
* @return Response
*
* @throws ForbiddenException
* @throws UnauthorizedException
* @throws PartnerRequestException
*/
protected function sendRequest($method, $uri, array $options = [])
{
try {
$response = $this->getClient()->request($method, $uri, $options);
} catch (ClientException $ex) {
$result = $ex->getResponse();
$code = $result->getStatusCode();
$message = $result->getReasonPhrase();
$body = $result->getBody();
if ($body) {
$jsonBody = json_decode($body);
if ($jsonBody && isset($jsonBody->error) && isset($jsonBody->error->message)) {
$message = $jsonBody->error->message;
}
}
if ($code === 403) {
throw new ForbiddenException($message);
}
if ($code === 401) {
throw new UnauthorizedException($message);
}
throw new PartnerRequestException(
'Service responded with error code: "' . $code . '" and message: "' . $message . '"',
$code
);
}
return $response;
}
/**
* Get OAuth data for header request
*
* @see http://api.yandex.ru/market/partner/doc/dg/concepts/authorization.xml
*
* @return string
*/
public function getAccessToken()
{
return 'oauth_token=' . parent::getAccessToken() . ', oauth_client_id=' . $this->getClientId()
. ', oauth_login=' . $this->getLogin();
}
/**
* Get User Campaigns
*
* Returns the user to the list of campaigns Yandex.market.
* The list coincides with the list of campaigns
* that are displayed in the partner interface Yandex.Market on page "My shops."
*
* @see http://api.yandex.ru/market/partner/doc/dg/reference/get-campaigns.xml
*
* @return Models\Campaigns
*/
public function getCampaigns()
{
$resource = 'campaigns.json';
$response = $this->sendRequest('GET', $this->getServiceUrl($resource));
$decodedResponseBody = $this->getDecodedBody($response->getBody());
$getCampaignsResponse = new Models\GetCampaignsResponse($decodedResponseBody);
return $getCampaignsResponse->getCampaigns();
}
/**
* Get information about orders by campaign id
*
* @param array $params
*
* Returns information on the requested orders.
* Available filtering by date ordering and order status.
* The maximum range of dates in a single request for a resource - 30 days.
*
* @see http://api.yandex.ru/market/partner/doc/dg/reference/get-campaigns-id-orders.xml
*
* @return Models\GetOrdersResponse
*/
public function getOrdersResponse($params = [])
{
$resource = 'campaigns/' . $this->campaignId . '/orders.json';
$resource .= '?' . http_build_query($params);
$response = $this->sendRequest('GET', $this->getServiceUrl($resource));
$decodedResponseBody = $this->getDecodedBody($response->getBody());
return new Models\GetOrdersResponse($decodedResponseBody);
}
/**
* Get only orders data without pagination
*
* @param array $params
* @return null|Models\Orders
*/
public function getOrders($params = [])
{
return $this->getOrdersResponse($params)->getOrders();
}
/**
* Get order info
*
* @param int $orderId
* @return Models\Order
*
* @link http://api.yandex.ru/market/partner/doc/dg/reference/get-campaigns-id-orders-id.xml
*/
public function getOrder($orderId)
{
$resource = 'campaigns/' . $this->campaignId . '/orders/' . $orderId . '.json';
$response = $this->sendRequest('GET', $this->getServiceUrl($resource));
$decodedResponseBody = $this->getDecodedBody($response->getBody());
$getOrderResponse = new Models\GetOrderResponse($decodedResponseBody);
return $getOrderResponse->getOrder();
}
/**
* Send changed status to Yandex.Market
*
* @param int $orderId
* @param string $status
* @param null|string $subStatus
* @return Models\Order
*
* @link http://api.yandex.ru/market/partner/doc/dg/reference/put-campaigns-id-orders-id-status.xml
*/
public function setOrderStatus($orderId, $status, $subStatus = null)
{
$resource = 'campaigns/' . $this->campaignId . '/orders/' . $orderId . '/status.json';
$data = [
"order" => [
"status" => $status
]
];
if ($subStatus) {
$data['order']['substatus'] = $subStatus;
}
$response = $this->sendRequest(
'PUT',
$this->getServiceUrl($resource),
[
'json' => $data
]
);
$decodedResponseBody = $this->getDecodedBody($response->getBody());
$updateOrderStatusResponse = new Models\UpdateOrderStatusResponse($decodedResponseBody);
return $updateOrderStatusResponse->getOrder();
}
/**
* Update changed delivery parameters
*
* @param int $orderId
* @param Models\Delivery $delivery
* @return Models\Order
*
* Example:
* PUT /v2/campaigns/10003/order/12345/delivery.json HTTP/1.1
*
* @link http://api.yandex.ru/market/partner/doc/dg/reference/put-campaigns-id-orders-id-delivery.xml
*/
public function updateDelivery($orderId, Models\Delivery $delivery)
{
$resource = 'campaigns/' . $this->campaignId . '/orders/' . $orderId . '/delivery.json';
$response = $this->sendRequest(
'PUT',
$this->getServiceUrl($resource),
[
'json' => $delivery->toArray()
]
);
$decodedResponseBody = $this->getDecodedBody($response->getBody());
$updateOrderDeliveryResponse = new Models\UpdateOrderDeliveryResponse($decodedResponseBody);
return $updateOrderDeliveryResponse->getOrder();
}
}
| {'content_hash': '4ceff4bb2d824d316d860707f4961306', 'timestamp': '', 'source': 'github', 'line_count': 404, 'max_line_length': 105, 'avg_line_length': 27.70049504950495, 'alnum_prop': 0.5951210794388347, 'repo_name': 'zbarinov/yandex-php-library', 'id': '4d23b3d0fa84b9ced63215d540995f4a205b7969', 'size': '11532', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Yandex/Market/Partner/PartnerClient.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Nginx', 'bytes': '715'}, {'name': 'PHP', 'bytes': '1149782'}, {'name': 'Shell', 'bytes': '4433'}]} |
require 'spec_helper'
require 'devise-links/links/registration'
require 'devise-links/links/labels'
describe Devise::Links::Registration do
extend_view_with Devise::Links::Registration
extend_view_with Devise::Links::Labels
describe '#new_registration_link' do
it "should create a registration link" do
view_engine do |e, view|
label = 'new registration'
path = 'new/reg/path'
# view.stubs(:user_reg_path).with(:new, :admin).returns path
view.stubs(:new_registration_path).returns path
output_label = view.new_registration_label
view.stubs(:link_to).returns output_label
res = e.run_template do
%{<%= new_registration_link(:role => :admin) %> }
end
res.should match /#{output_label}/
end
end
end
end
| {'content_hash': 'de7c41818d2c5919b9bb8ae9e29f71d2', 'timestamp': '', 'source': 'github', 'line_count': 31, 'max_line_length': 68, 'avg_line_length': 27.677419354838708, 'alnum_prop': 0.6177156177156177, 'repo_name': 'kristianmandrup/devise-links', 'id': 'a49f5e2681fe23a30f98992f262ee298d4f093eb', 'size': '858', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'spec/devise-links/registration-links_spec.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '10567'}]} |
package android.support.log4j2.slf4j;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.spi.AbstractLoggerAdapter;
import org.apache.logging.log4j.spi.LoggerContext;
import org.apache.logging.slf4j.Log4jLogger;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
/**
* Log4jLoggerFactory
*/
public class Log4jLoggerFactory extends AbstractLoggerAdapter<Logger> implements ILoggerFactory {
@Override
protected Logger newLogger(final String name, final LoggerContext context) {
final String key = Logger.ROOT_LOGGER_NAME.equals(name) ? LogManager.ROOT_LOGGER_NAME : name;
return new Log4jLogger(context.getLogger(key), name);
}
@Override
protected LoggerContext getContext() {
return LogManager.getContext(false);
}
}
| {'content_hash': '30ecddd07332e8e153d734ede4bb6409', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 101, 'avg_line_length': 29.77777777777778, 'alnum_prop': 0.7611940298507462, 'repo_name': 'fine1021/Log4JAndroid', 'id': '783ab0dc661cf1d7b6b15a97dc7d54f04e361dad', 'size': '804', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'log4j2-android/src/main/java/android/support/log4j2/slf4j/Log4jLoggerFactory.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '142518'}]} |
<?php
use yii\widgets\ListView;
/* @var $this yii\web\View */
/* @var $searchModel app\models\form\Content */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = $breadcrum;
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="content-index">
<?=ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => '/content/listItem',
'layout' => "{items}\n{pager}",
]);?>
</div>
| {'content_hash': 'e3a665720ae77a0d5393b311aae3978f', 'timestamp': '', 'source': 'github', 'line_count': 19, 'max_line_length': 52, 'avg_line_length': 21.63157894736842, 'alnum_prop': 0.6423357664233577, 'repo_name': 'froyot/dandan', 'id': '4af02620b7a0482e6beaef0c7179e5a7dedb9098', 'size': '411', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'fronted/views/post/index.php', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Batchfile', 'bytes': '515'}, {'name': 'CSS', 'bytes': '491122'}, {'name': 'HTML', 'bytes': '87733'}, {'name': 'JavaScript', 'bytes': '1879144'}, {'name': 'PHP', 'bytes': '335320'}]} |
local_path=$(dirname $0)
source $local_path/Common
func_check_xwalkservice
if [[ $? -eq 1 ]]; then
func_xwalkservice
if [[ $? -eq 1 ]]; then
echo "set xwalk service failure"
exit 1
fi
fi
pkgcmd -i -t wgt -p $local_path/../source/manifest_app_mainsource_tests.wgt -q
a=`sqlite3 /home/app/.applications/dbspace/.app_info.db "select package from app_info;" | grep mainsource`
if [[ $a =~ 'mainsource' ]]; then
echo "Use run as service install successfully"
else
echo "Use run as service mode install failure"
exit 1
fi
if [[ $a =~ 'mainsource' ]]; then
echo "Use run as service install app and the DB correctly"
pkgcmd -u -n mainsource -q
exit 0
else
echo "Use run as service install app and the DB incorrectly"
pkgcmd -u -n mainsource -q
exit 1
fi
| {'content_hash': 'de93ce27f338800de3710a18462304f2', 'timestamp': '', 'source': 'github', 'line_count': 30, 'max_line_length': 106, 'avg_line_length': 34.1, 'alnum_prop': 0.5219941348973607, 'repo_name': 'yugang/crosswalk-test-suite', 'id': '54c0b08cb3d270907554aa10b7327052f000be70', 'size': '2539', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'wrt/wrt-rtbin-tizen-tests/rtbinauto/Crosswalk_Run_As_Service_CheckDB.sh', 'mode': '33261', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '3495'}, {'name': 'CSS', 'bytes': '1694855'}, {'name': 'Erlang', 'bytes': '2850'}, {'name': 'Java', 'bytes': '155590'}, {'name': 'JavaScript', 'bytes': '32256550'}, {'name': 'PHP', 'bytes': '43783'}, {'name': 'Perl', 'bytes': '1696'}, {'name': 'Python', 'bytes': '4215706'}, {'name': 'Shell', 'bytes': '638387'}, {'name': 'XSLT', 'bytes': '2143471'}]} |
export * from "./trafficChart.component";
export * from "./trafficChart.service";
| {'content_hash': '06019fa48b660eb111ab948d000baf9f', 'timestamp': '', 'source': 'github', 'line_count': 2, 'max_line_length': 41, 'avg_line_length': 41.0, 'alnum_prop': 0.7317073170731707, 'repo_name': 'huazai128/angular2-admin', 'id': '05964f32312de63dbc63db611f5331f4f1420667', 'size': '82', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/app/pages/dashboard/trafficChart/index.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '76849'}, {'name': 'HTML', 'bytes': '20295'}, {'name': 'JavaScript', 'bytes': '38780'}, {'name': 'Shell', 'bytes': '153'}, {'name': 'TypeScript', 'bytes': '125804'}]} |
package nz.co.doltech.gwtjui.demo.client.application.interactions.selectable;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.gwtplatform.mvp.client.ViewWithUiHandlers;
import nz.co.doltech.gwtjui.interactions.client.ui.Selectable;
import org.gwtbootstrap3.client.ui.html.OrderedList;
import javax.inject.Inject;
public class SelectableView extends ViewWithUiHandlers<SelectableUiHandlers> implements SelectablePresenter.MyView {
interface Binder extends UiBinder<Widget, SelectableView> {
}
@UiField OrderedList list;
@UiField FocusPanel focus;
private Selectable selectable;
@Inject
SelectableView(Binder uiBinder) {
initWidget(uiBinder.createAndBindUi(this));
selectable = new Selectable(list);
}
@Override
protected void onAttach() {
super.onAttach();
Scheduler.get().scheduleDeferred(new Command() {
@Override
public void execute() {
focus.setFocus(true);
focus.setFocus(false);
}
});
}
}
| {'content_hash': '0bc1b6f9eb0da8c0a3e8fd7d83c096c5', 'timestamp': '', 'source': 'github', 'line_count': 45, 'max_line_length': 116, 'avg_line_length': 29.91111111111111, 'alnum_prop': 0.7184249628528975, 'repo_name': 'BenDol/gwt-jui-demo', 'id': '03841050047850066da53d8d784441569f8e416d', 'size': '1945', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/nz/co/doltech/gwtjui/demo/client/application/interactions/selectable/SelectableView.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '2462'}, {'name': 'HTML', 'bytes': '1602'}, {'name': 'Java', 'bytes': '68504'}, {'name': 'Shell', 'bytes': '1342'}]} |
<div>
I parametri consentono di richiedere agli utenti uno o più input che saranno
forniti a una compilazione. Ad esempio, si potrebbe avere un progetto che
esegue test su richiesta consentendo agli utenti di caricare un file ZIP
contenente i binari da testare. Si potrebbe ottenere tale risultato
aggiungendo qui un
<i>Parametro file</i>
.
<br />
Oppure si potrebbe avere un progetto che rilascia del software e si desidera
che gli utenti immettano delle note di rilascio che saranno caricate insieme
al software. Si potrebbe ottenere tale risultato aggiungendo qui un
<i>Parametro stringa multiriga</i>
.
<p>
Ogni parametro ha un
<i>Nome</i>
e qualche tipo di
<i>Valore</i>
che dipende dal tipo del parametro. Queste coppie nome-valore saranno
esportate come variabili d'ambiente all'avvio della compilazione,
consentendo ai passaggi successivi della configurazione della compilazione
(come le istruzioni di compilazione) di accedere a tali valori, ad esempio
utilizzando la sintassi
<code>${NOME_PARAMETRO}</code>
(o
<code>%NOME_PARAMETRO%</code>
su Windows).
<br />
Ciò implica anche che ogni parametro definito qui debba avere un
<i>Nome</i>
univoco.
</p>
<p>
Quando un progetto è parametrizzato, il collegamento
<i>Compila ora</i>
usuale sarà sostituito da un collegamento
<i>Compila con parametri</i>
dove agli utenti verrà chiesto di specificare i valori per ognuno dei
parametri definiti. Se questi scelgono di non immettere nulla, la
compilazione verrà avviata con il valore predefinito per ogni parametro.
</p>
<p>
Se una compilazione è avviata automaticamente, ad esempio se è avviata da un
trigger del sistema di gestione del codice sorgente, saranno utilizzati i
valori predefiniti per ogni parametro.
</p>
<p>
Quando una compilazione parametrizzata è in coda, i tentativi di avvio di
un'altra compilazione dello stesso progetto avranno successo solo se i
valori dei parametri sono diversi, o se l'opzione
<i>Esegui compilazioni concorrenti se necessario</i>
è abilitata.
</p>
<p>
Si veda la
<a
href="https://www.jenkins.io/redirect/parameterized-builds"
rel="noopener noreferrer"
target="_blank"
>
documentazione sulle compilazioni parametrizzate
</a>
per ulteriori informazioni su questa funzionalità.
</p>
</div>
| {'content_hash': '749fbff80f64cb8457b3a335c0efba01', 'timestamp': '', 'source': 'github', 'line_count': 70, 'max_line_length': 80, 'avg_line_length': 35.02857142857143, 'alnum_prop': 0.7222675367047309, 'repo_name': 'damianszczepanik/jenkins', 'id': 'f738e6f2852b08ccac8beaa3e7c30d54ecf978f0', 'size': '2463', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'core/src/main/resources/hudson/model/ParametersDefinitionProperty/help_it.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ANTLR', 'bytes': '4633'}, {'name': 'Batchfile', 'bytes': '1023'}, {'name': 'C', 'bytes': '2091'}, {'name': 'CSS', 'bytes': '215757'}, {'name': 'Dockerfile', 'bytes': '163'}, {'name': 'Groovy', 'bytes': '75812'}, {'name': 'HTML', 'bytes': '938754'}, {'name': 'Handlebars', 'bytes': '15221'}, {'name': 'Java', 'bytes': '11624679'}, {'name': 'JavaScript', 'bytes': '392682'}, {'name': 'Less', 'bytes': '193265'}, {'name': 'Perl', 'bytes': '16145'}, {'name': 'Python', 'bytes': '4709'}, {'name': 'Ruby', 'bytes': '17290'}, {'name': 'Shell', 'bytes': '2354'}]} |
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-| Low-level file storage engine -}
module Hevents.Eff.Store.FileOps where
import Control.Concurrent.Async
import Control.Concurrent.STM
import Control.Exception (Exception, IOException, bracket, catch)
import Control.Monad (forever)
import Control.Monad.Trans (liftIO)
import qualified Data.Binary.Get as Bin
import Data.ByteString (hGet, hPut)
import Data.ByteString.Lazy (fromStrict)
import Data.Either
import Data.Functor (void)
import Data.Monoid ((<>))
import Data.Serialize
import Data.Typeable
import Hevents.Eff.Store
import Prelude hiding (length, read)
import System.IO
-- |Internal definition of the storage to use for operations
data FileStorage = FileStorage { storeName :: String
, storeVersion :: Version
, storeHandle :: Maybe Handle
-- ^Handle to the underlying OS stream for storing events
, storeTid :: TMVar (Async ())
-- ^The store's thread id, if store is open and running
, storeTQueue :: TBQueue QueuedOperation
}
-- | Options for opening storage
data StorageOptions = StorageOptions { storageFilePath :: FilePath
-- ^The file path to store data
, storageVersion :: Version
-- ^Events version. Note this version represents the point of view of the consumer
-- of this storage which may contain events with different versions. The implementation
-- of `Versionable` should be able to handle any version, up to `storageVersion`
, storageQueueSize :: Int
-- ^Upper bound on the number of store operations that can be queued. The exact value
-- is dependent on the number of clients this storage is consumed by and the operations
-- throughput. Requests for operations will block when queue is full.
}
defaultOptions :: StorageOptions
defaultOptions = StorageOptions "store.data" (Version 1) 100
data QueuedOperation where
QueuedOperation :: forall s .
{ operation :: StoreOperation IO s,
opResult :: TMVar (StorageResult s) } -> QueuedOperation
data StorageException = CannotDeserialize String
deriving (Show, Typeable)
instance Exception StorageException
openFileStorage :: StorageOptions -> IO FileStorage
openFileStorage StorageOptions{..} = do
tidvar <- atomically newEmptyTMVar
tq <- newTBQueueIO storageQueueSize
h <- openFile storageFilePath ReadWriteMode
hSetBuffering h NoBuffering
let s@FileStorage{..} = FileStorage storageFilePath storageVersion (Just h) tidvar tq
tid <- async (runStorage s)
atomically $ putTMVar storeTid tid
return s
openHandleStorage :: Handle -> IO FileStorage
openHandleStorage hdl = do
tidvar <- atomically newEmptyTMVar
tq <- newTBQueueIO 100
hSetBuffering hdl NoBuffering
let s@FileStorage{..} = FileStorage "<handle>" (Version 1) (Just hdl) tidvar tq
tid <- async (runStorage s)
atomically $ putTMVar storeTid tid
return s
closeFileStorage :: FileStorage -> IO FileStorage
closeFileStorage s@(FileStorage _ _ h ltid _) = do
t <- liftIO $ atomically $ tryTakeTMVar ltid
case t of
Just tid -> liftIO $ cancel tid
Nothing -> return ()
void $ hClose `traverse` h
return s
-- | Run some computation requiring a `FileStorage`, automatically opening and closing required
-- file.
withStorage :: StorageOptions -> (FileStorage -> IO a) -> IO a
withStorage opts = bracket (openFileStorage opts) closeFileStorage
runStorage :: FileStorage -> IO ()
runStorage FileStorage{..} = do
forever $ do
QueuedOperation op res <- atomically $ readTBQueue storeTQueue
let ?currentVersion = storeVersion
atomically . putTMVar res =<< runOp op storeHandle
runOp :: (?currentVersion::Version) =>
StoreOperation IO s -> Maybe Handle -> IO (StorageResult s)
runOp _ Nothing = return NoOp
runOp (OpStore pre post) (Just h) =
do
p <- pre
case p of
Right ev -> do
let s = doStore ev
opres <- (hSeek h SeekFromEnd 0 >> hPut h s >> hFlush h >> return (WriteSucceed ev))
`catch` \ (ex :: IOException) -> return (OpFailed $ "exception " <> show ex <> " while storing event")
WriteSucceed <$> (post $ Right opres)
Left l -> WriteFailed <$> post (Left l)
runOp OpLoad (Just h) = do
pos <- hTell h
hSeek h SeekFromEnd 0
sz <- hTell h
hSeek h AbsoluteSeek 0
opres <- (LoadSucceed <$> readAll h sz)
`catch` \ (ex :: IOException) -> return (OpFailed $ "exception " <> show ex <> " while loading events")
hSeek h AbsoluteSeek pos
return opres
where
readAll :: (?currentVersion :: Version, Versionable s) => Handle -> Integer -> IO [s]
readAll hdl sz = if sz > 0 then
do
(loaded,ln) <- doLoad hdl
case loaded of
Right e -> do
es <- readAll hdl (sz - ln)
return $ e : es
Left err -> fail err
else
return []
runOp OpReset (Just handle) =
do
w <- hIsWritable handle
opres <- case w of
False -> return $ OpFailed "File handle not writeable while resetting event store"
True -> do
emptyEvents `catch` \ (ex :: IOException) -> return (OpFailed $ "exception" <> (show ex) <> " while resetting event store")
where emptyEvents = do
(hSetFileSize handle 0)
return ResetSucceed
return opres
-- |Read a single event from file store, returning also the number of bytes read
--
-- This is not symetric to doStore as we need first to read the length of the message, then
-- to read only the necessary amount of bytes from storage
doLoad :: Versionable s => Handle -> IO (Either String s, Integer)
doLoad h = do
lw <- hGet h 4
let l = fromIntegral $ Bin.runGet Bin.getWord32be $ fromStrict lw
bs <- hGet h l
let msg = do
v <- getWord8
_ <- getWord32be
pay <- getByteString (l - 5)
either fail return $ read (fromIntegral v) pay
content = runGet msg bs
return $ (content, fromIntegral $ l + 4)
push :: StoreOperation IO s -> FileStorage -> IO (StorageResult s)
push op FileStorage{..} = do
v <- atomically $ do
tmv <- newEmptyTMVar
writeTBQueue storeTQueue (QueuedOperation op tmv)
return tmv
atomically $ takeTMVar v
writeStore :: (Versionable e) => FileStorage -> IO (Either a e) -> (Either a (StorageResult e) -> IO r) -> IO (StorageResult r)
writeStore s pre post = push (OpStore pre post) s
readStore :: (Versionable s) => FileStorage -> IO (StorageResult s)
readStore = push OpLoad
resetStore :: FileStorage -> IO (StorageResult ())
resetStore = push OpReset
instance Store IO FileStorage where
close = closeFileStorage
store = writeStore
load = readStore
reset = resetStore
| {'content_hash': '3cf2667ec75bc3e2633189cfd8358724', 'timestamp': '', 'source': 'github', 'line_count': 194, 'max_line_length': 131, 'avg_line_length': 40.53092783505155, 'alnum_prop': 0.5906142693628386, 'repo_name': 'abailly/hevents', 'id': 'c5d2c04e26ee988a97ce21361e8a6d9308627593', 'size': '7863', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Hevents/Eff/Store/FileOps.hs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Haskell', 'bytes': '63862'}]} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {'content_hash': '454c8928366a8c3cb959cff93d58d0d7', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 31, 'avg_line_length': 9.692307692307692, 'alnum_prop': 0.7063492063492064, 'repo_name': 'mdoering/backbone', 'id': 'c269b288701ac087aff2a42d2da6202c0d06493a', 'size': '178', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Caryophyllaceae/Silene/Silene kungessana/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
import os
import sys
import subprocess
def ReadKddsToBeCalculated(fname):
"""
self explanatory
"""
listKdds=[]
with open(fname,'r') as f:
for line in f:
listKdds.append(line.rstrip('\n'))
return listKdds
gcr = "us.gcr.io"
project = "direct-disk-101619"
docker = "egs-rc-4039"
Kdds = ReadKddsToBeCalculated(sys.argv[1])
docker2run = os.path.join(gcr, project, docker) # full path to docker
for kdd in Kdds:
cmd = "docker run {0} python main.py {1}".format(docker2run, kdd)
#print(cmd)
rc = subprocess.call(cmd, shell=True)
#print(rc)
| {'content_hash': 'b2652ab7dc9508985a77a6633fe20a50', 'timestamp': '', 'source': 'github', 'line_count': 30, 'max_line_length': 69, 'avg_line_length': 20.3, 'alnum_prop': 0.6338259441707718, 'repo_name': 'Iwan-Zotow/runEGS', 'id': '7f3bc8523aa7d240a3651756be534e9575f4fa09', 'size': '628', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'run_local.py', 'mode': '33261', 'license': 'apache-2.0', 'language': [{'name': 'Jupyter Notebook', 'bytes': '12348489'}, {'name': 'Python', 'bytes': '205708'}]} |
module Features
module AuthenticationHelpers
unless ActionController::Base.new.respond_to?(:authenticate_participant!)
ActionController::Base.class_eval do
define_method(:authenticate_participant!) { true }
end
end
end
end
| {'content_hash': 'ac5c7f2af57b176a12fc5a5e8cbe16f5', 'timestamp': '', 'source': 'github', 'line_count': 9, 'max_line_length': 77, 'avg_line_length': 28.333333333333332, 'alnum_prop': 0.7215686274509804, 'repo_name': 'cbitstech/social_networking', 'id': 'dcce54b98f116267846b95ad566013a4f47d9d3c', 'size': '285', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'spec/support/feature_helpers.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '2598'}, {'name': 'HTML', 'bytes': '41438'}, {'name': 'JavaScript', 'bytes': '261548'}, {'name': 'Ruby', 'bytes': '179142'}]} |
module Status
class Plugin
# Plugin for Rubygems
class Rubygems < self
# Return url
#
# @return [String]
#
# @api private
#
def url
"https://rubygems.org/gems/#{project_short_name}"
end
memoize :url
# Return image source
#
# @return [String]
#
# @api private
#
def image_src
"https://badge.fury.io/rb/#{project_short_name}.png"
end
memoize :image_src
end
end
end
| {'content_hash': '6be245db1b55add428a105e925b23ddd', 'timestamp': '', 'source': 'github', 'line_count': 28, 'max_line_length': 60, 'avg_line_length': 18.0, 'alnum_prop': 0.5099206349206349, 'repo_name': 'zaidan/rom-status', 'id': '955de0f07464467ab906a36877869f511f389571', 'size': '504', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/status/plugin/rubygems.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CoffeeScript', 'bytes': '454'}, {'name': 'Ruby', 'bytes': '35123'}]} |
package java8;
import com.sandwich.koan.Koan;
import java.util.Base64;
import java.io.UnsupportedEncodingException;
import static com.sandwich.koan.constant.KoanConstants.__;
import static com.sandwich.util.Assert.assertEquals;
public class AboutBase64 {
private final String plainText = "lorem ipsum";
private final String encodedText = "bG9yZW0gaXBzdW0=";
@Koan
public void base64Encoding() {
try {
// Encode the plainText
// This uses the basic Base64 encoding scheme but there are corresponding
// getMimeEncoder and getUrlEncoder methods available if you require a
// different format/Base64 Alphabet
assertEquals(encodedText, Base64.getEncoder().encodeToString(__.getBytes("utf-8")));
} catch (UnsupportedEncodingException ex) {}
}
@Koan
public void base64Decoding() {
// Decode the Base64 encodedText
// This uses the basic Base64 decoding scheme but there are corresponding
// getMimeDecoder and getUrlDecoder methods available if you require a
// different format/Base64 Alphabet
byte[] decodedBytes = Base64.getDecoder().decode(__);
try {
String decodedText = new String(decodedBytes, "utf-8");
assertEquals(plainText, decodedText);
} catch (UnsupportedEncodingException ex) {}
}
}
| {'content_hash': 'd3d275755f4ea8e1a70e2cd58f75497e', 'timestamp': '', 'source': 'github', 'line_count': 40, 'max_line_length': 96, 'avg_line_length': 34.725, 'alnum_prop': 0.6781857451403888, 'repo_name': 'DavidWhitlock/java-koans', 'id': 'ed1235e89d727bf38b8e9dd949b89be65f349468', 'size': '1389', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'koans/src/java8/AboutBase64.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Dockerfile', 'bytes': '1055'}, {'name': 'Java', 'bytes': '288280'}, {'name': 'Ruby', 'bytes': '751'}]} |
namespace System.Drawing.API
{
public interface IApiTiming
{
float DeltaTime { get; }
}
}
| {'content_hash': '91d4dff71faa5ec2c87c920185edf7ae', 'timestamp': '', 'source': 'github', 'line_count': 7, 'max_line_length': 32, 'avg_line_length': 15.857142857142858, 'alnum_prop': 0.6036036036036037, 'repo_name': 'Meragon/Unity-WinForms', 'id': 'da15ce9d0a24a9f8df4638cd14c424768a40381c', 'size': '113', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Core/API/IApiTiming.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '1082017'}, {'name': 'ShaderLab', 'bytes': '2030'}]} |
class CefCallbackCToCpp
: public CefCToCppRefCounted<CefCallbackCToCpp, CefCallback,
cef_callback_t> {
public:
CefCallbackCToCpp();
// CefCallback methods.
void Continue() OVERRIDE;
void Cancel() OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_CALLBACK_CTOCPP_H_
| {'content_hash': '42fa596748e6040fa083ef8bb9b12bc8', 'timestamp': '', 'source': 'github', 'line_count': 12, 'max_line_length': 64, 'avg_line_length': 23.666666666666668, 'alnum_prop': 0.7183098591549296, 'repo_name': 'arkenthera/cef3d', 'id': '892d6e7ab624a835410c22c2b17948cef555c2c5', 'size': '1247', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Cef/libcef_dll/ctocpp/callback_ctocpp.h', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '1028782'}, {'name': 'C++', 'bytes': '2887899'}, {'name': 'CMake', 'bytes': '118535'}, {'name': 'HLSL', 'bytes': '821'}, {'name': 'Python', 'bytes': '82527'}]} |
package org.gradle.api.internal.tasks.testing.results;
import org.gradle.api.internal.tasks.testing.TestCompleteEvent;
import org.gradle.api.internal.tasks.testing.TestDescriptorInternal;
import org.gradle.api.internal.tasks.testing.TestResultProcessor;
import org.gradle.api.internal.tasks.testing.TestStartEvent;
import org.gradle.api.tasks.testing.TestFailure;
import org.gradle.api.tasks.testing.TestOutputEvent;
public class AttachParentTestResultProcessor implements TestResultProcessor {
private Object rootId;
private final TestResultProcessor processor;
public AttachParentTestResultProcessor(TestResultProcessor processor) {
this.processor = processor;
}
@Override
public void started(TestDescriptorInternal test, TestStartEvent event) {
if (rootId == null) {
assert test.isComposite();
rootId = test.getId();
} else if (event.getParentId() == null) {
event = event.withParentId(rootId);
}
processor.started(test, event);
}
@Override
public void failure(Object testId, TestFailure result) {
processor.failure(testId, result);
}
@Override
public void output(Object testId, TestOutputEvent event) {
processor.output(testId, event);
}
@Override
public void completed(Object testId, TestCompleteEvent event) {
if (testId.equals(rootId)) {
rootId = null;
}
processor.completed(testId, event);
}
}
| {'content_hash': 'b0efecf7bbafa41abe21164804d9d76a', 'timestamp': '', 'source': 'github', 'line_count': 48, 'max_line_length': 77, 'avg_line_length': 31.3125, 'alnum_prop': 0.7012641383898869, 'repo_name': 'gradle/gradle', 'id': 'd58225d4ece0ee44db8d19478afc7298230c2ac9', 'size': '2118', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'subprojects/testing-base/src/main/java/org/gradle/api/internal/tasks/testing/results/AttachParentTestResultProcessor.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Assembly', 'bytes': '277'}, {'name': 'Brainfuck', 'bytes': '54'}, {'name': 'C', 'bytes': '123600'}, {'name': 'C++', 'bytes': '1781062'}, {'name': 'CSS', 'bytes': '151435'}, {'name': 'GAP', 'bytes': '424'}, {'name': 'Gherkin', 'bytes': '191'}, {'name': 'Groovy', 'bytes': '30897043'}, {'name': 'HTML', 'bytes': '54458'}, {'name': 'Java', 'bytes': '28750090'}, {'name': 'JavaScript', 'bytes': '78583'}, {'name': 'Kotlin', 'bytes': '4154213'}, {'name': 'Objective-C', 'bytes': '652'}, {'name': 'Objective-C++', 'bytes': '441'}, {'name': 'Python', 'bytes': '57'}, {'name': 'Ruby', 'bytes': '16'}, {'name': 'Scala', 'bytes': '10840'}, {'name': 'Shell', 'bytes': '12148'}, {'name': 'Swift', 'bytes': '2040'}, {'name': 'XSLT', 'bytes': '42693'}]} |
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="simplethings.entityaudit.audited_entities" type="collection" />
<parameter key="simplethings.entityaudit.global_ignore_columns" type="collection" />
<parameter key="simplethings.entityaudit.table_prefix" type="string" />
<parameter key="simplethings.entityaudit.table_suffix" type="string" />
<parameter key="simplethings.entityaudit.revision_field_name" type="string" />
<parameter key="simplethings.entityaudit.revision_type_field_name" type="string" />
<parameter key="simplethings.entityaudit.revision_table_name" type="string" />
<parameter key="simplethings.entityaudit.revision_id_field_type" type="string" />
</parameters>
<services>
<service id="simplethings_entityaudit.manager" class="SimpleThings\EntityAudit\AuditManager">
<argument id="simplethings_entityaudit.config" type="service" />
</service>
<service id="simplethings_entityaudit.reader" class="SimpleThings\EntityAudit\AuditReader" factory-service="simplethings_entityaudit.manager" factory-method="createAuditReader">
<argument type="service" id="doctrine.orm.default_entity_manager" />
</service>
<service id="simplethings_entityaudit.log_revisions_listener" class="SimpleThings\EntityAudit\EventListener\LogRevisionsListener">
<argument id="simplethings_entityaudit.manager" type="service" />
<tag name="doctrine.event_subscriber" connection="default" />
</service>
<service id="simplethings_entityaudit.create_schema_listener" class="SimpleThings\EntityAudit\EventListener\CreateSchemaListener">
<argument id="simplethings_entityaudit.manager" type="service" />
<tag name="doctrine.event_subscriber" connection="default" />
</service>
<service id="simplethings_entityaudit.config" class="SimpleThings\EntityAudit\AuditConfiguration">
<call method="setAuditedEntityClasses">
<argument>%simplethings.entityaudit.audited_entities%</argument>
</call>
<call method="setGlobalIgnoreColumns">
<argument>%simplethings.entityaudit.global_ignore_columns%</argument>
</call>
<call method="setTablePrefix">
<argument>%simplethings.entityaudit.table_prefix%</argument>
</call>
<call method="setTableSuffix">
<argument>%simplethings.entityaudit.table_suffix%</argument>
</call>
<call method="setRevisionFieldName">
<argument>%simplethings.entityaudit.revision_field_name%</argument>
</call>
<call method="setRevisionTypeFieldName">
<argument>%simplethings.entityaudit.revision_type_field_name%</argument>
</call>
<call method="setRevisionTableName">
<argument>%simplethings.entityaudit.revision_table_name%</argument>
</call>
<call method="setRevisionIdFieldType">
<argument>%simplethings.entityaudit.revision_id_field_type%</argument>
</call>
</service>
</services>
</container>
| {'content_hash': '0ffc8483ff062ac6c31e4218921a088b', 'timestamp': '', 'source': 'github', 'line_count': 65, 'max_line_length': 185, 'avg_line_length': 53.69230769230769, 'alnum_prop': 0.6644699140401146, 'repo_name': 'kinkinweb/lhvb', 'id': '598d325a3987f0d5a5a35d62f7242fdaf65c22b6', 'size': '3490', 'binary': False, 'copies': '8', 'ref': 'refs/heads/master', 'path': 'vendor/simplethings/entity-audit-bundle/src/SimpleThings/EntityAudit/Resources/config/auditable.xml', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '163'}, {'name': 'Batchfile', 'bytes': '376'}, {'name': 'CSS', 'bytes': '370932'}, {'name': 'Cucumber', 'bytes': '184496'}, {'name': 'HTML', 'bytes': '100628'}, {'name': 'JavaScript', 'bytes': '93972'}, {'name': 'Makefile', 'bytes': '1847'}, {'name': 'PHP', 'bytes': '544345'}, {'name': 'Ruby', 'bytes': '1112'}, {'name': 'Shell', 'bytes': '9898'}, {'name': 'Smarty', 'bytes': '721'}]} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>V8 API Reference Guide for node.js v6.10.2: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v6.10.2
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1Exception.html">Exception</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">v8::Exception Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classv8_1_1Exception.html">v8::Exception</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1Exception.html#a8d575a721cf0fd5b325afb8b586c0d1e">CreateMessage</a>(Isolate *isolate, Local< Value > exception)</td><td class="entry"><a class="el" href="classv8_1_1Exception.html">v8::Exception</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>Error</b>(Local< String > message) (defined in <a class="el" href="classv8_1_1Exception.html">v8::Exception</a>)</td><td class="entry"><a class="el" href="classv8_1_1Exception.html">v8::Exception</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1Exception.html#a81d1fd3c8d729e9a8d830bc2830bfe77">GetStackTrace</a>(Local< Value > exception)</td><td class="entry"><a class="el" href="classv8_1_1Exception.html">v8::Exception</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>RangeError</b>(Local< String > message) (defined in <a class="el" href="classv8_1_1Exception.html">v8::Exception</a>)</td><td class="entry"><a class="el" href="classv8_1_1Exception.html">v8::Exception</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>ReferenceError</b>(Local< String > message) (defined in <a class="el" href="classv8_1_1Exception.html">v8::Exception</a>)</td><td class="entry"><a class="el" href="classv8_1_1Exception.html">v8::Exception</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>SyntaxError</b>(Local< String > message) (defined in <a class="el" href="classv8_1_1Exception.html">v8::Exception</a>)</td><td class="entry"><a class="el" href="classv8_1_1Exception.html">v8::Exception</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>TypeError</b>(Local< String > message) (defined in <a class="el" href="classv8_1_1Exception.html">v8::Exception</a>)</td><td class="entry"><a class="el" href="classv8_1_1Exception.html">v8::Exception</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0"><td class="entry"><b>V8_DEPRECATED</b>("Use version with an Isolate*", static Local< Message > CreateMessage(Local< Value > exception)) (defined in <a class="el" href="classv8_1_1Exception.html">v8::Exception</a>)</td><td class="entry"><a class="el" href="classv8_1_1Exception.html">v8::Exception</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
| {'content_hash': '72c2aa55f8e7f71c0f1c7d00dae8be0f', 'timestamp': '', 'source': 'github', 'line_count': 114, 'max_line_length': 379, 'avg_line_length': 61.98245614035088, 'alnum_prop': 0.661052929521653, 'repo_name': 'v8-dox/v8-dox.github.io', 'id': '7ce4edb063f4e8a0eb6fbace8b3f9ddd673225ab', 'size': '7066', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '1ff512c/html/classv8_1_1Exception-members.html', 'mode': '33188', 'license': 'mit', 'language': []} |
<HTML><HEAD>
<TITLE>Review for Vertigo (1958)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1 ALIGN="CENTER" CLASS="title"><A HREF="/Title?0052357">Vertigo (1958)</A></H1><H3 ALIGN=CENTER>reviewed by<BR><A HREF="/ReviewsBy?Ian+Low">Ian Low</A></H3><HR WIDTH="40%" SIZE="4">
<PRE>VERTIGO
Fragments Of An Obsession</PRE>
<P>In the pantheon of film making, there are undoubtable classics that stand
out as monumental artifacts of this art form. Some of these remain the
standards where new films are measured against and even imitated upon.
Citizen Kane, Casablanca and Lawrence of Arabia are such examples of a great
tradition of movie making that have been widely praised, liked and even
analyzed upon in countless books and articles. Yet, legendary as these films
are, there is one motion picture that has reached the heights of such
similar classic status, but still remains as one of the least conspicuous
among its more illustrious peers. I am referring to Alfred Hitchcock's
Vertigo.</P>
<P>Released to muted reviews and disappointing box office receipts, Vertigo has
since gained much respect and admiration from all aspects of the film
community. Ranging from film historians to the casual fan, Vertigo has now
deservedly taken its place among Hitchcock's other classic films as one of
the most intriguing of all thriller movies. And certainly, one of the most
personal films ever to have emerged from arguably, the best director in this
business. Beginning with this movie, Hitchcock managed to create a trilogy
of films in successive years that is perhaps, the most remarkable ever
attempted by any director. North By Northwest, Psycho and Vertigo feature
frequently among critics' best of lists and represents the culmination of
Hitchcock's prowess, as well as showcasing his brilliant skills as a
film-maker and his extensive knowledge of the language of the cinema.</P>
<P>Part of the mystique of the movie stems from the fact that it is misleading
the viewer right from the beginning, the plot seemingly about how James
Stewart's character, Scottie Ferguson tries to prevent "Madeline", played by
Kim Novak, from succumbing to a supernatural force that threatens to possess
and ultimately, overwhelms her. This deception is carried on brilliantly by
both the performances and the usually taut direction that Hitchcock imposes
on the entire picture. It is not until the middle third of the movie, that
Hitchcock surprisingly reveals the mystery in a fashion that completely
catches the viewer off guard. From there on, the film shifts to a more
personal tone of undesirable and questionable obsession on Scottie's part to
transform Judy back into his dream woman that was "Madeline". Yet, the
"Madeline" that he seeks never existed at all. It is this irony that
provides this film with its unique, almost surrealistic tone and among
Hitchcock's works, this is the film that is at once darkly depressing as it
is revealingly autobiographical.</P>
<P>Jimmy Stewart has always been known to play the charming and effervescent
American ordinary everyday guy, a role that is similarly typified by Tom
Hanks today. His winsome smile garnered him with his only Academy award in
The Philadelphia Story and his even more famous turn as George Bailey in
Capra's It's A Wonderful Life cemented Stewart as the quintessential
American hero. A face and a style that any American and even non-American
can identify with. But since he began to work with Hitchcock, Jimmy Stewart
began a series of roles that played him against type and character.</P>
<P>In Rear Window, Stewart's L.B. Jefferies's character begins the film as a
restless voyeuristic photographer. But by the end of the movie, one tends to
forget this questionable aspect of his character as he manages to solve a
murder mystery in the process. In Vertigo, however, Stewart plays a
character that displays even more flaws then the Jefferies character could
ever have. At the beginning, he faces seemingly increasing difficulty in
overcoming his fear of heights that was triggered off by his guilt towards
causing the death of a fellow police officer. Hitchcock then pulls off an
incredible delusion to the audience by deliberately misleading us into
thinking that Scottie Ferguson will conquer his fear by falling in love and
by resolving the mystery that surrounds "Madeline".</P>
<P>For all his reputation for suspense and thriller films, Hitchcock's ultimate
masterpiece does not focus on those two aspects as he does on the personal
aspects of his two main characters in the picture. We are allowed a glimpse
into the director's mindset and dare I say it, his emotions as he molded
Scottie and "Madeline" into human beings that seem at once, frightfully true
to life and yet, almost dreamlike in pure visual terms. As the audience, we
can certainly identify with Scottie's pursuit of his perfect woman as at one
time or another, each one of us had probably wanted to find that same person
who can fulfill our ultimate fantasies. The difference is, Scottie manages
to come close.</P>
<P>Only close, because his fantasy woman is after all, a masquerade fabricated
by his longtime friend Gavin Elster to deliberately lead Scottie into his
murderous scheme as an unknowing accomplice and also, as a convenient
scapegoat and alibi. Judy, the woman who plays the role of "Madeline" is
nothing like the "Madeline" that Scottie envisions. The real Judy is a more
earthly woman that seems at once materialistic and bubbly, which contrasts
strikingly with the icy cold blonde that is "Madeline", who simply emanates
with stylish sophistication. But Scottie is never let into this revelation
as early as the audience, so from the moment the truth is made known to the
viewer, we are made to observe and follow his emotional trauma in losing
"Madeline" and then the joy of rediscovering her in the form of Judy.</P>
<P>The beauty of the picture lies not in watching it for the first time, but
from subsequent viewings, when the audience has the intimate knowledge of
what has happened. The first half of the movie then takes on multiple layers
of meanings and and it becomes a responsibility for the viewer to understand
how difficult it is for Kim Novak to play Judy who herself is playing
"Madeline". Her movements and gestures are even more impressive with the
realization that she herself is putting up an act of deception and deceit.
Yet, from the moment Scottie fishes her out of the waters of the Golden Gate
bridge, the audience can almost identify with the extreme restraint that is
evident in Judy's eyes and that keeps her from revealing herself to Scottie.</P>
<P>Later in Scottie's apartment, we are already well aware of the ruse that
Judy is putting up for him. It is convincing to the point that the first
time viewer is totally taken in by the deception. You could believe that she
was suffering from amnesia, seemingly possessed by a "supernatural spirit"
that guides her through the various locations of San Francisco. But seeing
it the second time, notice how Novak manages to "act" surprised and shocked
in waking up naked in Scottie's room. But for all intents and purposes, she
"lets" him bring her there and even "lets" him undresses her in a deliberate
attempt to delude him. Throughout the whole charade, Scottie is completely
oblivious to the fact that she "knows". It is this idea of irony and
deceptive role-play that gives this film an unusual aural of mystery and
surrealistic romantiscm.</P>
<P>This is a romance that is unlikely, yet when it does finally occur, at the
cliffs where Judy almost overacts her part, we are already under the
impression that Scottie is in love with her. Simultaneously, we are equally
convinced that Judy, masquerading as "Madeline" is also falling for him. The
Hitchcockian touch at resolving this romance is sheer genius as it breaks
new ground in the way it treat film lovers on screen. Electing not to
provide an avenue for the doomed lovers to escape from, he decides to end
the picture almost abruptly at the infamous bell tower scene. It is the same
exact spot where earlier on, Scottie first witnesses the "suicidal" fall of
Elster's real wife. The same exact scene where Scottie relives his guilt at
being unable to prevent a certain death due to his vertigo.</P>
<P>A guilt which is unfairly burdened upon him the second time round as he is
only playing a pawn in the midst of a greater murderous scheme. A scheme
that involves Judy as "Madeline", a common girl hired by Elster because her
looks probably resemble that of Elster's wife. A guilt which would be
further complicated by the realization that Judy would herself find herself
falling hopelessly for him. At the end of the picture, Hitchcock has to
submit Scottie to one last trauma at the bell tower. Right at the moment
when Scottie is faced with the most difficult decision of his life, of
whether or not to bring Judy to justice or simply carry on the deception and
let the past slip by. The appearance of the nun at the top of the bell tower
is an inspired decision, a decision apparently made by Samuel Taylor, the
main scriptwriter for the film.</P>
<P>A nun represents God, and if the ending is abrupt, the resolvement of Judy's
involvement in the murder of the actual "Madeline" is to symbolize the
cliched notion that criminals may escape the hands of the law, but not from
the hand of God. Her apparent accidental fall may be even more symbolic in
the sense that she is re-enacting what she was asked to do by Elster, to
pretend to fall to her death to mask the death and murder of his actual
wife. The terrific irony here again is she is not acting, but really "doing"
it this time. Falling to her own death, which is as real as Elster's wife
death was. With that, the film concludes with the everlasting image of
Stewart's Scottie standing at the bell tower, looking down on the lifeless
body of his de-mystified obsession, a woman who never existed for him. A
woman who was manufactured for the purpose of a diabolical crime, and a
woman was in turn, re-manufactured by the very same man she was supposed to
deceive.</P>
<P>The re-fashioning of Judy into "Madeline" is itself, worthy of much
discussion. The main focal point becomes that of Judy being willing to
subject herself to a second of time of role-playing. But whereas the first
was due to financial and material benefits, possibly from Elster himself,
the second was unquestionably due to the purpose of pleasing Scottie. For by
the time she was "rediscovered", the audience can sense her love for him.
This is most clearly demonstrated in her reluctance to leave him a goodbye
note explaining the whole crime, and willing to play a second round of
charade with Scottie. And even after voicing her objections to being
remodeled, she eventually subjects herself to Scottie's almost unhealthy
desire to see and possess "Madeline" back in the form of another woman who
"happens" to look like her. This possession obsession at one time becomes
almost surreal. Look at the scene when she finally emerges from the bathroom
as the completed "product".</P>
<P>Roger Ebert calls this the single best shot or sequence that Hitchcock has
ever done, and I am very inclined to agree. The ghostlike green glow serves
as a haunting, almost hallucinating background to Novak's "Madeline" as she
proceeds with almost torturous pace towards Scottie. Their eyes locked in
almost twin emotions of elation and pain. Elation because both have
ultimately satisfied each other's desires. She, because she believes he will
finally accept her, and he, because the woman he thought he had "lost" so
dramatically and tragically has finally returned. In a scene where there is
no background or ambient noise, just images and Bernard Herrmann's stirring
and hauntingly romantic score, it is the ultimate piece of pure cinema
anyone has since or will ever conjure up. The moment the two tragic lovers
lock and embrace, the camera circles around the both of them, and as it does
so, images of San Juan Batista emerge from behind them, as if to indicate
that the past has caught up with the present, and later will engulf them to
a powerfully emotional and tragic end. Yet, Scottie clings on to her as if
he never has lost her, and he is at once willing to believe that she is the
same "Madeline" that he has fallen for during the first part of the film. He
hesitates only for a brief moment, but once he is convinced that she is
"genuine", he embraces her with the utmost of passion that has yet been
captured on celluloid.</P>
<P>Perhaps, the optimist would have hoped the film should have ended there. But
then, there is always the moral issue of not letting characters getting away
with blatant crime, especially when it involves murder. For us, for
Hitchcock, the resolution of this film represents one of the best climatic
endings to a motion picture. Dark, emotional, tense and frightful, these are
the emotions that one goes through together with the two leads as they
ascend the steps of the bell tower. Of course, the innovative "Vertigo" shot
heightens the tension and gives us a visual simulation of what Scottie is
feeling as he looks down towards the depths of the stairs. As Scottie
unravels the truth, a truth where Novak's character and the audience are
already well aware of, we see his expression of anger and of passion at the
same time. Emotions which would have been overplayed by any other actor,
Jimmy Stewart manages to convince us equally of his confusion, his guilt,
his hurt and his ultimate love for a fabled "woman" from which there is no
turning back from. As he reaches the top, he is ultimately faced with his
own strong belief of upholding the law, and his equally passionate feelings
for a woman who has deceived him and yet, now offer the only real hope of
redemption and his only compromised opportunity for a perfect love. And as
he contemplates his decision for either justice or love, he is cruelly
robbed of that decision as Judy accidentally plunges towards her own demise,
a justice meted out by perhaps, in equally "supernatural" manner.</P>
<P>As a motion picture, Vertigo possesses all the necessary technical
credentials for a 1958 film. George Tomasini's taut editing, Robert Burks's
elegant cinematography, Saul Bass's innovative and hypnotic title designs
and of course, Herrmann's score. The importance of how music affects a film
has never been understated. Yet somehow, Herrmann's musical soundtrack
manages to bring images that Burk's camera could not even capture. The
haunting title theme elicits both terror and romance simultaneously, and it
is this musical picture that gives the audience a glance into the movie's
contents right at the beginning of the credits. Coupled this with the eerie
logos supplied creatively by Bass and extreme close-ups of the woman's lips
and eye, Vertigo manages to evoke the entire atmosphere of the film in the
first few minutes. Herrmann's score is never catchy or tuneful, just long
stretches of mesmerizing moods and ambience that complements both story and
performances to perfection. At times overbearing, at times tender, this is
music that lives up to the high expectations of the director and his actors.
Pure cinema such as this could not have been created without the musical
strains of Bernard Herrmann and the striking photography of Burk and
Hitchcock.</P>
<P>Artistically, films like Citizen Kane and A Birth Of A Nation may have
displayed much more cinematic invention in terms of camera techniques and
other technical innovations. Vertigo however, propels the film medium
further by taking the established cinematic approaches and transcends them
by exploring the human emotion on celluloid. To accomplish this requires a
director of immense knowledge and skill, and a touch of brilliance. Further,
a set of actors who are able to translate the written script into film and
then expand on it by giving their own unique touch of humanity and
expression. Alfred Hitchcock, James Stewart and Kim Novak together with
Samuel Taylor and the crew of Vertigo created a cinematic milestone in 1958
and like the aforementioned film classics, it ranks as a motion picture
masterpiece worthy of the highest accolades. In generations to come, Vertigo
will only serve as a reminder to the art of the motion picture . or in
Hitchcock's preference, the art of pure cinema.</P>
<PRE>Ian Low
9th September 1999</PRE>
<HR><P CLASS=flush><SMALL>The review above was posted to the
<A HREF="news:rec.arts.movies.reviews">rec.arts.movies.reviews</A> newsgroup (<A HREF="news:de.rec.film.kritiken">de.rec.film.kritiken</A> for German reviews).<BR>
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.<BR>
Please direct comments/criticisms of the review to relevant newsgroups.<BR>
Broken URLs inthe reviews are the responsibility of the author.<BR>
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
</SMALL></P>
<P ALIGN=CENTER>Related links: <A HREF="/Reviews/">index of all rec.arts.movies.reviews reviews</A></P>
</P></BODY></HTML>
| {'content_hash': 'ddd14c15060e04afeb89437786a89612', 'timestamp': '', 'source': 'github', 'line_count': 248, 'max_line_length': 183, 'avg_line_length': 70.70564516129032, 'alnum_prop': 0.7886512688907898, 'repo_name': 'xianjunzhengbackup/code', 'id': '772be949543761d3b78600de0a05c0aa240ab764', 'size': '17535', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'data science/machine_learning_for_the_web/chapter_4/movie/20449.html', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'BitBake', 'bytes': '113'}, {'name': 'BlitzBasic', 'bytes': '256'}, {'name': 'CSS', 'bytes': '49827'}, {'name': 'HTML', 'bytes': '157006325'}, {'name': 'JavaScript', 'bytes': '14029'}, {'name': 'Jupyter Notebook', 'bytes': '4875399'}, {'name': 'Mako', 'bytes': '2060'}, {'name': 'Perl', 'bytes': '716'}, {'name': 'Python', 'bytes': '874414'}, {'name': 'R', 'bytes': '454'}, {'name': 'Shell', 'bytes': '3984'}]} |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
#extensions = ['sphinxcontrib.youtube']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'BIOF509'
copyright = '2016, Jonathan Street'
author = 'Jonathan Street'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.0'
# The full version, including alpha/beta/rc tags.
release = '1.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
#html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'BIOF509doc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'BIOF509.tex', 'BIOF509 Documentation',
'Jonathan Street', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'biof509', 'BIOF509 Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'BIOF509', 'BIOF509 Documentation',
author, 'BIOF509', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
| {'content_hash': '99b4608177ebb59a505cceefb3261d0f', 'timestamp': '', 'source': 'github', 'line_count': 270, 'max_line_length': 79, 'avg_line_length': 32.53703703703704, 'alnum_prop': 0.7044963005122368, 'repo_name': 'streety/biof509', 'id': '035fd3c4a20ba52f00ba085655bce7183bffbf1f', 'size': '9228', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'docs/conf.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Jupyter Notebook', 'bytes': '44062'}]} |
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>StaticWeb - Admin</title>
<meta name="viewport" content="width=device-width" />
<meta name="generator" content="StaticWeb" />
<link rel="apple-touch-icon" sizes="180x180" href="favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" href="favicons/favicon-32x32_neg.png" sizes="32x32">
<link rel="icon" type="image/png" href="favicons/favicon-16x16_neg.png" sizes="16x16">
<link rel="manifest" href="favicons/manifest.json">
<link rel="mask-icon" href="favicons/safari-pinned-tab.svg" color="#3A5C78">
<link rel="shortcut icon" href="favicons/favicon_neg.ico">
<meta name="msapplication-config" content="favicons/browserconfig.xml">
<meta name="theme-color" content="#3A5C78">
</head>
<body>
<p>
<a id="staticweb-login-link" href="https://brfskagagard-inloggning.azurewebsites.net?state=stateKeyToVerifyToken&appName=admin-dev">Login</a>
</p>
<script async="async" src="js/swchecker.js"></script>
</body>
</html>
| {'content_hash': 'ac83f918cd75abfd284a6566b40cc06f', 'timestamp': '', 'source': 'github', 'line_count': 26, 'max_line_length': 149, 'avg_line_length': 42.34615384615385, 'alnum_prop': 0.6802906448683016, 'repo_name': 'StefanWallin/core', 'id': '9a82a71660a135465ca88eb02f96f4a2bebf16c6', 'size': '1101', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'admin/index.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '7575'}, {'name': 'HTML', 'bytes': '5078'}, {'name': 'JavaScript', 'bytes': '63433'}]} |
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-parent</artifactId>
<version>999-SNAPSHOT</version>
</parent>
<artifactId>quarkus-bootstrap-bom-test</artifactId>
<name>Quarkus - Bootstrap - Test BOM</name>
<description>This BOM contains only test scoped dependencies for the bootstrap project's testsuite</description>
<packaging>pom</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-depchain</artifactId>
<type>pom</type>
<scope>test</scope>
<version>${shrinkwrap-depchain.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>3.3.0</version>
<scope>test</scope>
<exclusions>
<!-- let's prefer the plexus-utils pulled by maven-resolver-provider -->
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</exclusion>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<!-- maven compat is needed because the maven testing harness still uses maven 2 APIs -->
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>${maven.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
| {'content_hash': 'c9418a76b313d06708619abcc46f9877', 'timestamp': '', 'source': 'github', 'line_count': 68, 'max_line_length': 116, 'avg_line_length': 44.220588235294116, 'alnum_prop': 0.5407382773528434, 'repo_name': 'quarkusio/quarkus', 'id': '75ceb03f4c8062c316cc971e138670e8599826b4', 'size': '3007', 'binary': False, 'copies': '1', 'ref': 'refs/heads/main', 'path': 'independent-projects/bootstrap/bom-test/pom.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ANTLR', 'bytes': '23342'}, {'name': 'Batchfile', 'bytes': '13096'}, {'name': 'CSS', 'bytes': '6685'}, {'name': 'Dockerfile', 'bytes': '459'}, {'name': 'FreeMarker', 'bytes': '8106'}, {'name': 'Groovy', 'bytes': '16133'}, {'name': 'HTML', 'bytes': '1418749'}, {'name': 'Java', 'bytes': '38584810'}, {'name': 'JavaScript', 'bytes': '90960'}, {'name': 'Kotlin', 'bytes': '704351'}, {'name': 'Mustache', 'bytes': '13191'}, {'name': 'Scala', 'bytes': '9756'}, {'name': 'Shell', 'bytes': '71729'}]} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>metacoq-checker: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.9.1 / metacoq-checker - 1.0~alpha1+8.8</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
metacoq-checker
<small>
1.0~alpha1+8.8
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-04-18 10:02:02 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-04-18 10:02:02 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.9.1 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.09.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.09.1 Official release 4.09.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://metacoq.github.io/metacoq"
dev-repo: "git+https://github.com/MetaCoq/metacoq.git#coq-8.8"
bug-reports: "https://github.com/MetaCoq/metacoq/issues"
authors: ["Abhishek Anand <[email protected]>"
"Simon Boulier <[email protected]>"
"Cyril Cohen <[email protected]>"
"Yannick Forster <[email protected]>"
"Fabian Kunze <[email protected]>"
"Gregory Malecha <[email protected]>"
"Matthieu Sozeau <[email protected]>"
"Nicolas Tabareau <[email protected]>"
"Théo Winterhalter <[email protected]>"
]
license: "MIT"
build: [
["sh" "./configure.sh"]
[make "-j%{jobs}%" "checker"]
]
install: [
[make "-C" "checker" "install"]
]
depends: [
"ocaml" {> "4.02.3"}
"coq" {>= "8.8" & < "8.9~"}
"coq-metacoq-template" {= version}
]
synopsis: "Specification of Coq's type theory and reference checker implementation"
description: """
MetaCoq is a meta-programming framework for Coq.
The Checker module provides a complete specification of Coq's typing and conversion
relation along with a reference type-checker that is extracted to a pluging.
This provides a command: `MetaCoq Check [global_reference]` that can be used
to typecheck a Coq definition using the verified type-checker.
"""
url {
src: "https://github.com/MetaCoq/metacoq/archive/1.0-alpha+8.8.tar.gz"
checksum: "sha256=c2fe122ad30849e99c1e5c100af5490cef0e94246f8eb83f6df3f2ccf9edfc04"
}</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-metacoq-checker.1.0~alpha1+8.8 coq.8.9.1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.9.1).
The following dependencies couldn't be met:
- coq-metacoq-checker -> coq < 8.9~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-metacoq-checker.1.0~alpha1+8.8</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {'content_hash': '6b1349436f877e0115a633dbdca30445', 'timestamp': '', 'source': 'github', 'line_count': 181, 'max_line_length': 159, 'avg_line_length': 43.08839779005525, 'alnum_prop': 0.559174253109373, 'repo_name': 'coq-bench/coq-bench.github.io', 'id': 'a9febdc2e0e2ddb10fc355a7692ffff8131a4e4a', 'size': '7825', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'clean/Linux-x86_64-4.09.1-2.0.6/released/8.9.1/metacoq-checker/1.0~alpha1+8.8.html', 'mode': '33188', 'license': 'mit', 'language': []} |
function B = normalizecols(A);
%
% B = normalizecols(A);
%
% Normalizes the columns of a matrix, so each is a unit vector.
B = A./repmat(sqrt(sum(A.^2)), size(A,1), 1); | {'content_hash': 'd6b8bdd6ca4a20ec270b7a63d70b1af7', 'timestamp': '', 'source': 'github', 'line_count': 7, 'max_line_length': 64, 'avg_line_length': 24.428571428571427, 'alnum_prop': 0.6432748538011696, 'repo_name': 'wilsonCernWq/GLMspiketools', 'id': 'a7c2416b430b63cf6fb5d7483289133ca85eabc4', 'size': '171', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'glmtools_misc/normalizecols.m', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Matlab', 'bytes': '92330'}]} |
package levar
package object util {
import java.net.{ URL, MalformedURLException }
/** Regex match for valid organization names */
def validOrgName(name: String): Boolean = name.matches("""[-\w\.]+""")
/** Check for valid URL */
def validURL(url: String): Boolean = {
try {
new URL(url)
true
} catch {
case _: MalformedURLException => false
}
}
def eitherAsAny(eith: Either[_, _]): Any = eith.fold(identity, identity)
}
| {'content_hash': 'ae986af11dc3f1b5bd9152d2bddad889', 'timestamp': '', 'source': 'github', 'line_count': 21, 'max_line_length': 74, 'avg_line_length': 22.333333333333332, 'alnum_prop': 0.6183368869936035, 'repo_name': 'peoplepattern/LeVar', 'id': '725e86f6b6b915da6e28845565628fcc1a308ee5', 'size': '469', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'levar-core/src/main/scala/levar/util.scala', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '23179'}, {'name': 'HTML', 'bytes': '3753'}, {'name': 'PLSQL', 'bytes': '9220'}, {'name': 'Scala', 'bytes': '189690'}]} |
using System;
namespace NLibuv
{
public interface IUvHandle
{
/// <summary>
/// Gets the type of the current handle.
/// </summary>
UvHandleType HandleType { get; }
/// <summary>
/// Gets the loop object, on which the handle was initialized.
/// </summary>
UvLoop Loop { get; }
/// <summary>
/// Properly closes the handle and ensures that current object will be disposed correctly.
/// </summary>
void Close();
}
} | {'content_hash': '8972f53f255369db21775d8483c08709', 'timestamp': '', 'source': 'github', 'line_count': 22, 'max_line_length': 92, 'avg_line_length': 21.227272727272727, 'alnum_prop': 0.6167023554603854, 'repo_name': 'neris/NLibuv', 'id': '3583d62ec5ca1105abd95da03c3e9e8c69014a61', 'size': '469', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/NLibuv/IUvHandle.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '79809'}]} |
<?php
/*
* <auto-generated>
* This code was generated by a Codezu.
*
* Changes to this file may cause incorrect behavior and will be lost if
* the code is regenerated.
* </auto-generated>
*/
namespace Mozu\Api\Contracts\CommerceRuntime\Carts;
/**
* Collection of messages logged or created each time the cart was modifed.
*/
class CartChangeMessageCollection
{
/**
*Total number of objects in am item collection. Total counts are calculated for numerous objects in Mozu, including location inventory, products, options, product types, product reservations, categories, addresses, carriers, tax rates, time zones, and much more.
*/
public $totalCount;
/**
*Collection list of items. All returned data is provided in an items array. For a failed request, the returned response may be success with an empty item collection. Items are used throughout APIs for carts, wish lists, documents, payments, returns, properties, and more.
*/
public $items;
}
?>
| {'content_hash': 'bf5792f514496012e229c9505031e79b', 'timestamp': '', 'source': 'github', 'line_count': 34, 'max_line_length': 272, 'avg_line_length': 28.941176470588236, 'alnum_prop': 0.7408536585365854, 'repo_name': 'sanjaymandadi/mozu-php-sdk', 'id': '5c69c53aef07762b72c5830d2fc28467628b3084', 'size': '984', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Contracts/CommerceRuntime/Carts/CartChangeMessageCollection.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'PHP', 'bytes': '2811166'}]} |
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Xunit;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Commands.Management.Storage.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Commands.Management.Storage.Test")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("779954d6-2751-45ba-ad0f-0e30d384c099")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.1.3")]
[assembly: AssemblyFileVersion("1.1.3")]
[assembly: CollectionBehavior(DisableTestParallelization = true)]
| {'content_hash': '228176e83ab9e9b9319cf295d220df90', 'timestamp': '', 'source': 'github', 'line_count': 52, 'max_line_length': 86, 'avg_line_length': 42.86538461538461, 'alnum_prop': 0.699416778824585, 'repo_name': 'shuagarw/azure-powershell', 'id': 'f97be4ccddb16319ec5c949c3f88f6291931f2a7', 'size': '2232', 'binary': False, 'copies': '3', 'ref': 'refs/heads/dev', 'path': 'src/ResourceManager/Storage/Commands.Management.Storage.Test/Properties/AssemblyInfo.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '16509'}, {'name': 'C#', 'bytes': '30266509'}, {'name': 'HTML', 'bytes': '209'}, {'name': 'JavaScript', 'bytes': '4979'}, {'name': 'PHP', 'bytes': '41'}, {'name': 'PowerShell', 'bytes': '3266272'}, {'name': 'Shell', 'bytes': '50'}, {'name': 'XSLT', 'bytes': '6114'}]} |
package org.apache.activemq.artemis.core.config.impl;
import java.io.File;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
import org.apache.activemq.artemis.core.journal.impl.JournalConstants;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class ConfigurationImplTest extends ActiveMQTestBase {
protected Configuration conf;
@Test
public void testDefaults() {
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultScheduledThreadPoolMaxSize(), conf.getScheduledThreadPoolMaxSize());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultSecurityInvalidationInterval(), conf.getSecurityInvalidationInterval());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultSecurityEnabled(), conf.isSecurityEnabled());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultBindingsDirectory(), conf.getBindingsDirectory());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultCreateBindingsDir(), conf.isCreateBindingsDir());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultJournalDir(), conf.getJournalDirectory());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultCreateJournalDir(), conf.isCreateJournalDir());
Assert.assertEquals(ConfigurationImpl.DEFAULT_JOURNAL_TYPE, conf.getJournalType());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultJournalSyncTransactional(), conf.isJournalSyncTransactional());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultJournalSyncNonTransactional(), conf.isJournalSyncNonTransactional());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultJournalFileSize(), conf.getJournalFileSize());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultJournalMinFiles(), conf.getJournalMinFiles());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultJournalMaxIoAio(), conf.getJournalMaxIO_AIO());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultJournalMaxIoNio(), conf.getJournalMaxIO_NIO());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultWildcardRoutingEnabled(), conf.isWildcardRoutingEnabled());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultTransactionTimeout(), conf.getTransactionTimeout());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultMessageExpiryScanPeriod(), conf.getMessageExpiryScanPeriod()); // OK
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultMessageExpiryThreadPriority(), conf.getMessageExpiryThreadPriority()); // OK
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultTransactionTimeoutScanPeriod(), conf.getTransactionTimeoutScanPeriod()); // OK
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultManagementAddress(), conf.getManagementAddress()); // OK
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress(), conf.getManagementNotificationAddress()); // OK
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultClusterUser(), conf.getClusterUser()); // OK
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultClusterPassword(), conf.getClusterPassword()); // OK
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultPersistenceEnabled(), conf.isPersistenceEnabled());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultPersistDeliveryCountBeforeDelivery(), conf.isPersistDeliveryCountBeforeDelivery());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultFileDeployerScanPeriod(), conf.getFileDeployerScanPeriod());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultThreadPoolMaxSize(), conf.getThreadPoolMaxSize());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultJmxManagementEnabled(), conf.isJMXManagementEnabled());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultConnectionTtlOverride(), conf.getConnectionTTLOverride());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultAsyncConnectionExecutionEnabled(), conf.isAsyncConnectionExecutionEnabled());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultPagingDir(), conf.getPagingDirectory());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultLargeMessagesDir(), conf.getLargeMessagesDirectory());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultJournalCompactPercentage(), conf.getJournalCompactPercentage());
Assert.assertEquals(JournalConstants.DEFAULT_JOURNAL_BUFFER_TIMEOUT_AIO, conf.getJournalBufferTimeout_AIO());
Assert.assertEquals(JournalConstants.DEFAULT_JOURNAL_BUFFER_TIMEOUT_NIO, conf.getJournalBufferTimeout_NIO());
Assert.assertEquals(JournalConstants.DEFAULT_JOURNAL_BUFFER_SIZE_AIO, conf.getJournalBufferSize_AIO());
Assert.assertEquals(JournalConstants.DEFAULT_JOURNAL_BUFFER_SIZE_NIO, conf.getJournalBufferSize_NIO());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultJournalLogWriteRate(), conf.isLogJournalWriteRate());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultJournalPerfBlastPages(), conf.getJournalPerfBlastPages());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultMessageCounterEnabled(), conf.isMessageCounterEnabled());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultMessageCounterMaxDayHistory(), conf.getMessageCounterMaxDayHistory());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultMessageCounterSamplePeriod(), conf.getMessageCounterSamplePeriod());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultIdCacheSize(), conf.getIDCacheSize());
Assert.assertEquals(ActiveMQDefaultConfiguration.isDefaultPersistIdCache(), conf.isPersistIDCache());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultServerDumpInterval(), conf.getServerDumpInterval());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultMemoryWarningThreshold(), conf.getMemoryWarningThreshold());
Assert.assertEquals(ActiveMQDefaultConfiguration.getDefaultMemoryMeasureInterval(), conf.getMemoryMeasureInterval());
}
@Test
public void testSetGetAttributes() throws Exception {
for (int j = 0; j < 100; j++) {
int i = RandomUtil.randomInt();
conf.setScheduledThreadPoolMaxSize(i);
Assert.assertEquals(i, conf.getScheduledThreadPoolMaxSize());
long l = RandomUtil.randomLong();
conf.setSecurityInvalidationInterval(l);
Assert.assertEquals(l, conf.getSecurityInvalidationInterval());
boolean b = RandomUtil.randomBoolean();
conf.setSecurityEnabled(b);
Assert.assertEquals(b, conf.isSecurityEnabled());
String s = RandomUtil.randomString();
conf.setBindingsDirectory(s);
Assert.assertEquals(s, conf.getBindingsDirectory());
b = RandomUtil.randomBoolean();
conf.setCreateBindingsDir(b);
Assert.assertEquals(b, conf.isCreateBindingsDir());
s = RandomUtil.randomString();
conf.setJournalDirectory(s);
Assert.assertEquals(s, conf.getJournalDirectory());
b = RandomUtil.randomBoolean();
conf.setCreateJournalDir(b);
Assert.assertEquals(b, conf.isCreateJournalDir());
i = RandomUtil.randomInt() % 2;
JournalType journal = i == 0 ? JournalType.ASYNCIO : JournalType.NIO;
conf.setJournalType(journal);
Assert.assertEquals(journal, conf.getJournalType());
b = RandomUtil.randomBoolean();
conf.setJournalSyncTransactional(b);
Assert.assertEquals(b, conf.isJournalSyncTransactional());
b = RandomUtil.randomBoolean();
conf.setJournalSyncNonTransactional(b);
Assert.assertEquals(b, conf.isJournalSyncNonTransactional());
i = RandomUtil.randomInt();
conf.setJournalFileSize(i);
Assert.assertEquals(i, conf.getJournalFileSize());
i = RandomUtil.randomInt();
conf.setJournalMinFiles(i);
Assert.assertEquals(i, conf.getJournalMinFiles());
i = RandomUtil.randomInt();
conf.setJournalMaxIO_AIO(i);
Assert.assertEquals(i, conf.getJournalMaxIO_AIO());
i = RandomUtil.randomInt();
conf.setJournalMaxIO_NIO(i);
Assert.assertEquals(i, conf.getJournalMaxIO_NIO());
s = RandomUtil.randomString();
conf.setManagementAddress(new SimpleString(s));
Assert.assertEquals(s, conf.getManagementAddress().toString());
i = RandomUtil.randomInt();
conf.setMessageExpiryThreadPriority(i);
Assert.assertEquals(i, conf.getMessageExpiryThreadPriority());
l = RandomUtil.randomLong();
conf.setMessageExpiryScanPeriod(l);
Assert.assertEquals(l, conf.getMessageExpiryScanPeriod());
b = RandomUtil.randomBoolean();
conf.setPersistDeliveryCountBeforeDelivery(b);
Assert.assertEquals(b, conf.isPersistDeliveryCountBeforeDelivery());
b = RandomUtil.randomBoolean();
conf.setEnabledAsyncConnectionExecution(b);
Assert.assertEquals(b, conf.isAsyncConnectionExecutionEnabled());
b = RandomUtil.randomBoolean();
conf.setPersistenceEnabled(b);
Assert.assertEquals(b, conf.isPersistenceEnabled());
b = RandomUtil.randomBoolean();
conf.setJMXManagementEnabled(b);
Assert.assertEquals(b, conf.isJMXManagementEnabled());
l = RandomUtil.randomLong();
conf.setFileDeployerScanPeriod(l);
Assert.assertEquals(l, conf.getFileDeployerScanPeriod());
l = RandomUtil.randomLong();
conf.setConnectionTTLOverride(l);
Assert.assertEquals(l, conf.getConnectionTTLOverride());
i = RandomUtil.randomInt();
conf.setThreadPoolMaxSize(i);
Assert.assertEquals(i, conf.getThreadPoolMaxSize());
SimpleString ss = RandomUtil.randomSimpleString();
conf.setManagementNotificationAddress(ss);
Assert.assertEquals(ss, conf.getManagementNotificationAddress());
s = RandomUtil.randomString();
conf.setClusterUser(s);
Assert.assertEquals(s, conf.getClusterUser());
i = RandomUtil.randomInt();
conf.setIDCacheSize(i);
Assert.assertEquals(i, conf.getIDCacheSize());
b = RandomUtil.randomBoolean();
conf.setPersistIDCache(b);
Assert.assertEquals(b, conf.isPersistIDCache());
i = RandomUtil.randomInt();
conf.setJournalCompactMinFiles(i);
Assert.assertEquals(i, conf.getJournalCompactMinFiles());
i = RandomUtil.randomInt();
conf.setJournalCompactPercentage(i);
Assert.assertEquals(i, conf.getJournalCompactPercentage());
i = RandomUtil.randomInt();
conf.setJournalBufferSize_AIO(i);
Assert.assertEquals(i, conf.getJournalBufferSize_AIO());
i = RandomUtil.randomInt();
conf.setJournalBufferTimeout_AIO(i);
Assert.assertEquals(i, conf.getJournalBufferTimeout_AIO());
i = RandomUtil.randomInt();
conf.setJournalBufferSize_NIO(i);
Assert.assertEquals(i, conf.getJournalBufferSize_NIO());
i = RandomUtil.randomInt();
conf.setJournalBufferTimeout_NIO(i);
Assert.assertEquals(i, conf.getJournalBufferTimeout_NIO());
b = RandomUtil.randomBoolean();
conf.setLogJournalWriteRate(b);
Assert.assertEquals(b, conf.isLogJournalWriteRate());
i = RandomUtil.randomInt();
conf.setJournalPerfBlastPages(i);
Assert.assertEquals(i, conf.getJournalPerfBlastPages());
l = RandomUtil.randomLong();
conf.setServerDumpInterval(l);
Assert.assertEquals(l, conf.getServerDumpInterval());
s = RandomUtil.randomString();
conf.setPagingDirectory(s);
Assert.assertEquals(s, conf.getPagingDirectory());
s = RandomUtil.randomString();
conf.setLargeMessagesDirectory(s);
Assert.assertEquals(s, conf.getLargeMessagesDirectory());
b = RandomUtil.randomBoolean();
conf.setWildcardRoutingEnabled(b);
Assert.assertEquals(b, conf.isWildcardRoutingEnabled());
l = RandomUtil.randomLong();
conf.setTransactionTimeout(l);
Assert.assertEquals(l, conf.getTransactionTimeout());
b = RandomUtil.randomBoolean();
conf.setMessageCounterEnabled(b);
Assert.assertEquals(b, conf.isMessageCounterEnabled());
l = RandomUtil.randomPositiveLong();
conf.setMessageCounterSamplePeriod(l);
Assert.assertEquals(l, conf.getMessageCounterSamplePeriod());
i = RandomUtil.randomInt();
conf.setMessageCounterMaxDayHistory(i);
Assert.assertEquals(i, conf.getMessageCounterMaxDayHistory());
l = RandomUtil.randomLong();
conf.setTransactionTimeoutScanPeriod(l);
Assert.assertEquals(l, conf.getTransactionTimeoutScanPeriod());
s = RandomUtil.randomString();
conf.setClusterPassword(s);
Assert.assertEquals(s, conf.getClusterPassword());
}
}
@Test
public void testGetSetInterceptors() {
final String name1 = "uqwyuqywuy";
final String name2 = "yugyugyguyg";
conf.getIncomingInterceptorClassNames().add(name1);
conf.getIncomingInterceptorClassNames().add(name2);
Assert.assertTrue(conf.getIncomingInterceptorClassNames().contains(name1));
Assert.assertTrue(conf.getIncomingInterceptorClassNames().contains(name2));
Assert.assertFalse(conf.getIncomingInterceptorClassNames().contains("iijij"));
}
@Test
public void testSerialize() throws Exception {
boolean b = RandomUtil.randomBoolean();
conf.setHAPolicyConfiguration(new LiveOnlyPolicyConfiguration());
int i = RandomUtil.randomInt();
conf.setScheduledThreadPoolMaxSize(i);
Assert.assertEquals(i, conf.getScheduledThreadPoolMaxSize());
long l = RandomUtil.randomLong();
conf.setSecurityInvalidationInterval(l);
Assert.assertEquals(l, conf.getSecurityInvalidationInterval());
b = RandomUtil.randomBoolean();
conf.setSecurityEnabled(b);
Assert.assertEquals(b, conf.isSecurityEnabled());
String s = RandomUtil.randomString();
conf.setBindingsDirectory(s);
Assert.assertEquals(s, conf.getBindingsDirectory());
b = RandomUtil.randomBoolean();
conf.setCreateBindingsDir(b);
Assert.assertEquals(b, conf.isCreateBindingsDir());
s = RandomUtil.randomString();
conf.setJournalDirectory(s);
Assert.assertEquals(s, conf.getJournalDirectory());
b = RandomUtil.randomBoolean();
conf.setCreateJournalDir(b);
Assert.assertEquals(b, conf.isCreateJournalDir());
i = RandomUtil.randomInt() % 2;
JournalType journal = i == 0 ? JournalType.ASYNCIO : JournalType.NIO;
conf.setJournalType(journal);
Assert.assertEquals(journal, conf.getJournalType());
b = RandomUtil.randomBoolean();
conf.setJournalSyncTransactional(b);
Assert.assertEquals(b, conf.isJournalSyncTransactional());
b = RandomUtil.randomBoolean();
conf.setJournalSyncNonTransactional(b);
Assert.assertEquals(b, conf.isJournalSyncNonTransactional());
i = RandomUtil.randomInt();
conf.setJournalFileSize(i);
Assert.assertEquals(i, conf.getJournalFileSize());
i = RandomUtil.randomInt();
conf.setJournalMinFiles(i);
Assert.assertEquals(i, conf.getJournalMinFiles());
i = RandomUtil.randomInt();
conf.setJournalMaxIO_AIO(i);
Assert.assertEquals(i, conf.getJournalMaxIO_AIO());
i = RandomUtil.randomInt();
conf.setJournalMaxIO_NIO(i);
Assert.assertEquals(i, conf.getJournalMaxIO_NIO());
s = RandomUtil.randomString();
conf.setManagementAddress(new SimpleString(s));
Assert.assertEquals(s, conf.getManagementAddress().toString());
i = RandomUtil.randomInt();
conf.setMessageExpiryThreadPriority(i);
Assert.assertEquals(i, conf.getMessageExpiryThreadPriority());
l = RandomUtil.randomLong();
conf.setMessageExpiryScanPeriod(l);
Assert.assertEquals(l, conf.getMessageExpiryScanPeriod());
b = RandomUtil.randomBoolean();
conf.setPersistDeliveryCountBeforeDelivery(b);
Assert.assertEquals(b, conf.isPersistDeliveryCountBeforeDelivery());
b = RandomUtil.randomBoolean();
conf.setEnabledAsyncConnectionExecution(b);
Assert.assertEquals(b, conf.isAsyncConnectionExecutionEnabled());
b = RandomUtil.randomBoolean();
conf.setPersistenceEnabled(b);
Assert.assertEquals(b, conf.isPersistenceEnabled());
b = RandomUtil.randomBoolean();
conf.setJMXManagementEnabled(b);
Assert.assertEquals(b, conf.isJMXManagementEnabled());
l = RandomUtil.randomLong();
conf.setFileDeployerScanPeriod(l);
Assert.assertEquals(l, conf.getFileDeployerScanPeriod());
l = RandomUtil.randomLong();
conf.setConnectionTTLOverride(l);
Assert.assertEquals(l, conf.getConnectionTTLOverride());
i = RandomUtil.randomInt();
conf.setThreadPoolMaxSize(i);
Assert.assertEquals(i, conf.getThreadPoolMaxSize());
SimpleString ss = RandomUtil.randomSimpleString();
conf.setManagementNotificationAddress(ss);
Assert.assertEquals(ss, conf.getManagementNotificationAddress());
s = RandomUtil.randomString();
conf.setClusterUser(s);
Assert.assertEquals(s, conf.getClusterUser());
i = RandomUtil.randomInt();
conf.setIDCacheSize(i);
Assert.assertEquals(i, conf.getIDCacheSize());
b = RandomUtil.randomBoolean();
conf.setPersistIDCache(b);
Assert.assertEquals(b, conf.isPersistIDCache());
i = RandomUtil.randomInt();
conf.setJournalCompactMinFiles(i);
Assert.assertEquals(i, conf.getJournalCompactMinFiles());
i = RandomUtil.randomInt();
conf.setJournalCompactPercentage(i);
Assert.assertEquals(i, conf.getJournalCompactPercentage());
i = RandomUtil.randomInt();
conf.setJournalBufferSize_AIO(i);
Assert.assertEquals(i, conf.getJournalBufferSize_AIO());
i = RandomUtil.randomInt();
conf.setJournalBufferTimeout_AIO(i);
Assert.assertEquals(i, conf.getJournalBufferTimeout_AIO());
i = RandomUtil.randomInt();
conf.setJournalBufferSize_NIO(i);
Assert.assertEquals(i, conf.getJournalBufferSize_NIO());
i = RandomUtil.randomInt();
conf.setJournalBufferTimeout_NIO(i);
Assert.assertEquals(i, conf.getJournalBufferTimeout_NIO());
b = RandomUtil.randomBoolean();
conf.setLogJournalWriteRate(b);
Assert.assertEquals(b, conf.isLogJournalWriteRate());
i = RandomUtil.randomInt();
conf.setJournalPerfBlastPages(i);
Assert.assertEquals(i, conf.getJournalPerfBlastPages());
l = RandomUtil.randomLong();
conf.setServerDumpInterval(l);
Assert.assertEquals(l, conf.getServerDumpInterval());
s = RandomUtil.randomString();
conf.setPagingDirectory(s);
Assert.assertEquals(s, conf.getPagingDirectory());
s = RandomUtil.randomString();
conf.setLargeMessagesDirectory(s);
Assert.assertEquals(s, conf.getLargeMessagesDirectory());
b = RandomUtil.randomBoolean();
conf.setWildcardRoutingEnabled(b);
Assert.assertEquals(b, conf.isWildcardRoutingEnabled());
l = RandomUtil.randomLong();
conf.setTransactionTimeout(l);
Assert.assertEquals(l, conf.getTransactionTimeout());
b = RandomUtil.randomBoolean();
conf.setMessageCounterEnabled(b);
Assert.assertEquals(b, conf.isMessageCounterEnabled());
l = RandomUtil.randomPositiveLong();
conf.setMessageCounterSamplePeriod(l);
Assert.assertEquals(l, conf.getMessageCounterSamplePeriod());
i = RandomUtil.randomInt();
conf.setMessageCounterMaxDayHistory(i);
Assert.assertEquals(i, conf.getMessageCounterMaxDayHistory());
l = RandomUtil.randomLong();
conf.setTransactionTimeoutScanPeriod(l);
Assert.assertEquals(l, conf.getTransactionTimeoutScanPeriod());
s = RandomUtil.randomString();
conf.setClusterPassword(s);
Assert.assertEquals(s, conf.getClusterPassword());
// This will use serialization to perform a deep copy of the object
Configuration conf2 = conf.copy();
Assert.assertTrue(conf.equals(conf2));
}
@Test
public void testResolvePath() throws Throwable {
// Validate that the resolve method will work even with artemis.instance doesn't exist
String oldProperty = System.getProperty("artemis.instance");
try {
System.setProperty("artemis.instance", "/tmp/" + RandomUtil.randomString());
ConfigurationImpl configuration = new ConfigurationImpl();
configuration.setJournalDirectory("./data-journal");
File journalLocation = configuration.getJournalLocation();
Assert.assertFalse("This path shouldn't resolve to a real folder", journalLocation.exists());
}
finally {
if (oldProperty == null) {
System.clearProperty("artemis.instance");
}
else {
System.setProperty("artemis.instance", oldProperty);
}
}
}
@Test
public void testAbsolutePath() throws Throwable {
// Validate that the resolve method will work even with artemis.instance doesn't exist
String oldProperty = System.getProperty("artemis.instance");
File tempFolder = null;
try {
System.setProperty("artemis.instance", "/tmp/" + RandomUtil.randomString());
tempFolder = File.createTempFile("journal-folder", "");
tempFolder.delete();
tempFolder = new File(tempFolder.getAbsolutePath());
tempFolder.mkdirs();
System.out.println("TempFolder = " + tempFolder.getAbsolutePath());
ConfigurationImpl configuration = new ConfigurationImpl();
configuration.setJournalDirectory(tempFolder.getAbsolutePath());
File journalLocation = configuration.getJournalLocation();
Assert.assertTrue(journalLocation.exists());
}
finally {
if (oldProperty == null) {
System.clearProperty("artemis.instance");
}
else {
System.setProperty("artemis.instance", oldProperty);
}
if (tempFolder != null) {
tempFolder.delete();
}
}
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
conf = createConfiguration();
}
protected Configuration createConfiguration() throws Exception {
return new ConfigurationImpl();
}
}
| {'content_hash': '234dc968e36131531af8b5c60b1588ee', 'timestamp': '', 'source': 'github', 'line_count': 546, 'max_line_length': 147, 'avg_line_length': 42.663003663003664, 'alnum_prop': 0.7165364471537735, 'repo_name': 'waysact/activemq-artemis', 'id': '447d51bb9bfabc36bcbee452805b663354e9af63', 'size': '24093', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '5879'}, {'name': 'C', 'bytes': '23262'}, {'name': 'C++', 'bytes': '1032'}, {'name': 'CMake', 'bytes': '4260'}, {'name': 'CSS', 'bytes': '11732'}, {'name': 'HTML', 'bytes': '19113'}, {'name': 'Java', 'bytes': '22819589'}, {'name': 'Shell', 'bytes': '11911'}]} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="zh">
<head>
<!-- Generated by javadoc (1.8.0_171) on Mon Apr 22 17:36:00 CST 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>D - 索引 (android API)</title>
<meta name="date" content="2019-04-22">
<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="D - \u7D22\u5F15 (android API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>您的浏览器已禁用 JavaScript。</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="跳过导航链接">跳过导航链接</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="导航">
<li><a href="../overview-summary.html">概览</a></li>
<li>程序包</li>
<li>类</li>
<li><a href="../overview-tree.html">树</a></li>
<li><a href="../deprecated-list.html">已过时</a></li>
<li class="navBarCell1Rev">索引</li>
<li><a href="../help-doc.html">帮助</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-3.html">上一个字母</a></li>
<li><a href="index-5.html">下一个字母</a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-files/index-4.html" target="_top">框架</a></li>
<li><a href="index-4.html" target="_top">无框架</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../allclasses-noframe.html">所有类</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="contentContainer"><a href="index-1.html">A</a> <a href="index-2.html">B</a> <a href="index-3.html">C</a> <a href="index-4.html">D</a> <a href="index-5.html">E</a> <a href="index-6.html">F</a> <a href="index-7.html">G</a> <a href="index-8.html">H</a> <a href="index-9.html">I</a> <a href="index-10.html">J</a> <a href="index-11.html">L</a> <a href="index-12.html">M</a> <a href="index-13.html">N</a> <a href="index-14.html">O</a> <a href="index-15.html">P</a> <a href="index-16.html">R</a> <a href="index-17.html">S</a> <a href="index-18.html">T</a> <a href="index-19.html">U</a> <a href="index-20.html">V</a> <a href="index-21.html">W</a> <a name="I:D">
<!-- -->
</a>
<h2 class="title">D</h2>
<dl>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/ContactManager.html#declineInvitation-java.lang.String-java.lang.String-java.lang.String-cn.jpush.im.api.BasicCallback-">declineInvitation(String, String, String, BasicCallback)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/ContactManager.html" title="cn.jpush.im.android.api中的类">ContactManager</a></dt>
<dd>
<div class="block">拒绝对方的好友请求</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/ChatRoomManager.html#delChatRoomAdmin-long-java.util.List-cn.jpush.im.api.BasicCallback-">delChatRoomAdmin(long, List<UserInfo>, BasicCallback)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/ChatRoomManager.html" title="cn.jpush.im.android.api中的类">ChatRoomManager</a></dt>
<dd>
<div class="block">取消指定用户的聊天室房管身份,只有房主有此权限</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/ChatRoomManager.html#delChatRoomBlacklist-long-java.util.List-cn.jpush.im.api.BasicCallback-">delChatRoomBlacklist(long, List<UserInfo>, BasicCallback)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/ChatRoomManager.html" title="cn.jpush.im.android.api中的类">ChatRoomManager</a></dt>
<dd>
<div class="block">将用户从聊天室黑名单中移除,只有聊天室的房主和房管有此权限</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/ChatRoomManager.html#delChatRoomSilence-long-java.util.Collection-cn.jpush.im.api.BasicCallback-">delChatRoomSilence(long, Collection<UserInfo>, BasicCallback)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/ChatRoomManager.html" title="cn.jpush.im.android.api中的类">ChatRoomManager</a></dt>
<dd>
<div class="block">将指定用户从聊天室禁言列表中移除(批量设置一次最多500个)
只有房主和管理员可设置,取消成功聊天室成员会收到<a href="../cn/jpush/im/android/api/event/ChatRoomNotificationEvent.html" title="cn.jpush.im.android.api.event中的类"><code>ChatRoomNotificationEvent</code></a></div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/model/Conversation.html#deleteAllMessage--">deleteAllMessage()</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/Conversation.html" title="cn.jpush.im.android.api.model中的类">Conversation</a></dt>
<dd>
<div class="block">删除会话中的所有消息,但不会删除会话本身。</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/JMessageClient.html#deleteChatRoomConversation-long-">deleteChatRoomConversation(long)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd>
<div class="block">删除聊天室会话,同时删除掉本地相关缓存文件</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/JMessageClient.html#deleteGroupConversation-long-">deleteGroupConversation(long)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd>
<div class="block">删除群聊的会话,同时删除掉本地聊天记录</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/model/Conversation.html#deleteMessage-int-">deleteMessage(int)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/Conversation.html" title="cn.jpush.im.android.api.model中的类">Conversation</a></dt>
<dd>
<div class="block">删除会话中指定messageId的消息
由于聊天室类型会话中所有消息都不会保存到本地,调用此接口将固定返回false</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/JMessageClient.html#deleteSingleConversation-java.lang.String-">deleteSingleConversation(String)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd>
<div class="block">删除单聊的会话,同时删除掉本地聊天记录。</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/JMessageClient.html#deleteSingleConversation-java.lang.String-java.lang.String-">deleteSingleConversation(String, String)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd>
<div class="block">删除与指定appkey下username的单聊的会话,同时删除掉本地聊天记录。</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/model/GroupInfo.html#delGroupAnnouncement-int-cn.jpush.im.api.BasicCallback-">delGroupAnnouncement(int, BasicCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/GroupInfo.html" title="cn.jpush.im.android.api.model中的类">GroupInfo</a></dt>
<dd>
<div class="block">删除群内指定id的公告,只有群主和管理员有权限删除<br/>
删除群公告成功时群内所有成员会收到<a href="../cn/jpush/im/android/api/event/GroupAnnouncementChangedEvent.html" title="cn.jpush.im.android.api.event中的类"><code>GroupAnnouncementChangedEvent</code></a></div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/model/GroupInfo.html#delGroupBlacklist-java.util.List-cn.jpush.im.api.BasicCallback-">delGroupBlacklist(List<UserInfo>, BasicCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/GroupInfo.html" title="cn.jpush.im.android.api.model中的类">GroupInfo</a></dt>
<dd>
<div class="block">将用户从群组黑名单中移除,只有群主和管理员有此权限.</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/model/GroupInfo.html#delGroupSilence-java.util.Collection-cn.jpush.im.api.BasicCallback-">delGroupSilence(Collection<UserInfo>, BasicCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/GroupInfo.html" title="cn.jpush.im.android.api.model中的类">GroupInfo</a></dt>
<dd>
<div class="block">取消群成员禁言(批量设置一次最多500个),取消禁言成功后会以系统消息形式通知群内成员</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/JMessageClient.html#delUsersFromBlacklist-java.util.List-cn.jpush.im.api.BasicCallback-">delUsersFromBlacklist(List<String>, BasicCallback)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd>
<div class="block">将用户移出黑名单。</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/JMessageClient.html#delUsersFromBlacklist-java.util.List-java.lang.String-cn.jpush.im.api.BasicCallback-">delUsersFromBlacklist(List<String>, String, BasicCallback)</a></span> - 类 中的静态方法cn.jpush.im.android.api.<a href="../cn/jpush/im/android/api/JMessageClient.html" title="cn.jpush.im.android.api中的类">JMessageClient</a></dt>
<dd>
<div class="block">将用户移出黑名单,通过指定appKey可以实现跨应用将用户移出黑名单</div>
</dd>
<dt><a href="../cn/jpush/im/android/api/model/DeviceInfo.html" title="cn.jpush.im.android.api.model中的类"><span class="typeNameLink">DeviceInfo</span></a> - <a href="../cn/jpush/im/android/api/model/package-summary.html">cn.jpush.im.android.api.model</a>中的类</dt>
<dd>
<div class="block">设备状态信息,使用<a href="../cn/jpush/im/android/api/JMessageClient.html#login-java.lang.String-java.lang.String-cn.jpush.im.android.api.callback.RequestCallback-"><code>JMessageClient.login(String, String, RequestCallback)</code></a>可以返回账号所登陆过的设备信息。</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/model/DeviceInfo.html#DeviceInfo-long-cn.jpush.im.android.api.enums.PlatformType-int-int-boolean-int-">DeviceInfo(long, PlatformType, int, int, boolean, int)</a></span> - 类 的构造器cn.jpush.im.android.api.model.<a href="../cn/jpush/im/android/api/model/DeviceInfo.html" title="cn.jpush.im.android.api.model中的类">DeviceInfo</a></dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/jmrtc/JMRTCInternalUse.html#doCompleteCallBackToUser-cn.jpush.im.api.BasicCallback-int-java.lang.String-java.lang.Object...-">doCompleteCallBackToUser(BasicCallback, int, String, Object...)</a></span> - 类 中的静态方法cn.jpush.im.android.api.jmrtc.<a href="../cn/jpush/im/android/api/jmrtc/JMRTCInternalUse.html" title="cn.jpush.im.android.api.jmrtc中的类">JMRTCInternalUse</a></dt>
<dd> </dd>
<dt><a href="../cn/jpush/im/android/api/callback/DownloadAvatarCallback.html" title="cn.jpush.im.android.api.callback中的类"><span class="typeNameLink">DownloadAvatarCallback</span></a> - <a href="../cn/jpush/im/android/api/callback/package-summary.html">cn.jpush.im.android.api.callback</a>中的类</dt>
<dd> </dd>
<dt><a href="../cn/jpush/im/android/api/callback/DownloadCompletionCallback.html" title="cn.jpush.im.android.api.callback中的类"><span class="typeNameLink">DownloadCompletionCallback</span></a> - <a href="../cn/jpush/im/android/api/callback/package-summary.html">cn.jpush.im.android.api.callback</a>中的类</dt>
<dd> </dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/content/FileContent.html#downloadFile-cn.jpush.im.android.api.model.Message-cn.jpush.im.android.api.callback.DownloadCompletionCallback-">downloadFile(Message, DownloadCompletionCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/FileContent.html" title="cn.jpush.im.android.api.content中的类">FileContent</a></dt>
<dd>
<div class="block">下载消息中文件。</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/content/ImageContent.html#downloadOriginImage-cn.jpush.im.android.api.model.Message-cn.jpush.im.android.api.callback.DownloadCompletionCallback-">downloadOriginImage(Message, DownloadCompletionCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/ImageContent.html" title="cn.jpush.im.android.api.content中的类">ImageContent</a></dt>
<dd>
<div class="block">下载图片消息中的原图,下载过程中想要取消的话调用<a href="../cn/jpush/im/android/api/content/ImageContent.html#cancelDownload-cn.jpush.im.android.api.model.Message-"><code>ImageContent.cancelDownload(Message)</code></a>。</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/content/VideoContent.html#downloadThumbImage-cn.jpush.im.android.api.model.Message-cn.jpush.im.android.api.callback.DownloadCompletionCallback-">downloadThumbImage(Message, DownloadCompletionCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/VideoContent.html" title="cn.jpush.im.android.api.content中的类">VideoContent</a></dt>
<dd>
<div class="block">下载视频消息的缩略图(如果视频消息发送者有指定的话)
对于用户在线期间收到的视频消息:sdk会在接收到视频消息时自动下载缩略图文件。</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/content/ImageContent.html#downloadThumbnailImage-cn.jpush.im.android.api.model.Message-cn.jpush.im.android.api.callback.DownloadCompletionCallback-">downloadThumbnailImage(Message, DownloadCompletionCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/ImageContent.html" title="cn.jpush.im.android.api.content中的类">ImageContent</a></dt>
<dd>
<div class="block">下载图片消息中原图对应的缩略图
对于用户在线期间收到的图片消息:sdk会在接收到图片消息时自动下载缩略图。</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/content/VideoContent.html#downloadVideoFile-cn.jpush.im.android.api.model.Message-cn.jpush.im.android.api.callback.DownloadCompletionCallback-">downloadVideoFile(Message, DownloadCompletionCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/VideoContent.html" title="cn.jpush.im.android.api.content中的类">VideoContent</a></dt>
<dd>
<div class="block">下载视频消息中的视频文件,下载过程中如果想取消调用<a href="../cn/jpush/im/android/api/content/VideoContent.html#cancelDownload-cn.jpush.im.android.api.model.Message-"><code>VideoContent.cancelDownload(Message)</code></a>
注意:sdk收到文件消息后,不会自动下载视频文件附件,需要用户主动调用此接口完成下载。</div>
</dd>
<dt><span class="memberNameLink"><a href="../cn/jpush/im/android/api/content/VoiceContent.html#downloadVoiceFile-cn.jpush.im.android.api.model.Message-cn.jpush.im.android.api.callback.DownloadCompletionCallback-">downloadVoiceFile(Message, DownloadCompletionCallback)</a></span> - 类 中的方法cn.jpush.im.android.api.content.<a href="../cn/jpush/im/android/api/content/VoiceContent.html" title="cn.jpush.im.android.api.content中的类">VoiceContent</a></dt>
<dd>
<div class="block">下载语音消息中的语音文件。</div>
</dd>
</dl>
<a href="index-1.html">A</a> <a href="index-2.html">B</a> <a href="index-3.html">C</a> <a href="index-4.html">D</a> <a href="index-5.html">E</a> <a href="index-6.html">F</a> <a href="index-7.html">G</a> <a href="index-8.html">H</a> <a href="index-9.html">I</a> <a href="index-10.html">J</a> <a href="index-11.html">L</a> <a href="index-12.html">M</a> <a href="index-13.html">N</a> <a href="index-14.html">O</a> <a href="index-15.html">P</a> <a href="index-16.html">R</a> <a href="index-17.html">S</a> <a href="index-18.html">T</a> <a href="index-19.html">U</a> <a href="index-20.html">V</a> <a href="index-21.html">W</a> </div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="跳过导航链接">跳过导航链接</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="导航">
<li><a href="../overview-summary.html">概览</a></li>
<li>程序包</li>
<li>类</li>
<li><a href="../overview-tree.html">树</a></li>
<li><a href="../deprecated-list.html">已过时</a></li>
<li class="navBarCell1Rev">索引</li>
<li><a href="../help-doc.html">帮助</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-3.html">上一个字母</a></li>
<li><a href="index-5.html">下一个字母</a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-files/index-4.html" target="_top">框架</a></li>
<li><a href="index-4.html" target="_top">无框架</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../allclasses-noframe.html">所有类</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 ======= -->
</body>
</html>
| {'content_hash': '36e7cc4973dd70aa81446e393ec0d201', 'timestamp': '', 'source': 'github', 'line_count': 232, 'max_line_length': 770, 'avg_line_length': 74.23706896551724, 'alnum_prop': 0.7189804331417291, 'repo_name': 'Aoyunyun/jpush-docs', 'id': 'e5b2bbf466a87e9d736d91aff40835a1fdc491ff', 'size': '19169', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'zh/jmessage/client/im_android_api_docs/index-files/index-4.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '143254'}, {'name': 'HTML', 'bytes': '7277764'}, {'name': 'JavaScript', 'bytes': '195949'}, {'name': 'Python', 'bytes': '4590'}, {'name': 'Shell', 'bytes': '2945'}]} |
#include <arch_helpers.h>
#include <assert.h>
#include <bakery_lock.h>
#include <bl_common.h>
#include <context.h>
#include <context_mgmt.h>
#include <debug.h>
#include <denver.h>
#include <gic_v2.h>
#include <interrupt_mgmt.h>
#include <platform.h>
#include <tegra_def.h>
#include <tegra_private.h>
DEFINE_BAKERY_LOCK(tegra_fiq_lock);
/*******************************************************************************
* Static variables
******************************************************************************/
static uint64_t ns_fiq_handler_addr;
static unsigned int fiq_handler_active;
static pcpu_fiq_state_t fiq_state[PLATFORM_CORE_COUNT];
/*******************************************************************************
* Handler for FIQ interrupts
******************************************************************************/
static uint64_t tegra_fiq_interrupt_handler(uint32_t id,
uint32_t flags,
void *handle,
void *cookie)
{
cpu_context_t *ctx = cm_get_context(NON_SECURE);
el3_state_t *el3state_ctx = get_el3state_ctx(ctx);
int cpu = plat_my_core_pos();
uint32_t irq;
bakery_lock_get(&tegra_fiq_lock);
/*
* The FIQ was generated when the execution was in the non-secure
* world. Save the context registers to start with.
*/
cm_el1_sysregs_context_save(NON_SECURE);
/*
* Save elr_el3 and spsr_el3 from the saved context, and overwrite
* the context with the NS fiq_handler_addr and SPSR value.
*/
fiq_state[cpu].elr_el3 = read_ctx_reg(el3state_ctx, CTX_ELR_EL3);
fiq_state[cpu].spsr_el3 = read_ctx_reg(el3state_ctx, CTX_SPSR_EL3);
/*
* Set the new ELR to continue execution in the NS world using the
* FIQ handler registered earlier.
*/
assert(ns_fiq_handler_addr);
write_ctx_reg(el3state_ctx, CTX_ELR_EL3, ns_fiq_handler_addr);
/*
* Mark this interrupt as complete to avoid a FIQ storm.
*/
irq = plat_ic_acknowledge_interrupt();
if (irq < 1022)
plat_ic_end_of_interrupt(irq);
bakery_lock_release(&tegra_fiq_lock);
return 0;
}
/*******************************************************************************
* Setup handler for FIQ interrupts
******************************************************************************/
void tegra_fiq_handler_setup(void)
{
uint64_t flags;
int rc;
/* return if already registered */
if (fiq_handler_active)
return;
/*
* Register an interrupt handler for FIQ interrupts generated for
* NS interrupt sources
*/
flags = 0;
set_interrupt_rm_flag(flags, NON_SECURE);
rc = register_interrupt_type_handler(INTR_TYPE_EL3,
tegra_fiq_interrupt_handler,
flags);
if (rc)
panic();
/* handler is now active */
fiq_handler_active = 1;
}
/*******************************************************************************
* Validate and store NS world's entrypoint for FIQ interrupts
******************************************************************************/
void tegra_fiq_set_ns_entrypoint(uint64_t entrypoint)
{
ns_fiq_handler_addr = entrypoint;
}
/*******************************************************************************
* Handler to return the NS EL1/EL0 CPU context
******************************************************************************/
int tegra_fiq_get_intr_context(void)
{
cpu_context_t *ctx = cm_get_context(NON_SECURE);
gp_regs_t *gpregs_ctx = get_gpregs_ctx(ctx);
el1_sys_regs_t *el1state_ctx = get_sysregs_ctx(ctx);
int cpu = plat_my_core_pos();
uint64_t val;
/*
* We store the ELR_EL3, SPSR_EL3, SP_EL0 and SP_EL1 registers so
* that el3_exit() sends these values back to the NS world.
*/
write_ctx_reg(gpregs_ctx, CTX_GPREG_X0, fiq_state[cpu].elr_el3);
write_ctx_reg(gpregs_ctx, CTX_GPREG_X1, fiq_state[cpu].spsr_el3);
val = read_ctx_reg(gpregs_ctx, CTX_GPREG_SP_EL0);
write_ctx_reg(gpregs_ctx, CTX_GPREG_X2, val);
val = read_ctx_reg(el1state_ctx, CTX_SP_EL1);
write_ctx_reg(gpregs_ctx, CTX_GPREG_X3, val);
return 0;
}
| {'content_hash': '018b19a27ee8c559c10cac6c56424a38', 'timestamp': '', 'source': 'github', 'line_count': 134, 'max_line_length': 80, 'avg_line_length': 29.350746268656717, 'alnum_prop': 0.5542842613780828, 'repo_name': 'sbranden/arm-trusted-firmware', 'id': '7fcc114c0624c9f7498ed9d6b6008613845a9209', 'size': '5489', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'plat/nvidia/tegra/common/tegra_fiq_glue.c', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Assembly', 'bytes': '583601'}, {'name': 'C', 'bytes': '3262969'}, {'name': 'C++', 'bytes': '67409'}, {'name': 'Makefile', 'bytes': '188703'}, {'name': 'Objective-C', 'bytes': '2286'}]} |
Plugin.define "Sendcard" do
author "Brendan Coles <[email protected]>" # 2011-03-15
version "0.1"
description "Sendcard is a multi-database (It currently supports 9 different databases!) ecards script or virtual postcard program written in PHP. Suitable for large or small sites, it is very easy to setup, and comes with an installation wizard."
website "http://www.sendcard.org/"
# Google results as at 2011-03-15 #
# 255 for scscsc320
# 141 for "Powered by sendcard - an advanced PHP e-card program" -dork
# Dorks #
dorks [
'"scscsc320"',
'"Powered by sendcard - an advanced PHP e-card program" -dork'
]
# Matches #
matches [
# Powered by logo link
{ :regexp=>/<a href="http:\/\/(sendcard.sf.net|www.sendcard.org)\/"( title="download your own PHP e-card script")?><img src="poweredbysendcard102x47.gif"[^>]+alt="Powered by sendcard - an advanced PHP e-card program"[^>]*><\/a>/ },
# Powered by logo
{ :certainty=>25, :regexp=>/<img src="poweredbysendcard102x47.gif"[^>]+alt="Powered by sendcard - an advanced PHP e-card program">/ },
# HTML Comment
{ :text=>"<!-- The following line should allow me to search on google and find sendcard installations -->" },
# "scscsc320" string provided for Google hackers as per HTML comment:
# <!-- The following line should allow me to search on google and find sendcard installations -->
{ :text=>'<div style="display: none; color: White;">scscsc320</div>' },
]
end
| {'content_hash': 'a35083c153883f03f780719ff531005d', 'timestamp': '', 'source': 'github', 'line_count': 39, 'max_line_length': 247, 'avg_line_length': 36.38461538461539, 'alnum_prop': 0.7110641296687809, 'repo_name': 'Yukinoshita47/Yuki-Chan-The-Auto-Pentest', 'id': '77dc8022f9eecbfb14770b54a2738d79d0ed511c', 'size': '1664', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'Module/WhatWeb/plugins/sendcard.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '36211'}, {'name': 'JavaScript', 'bytes': '3038'}, {'name': 'Makefile', 'bytes': '1360'}, {'name': 'Perl', 'bytes': '108876'}, {'name': 'Python', 'bytes': '3034585'}, {'name': 'Roff', 'bytes': '6738'}, {'name': 'Ruby', 'bytes': '2693582'}, {'name': 'Shell', 'bytes': '53755'}, {'name': 'XSLT', 'bytes': '5475'}]} |
using namespace boost::python;
using namespace GafferUIBindings;
using namespace GafferUI;
struct NodeGadgetCreator
{
NodeGadgetCreator( object fn )
: m_fn( fn )
{
}
NodeGadgetPtr operator()( Gaffer::NodePtr node )
{
IECorePython::ScopedGILLock gilLock;
NodeGadgetPtr result = extract<NodeGadgetPtr>( m_fn( node ) );
return result;
}
private :
object m_fn;
};
static void registerNodeGadget( IECore::TypeId nodeType, object creator )
{
NodeGadget::registerNodeGadget( nodeType, NodeGadgetCreator( creator ) );
}
static Gaffer::NodePtr node( NodeGadget &nodeGadget )
{
return nodeGadget.node();
}
void GafferUIBindings::bindNodeGadget()
{
typedef NodeGadgetWrapper<NodeGadget> Wrapper;
IE_CORE_DECLAREPTR( Wrapper );
NodeGadgetClass<NodeGadget, WrapperPtr>()
.def( "node", &node )
.def( "create", &NodeGadget::create ).staticmethod( "create" )
.def( "registerNodeGadget", ®isterNodeGadget ).staticmethod( "registerNodeGadget" )
;
}
| {'content_hash': 'b03efdedcd10c91e68db05ee4b2a9ce2', 'timestamp': '', 'source': 'github', 'line_count': 45, 'max_line_length': 88, 'avg_line_length': 21.666666666666668, 'alnum_prop': 0.7323076923076923, 'repo_name': 'davidsminor/gaffer', 'id': 'a5bc00d968cbfbe477a92edc7d487d2655f1afda', 'size': '3104', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/GafferUIBindings/NodeGadgetBinding.cpp', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '9286'}, {'name': 'C++', 'bytes': '3358250'}, {'name': 'COBOL', 'bytes': '64449'}, {'name': 'CSS', 'bytes': '28027'}, {'name': 'Python', 'bytes': '3267354'}, {'name': 'Shell', 'bytes': '7055'}, {'name': 'Slash', 'bytes': '35200'}]} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {'content_hash': '4a36ae6a2cb1fdfc88bba833ad633512', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 39, 'avg_line_length': 10.23076923076923, 'alnum_prop': 0.6917293233082706, 'repo_name': 'mdoering/backbone', 'id': '5f083f0131bb95cb5adce1dd72d19debc17ef419', 'size': '186', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Liliopsida/Poales/Cyperaceae/Carex/Carex austroalpina/ Syn. Carex sempervirens tenax/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
package com.lfk.justwetools.View.NewPaint;
import android.app.Application;
import java.util.ArrayList;
/**
* Created by liufengkai on 15/8/25.
*/
public class PathNode extends Application{
public class Node{
public Node() {}
public float x;
public float y;
public int PenColor;
public int TouchEvent;
public int PenWidth;
public boolean IsPaint;
public long time;
public int EraserWidth;
}
private ArrayList<Node> PathList;
public ArrayList<Node> getPathList() {
return PathList;
}
public void addNode(Node node){
PathList.add(node);
}
public Node NewAnode(){
return new Node();
}
public void clearList(){
PathList.clear();
}
@Override
public void onCreate() {
super.onCreate();
PathList = new ArrayList<Node>();
}
public void setPathList(ArrayList<Node> pathList) {
PathList = pathList;
}
public Node getTheLastNote(){
return PathList.get(PathList.size()-1);
}
public void deleteTheLastNote(){
PathList.remove(PathList.size()-1);
}
public PathNode() {
PathList = new ArrayList<Node>();
}
}
| {'content_hash': '068a025dc9c566f5ebea5e91fdc4b62a', 'timestamp': '', 'source': 'github', 'line_count': 64, 'max_line_length': 55, 'avg_line_length': 19.5, 'alnum_prop': 0.5985576923076923, 'repo_name': 'xxzj990/Reader', 'id': 'c61ac53384e81f8b78f2c7a16495fba5202238e3', 'size': '1248', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/src/main/java/com/lfk/justwetools/View/NewPaint/PathNode.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '30096'}, {'name': 'HTML', 'bytes': '962'}, {'name': 'Java', 'bytes': '267523'}, {'name': 'JavaScript', 'bytes': '24085'}]} |
<head>
<!-- Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<!-- Plots go in blank <div> elements.
You can size them in the plot layout,
or give the div a size as shown here.
-->
<div id="myDiv" style="width:90%;height:550px;"></div>
<script>
Plotly.d3.csv('https://data.sfgov.org/resource/tvq9-ec9w.csv', function(err, rows){
function unpack(rows, key) {
return rows.map(function(row) {
if (row["case_disposition"] == "Confirmed"){
return row[key];
}; });
}
casesDict = {}
deathDict = {}
var i;
for (i = 0; i < rows.length; i++) {
if (rows[i]["case_disposition"] == "Confirmed"){
currDate = rows[i]["date"]
currCases = parseInt(rows[i]["case_count"])
if (currDate in casesDict) {
casesDict[currDate] += currCases
} else {
casesDict[currDate] = currCases
}
}
if (rows[i]["case_disposition"] == "Death"){
currDate = rows[i]["date"]
currCases = parseInt(rows[i]["case_count"])
if (currDate in deathDict) {
deathDict[currDate] += currCases
} else {
deathDict[currDate] = currCases
}
}
}
var casesData = {
type: "scatter",
mode: "lines",
name: 'New cases per day',
x: Object.keys(casesDict),
y: Object.values(casesDict),
line: {color: '#1279ED'}
}
var deathData = {
type: "bar",
mode: "lines",
name: 'New deaths per day',
x: Object.keys(deathDict),
y: Object.values(deathDict),
line: {color: '#B5DD02'}
}
//data = [casesData]
data = [casesData, deathData]
var layout = {
title: 'SF COVID-19 Confirmed New Cases By Day',
xaxis: {
type: 'date',
title: {
automargin: true,
text: "Date"
}
},
yaxis: {
title: {
automargin: true,
text: "New cases"
}
},
};
Plotly.plot(myDiv, data, layout);
})
</script>
<p>
Data from -
<a href="https://data.sfgov.org/stories/s/fjki-2fab">San Francisco COVID-19 Data Tracker</a>
<br>
Powered by their <a href="https://data.sfgov.org/COVID-19/COVID-19-Cases-Summarized-by-Date-Transmission-and/tvq9-ec9w"> API</a>
</p>
| {'content_hash': 'fea9ad793f6e7ffc8feac5c90eca7972', 'timestamp': '', 'source': 'github', 'line_count': 101, 'max_line_length': 132, 'avg_line_length': 21.019801980198018, 'alnum_prop': 0.5925577013659915, 'repo_name': 'richieM/richieM.github.io', 'id': 'f16de43944991bedf7cbe4a76e400e96f9ce33db', 'size': '2123', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'SF-COVID/index.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '222889'}, {'name': 'HTML', 'bytes': '5423416'}, {'name': 'JavaScript', 'bytes': '13239197'}, {'name': 'SCSS', 'bytes': '58835'}]} |
<?php
/**
* Модуль для работы с сессиями пользователей
*/
/**
* @return array настройки шардов хранения сессий пользователя
*/
function session_config() {
return [
[
'host' => 'cachesession1',
],
[
'host' => 'cachesession2',
],
];
}
/**
* @return mixed соединение с пулом кешей хранения сессий пользователя
*/
function session_getconnection() {
$connection = null;
$config = session_config();
foreach($config as $v) {
if (is_null($connection)) {
$connection = memcache_connect($v['host']);
} else {
memcache_add_server($connection, $v['host']);
}
}
return $connection;
}
/**
* Функция получения данных сессии
* @param string $sessionId идентификатор сессии
* @return mixed данные и сессии
*/
function session_get($sessionId) {
$connection = session_getconnection();
return memcache_get($connection, $sessionId);
}
| {'content_hash': '285d4004f32f53d750a7ad0c9521d6ab', 'timestamp': '', 'source': 'github', 'line_count': 45, 'max_line_length': 70, 'avg_line_length': 21.6, 'alnum_prop': 0.588477366255144, 'repo_name': 'alxmslwork/order', 'id': '551690cbabddd35aba6898f0f739a64d571d5f5e', 'size': '1157', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'source/ordr/session/session.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '11281'}, {'name': 'Nginx', 'bytes': '51'}, {'name': 'PHP', 'bytes': '80832'}, {'name': 'Shell', 'bytes': '4738'}]} |
<?php
error_reporting(E_STRICT | E_ALL);
// You can set the include path to src directory or reference
// DfpUser.php directly via require_once.
// $path = '/path/to/dfp_api_php_lib/src';
$path = dirname(__FILE__) . '/../../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
try {
// Get DfpUser from credentials in "../auth.ini"
// relative to the DfpUser.php file's directory.
$user = new DfpUser();
// Log SOAP XML request and response.
$user->LogDefaults();
// Get the TeamService.
$teamService = $user->GetService('TeamService', 'v201502');
// Create an array to store local team objects.
$teams = array();
for ($i = 0; $i < 5; $i++) {
$team = new Team();
$team->name = 'Team #' . uniqid();
$team->hasAllCompanies = false;
$team->hasAllInventory = false;
$teams[] = $team;
}
// Create the teams on the server.
$teams = $teamService->createTeams($teams);
// Display results.
if (isset($teams)) {
foreach ($teams as $team) {
print 'A team with ID "' . $team->id
. '" and name "'. $team->name
. '" was created."' . "\n";
}
} else {
print "No teams created.\n";
}
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (Exception $e) {
print $e->getMessage() . "\n";
}
| {'content_hash': 'fd625e16de48a27d137bbf9ac82132c4', 'timestamp': '', 'source': 'github', 'line_count': 56, 'max_line_length': 69, 'avg_line_length': 27.196428571428573, 'alnum_prop': 0.6080105055810899, 'repo_name': 'Adslive/googleads-php-lib', 'id': 'c9d76efb943be05bb090688f27fdb130b7e3934e', 'size': '2558', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'examples/Dfp/v201502/TeamService/CreateTeams.php', 'mode': '33261', 'license': 'apache-2.0', 'language': [{'name': 'PHP', 'bytes': '45961097'}, {'name': 'XSLT', 'bytes': '17842'}]} |
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'django-cruds-adminlte'
copyright = u'2017, Óscar M. Lage'
author = u'Óscar M. Lage'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'0.0.3'
# The full version, including alpha/beta/rc tags.
release = u'0.0.3'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'django-cruds-adminltedoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'django-cruds-adminlte.tex',
u'django-cruds-adminlte Documentation',
u'Óscar M. Lage', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'django-cruds-adminlte',
u'django-cruds-adminlte Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'django-cruds-adminlte',
u'django-cruds-adminlte Documentation',
author, 'django-cruds-adminlte', 'One line description of project.',
'Miscellaneous'),
]
| {'content_hash': '5535439e650c68c140006eabd35e66d3', 'timestamp': '', 'source': 'github', 'line_count': 124, 'max_line_length': 78, 'avg_line_length': 30.588709677419356, 'alnum_prop': 0.6659636171895598, 'repo_name': 'luisza/django-cruds-adminlte', 'id': '719ef65b9b562727198456bdb6e17ae819513028', 'size': '4862', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'docs/conf.py', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'CSS', 'bytes': '246689'}, {'name': 'HTML', 'bytes': '75891'}, {'name': 'JavaScript', 'bytes': '246595'}, {'name': 'Python', 'bytes': '57039'}]} |
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace Naxis.Core.Extensions
{
/// <summary>
/// Type扩展
/// </summary>
public static class TypeExtensions
{
/// <summary>
/// 返回类型的实例
/// </summary>
/// <param name="type"></param>
/// <param name="args"></param>
/// <returns></returns>
public static object CreateInstance(this Type type, params object[] args)
{
return Activator.CreateInstance(type, args);
}
/// <summary>
/// 返回泛型的实例
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="type"></param>
/// <param name="args"></param>
/// <returns></returns>
public static T CreateInstance<T>(this Type type, params object[] args)
{
return (T)type.CreateInstance(args);
}
/// <summary>
/// 获取属性信息
/// </summary>
/// <param name="expression"></param>
/// <returns></returns>
public static MemberInfo GetMemberInfo(this Expression expression)
{
var lambda = (LambdaExpression)expression;
MemberExpression memberExpression;
var body = lambda.Body as UnaryExpression;
if (body != null)
{
var unaryExpression = body;
memberExpression = (MemberExpression)unaryExpression.Operand;
}
else
{
memberExpression = (MemberExpression)lambda.Body;
}
return memberExpression.Member;
}
/// <summary>
/// 类型是否有指定特性
/// </summary>
/// <param name="type"></param>
/// <param name="attributeType"></param>
/// <returns></returns>
public static bool HasAttribute(this Type type, Type attributeType)
{
return type.GetCustomAttributes(attributeType, false).Length > 0;
}
/// <summary>
/// 方法是否有指定特性
/// </summary>
/// <param name="type"></param>
/// <param name="attributeType"></param>
/// <returns></returns>
public static bool HasMethodsWithAttribute(this Type type, Type attributeType)
{
return type.GetMethods().Any(methodInfo => methodInfo.GetCustomAttributes(attributeType, false).Length > 0);
}
/// <summary>
/// 属性是否有指定特性
/// </summary>
/// <param name="methodInfo"></param>
/// <param name="attributeType"></param>
/// <returns></returns>
public static bool HasAttribute(this MethodInfo methodInfo, Type attributeType)
{
return methodInfo.GetCustomAttributes(attributeType, false).Length > 0;
}
/// <summary>
/// 是否能转换到另一个类型
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="type"></param>
/// <returns></returns>
public static bool CanBeCastTo<T>(this Type type)
{
if (type == null)
{
return false;
}
var destinationType = typeof(T);
return CanBeCastTo(type, destinationType);
}
/// <summary>
/// 是否能转换到另一个类型
/// </summary>
/// <param name="type"></param>
/// <param name="destinationType"></param>
/// <returns></returns>
public static bool CanBeCastTo(this Type type, Type destinationType)
{
if (type == null)
{
return false;
}
return type == destinationType || destinationType.IsAssignableFrom(type);
}
/// <summary>
/// 是否对象实例
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static bool IsConcrete(this Type type)
{
if (type == null)
{
return false;
}
return !type.IsAbstract && !type.IsInterface;
}
/// <summary>
/// 非对象实例(接口/抽象类)
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static bool IsNotConcrete(this Type type)
{
return !type.IsConcrete();
}
}
}
| {'content_hash': '1f0bb5e0d76dfb38c38809bbb5f05b84', 'timestamp': '', 'source': 'github', 'line_count': 154, 'max_line_length': 120, 'avg_line_length': 28.42207792207792, 'alnum_prop': 0.5058259081562714, 'repo_name': 'swpudp/Naxis', 'id': 'dbcd299964c6dd269767ada0ffd079b670dc2cb3', 'size': '4553', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Naxis.Common/Extensions/TypeExtensions.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP', 'bytes': '96'}, {'name': 'C#', 'bytes': '994969'}, {'name': 'CSS', 'bytes': '842932'}, {'name': 'HTML', 'bytes': '167343'}, {'name': 'JavaScript', 'bytes': '610860'}, {'name': 'TypeScript', 'bytes': '394'}]} |
//
// (C) Jan de Vaan 2007-2010, all rights reserved. See the accompanying "License.txt" for licensed use.
//
#ifndef JLS_INTERFACE
#define JLS_INTERFACE
#include "pubtypes.h"
#include "dcmtk/ofstd/ofstd.h" /* for size_t */
#include "dcmtk/ofstd/ofdefine.h" /* for DCMTK_DECL_EXPORT */
#ifdef charls_EXPORTS
#define DCMTK_CHARLS_EXPORT DCMTK_DECL_EXPORT
#else
#define DCMTK_CHARLS_EXPORT DCMTK_DECL_IMPORT
#endif
#ifndef CHARLS_IMEXPORT
#define CHARLS_IMEXPORT(returntype) DCMTK_CHARLS_EXPORT returntype
#endif
#ifdef __cplusplus
extern "C"
{
#endif
CHARLS_IMEXPORT(enum JLS_ERROR) JpegLsEncode(void* compressedData, size_t compressedLength, size_t* pcbyteWritten,
const void* uncompressedData, size_t uncompressedLength, struct JlsParameters* pparams);
CHARLS_IMEXPORT(enum JLS_ERROR) JpegLsDecode(void* uncompressedData, size_t uncompressedLength,
const void* compressedData, size_t compressedLength,
struct JlsParameters* info);
CHARLS_IMEXPORT(enum JLS_ERROR) JpegLsDecodeRect(void* uncompressedData, size_t uncompressedLength,
const void* compressedData, size_t compressedLength,
struct JlsRect rect, struct JlsParameters* info);
CHARLS_IMEXPORT(enum JLS_ERROR) JpegLsReadHeader(const void* uncompressedData, size_t uncompressedLength,
struct JlsParameters* pparams);
CHARLS_IMEXPORT(enum JLS_ERROR) JpegLsVerifyEncode(const void* uncompressedData, size_t uncompressedLength,
const void* compressedData, size_t compressedLength);
#ifdef __cplusplus
}
#endif
#endif
| {'content_hash': 'd1ccf9eaad720240f7bd9c719eccb932', 'timestamp': '', 'source': 'github', 'line_count': 51, 'max_line_length': 116, 'avg_line_length': 29.705882352941178, 'alnum_prop': 0.7768976897689769, 'repo_name': 'NCIP/annotation-and-image-markup', 'id': '1a7bd4b9259183c2270e10dd26578801ee7ae0d1', 'size': '1515', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'AIMToolkit_v4.1.0_rv44/source/dcmtk-3.6.1_20121102/dcmjpls/libcharls/intrface.h', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '31363450'}, {'name': 'C#', 'bytes': '5152916'}, {'name': 'C++', 'bytes': '148605530'}, {'name': 'CSS', 'bytes': '85406'}, {'name': 'Java', 'bytes': '2039090'}, {'name': 'Objective-C', 'bytes': '381107'}, {'name': 'Perl', 'bytes': '502054'}, {'name': 'Shell', 'bytes': '11832'}, {'name': 'Tcl', 'bytes': '30867'}]} |
'use strict';
// global events
var EVENTS = require('../events');
var ViewModel = require('./models/getFeatureInfo');
var View = require('./views/getFeatureInfo');
var UI_Panel = require('./panel');
var Controller = function(options) {
// initialize VM, and that's all a controller should EVER do, everything
// else is handled by the vm and model
this.vm = new ViewModel(options);
};
var GetFeatureInfo = function(options) {
this.options = {
// initial module options
};
// override and extend default options
for (var opt in options) {
if (options.hasOwnProperty(opt)) {
this.options[opt] = options[opt];
}
}
this.init();
return {
controller: this.controller,
view: this.view
};
};
GetFeatureInfo.prototype = {
init: function() {
var gfi_controller = new Controller(this.options);
var gfi_view = View;
var panel = new UI_Panel(this.options, {
title: 'Rezultati',
component: {controller: gfi_controller, view: gfi_view},
width: '200px',
top: '56px',
right: '10px'
});
this.controller = panel.controller;
this.view = panel.view;
EVENTS.on('getFeatureInfo.results', function(options) {
gfi_controller.vm.set(options.features);
});
gfi_controller.vm.events.on('results.show', function(options) {
panel.controller.vm.show();
});
gfi_controller.vm.events.on('results.hide', function(options) {
panel.controller.vm.hide();
});
gfi_controller.vm.events.on('result.click', function(options) {
EVENTS.emit('getFeatureInfo.result.clicked', options);
});
panel.controller.vm.events.on('panel.closed', function () {
EVENTS.emit('getFeatureInfo.results.closed');
});
EVENTS.on('getFeatureInfo.tool.deactivate', function () {
panel.controller.vm.hide();
});
}
};
module.exports = GetFeatureInfo;
| {'content_hash': '93412c864f5f8d7c266ca53c0bb1a596', 'timestamp': '', 'source': 'github', 'line_count': 80, 'max_line_length': 76, 'avg_line_length': 26.025, 'alnum_prop': 0.5840537944284342, 'repo_name': 'candela-it/sunlumo', 'id': 'c849c6d2067692610e72c2863f156a0621516057', 'size': '2082', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'django_project/lib_js/lib/ui/getFeatureInfo.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '394728'}, {'name': 'HTML', 'bytes': '2964'}, {'name': 'JavaScript', 'bytes': '364730'}, {'name': 'Python', 'bytes': '99692'}, {'name': 'Ruby', 'bytes': '900'}, {'name': 'Shell', 'bytes': '446'}]} |
<!doctype html>
<html>
<title>npm-init</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="../../static/style.css">
<link rel="canonical" href="https://www.npmjs.org/doc/cli/npm-init.html">
<script async=true src="../../static/toc.js"></script>
<body>
<div id="wrapper">
<h1><a href="../cli/npm-init.html">npm-init</a></h1> <p>create a package.json file</p>
<h2 id="synopsis">SYNOPSIS</h2>
<pre><code>npm init [--force|-f|--yes|-y|--scope]
npm init <@scope> (same as `npx <@scope>/create`)
npm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`)</code></pre><h2 id="examples">EXAMPLES</h2>
<p>Create a new React-based project using <a href="https://npm.im/create-react-app"><code>create-react-app</code></a>:</p>
<pre><code>$ npm init react-app ./my-react-app</code></pre><p>Create a new <code>esm</code>-compatible package using <a href="https://npm.im/create-esm"><code>create-esm</code></a>:</p>
<pre><code>$ mkdir my-esm-lib && cd my-esm-lib
$ npm init esm --yes</code></pre><p>Generate a plain old package.json using legacy init:</p>
<pre><code>$ mkdir my-npm-pkg && cd my-npm-pkg
$ git init
$ npm init</code></pre><p>Generate it without having it ask any questions:</p>
<pre><code>$ npm init -y</code></pre><h2 id="description">DESCRIPTION</h2>
<p><code>npm init <initializer></code> can be used to set up a new or existing npm package.</p>
<p><code>initializer</code> in this case is an npm package named <code>create-<initializer></code>, which
will be installed by <a href="https://npm.im/npx"><code><a href="../cli/npx.html">npx(1)</a></code></a>, and then have its main bin
executed -- presumably creating or updating <code>package.json</code> and running any other
initialization-related operations.</p>
<p>The init command is transformed to a corresponding <code>npx</code> operation as follows:</p>
<ul>
<li><code>npm init foo</code> -> <code>npx create-foo</code></li>
<li><code>npm init @usr/foo</code> -> <code>npx @usr/create-foo</code></li>
<li><code>npm init @usr</code> -> <code>npx @usr/create</code></li>
</ul>
<p>Any additional options will be passed directly to the command, so <code>npm init foo
--hello</code> will map to <code>npx create-foo --hello</code>.</p>
<p>If the initializer is omitted (by just calling <code>npm init</code>), init will fall back
to legacy init behavior. It will ask you a bunch of questions, and then write a
package.json for you. It will attempt to make reasonable guesses based on
existing fields, dependencies, and options selected. It is strictly additive, so
it will keep any fields and values that were already set. You can also use
<code>-y</code>/<code>--yes</code> to skip the questionnaire altogether. If you pass <code>--scope</code>, it
will create a scoped package.</p>
<h2 id="see-also">SEE ALSO</h2>
<ul>
<li><a href="https://github.com/isaacs/init-package-json">https://github.com/isaacs/init-package-json</a></li>
<li><a href="../files/package.json.html">package.json(5)</a></li>
<li><a href="../cli/npm-version.html">npm-version(1)</a></li>
<li><a href="../misc/npm-scope.html">npm-scope(7)</a></li>
</ul>
</div>
<table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
<tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18> </td></tr>
<tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td colspan=6 style="width:60px;height:10px;background:#fff"> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td></tr>
<tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2> </td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td></tr>
<tr><td style="width:10px;height:10px;background:#fff" rowspan=2> </td></tr>
<tr><td style="width:10px;height:10px;background:#fff"> </td></tr>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
<p id="footer">npm-init — [email protected]</p>
| {'content_hash': 'b814ace278ccc8d889d4d84a040e636a', 'timestamp': '', 'source': 'github', 'line_count': 65, 'max_line_length': 807, 'avg_line_length': 82.63076923076923, 'alnum_prop': 0.7013591509960901, 'repo_name': 'joegesualdo/dotfiles', 'id': 'af9d321cf10c183d2fbc88d707f9c2a8e834ab02', 'size': '5371', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'npm-global/lib/node_modules/npm/html/doc/cli/npm-init.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '712'}, {'name': 'CoffeeScript', 'bytes': '386'}, {'name': 'Elm', 'bytes': '332785'}, {'name': 'JavaScript', 'bytes': '115864'}, {'name': 'Ruby', 'bytes': '5718'}, {'name': 'Shell', 'bytes': '24929'}, {'name': 'Vim script', 'bytes': '90842'}]} |
.. aiohttp documentation master file, created by
sphinx-quickstart on Wed Mar 5 12:35:35 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
aiohttp
=======
HTTP client/server for :term:`asyncio` (:pep:`3156`).
.. _GitHub: https://github.com/KeepSafe/aiohttp
.. _Freenode: http://freenode.net
Features
--------
- Supports both :ref:`aiohttp-client` and :ref:`HTTP Server <aiohttp-web>`.
- Supports both :ref:`Server WebSockets <aiohttp-web-websockets>` and
:ref:`Client WebSockets <aiohttp-client-websockets>` out-of-the-box.
- Web-server has :ref:`aiohttp-web-middlewares`,
:ref:`aiohttp-web-signals` and pluggable routing.
Library Installation
--------------------
::
$ pip install aiohttp
You may want to install *optional* :term:`cchardet` library as faster
replacement for :term:`chardet`::
$ pip install cchardet
Getting Started
---------------
Client example::
import asyncio
import aiohttp
async def fetch_page(session, url):
with aiohttp.Timeout(10):
async with session.get(url) as response:
assert response.status == 200
return await response.read()
loop = asyncio.get_event_loop()
with aiohttp.ClientSession(loop=loop) as session:
content = loop.run_until_complete(
fetch_page(session, 'http://python.org'))
print(content)
Server example::
from aiohttp import web
async def handle(request):
name = request.match_info.get('name', "Anonymous")
text = "Hello, " + name
return web.Response(body=text.encode('utf-8'))
app = web.Application()
app.router.add_route('GET', '/{name}', handle)
web.run_app(app)
.. note::
Throughout this documentation, examples utilize the `async/await` syntax
introduced by :pep:`492` that is only valid for Python 3.5+.
If you are using Python 3.4, please replace ``await`` with
``yield from`` and ``async def`` with a ``@coroutine`` decorator.
For example, this::
async def coro(...):
ret = await f()
should be replaced by::
@asyncio.coroutine
def coro(...):
ret = yield from f()
Source code
-----------
The project is hosted on GitHub_
Please feel free to file an issue on the `bug tracker
<https://github.com/KeepSafe/aiohttp/issues>`_ if you have found a bug
or have some suggestion in order to improve the library.
The library uses `Travis <https://travis-ci.org/KeepSafe/aiohttp>`_ for
Continuous Integration.
Dependencies
------------
- Python Python 3.4.1+
- *chardet* library
- *Optional* :term:`cchardet` library as faster replacement for
:term:`chardet`.
Install it explicitly via::
$ pip install cchardet
Discussion list
---------------
*aio-libs* google group: https://groups.google.com/forum/#!forum/aio-libs
Feel free to post your questions and ideas here.
Contributing
------------
Please read the :ref:`instructions for contributors<aiohttp-contributing>`
before making a Pull Request.
Authors and License
-------------------
The ``aiohttp`` package is written mostly by Nikolay Kim and Andrew Svetlov.
It's *Apache 2* licensed and freely available.
Feel free to improve this package and send a pull request to GitHub_.
Contents
--------
.. toctree::
client
client_reference
web
web_reference
server
multidict
multipart
api
logging
gunicorn
faq
new_router
contributing
changes
glossary
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. disqus::
| {'content_hash': 'ec27cce6b36b5d6bed4a4728df978ac9', 'timestamp': '', 'source': 'github', 'line_count': 167, 'max_line_length': 76, 'avg_line_length': 21.802395209580837, 'alnum_prop': 0.6550398242241142, 'repo_name': 'decentfox/aiohttp', 'id': '3117ab2550044523d559d9c759cc6fd0df4bbdd4', 'size': '3641', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'docs/index.rst', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '838'}, {'name': 'CSS', 'bytes': '112'}, {'name': 'HTML', 'bytes': '1060'}, {'name': 'Makefile', 'bytes': '2272'}, {'name': 'PLpgSQL', 'bytes': '765'}, {'name': 'Python', 'bytes': '995177'}, {'name': 'Shell', 'bytes': '550'}]} |
var mraa = require('mraa');
function Womprat(config){
if(!this.config) this.config = config;
};
Womprat.prototype.constructor = womprat;
/* contrains a value to a minimum and maximum range
* @param {Number} value
* @param {Number} min
* @param {Number} max
* @return {Number}
*/
Womprat.prototype.constrain = function (value, min, max){
if(value < min) return min;
else if (value > max) return max;
else return value;
};
/* maps a value from an old range to a new range
* @param {Number} x
* @param {Number} in_min
* @param {Number} in_max
* @param {Number} out_min
* @param {Number} out_max
* @return {Number}
*/
Womprat.prototype.map = function (x, in_min, in_max, out_min, out_max){
return(x-in_min)*(out_max - out_min)/(in_max - in_min)+out_min;
};
module.exports = Womprat;
| {'content_hash': 'dee5935dadf0f3eaeb1797f0a0e722ab', 'timestamp': '', 'source': 'github', 'line_count': 32, 'max_line_length': 71, 'avg_line_length': 25.46875, 'alnum_prop': 0.6539877300613497, 'repo_name': 'Foxman13/womprat', 'id': 'ac42f1303778fa3d2500bd72ba797fb8bc697915', 'size': '815', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'js/index.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '947'}]} |
(function() {
'use strict';
var root = this;
root.define([
'views/edit/contact',
'models/contact'
],
function( EditContact, Contact ) {
describe('EditContact Itemview', function () {
it('should be an instance of EditContact Itemview', function () {
var contact = new Contact({
firstName: 'Foo',
lastName: 'Bar',
phoneNumber: '0000000000'
});
var editContact = new EditContact({
model: contact
});
expect( editContact ).to.be.an.instanceOf( EditContact );
});
});
});
}).call( this );
| {'content_hash': 'b1ffeeee9d0edf70edb0aad56c7ed211', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 81, 'avg_line_length': 29.62962962962963, 'alnum_prop': 0.41625, 'repo_name': 'shaine/marionette-gentle-introduction-requirejs', 'id': '3a5e4e557fff20804e438aefef1e38654e4a5870', 'size': '800', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'test/spec/views/edit/contact.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '181878'}, {'name': 'JavaScript', 'bytes': '63052'}]} |
using System;
using System.Linq;
using Microsoft.VisualStudio.Language.StandardClassification;
namespace ILSupport
{
public static partial class ILParser
{
private class Span
{
public Span ( string @class, string start, string end, string escape = null )
{
Class = @class;
Start = start;
End = end;
Escape = escape;
}
public readonly string Class;
public readonly string Start;
public readonly string End;
public readonly string Escape;
}
private static Span IdentifySpan ( string text, int position )
{
var part = text.Substring ( position, Math.Min ( spanStartMaxLength, text.Length - position ) );
foreach ( var span in spans )
if ( part.StartsWith ( span.Start ) )
return span;
return null;
}
private static readonly Span [ ] spans = { new Span ( PredefinedClassificationTypeNames.Comment, "/*", "*/", null ),
new Span ( PredefinedClassificationTypeNames.Comment, "//", "\n", null ),
new Span ( PredefinedClassificationTypeNames.String, "@\"", "\"", "\"\"" ),
new Span ( PredefinedClassificationTypeNames.String, "\"", "\"", "\\\"" ),
new Span ( PredefinedClassificationTypeNames.Character, "'", "'", "\\\'" ) };
private static readonly int spanStartMaxLength = spans.Max ( s => s.Start.Length );
}
} | {'content_hash': '0261a301cd077685a561dacb9d79d96d', 'timestamp': '', 'source': 'github', 'line_count': 44, 'max_line_length': 131, 'avg_line_length': 40.43181818181818, 'alnum_prop': 0.4867903316469927, 'repo_name': 'ins0mniaque/ILSupport', 'id': 'a9ccc0edcb3c15d2def5443d56d8238348fbead3', 'size': '1779', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'IL Support/Parser/Parser.span.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '47122'}, {'name': 'F#', 'bytes': '1132'}, {'name': 'Visual Basic .NET', 'bytes': '16886'}]} |
namespace CefSharp
{
/// <summary>
/// The manner in which a link click should be opened.
/// </summary>
public enum WindowOpenDisposition
{
/// <summary>
/// An enum constant representing the unknown option.
/// </summary>
Unknown,
/// <summary>
/// An enum constant representing the current tab option.
/// </summary>
CurrentTab,
/// <summary>
/// Indicates that only one tab with the url should exist in the same window
/// </summary>
SingletonTab,
/// <summary>
/// An enum constant representing the new foreground tab option.
/// </summary>
NewForegroundTab,
/// <summary>
/// An enum constant representing the new background tab option.
/// </summary>
NewBackgroundTab,
/// <summary>
/// An enum constant representing the new popup option.
/// </summary>
NewPopup,
/// <summary>
/// An enum constant representing the new window option.
/// </summary>
NewWindow,
/// <summary>
/// An enum constant representing the save to disk option.
/// </summary>
SaveToDisk,
/// <summary>
/// An enum constant representing the off the record option.
/// </summary>
OffTheRecord,
/// <summary>
/// An enum constant representing the ignore action option.
/// </summary>
IgnoreAction
}
}
| {'content_hash': '61dbebd8c86f0b05e34583980201e383', 'timestamp': '', 'source': 'github', 'line_count': 49, 'max_line_length': 84, 'avg_line_length': 31.06122448979592, 'alnum_prop': 0.5440210249671484, 'repo_name': 'Livit/CefSharp', 'id': 'c2722845bd36a635ad5939606fa575f56a0c392a', 'size': '1691', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'CefSharp/Enums/WindowOpenDisposition.cs', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Batchfile', 'bytes': '335'}, {'name': 'C#', 'bytes': '919437'}, {'name': 'C++', 'bytes': '468798'}, {'name': 'CSS', 'bytes': '92244'}, {'name': 'HTML', 'bytes': '85258'}, {'name': 'JavaScript', 'bytes': '2653'}, {'name': 'PowerShell', 'bytes': '9677'}]} |