text stringlengths 2 1.04M | meta dict |
|---|---|
#include <gtest/gtest.h>
#include "test/ServerFixture.hh"
using namespace gazebo;
class ForceTorqueSensor_TEST : public ServerFixture
{
};
static std::string forceTorqueSensorString =
"<sdf version='1.4'>"
" <sensor name='force_torque' type='force_torque'>"
" <update_rate>30</update_rate>"
" <always_on>true</always_on>"
" </sensor>"
"</sdf>";
/////////////////////////////////////////////////
/// \brief Test Creation of a ForceTorque sensor
TEST_F(ForceTorqueSensor_TEST, CreateForceTorque)
{
Load("worlds/pioneer2dx.world");
sensors::SensorManager *mgr = sensors::SensorManager::Instance();
sdf::ElementPtr sdf(new sdf::Element);
sdf::initFile("sensor.sdf", sdf);
sdf::readString(forceTorqueSensorString, sdf);
physics::WorldPtr world = physics::get_world("default");
physics::ModelPtr model = world->GetModel("pioneer2dx");
physics::JointPtr joint = model->GetJoint("left_wheel_hinge");
// Create the Ray sensor
std::string sensorName = mgr->CreateSensor(sdf, "default",
"pioneer2dx::left_wheel_hinge", joint->GetId());
// Make sure the returned sensor name is correct
EXPECT_EQ(sensorName,
std::string("default::pioneer2dx::left_wheel_hinge::force_torque"));
// Update the sensor manager so that it can process new sensors.
mgr->Update();
// Get a pointer to the Ray sensor
sensors::ForceTorqueSensorPtr sensor =
boost::dynamic_pointer_cast<sensors::ForceTorqueSensor>(
mgr->GetSensor(sensorName));
// Make sure the above dynamic cast worked.
EXPECT_TRUE(sensor != NULL);
EXPECT_EQ(sensor->GetTorque(), math::Vector3(0, 0, 0));
EXPECT_EQ(sensor->GetForce(), math::Vector3(0, 0, 0));
EXPECT_TRUE(sensor->IsActive());
}
/////////////////////////////////////////////////
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| {
"content_hash": "99c7d9f3e43fb3ab40df89a6017be17d",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 74,
"avg_line_length": 29.171875,
"alnum_prop": 0.6598821638993037,
"repo_name": "jonbinney/gazebo_ros_wrapper",
"id": "d203e764ec6feee548a27fe786de4638021ce4af",
"size": "2492",
"binary": false,
"copies": "1",
"ref": "refs/heads/indigo-devel",
"path": "gazebo/sensors/ForceTorqueSensor_TEST.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "565866"
},
{
"name": "C++",
"bytes": "8280611"
},
{
"name": "CSS",
"bytes": "12592"
},
{
"name": "JavaScript",
"bytes": "25255"
}
],
"symlink_target": ""
} |
export ALGORITHM_SVM_INSTALL_DIR = $(HOME)/opt/algorithm-svm
# Path to FreeLing install tree
export FREELING_INSTALL_DIR = $(HOME)/opt/freeling
# Path to FOMA install tree
# (a copy is helpfully included in FreeLing)
export FOMA_INSTALL_DIR = $(FREELING_INSTALL_DIR)
# Path to KenLM source/build trees (usually the same)
export KENLM_SRC_DIR = $(HOME)/src/kenlm
export KENLM_BUILD_DIR = $(KENLM_SRC_DIR)/build
# Path to LibXML2 install tree
# (usually available as a distro package under /usr)
export LIBXML2_INSTALL_DIR = /usr
# Path to Apertium lttoolbox install tree
# (may be available as a distro package under /usr)
export LTTOOLBOX_INSTALL_DIR = /usr
# Path to MaltParser JAR file
export MALTPARSER_JAR = $(HOME)/src/maltparser-1.9.0/maltparser-1.9.0.jar
# Path to Wapiti install tree
export WAPITI_INSTALL_DIR = $(HOME)/opt/wapiti
# TCP port numbers for the SQUOIA and MaltParser servers
# (note: if you change these, also edit MT_systems/translate_demo.cfg)
SQUOIA_PORT = 9001
MALTPARSER_PORT = 9002
# C++ compilation
CXX = g++
CXXFLAGS = -std=gnu++11 -Wall -O0 -g3
export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(FREELING_INSTALL_DIR)/lib
JAVA = java
all clean:
cd FreeLingModules && $(MAKE) $@
cd MT_systems && $(MAKE) $@
cd MT_systems/maltparser_tools && $(MAKE) $@
cd MT_systems/matxin-lex && $(MAKE) $@
cd MT_systems/squoia/esqu && $(MAKE) $@
run-squoia:
export FREELINGSHARE=$(FREELING_INSTALL_DIR)/share/freeling; \
cd FreeLingModules && ./server_squoia -f es_demo.cfg --server --port=$(SQUOIA_PORT)
test-squoia:
cd FreeLingModules && cat ../input-demo.txt | ./analyzer_client $(SQUOIA_PORT)
run-malt:
$(JAVA) -cp $(MALTPARSER_JAR):MT_systems/maltparser_tools/bin MaltParserServer $(MALTPARSER_PORT) MT_systems/models/splitDatesModel.mco
run-translate: $(MALTPARSER_JAR)
mkdir -p MT_systems/tmp
export PATH=$(PWD)/FreeLingModules:$(PATH); \
export PERL5LIB=$(ALGORITHM_SVM_INSTALL_DIR)/lib/perl5; \
cd MT_systems && ./translate.pm \
--config translate_demo.cfg \
--file ../input-demo.txt
help-translate:
export PERL5LIB=$(ALGORITHM_SVM_INSTALL_DIR)/lib/perl5; \
cd MT_systems && ./translate.pm -h
.PHONY: all clean help-translate run-malt run-squoia run-translate test-squoia
# end squoia/Makefile
| {
"content_hash": "e17bdfeafac5e89076ee766762604103",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 136,
"avg_line_length": 31.26388888888889,
"alnum_prop": 0.7241226121723678,
"repo_name": "ariosquoia/squoia",
"id": "33a10ccba0c63f8fb3434e40541fd5dcf0226fa9",
"size": "2338",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Makefile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "87221"
},
{
"name": "C++",
"bytes": "299304"
},
{
"name": "Erlang",
"bytes": "12543"
},
{
"name": "Java",
"bytes": "66459"
},
{
"name": "Makefile",
"bytes": "24197"
},
{
"name": "Perl",
"bytes": "1633176"
},
{
"name": "Shell",
"bytes": "29329"
},
{
"name": "TeX",
"bytes": "222578"
}
],
"symlink_target": ""
} |
module Dominusrb
module DiscordCommands
module Debug
extend Discordrb::Commands::CommandContainer
# default "false"
debug = false
command :debug , description: 'swap debug mode' do |event|
unless event.user.id == BOT.bot_app.owner.id
event.respond 'You are not Bot Owner'
break
end
if debug
BOT.debug '-------- debug mode OFF --------'
BOT.mode=:normal
debug = false
event.respond "`debug mode` **OFF**"
else
BOT.mode=:debug
BOT.debug '-------- debug mode ON --------'
debug = true
event.respond "`debug mode` **ON**"
end
end
end
end
end | {
"content_hash": "5452be9cb281014d3395acf753222a21",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 64,
"avg_line_length": 24.896551724137932,
"alnum_prop": 0.5221606648199446,
"repo_name": "skmtkytr/Dominusrb",
"id": "a627c735bac91605fc1c992fcae88cf3e447cedf",
"size": "722",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/modules/commands/debug.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "29440"
}
],
"symlink_target": ""
} |
package erepnikov.products_storage;
import erepnikov.products_storage.models.Food;
import erepnikov.products_storage.storages.Shop;
import erepnikov.products_storage.storages.Storage;
import erepnikov.products_storage.storages.Trash;
import erepnikov.products_storage.storages.Warehouse;
import java.util.ArrayList;
import java.util.List;
/**
* Class ControlQuality.
*
* @author Egor Repnikov
* @version 0.0.1
* @since 04.11.2017
*/
public class ControlQuality {
/**
* List of all storages.
*/
private List<Storage> storages = new ArrayList<>();
/**
* Construct call initStorages().
*/
public ControlQuality() {
this.initStorages();
}
/**
* Initialize List of Storage storages.
*/
private void initStorages() {
this.storages.add(new Warehouse());
this.storages.add(new Shop());
this.storages.add(new Trash());
}
/**
* Checks and adds Food to the right storage.
* @param food Food
*/
public void distribute(Food food) {
for (Storage storage : this.storages) {
if (storage.checkFood(food)) {
storage.add(food);
break;
}
}
}
/**
* Resort food in storages.
*/
public void resort() {
List<Food> allFood = new ArrayList<>();
for (Storage storage : this.storages) {
allFood.addAll(storage.getFoodStorage());
}
this.cleanStorages();
for (Food food : allFood) {
this.distribute(food);
}
}
/**
* Clean all storages.
*/
private void cleanStorages() {
for (Storage storage : this.storages) {
storage.getFoodStorage().clear();
}
}
/**
* Getter of storages
* @return storages
*/
public List<Storage> getStorages() {
return this.storages;
}
}
| {
"content_hash": "70aa142c0fa4ea9ea9a316cc6373eba6",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 55,
"avg_line_length": 22.541176470588237,
"alnum_prop": 0.5798538622129437,
"repo_name": "EgorTrevelyan/junior",
"id": "4fd3c91157b563a9dc3ac78b3668aa3366a805c1",
"size": "1916",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chapter_004/src/main/java/erepnikov/products_storage/ControlQuality.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "27358"
},
{
"name": "Java",
"bytes": "603705"
},
{
"name": "XSLT",
"bytes": "514"
}
],
"symlink_target": ""
} |
namespace Serenity.ComponentModel
{
/// <summary>
/// Sets the CSS class for columns and form fields.
/// In forms, class is added to container div with .field class that contains both label and editor.
/// For columns, it sets cssClass property of SlickColumn, which adds this class to slick cells for all rows.
/// Slick column headers are not affected by this attribute, use HeaderCssClass for that.
/// </summary>
public class CssClassAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="CssClassAttribute"/> class.
/// </summary>
/// <param name="cssClass">The CSS class.</param>
public CssClassAttribute(string cssClass)
{
CssClass = cssClass;
}
/// <summary>
/// Gets the CSS class.
/// </summary>
/// <value>
/// The CSS class.
/// </value>
public string CssClass { get; private set; }
}
} | {
"content_hash": "e11f414e0b1fee736ac156c8ed6ee629",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 113,
"avg_line_length": 36.42857142857143,
"alnum_prop": 0.5813725490196079,
"repo_name": "volkanceylan/Serenity",
"id": "7b945e669ffe44b011d4050b0ee284bf4fb0e5f2",
"size": "1022",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Serenity.Net.Core/ComponentModel/PropertyGrid/CssClassAttribute.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1592"
},
{
"name": "C#",
"bytes": "3328213"
},
{
"name": "CSS",
"bytes": "198506"
},
{
"name": "HTML",
"bytes": "2818"
},
{
"name": "JavaScript",
"bytes": "638940"
},
{
"name": "Roff",
"bytes": "11586"
},
{
"name": "Shell",
"bytes": "287"
},
{
"name": "Smalltalk",
"bytes": "290"
},
{
"name": "TSQL",
"bytes": "1592"
},
{
"name": "TypeScript",
"bytes": "804757"
},
{
"name": "XSLT",
"bytes": "17702"
}
],
"symlink_target": ""
} |
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
$string['addmorechoices'] = 'Añadir más opciones';
$string['allowupdate'] = 'Permitir la actualización de la consulta';
$string['answered'] = 'Contestado';
$string['atleastoneoption'] = 'Necesita proporcionar al menos una respuesta posible.';
$string['choice'] = 'Opción';
$string['choice:addinstance'] = 'Añadir una nueva opción';
$string['choice:choose'] = 'Registrar una elección';
$string['choiceclose'] = 'Hasta';
$string['choice:deleteresponses'] = 'Eliminar respuestas';
$string['choice:downloadresponses'] = 'Descargar respuestas';
$string['choicefull'] = 'Esta opción está completa y no hay espacios disponibles.';
$string['choicename'] = 'Título de la consulta';
$string['choiceopen'] = 'Abrir';
$string['choiceoptions'] = 'Opciones de la Consulta';
$string['choiceoptions_help'] = '<P>Aquí es donde usted especifica las opciones que los participantes tienen para escoger.
<P>Puede rellenar cualquier número de éstas, es decir, puede dejar alguna en blanco si
no necesita las 6 opciones. Las opciones no rellenadas no aparecerán en el cuestionario.';
$string['choice:readresponses'] = 'Leer respuestas';
$string['choicesaved'] = 'Su elección ha sido guardada';
$string['choicetext'] = 'Pregunta a responder';
$string['chooseaction'] = 'Elija una acción ...';
$string['completionsubmit'] = 'Mostrar como completada cuando el usuario selecciona una opción';
$string['displayhorizontal'] = 'Mostrar horizontalmente';
$string['displaymode'] = 'Modo de visualización de las opciones';
$string['displayvertical'] = 'Mostrar verticalmente';
$string['expired'] = 'Lo sentimos, esta actividad se cerró el {$a} y ya no está disponible';
$string['full'] = '(Lleno)';
$string['havetologin'] = 'Debe entrar antes de remitir su elección';
$string['limit'] = 'Límite';
$string['limitanswers'] = 'Limitar el número de respuestas permitidas';
$string['limitanswers_help'] = '<p>Esta opción le permite limitar el número de participantes que
pueden seleccionar cada opción en particular.</p>
<p>Una vez que se ha activado, cada opción puede fijar un límite.
Cuando se alcanza, nadie más puede seleccionar esa opción. Un
límite de cero (0) significa que nadie puede seleccionar esa opción.</p>
<p>Si está desactivada, cualquier número de participantes puede
seleccionar cualquiera de las opciones.</p>';
$string['limitno'] = 'Límite {no}';
$string['modulename'] = 'Consulta';
$string['modulename_help'] = 'El módulo Consulta permite al profesor hacer una pregunta especificando las posibles respuestas posibles.
Los resultados de la elección puede ser publicados después que los estudiantes hayan respondido, después de cierta fecha, o no publicarse. Los resultados pueden ser publicados, con los nombres de los estudiantes o de forma anónima.
Una Consulta puede utilizarse
* Para realizar una encuesta rápida que estimule a los alunmos a reflexionar sobre un tema
* Para comprobar rápidamente que los estudiantes han entendido algo concreto
* Para facilitar la toma de decisiones, por ejemplo permitiendo a los estudiantes votar algún aspecto relacionado con el curso.';
$string['modulenameplural'] = 'Consultas';
$string['moveselectedusersto'] = 'Mover los usuarios seleccionados a...';
$string['mustchooseone'] = 'Debe elegir una respuesta antes de guardar. No se ha guardado nada.';
$string['noguestchoose'] = 'Lo sentimos, los invitados no pueden responder encuestas.';
$string['noresultsviewable'] = 'Los resultados no pueden verse en este momento.';
$string['notanswered'] = 'Sin contestar aún';
$string['notenrolledchoose'] = 'Lo sentimos, solo los usuarios matriculados pueden seleccionar una opción.';
$string['notopenyet'] = 'Lo sentimos, esta actividad no estará disponible hasta {$a}';
$string['numberofuser'] = 'Número de participantes';
$string['numberofuserinpercentage'] = 'Porcentaje de participantes';
$string['option'] = 'Opción';
$string['optionno'] = 'Opción {no}';
$string['options'] = 'Opciones';
$string['page-mod-choice-x'] = 'Cualquier página del módulo Consulta';
$string['pluginadministration'] = 'Administración';
$string['pluginname'] = 'Consulta';
$string['privacy'] = 'Privacidad de los resultados';
$string['publish'] = 'Publicar resultados';
$string['publishafteranswer'] = 'Mostrar los resultados al estudiante después de su respuesta';
$string['publishafterclose'] = 'Mostrar los resultados a los estudiantes sólo después de cerrar la consulta';
$string['publishalways'] = 'Mostrar siempre los resultados a los estudiantes';
$string['publishanonymous'] = 'Publicar resultados anónimamente, sin mostrar los nombres de los alumnos';
$string['publishnames'] = 'Publicar resultados con los nombres de los alumnos';
$string['publishnot'] = 'No publicar los resultados';
$string['removemychoice'] = 'Eliminar mi elección';
$string['removeresponses'] = 'Eliminar todas las respuestas';
$string['responses'] = 'Respuestas';
$string['responsesresultgraphheader'] = 'Vista de gráfica';
$string['responsesto'] = 'Respuestas para {$a}';
$string['results'] = 'Resultados';
$string['savemychoice'] = 'Guardar mi elección';
$string['showunanswered'] = 'Mostrar columna de no respondidas';
$string['skipresultgraph'] = 'Pasar por alto gráfico de resultados';
$string['spaceleft'] = 'espacio disponible';
$string['spacesleft'] = 'espacios disponibles';
$string['taken'] = 'Tomadas';
$string['timerestrict'] = 'Restringir la respuesta a este período';
$string['userchoosethisoption'] = 'El usuario elegió esta opción';
$string['viewallresponses'] = 'Ver {$a} respuestas';
$string['withselected'] = 'Con seleccionados';
$string['yourselection'] = 'Su elección';
| {
"content_hash": "9d446159df0899a7c6a71e2d66b438f5",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 231,
"avg_line_length": 55.43859649122807,
"alnum_prop": 0.7454113924050633,
"repo_name": "Vicecalidadumb/empleoumb",
"id": "fc8a36d3d9b1748ef80c043f7c009859b6e6add2",
"size": "6633",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lang/es/choice.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "169845"
},
{
"name": "JavaScript",
"bytes": "567297"
},
{
"name": "PHP",
"bytes": "14173045"
}
],
"symlink_target": ""
} |
package jftp.client;
import jftp.client.auth.UserCredentials;
import jftp.connection.Connection;
public abstract class Client {
protected String host;
protected int port;
protected UserCredentials userCredentials = UserCredentials.ANONYMOUS;
public void setCredentials(UserCredentials userCredentials) {
this.userCredentials = userCredentials;
}
public void setHost(String host) {
this.host = host;
}
public void setPort(int port) {
this.port = port;
}
/**
* Opens a connection to the given host and port.
*
* @return
* An active connection matching the protocol set by the client. All activity and
* communication should be handled using this connection.
*
* @throws
* ConnectionInitialisationException
*/
public abstract Connection connect();
public abstract void disconnect();
}
| {
"content_hash": "ee0f74a36cc18efbda1cfa31d22923bd",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 82,
"avg_line_length": 21.94736842105263,
"alnum_prop": 0.7446043165467626,
"repo_name": "JAGFin1/JFTP",
"id": "7d2c559954c0608e8f682a323695277599584349",
"size": "834",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/jftp/client/Client.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "59625"
},
{
"name": "XML",
"bytes": "347"
}
],
"symlink_target": ""
} |
package com.ait.lienzo.shared.core.types;
import java.util.List;
import com.ait.lienzo.client.core.shape.Text;
/**
* Enum to create a type safe set of values for {@link Text} Alignment.
*/
public enum TextAlign implements EnumWithValue
{
START("start"), END("end"), LEFT("left"), CENTER("center"), RIGHT("right");
private final String m_value;
private static final EnumStringMap<TextAlign> LOOKUP_MAP = Statics.build(TextAlign.values());
private TextAlign(final String value)
{
m_value = value;
}
@Override
public final String getValue()
{
return m_value;
}
@Override
public final String toString()
{
return m_value;
}
public static final TextAlign lookup(final String key)
{
return Statics.lookup(key, LOOKUP_MAP, START);
}
public static final List<String> getKeys()
{
return Statics.getKeys(TextAlign.values());
}
public static final List<TextAlign> getValues()
{
return Statics.getValues(TextAlign.values());
}
}
| {
"content_hash": "9a62b9e51aec09fa52d3c93d088d77a1",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 97,
"avg_line_length": 21,
"alnum_prop": 0.6433239962651728,
"repo_name": "ahome-it/lienzo-core",
"id": "5419313a7b0a9be8694d58efa983a2851fb2c7ac",
"size": "1710",
"binary": false,
"copies": "1",
"ref": "refs/heads/2.0",
"path": "src/main/java/com/ait/lienzo/shared/core/types/TextAlign.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2234441"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Consp. System. Corticiac. (Tartu) 122 (1968)
#### Original name
null
### Remarks
null | {
"content_hash": "c1a8d4d4a5fb08f5914fd3f86d73aa43",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 44,
"avg_line_length": 13.307692307692308,
"alnum_prop": 0.6936416184971098,
"repo_name": "mdoering/backbone",
"id": "ca561fa6eee05aa9653661acb6e79cab0abbc81c",
"size": "240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Agaricomycetes/Hymenochaetales/Schizoporaceae/Hyphodontia/Hyphodontia sambuci/ Syn. Hyphodontia hariotii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
class ModelBackend(object):
"""
Authenticates against settings.AUTH_USER_MODEL.
"""
def authenticate(self, username=None, password=None, **kwargs):
UserModel = get_user_model()
if username is None:
username = kwargs.get(UserModel.USERNAME_FIELD)
try:
user = UserModel._default_manager.get_by_natural_key(username)
except UserModel.DoesNotExist:
# Run the default password hasher once to reduce the timing
# difference between an existing and a non-existing user (#20760).
UserModel().set_password(password)
else:
if user.check_password(password) and self.user_can_authenticate(user):
return user
def user_can_authenticate(self, user):
"""
Reject users with is_active=False. Custom user models that don't have
that attribute are allowed.
"""
is_active = getattr(user, 'is_active', None)
return is_active or is_active is None
def _get_user_permissions(self, user_obj):
return user_obj.user_permissions.all()
def _get_group_permissions(self, user_obj):
user_groups_field = get_user_model()._meta.get_field('groups')
user_groups_query = 'group__%s' % user_groups_field.related_query_name()
return Permission.objects.filter(**{user_groups_query: user_obj})
def _get_permissions(self, user_obj, obj, from_name):
"""
Returns the permissions of `user_obj` from `from_name`. `from_name` can
be either "group" or "user" to return permissions from
`_get_group_permissions` or `_get_user_permissions` respectively.
"""
if not user_obj.is_active or user_obj.is_anonymous() or obj is not None:
return set()
perm_cache_name = '_%s_perm_cache' % from_name
if not hasattr(user_obj, perm_cache_name):
if user_obj.is_superuser:
perms = Permission.objects.all()
else:
perms = getattr(self, '_get_%s_permissions' % from_name)(user_obj)
perms = perms.values_list('content_type__app_label', 'codename').order_by()
setattr(user_obj, perm_cache_name, set("%s.%s" % (ct, name) for ct, name in perms))
return getattr(user_obj, perm_cache_name)
def get_user_permissions(self, user_obj, obj=None):
"""
Returns a set of permission strings the user `user_obj` has from their
`user_permissions`.
"""
return self._get_permissions(user_obj, obj, 'user')
def get_group_permissions(self, user_obj, obj=None):
"""
Returns a set of permission strings the user `user_obj` has from the
groups they belong.
"""
return self._get_permissions(user_obj, obj, 'group')
def get_all_permissions(self, user_obj, obj=None):
if not user_obj.is_active or user_obj.is_anonymous() or obj is not None:
return set()
if not hasattr(user_obj, '_perm_cache'):
user_obj._perm_cache = self.get_user_permissions(user_obj)
user_obj._perm_cache.update(self.get_group_permissions(user_obj))
return user_obj._perm_cache
def has_perm(self, user_obj, perm, obj=None):
if not user_obj.is_active:
return False
return perm in self.get_all_permissions(user_obj, obj)
def has_module_perms(self, user_obj, app_label):
"""
Returns True if user_obj has any permissions in the given app_label.
"""
if not user_obj.is_active:
return False
for perm in self.get_all_permissions(user_obj):
if perm[:perm.index('.')] == app_label:
return True
return False
def get_user(self, user_id):
UserModel = get_user_model()
try:
user = UserModel._default_manager.get(pk=user_id)
except UserModel.DoesNotExist:
return None
return user if self.user_can_authenticate(user) else None
class AllowAllUsersModelBackend(ModelBackend):
def user_can_authenticate(self, user):
return True
class RemoteUserBackend(ModelBackend):
"""
This backend is to be used in conjunction with the ``RemoteUserMiddleware``
found in the middleware module of this package, and is used when the server
is handling authentication outside of Django.
By default, the ``authenticate`` method creates ``User`` objects for
usernames that don't already exist in the database. Subclasses can disable
this behavior by setting the ``create_unknown_user`` attribute to
``False``.
"""
# Create a User object if not already in the database?
create_unknown_user = True
def authenticate(self, remote_user):
"""
The username passed as ``remote_user`` is considered trusted. This
method simply returns the ``User`` object with the given username,
creating a new ``User`` object if ``create_unknown_user`` is ``True``.
Returns None if ``create_unknown_user`` is ``False`` and a ``User``
object with the given username is not found in the database.
"""
if not remote_user:
return
user = None
username = self.clean_username(remote_user)
UserModel = get_user_model()
# Note that this could be accomplished in one try-except clause, but
# instead we use get_or_create when creating unknown users since it has
# built-in safeguards for multiple threads.
if self.create_unknown_user:
user, created = UserModel._default_manager.get_or_create(**{
UserModel.USERNAME_FIELD: username
})
if created:
user = self.configure_user(user)
else:
try:
user = UserModel._default_manager.get_by_natural_key(username)
except UserModel.DoesNotExist:
pass
return user if self.user_can_authenticate(user) else None
def clean_username(self, username):
"""
Performs any cleaning on the "username" prior to using it to get or
create the user object. Returns the cleaned username.
By default, returns the username unchanged.
"""
return username
def configure_user(self, user):
"""
Configures a user after creation and returns the updated user.
By default, returns the user unmodified.
"""
return user
class AllowAllUsersRemoteUserBackend(RemoteUserBackend):
def user_can_authenticate(self, user):
return True
| {
"content_hash": "08ffdc1515dd54b67abba3046903ea28",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 95,
"avg_line_length": 37.733333333333334,
"alnum_prop": 0.6226442873969376,
"repo_name": "daniponi/django",
"id": "43d8627d0c499cf9ed12ab6b6b06ef1078aa1c4e",
"size": "6792",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "django/contrib/auth/backends.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "52372"
},
{
"name": "HTML",
"bytes": "170531"
},
{
"name": "JavaScript",
"bytes": "255773"
},
{
"name": "Makefile",
"bytes": "125"
},
{
"name": "Python",
"bytes": "11559565"
},
{
"name": "Shell",
"bytes": "809"
},
{
"name": "Smarty",
"bytes": "130"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Newtonsoft.Json.Linq;
using VkNet.Abstractions;
using VkNet.Enums;
using VkNet.Enums.Filters;
using VkNet.Infrastructure;
using VkNet.Model;
using VkNet.Model.Attachments;
using VkNet.Model.RequestParams;
using VkNet.Utils;
namespace VkNet.Categories;
/// <inheritdoc />
public partial class AudioCategory : IAudioCategory
{
private readonly IVkApiInvoke _vk;
/// <summary>
/// api vk.com
/// </summary>
/// <param name="vk"> Api vk.com </param>
public AudioCategory(IVkApiInvoke vk) => _vk = vk;
/// <inheritdoc />
public long Add(long audioId, long ownerId, string accessKey = null, long? groupId = null, long? albumId = null)
{
var parameters = new VkParameters
{
{
"audio_id", audioId
},
{
"owner_id", ownerId
},
{
"access_key", accessKey
},
{
"group_id", groupId
},
{
"album_id", albumId
}
};
return _vk.Call<long>("audio.add", parameters);
}
/// <inheritdoc />
public AudioPlaylist CreatePlaylist(long ownerId, string title, string description = null, IEnumerable<string> audioIds = null)
{
var parameters = new VkParameters
{
{
"owner_id", ownerId
},
{
"title", title
},
{
"description", description
},
{
"audio_ids", audioIds
}
};
return _vk.Call<AudioPlaylist>("audio.createPlaylist", parameters);
}
/// <inheritdoc />
public bool Delete(long audioId, long ownerId)
{
var parameters = new VkParameters
{
{
"audio_id", audioId
},
{
"owner_id", ownerId
}
};
return _vk.Call<bool>("audio.delete", parameters);
}
/// <inheritdoc />
public bool DeletePlaylist(long ownerId, long playlistId)
{
var parameters = new VkParameters
{
{
"owner_id", ownerId
},
{
"playlist_id", playlistId
}
};
return _vk.Call<bool>("audio.deletePlaylist", parameters);
}
/// <inheritdoc />
public long Edit(AudioEditParams @params) => _vk.Call<long>("audio.edit", new()
{
{
"owner_id", @params.OwnerId
},
{
"audio_id", @params.AudioId
},
{
"artist", @params.Artist
},
{
"title", @params.Title
},
{
"text", @params.Text
},
{
"genre_id", @params.GenreId
},
{
"no_search", @params.NoSearch
}
});
/// <inheritdoc />
public bool EditPlaylist(long ownerId, int playlistId, string title, string description = null, IEnumerable<string> audioIds = null)
{
var parameters = new VkParameters
{
{
"owner_id", ownerId
},
{
"playlist_id", playlistId
},
{
"title", title
},
{
"description", description
},
{
"audio_ids", audioIds
}
};
return _vk.Call<bool>("audio.editPlaylist", parameters);
}
/// <inheritdoc />
public VkCollection<Audio> Get(AudioGetParams @params) => _vk.Call<VkCollection<Audio>>("audio.get", new()
{
{
"owner_id", @params.OwnerId
},
{
"album_id", @params.AlbumId
},
{
"playlist_id", @params.PlaylistId
},
{
"audio_ids", @params.AudioIds
},
{
"offset", @params.Offset
},
{
"count", @params.Count
},
{
"access_key", @params.AccessKey
}
});
/// <inheritdoc />
public VkCollection<AudioPlaylist> GetPlaylists(long ownerId, uint? count = null, uint? offset = null)
{
var parameters = new VkParameters
{
{
"owner_id", ownerId
},
{
"offset", offset
},
{
"count", count
}
};
return _vk.Call<VkCollection<AudioPlaylist>>("audio.getPlaylists", parameters);
}
/// <inheritdoc />
public AudioPlaylist GetPlaylistById(long ownerId, long playlistId)
{
var parameters = new VkParameters
{
{
"owner_id", ownerId
},
{
"playlist_id", playlistId
}
};
return _vk.Call<AudioPlaylist>("audio.getPlaylistById", parameters);
}
/// <inheritdoc />
public IEnumerable<object> GetBroadcastList(AudioBroadcastFilter filter = null, bool? active = null)
{
var parameters = new VkParameters
{
{
"filter", filter
},
{
"active", active
}
};
return _vk.Call<ReadOnlyCollection<object>>("audio.getBroadcastList", parameters);
}
/// <inheritdoc />
public IEnumerable<Audio> GetById(IEnumerable<string> audios)
{
var parameters = new VkParameters
{
{
"audios", audios
}
};
return _vk.Call<ReadOnlyCollection<Audio>>("audio.getById", parameters);
}
/// <inheritdoc />
public AudioGetCatalogResult GetCatalog(uint? count, bool? extended, UsersFields fields = null)
{
var parameters = new VkParameters
{
{
"extended", extended
},
{
"count", count
},
{
"fields", fields
}
};
return _vk.Call<AudioGetCatalogResult>("audio.getCatalog", parameters);
}
/// <inheritdoc />
public long GetCount(long ownerId)
{
var parameters = new VkParameters
{
{
"owner_id", ownerId
}
};
return _vk.Call<long>("audio.getCount", parameters);
}
/// <inheritdoc />
public Lyrics GetLyrics(long lyricsId)
{
var parameters = new VkParameters
{
{
"lyrics_id", lyricsId
}
};
return _vk.Call<Lyrics>("audio.getLyrics", parameters);
}
/// <inheritdoc />
public IEnumerable<Audio> GetPopular(bool onlyEng = false, AudioGenre? genre = null, uint? count = null, uint? offset = null)
{
var parameters = new VkParameters
{
{
"only_eng", onlyEng
},
{
"genre_id", genre
},
{
"offset", offset
},
{
"count", count
}
};
return _vk.Call<ReadOnlyCollection<Audio>>("audio.getPopular", parameters);
}
/// <inheritdoc />
public VkCollection<Audio> GetRecommendations(string targetAudio = null, long? userId = null, uint? count = null,
uint? offset = null, bool? shuffle = null)
{
var parameters = new VkParameters
{
{
"target_audio", targetAudio
},
{
"user_id", userId
},
{
"offset", offset
},
{
"count", count
},
{
"shuffle", shuffle
}
};
return _vk.Call<VkCollection<Audio>>("audio.getRecommendations", parameters);
}
/// <inheritdoc />
public Uri GetUploadServer()
{
var response = _vk.Call("audio.getUploadServer", VkParameters.Empty);
return response["upload_url"];
}
/// <inheritdoc />
public IEnumerable<long> AddToPlaylist(long ownerId, long playlistId, IEnumerable<string> audioIds)
{
var parameters = new VkParameters
{
{
"owner_id", ownerId
},
{
"playlist_id", playlistId
},
{
"audio_ids", audioIds
}
};
return _vk.Call("audio.addToPlaylist", parameters)
.ToReadOnlyCollectionOf<long>(x => x["audio_id"]);
}
/// <inheritdoc />
public bool Reorder(long audioId, long? ownerId, long? before, long? after)
{
var parameters = new VkParameters
{
{
"audio_id", audioId
},
{
"owner_id", ownerId
},
{
"before", before
},
{
"after", after
}
};
return _vk.Call<bool>("audio.reorder", parameters);
}
/// <inheritdoc />
public Audio Restore(long audioId, long? ownerId = null)
{
var parameters = new VkParameters
{
{
"audio_id", audioId
},
{
"owner_id", ownerId
}
};
return _vk.Call<Audio>("audio.restore", parameters);
}
/// <inheritdoc />
public Audio Save(string response, string artist = null, string title = null)
{
VkErrors.ThrowIfNullOrEmpty(() => response);
var responseJson = response.ToJObject();
var server = responseJson["server"]
.ToString();
var hash = responseJson["hash"]
.ToString();
var audio = responseJson["audio"]
.ToString();
var parameters = new VkParameters
{
{
"server", server
},
// Фикс #161. Из-за URL Decode строка audio передавалась неверно, из-за чего появлялась ошибка Invalid hash
{
"audio", audio
},
{
"hash", hash
},
{
"artist", artist
},
{
"title", title
}
};
return _vk.Call<Audio>("audio.save", parameters);
}
/// <inheritdoc />
public VkCollection<Audio> Search(AudioSearchParams @params) => _vk.Call<VkCollection<Audio>>("audio.search", new()
{
{
"q", @params.Query
},
{
"auto_complete", @params.Autocomplete
},
{
"sort", @params.Sort
},
{
"lyrics", @params.Lyrics
},
{
"performer_only", @params.PerformerOnly
},
{
"search_own", @params.SearchOwn
},
{
"count", @params.Count
},
{
"offset", @params.Offset
}
});
/// <inheritdoc />
public IEnumerable<long> SetBroadcast(string audio = null, IEnumerable<long> targetIds = null)
{
var parameters = new VkParameters
{
{
"audio", audio
},
{
"target_ids", targetIds
}
};
return _vk.Call<ReadOnlyCollection<long>>("audio.setBroadcast", parameters);
}
} | {
"content_hash": "3b1180848605204dba111dd52b40ccfa",
"timestamp": "",
"source": "github",
"line_count": 489,
"max_line_length": 133,
"avg_line_length": 17.75869120654397,
"alnum_prop": 0.6116996775679411,
"repo_name": "vknet/vk",
"id": "d97691313fe7b66dbd435a85675331b399776d27",
"size": "8741",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "VkNet/Categories/AudioCategory.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "3715513"
},
{
"name": "Dockerfile",
"bytes": "345"
},
{
"name": "HTML",
"bytes": "90930"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Revis. gen. pl. (Leipzig) 3: 479 (1898)
#### Original name
Agaricus aueri Nees
### Remarks
null | {
"content_hash": "3ec9c254beea03b5b887fa6fa53bb231",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 12.23076923076923,
"alnum_prop": 0.6792452830188679,
"repo_name": "mdoering/backbone",
"id": "f784774d2d83fb245fdf34a3d1047793cde4ea7b",
"size": "209",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Agaricomycetes/Agaricales/Agaricaceae/Agaricus/Fungus aueri/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package cadelac.framework.blade.facility.db;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
/**
* Base class for Select queries
* @author cadelac
*
*/
public abstract class QueryBase implements ExecutableQuery {
public QueryBase(final String query_) {
_query = query_;
}
@Override
public String getQuery() {
return _query;
}
protected Logger getLogger() {
return logger;
}
private final String _query;
private static final Logger logger = LogManager.getLogger(QueryBase.class);
}
| {
"content_hash": "e9d708cf101f3d3b13d57e1e92ba0d25",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 76,
"avg_line_length": 19.428571428571427,
"alnum_prop": 0.7371323529411765,
"repo_name": "cadelac/dispatcha",
"id": "6627533f7f261009814aaa8f36d478c1bfefb04c",
"size": "544",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/cadelac/framework/blade/facility/db/QueryBase.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "122238"
}
],
"symlink_target": ""
} |
package monix.execution.internal
import monix.execution.UncaughtExceptionReporter
import monix.execution.exceptions.CompositeException
import monix.execution.schedulers.CanBlock
import scala.concurrent.Awaitable
import scala.concurrent.duration.Duration
import scala.scalajs.js
import scala.util.control.NonFatal
private[monix] object Platform {
/**
* Returns `true` in case Monix is running on top of Scala.js,
* or `false` otherwise.
*/
final val isJS = true
/**
* Returns `true` in case Monix is running on top of the JVM,
* or `false` otherwise.
*/
final val isJVM = false
/**
* Reads environment variable in a platform-specific way.
*/
def getEnv(key: String): Option[String] = {
import js.Dynamic.global
try {
// Node.js specific API, could fail
if (js.typeOf(global.process) == "object" && js.typeOf(global.process.env) == "object")
global.process.env.selectDynamic(key).asInstanceOf[js.UndefOr[String]]
.toOption
.collect { case s: String => s.trim }
.filter(_.nonEmpty)
else
None
} catch {
case NonFatal(_) => None
}
}
/** Recommended batch size used for breaking synchronous loops in
* asynchronous batches. When streaming value from a producer to
* a synchronous consumer it's recommended to break the streaming
* in batches as to not hold the current thread or run-loop
* indefinitely.
*
* It's always a power of 2, because then for
* applying the modulo operation we can just do:
*
* {{{
* val modulus = Platform.recommendedBatchSize - 1
* // ...
* nr = (nr + 1) & modulus
* }}}
*/
final val recommendedBatchSize: Int = 512
/** Recommended chunk size in unbounded buffer implementations that are chunked,
* or in chunked streams.
*
* Should be a power of 2.
*/
final val recommendedBufferChunkSize: Int = 128
/**
* Auto cancelable run loops are set to `false` if Monix
* is running on top of Scala.js.
*/
final val autoCancelableRunLoops: Boolean = true
/**
* Local context propagation is set to `false` if Monix
* is running on top of Scala.js given that it is single
* threaded.
*/
final val localContextPropagation: Boolean = false
/** Blocks for the result of `fa`.
*
* This operation is only supported on top of the JVM, whereas for
* JavaScript a dummy is provided.
*/
def await[A](fa: Awaitable[A], timeout: Duration)(implicit permit: CanBlock): A =
throw new UnsupportedOperationException(
"Blocking operations are not supported on top of JavaScript"
)
/** Composes multiple errors together, meant for those cases in which
* error suppression, due to a second error being triggered, is not
* acceptable.
*
* On top of the JVM this function uses `Throwable#addSuppressed`,
* available since Java 7. On top of JavaScript the function would return
* a `CompositeException`.
*/
def composeErrors(first: Throwable, rest: Throwable*): Throwable =
rest.filter(_ ne first).toList match {
case Nil => first
case nonEmpty =>
first match {
case CompositeException(errors) =>
CompositeException(errors ::: nonEmpty)
case _ =>
CompositeException(first :: nonEmpty)
}
}
/**
* Useful utility that combines an `Either` result, which is what
* `MonadError#attempt` returns.
*/
def composeErrors(first: Throwable, second: Either[Throwable, _]): Throwable =
second match {
case Left(e2) => composeErrors(first, e2)
case _ => first
}
/**
* Returns the current thread's ID.
*
* To be used for multi-threading optimizations. Note that
* in JavaScript this always returns the same value.
*/
def currentThreadId(): Long = 1L
/**
* For reporting errors when we don't have access to
* an error handler.
*/
def reportFailure(e: Throwable): Unit = {
UncaughtExceptionReporter.default.reportFailure(e)
}
}
| {
"content_hash": "a08338cf7e1ed924eb83ea4d27c3c370",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 93,
"avg_line_length": 29.89051094890511,
"alnum_prop": 0.6537240537240537,
"repo_name": "monixio/monix",
"id": "bc2dd45a3631c5a96a83376d745abd78ed4fccc7",
"size": "4768",
"binary": false,
"copies": "2",
"ref": "refs/heads/series/4.x",
"path": "monix-execution/js/src/main/scala/monix/execution/internal/Platform.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "108987"
},
{
"name": "Scala",
"bytes": "2315190"
},
{
"name": "Shell",
"bytes": "2950"
}
],
"symlink_target": ""
} |
<?php
namespace Google\Service\Spectrum;
class PawsGetSpectrumRequest extends \Google\Model
{
protected $antennaType = '\Google\Service\Spectrum\AntennaCharacteristics';
protected $antennaDataType = '';
protected $capabilitiesType = '\Google\Service\Spectrum\DeviceCapabilities';
protected $capabilitiesDataType = '';
protected $deviceDescType = '\Google\Service\Spectrum\DeviceDescriptor';
protected $deviceDescDataType = '';
protected $locationType = '\Google\Service\Spectrum\GeoLocation';
protected $locationDataType = '';
protected $masterDeviceDescType = '\Google\Service\Spectrum\DeviceDescriptor';
protected $masterDeviceDescDataType = '';
protected $ownerType = '\Google\Service\Spectrum\DeviceOwner';
protected $ownerDataType = '';
public $requestType;
public $type;
public $version;
public function setAntenna(\Google\Service\Spectrum\AntennaCharacteristics $antenna)
{
$this->antenna = $antenna;
}
public function getAntenna()
{
return $this->antenna;
}
public function setCapabilities(\Google\Service\Spectrum\DeviceCapabilities $capabilities)
{
$this->capabilities = $capabilities;
}
public function getCapabilities()
{
return $this->capabilities;
}
public function setDeviceDesc(\Google\Service\Spectrum\DeviceDescriptor $deviceDesc)
{
$this->deviceDesc = $deviceDesc;
}
public function getDeviceDesc()
{
return $this->deviceDesc;
}
public function setLocation(\Google\Service\Spectrum\GeoLocation $location)
{
$this->location = $location;
}
public function getLocation()
{
return $this->location;
}
public function setMasterDeviceDesc(\Google\Service\Spectrum\DeviceDescriptor $masterDeviceDesc)
{
$this->masterDeviceDesc = $masterDeviceDesc;
}
public function getMasterDeviceDesc()
{
return $this->masterDeviceDesc;
}
public function setOwner(\Google\Service\Spectrum\DeviceOwner $owner)
{
$this->owner = $owner;
}
public function getOwner()
{
return $this->owner;
}
public function setRequestType($requestType)
{
$this->requestType = $requestType;
}
public function getRequestType()
{
return $this->requestType;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
public function setVersion($version)
{
$this->version = $version;
}
public function getVersion()
{
return $this->version;
}
}
| {
"content_hash": "1dddd460fd7def663ff97c926d6e2788",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 98,
"avg_line_length": 21.869565217391305,
"alnum_prop": 0.7021868787276342,
"repo_name": "xevious99/google-api-php-client",
"id": "716314b7254f8939f1da125dd4bb92bb9f921259",
"size": "3105",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Google/Service/Spectrum/PawsGetSpectrumRequest.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1924"
},
{
"name": "PHP",
"bytes": "4079075"
}
],
"symlink_target": ""
} |
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.weblayer;
import android.graphics.Bitmap;
import androidx.annotation.Nullable;
/**
* Informed of changes to the favicon of the current navigation.
*/
abstract class FaviconCallback {
/**
* Called when the favicon of the current navigation has changed. This is called with null when
* a navigation is started.
*
* @param favicon The favicon.
*/
public void onFaviconChanged(@Nullable Bitmap favicon) {}
}
| {
"content_hash": "cecc676e7b7c34e670a3aa29b54260ba",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 99,
"avg_line_length": 27.59090909090909,
"alnum_prop": 0.7199341021416804,
"repo_name": "chromium/chromium",
"id": "42aba9f3587a1499476f86c234f5659961358bb9",
"size": "607",
"binary": false,
"copies": "5",
"ref": "refs/heads/main",
"path": "weblayer/public/java/org/chromium/weblayer/FaviconCallback.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class Message(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsMessage(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Message()
x.Init(buf, n + offset)
return x
@classmethod
def MessageBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x50\x50\x58\x46", size_prefixed=size_prefixed)
# Message
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# Message
def BodyType(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
return 0
# Message
def Body(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
from flatbuffers.table import Table
obj = Table(bytearray(), 0)
self._tab.Union(obj, o)
return obj
return None
def MessageStart(builder): builder.StartObject(2)
def MessageAddBodyType(builder, bodyType): builder.PrependUint8Slot(0, bodyType, 0)
def MessageAddBody(builder, body): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(body), 0)
def MessageEnd(builder): return builder.EndObject()
| {
"content_hash": "423c34000c4288cad427ef17d59c3970",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 130,
"avg_line_length": 35.13953488372093,
"alnum_prop": 0.6644606221045665,
"repo_name": "probprog/pyprob",
"id": "9f743b1911b443e8c90452a22d9a26357f6b0be6",
"size": "1599",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pyprob/ppx/Message.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Dockerfile",
"bytes": "667"
},
{
"name": "Jupyter Notebook",
"bytes": "123161"
},
{
"name": "Python",
"bytes": "580095"
},
{
"name": "Shell",
"bytes": "215"
}
],
"symlink_target": ""
} |
from client import TwiceRedis
from client import Listener
| {
"content_hash": "437f130f2565d878e5d048c79133c933",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 29,
"avg_line_length": 29,
"alnum_prop": 0.8620689655172413,
"repo_name": "tr3buchet/twiceredis",
"id": "11352fb9a5a4f71b50c0ab59ad6e987d344479c4",
"size": "679",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "twiceredis/__init__.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "13876"
}
],
"symlink_target": ""
} |
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file was generated by:
// tools/json_schema_compiler/compiler.py.
// NOTE: The format of types has changed. 'FooType' is now
// 'chrome.management.FooType'.
// Please run the closure compiler before committing changes.
// See https://chromium.googlesource.com/chromium/src/+/master/docs/closure_compilation.md
/** @fileoverview Externs generated from namespace: management */
/** @const */
chrome.management = {};
/**
* Information about an icon belonging to an extension, app, or theme.
* @typedef {{
* size: number,
* url: string
* }}
* @see https://developer.chrome.com/extensions/management#type-IconInfo
*/
chrome.management.IconInfo;
/**
* @enum {string}
* @see https://developer.chrome.com/extensions/management#type-LaunchType
*/
chrome.management.LaunchType = {
OPEN_AS_REGULAR_TAB: 'OPEN_AS_REGULAR_TAB',
OPEN_AS_PINNED_TAB: 'OPEN_AS_PINNED_TAB',
OPEN_AS_WINDOW: 'OPEN_AS_WINDOW',
OPEN_FULL_SCREEN: 'OPEN_FULL_SCREEN',
};
/**
* @enum {string}
* @see https://developer.chrome.com/extensions/management#type-ExtensionDisabledReason
*/
chrome.management.ExtensionDisabledReason = {
UNKNOWN: 'unknown',
PERMISSIONS_INCREASE: 'permissions_increase',
};
/**
* @enum {string}
* @see https://developer.chrome.com/extensions/management#type-ExtensionType
*/
chrome.management.ExtensionType = {
EXTENSION: 'extension',
HOSTED_APP: 'hosted_app',
PACKAGED_APP: 'packaged_app',
LEGACY_PACKAGED_APP: 'legacy_packaged_app',
THEME: 'theme',
LOGIN_SCREEN_EXTENSION: 'login_screen_extension',
};
/**
* @enum {string}
* @see https://developer.chrome.com/extensions/management#type-ExtensionInstallType
*/
chrome.management.ExtensionInstallType = {
ADMIN: 'admin',
DEVELOPMENT: 'development',
NORMAL: 'normal',
SIDELOAD: 'sideload',
OTHER: 'other',
};
/**
* Information about an installed extension, app, or theme.
* @typedef {{
* id: string,
* name: string,
* shortName: string,
* description: string,
* version: string,
* versionName: (string|undefined),
* mayDisable: boolean,
* mayEnable: (boolean|undefined),
* enabled: boolean,
* disabledReason: (!chrome.management.ExtensionDisabledReason|undefined),
* isApp: boolean,
* type: !chrome.management.ExtensionType,
* appLaunchUrl: (string|undefined),
* homepageUrl: (string|undefined),
* updateUrl: (string|undefined),
* offlineEnabled: boolean,
* optionsUrl: string,
* icons: (!Array<!chrome.management.IconInfo>|undefined),
* permissions: !Array<string>,
* hostPermissions: !Array<string>,
* installType: !chrome.management.ExtensionInstallType,
* launchType: (!chrome.management.LaunchType|undefined),
* availableLaunchTypes: (!Array<!chrome.management.LaunchType>|undefined)
* }}
* @see https://developer.chrome.com/extensions/management#type-ExtensionInfo
*/
chrome.management.ExtensionInfo;
/**
* Options for how to handle the extension's uninstallation.
* @typedef {{
* showConfirmDialog: (boolean|undefined)
* }}
* @see https://developer.chrome.com/extensions/management#type-UninstallOptions
*/
chrome.management.UninstallOptions;
/**
* Returns a list of information about installed extensions and apps.
* @param {function(!Array<!chrome.management.ExtensionInfo>): void=} callback
* @see https://developer.chrome.com/extensions/management#method-getAll
*/
chrome.management.getAll = function(callback) {};
/**
* Returns information about the installed extension, app, or theme that has the
* given ID.
* @param {string} id The ID from an item of $(ref:management.ExtensionInfo).
* @param {function(!chrome.management.ExtensionInfo): void=} callback
* @see https://developer.chrome.com/extensions/management#method-get
*/
chrome.management.get = function(id, callback) {};
/**
* Returns information about the calling extension, app, or theme. Note: This
* function can be used without requesting the 'management' permission in the
* manifest.
* @param {function(!chrome.management.ExtensionInfo): void=} callback
* @see https://developer.chrome.com/extensions/management#method-getSelf
*/
chrome.management.getSelf = function(callback) {};
/**
* Returns a list of <a href='permission_warnings'>permission warnings</a> for
* the given extension id.
* @param {string} id The ID of an already installed extension.
* @param {function(!Array<string>): void=} callback
* @see https://developer.chrome.com/extensions/management#method-getPermissionWarningsById
*/
chrome.management.getPermissionWarningsById = function(id, callback) {};
/**
* Returns a list of <a href='permission_warnings'>permission warnings</a> for
* the given extension manifest string. Note: This function can be used without
* requesting the 'management' permission in the manifest.
* @param {string} manifestStr Extension manifest JSON string.
* @param {function(!Array<string>): void=} callback
* @see https://developer.chrome.com/extensions/management#method-getPermissionWarningsByManifest
*/
chrome.management.getPermissionWarningsByManifest = function(manifestStr, callback) {};
/**
* Enables or disables an app or extension. In most cases this function must be
* called in the context of a user gesture (e.g. an onclick handler for a
* button), and may present the user with a native confirmation UI as a way of
* preventing abuse.
* @param {string} id This should be the id from an item of
* $(ref:management.ExtensionInfo).
* @param {boolean} enabled Whether this item should be enabled or disabled.
* @param {function(): void=} callback
* @see https://developer.chrome.com/extensions/management#method-setEnabled
*/
chrome.management.setEnabled = function(id, enabled, callback) {};
/**
* Uninstalls a currently installed app or extension. Note: This function does
* not work in managed environments when the user is not allowed to uninstall
* the specified extension/app.
* @param {string} id This should be the id from an item of
* $(ref:management.ExtensionInfo).
* @param {!chrome.management.UninstallOptions=} options
* @param {function(): void=} callback
* @see https://developer.chrome.com/extensions/management#method-uninstall
*/
chrome.management.uninstall = function(id, options, callback) {};
/**
* Uninstalls the calling extension. Note: This function can be used without
* requesting the 'management' permission in the manifest. This function does
* not work in managed environments when the user is not allowed to uninstall
* the specified extension/app.
* @param {!chrome.management.UninstallOptions=} options
* @param {function(): void=} callback
* @see https://developer.chrome.com/extensions/management#method-uninstallSelf
*/
chrome.management.uninstallSelf = function(options, callback) {};
/**
* Launches an application.
* @param {string} id The extension id of the application.
* @param {function(): void=} callback
* @see https://developer.chrome.com/extensions/management#method-launchApp
*/
chrome.management.launchApp = function(id, callback) {};
/**
* Display options to create shortcuts for an app. On Mac, only packaged app
* shortcuts can be created.
* @param {string} id This should be the id from an app item of
* $(ref:management.ExtensionInfo).
* @param {function(): void=} callback
* @see https://developer.chrome.com/extensions/management#method-createAppShortcut
*/
chrome.management.createAppShortcut = function(id, callback) {};
/**
* Set the launch type of an app.
* @param {string} id This should be the id from an app item of
* $(ref:management.ExtensionInfo).
* @param {!chrome.management.LaunchType} launchType The target launch type.
* Always check and make sure this launch type is in
* $(ref:ExtensionInfo.availableLaunchTypes), because the available launch
* types vary on different platforms and configurations.
* @param {function(): void=} callback
* @see https://developer.chrome.com/extensions/management#method-setLaunchType
*/
chrome.management.setLaunchType = function(id, launchType, callback) {};
/**
* Generate an app for a URL. Returns the generated bookmark app.
* @param {string} url The URL of a web page. The scheme of the URL can only be
* "http" or "https".
* @param {string} title The title of the generated app.
* @param {function(!chrome.management.ExtensionInfo): void=} callback
* @see https://developer.chrome.com/extensions/management#method-generateAppForLink
*/
chrome.management.generateAppForLink = function(url, title, callback) {};
/**
* Checks if the replacement android app can be installed. Errors generated by
* this API are reported by setting $(ref:runtime.lastError) and executing the
* function's regular callback.
* @param {function(boolean): void} callback
* @see https://developer.chrome.com/extensions/management#method-canInstallReplacementAndroidApp
*/
chrome.management.canInstallReplacementAndroidApp = function(callback) {};
/**
* Prompts the user to install the replacement Android app from the manifest.
* Errors generated by this API are reported by setting $(ref:runtime.lastError)
* and executing the function's regular callback.
* @param {function(): void=} callback
* @see https://developer.chrome.com/extensions/management#method-installReplacementAndroidApp
*/
chrome.management.installReplacementAndroidApp = function(callback) {};
/**
* Launches the replacement_web_app specified in the manifest. Prompts the user
* to install if not already installed.
* @param {function(): void=} callback
* @see https://developer.chrome.com/extensions/management#method-installReplacementWebApp
*/
chrome.management.installReplacementWebApp = function(callback) {};
/**
* Fired when an app or extension has been installed.
* @type {!ChromeEvent}
* @see https://developer.chrome.com/extensions/management#event-onInstalled
*/
chrome.management.onInstalled;
/**
* Fired when an app or extension has been uninstalled.
* @type {!ChromeEvent}
* @see https://developer.chrome.com/extensions/management#event-onUninstalled
*/
chrome.management.onUninstalled;
/**
* Fired when an app or extension has been enabled.
* @type {!ChromeEvent}
* @see https://developer.chrome.com/extensions/management#event-onEnabled
*/
chrome.management.onEnabled;
/**
* Fired when an app or extension has been disabled.
* @type {!ChromeEvent}
* @see https://developer.chrome.com/extensions/management#event-onDisabled
*/
chrome.management.onDisabled;
| {
"content_hash": "64c19cc1fc360a2818506ddec83e1285",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 97,
"avg_line_length": 37.329824561403505,
"alnum_prop": 0.7364413948679387,
"repo_name": "scheib/chromium",
"id": "33d8ed755d7c74e696bb892d8c1a064995cb1a07",
"size": "10639",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "third_party/closure_compiler/externs/management.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
package sun.misc;
import sun.reflect.ConstantPool;
import sun.reflect.annotation.AnnotationType;
import sun.nio.ch.Interruptible;
public interface JavaLangAccess {
/** Return the constant pool for a class. */
ConstantPool getConstantPool(Class klass);
/**
* Set the AnnotationType instance corresponding to this class.
* (This method only applies to annotation types.)
*/
void setAnnotationType(Class klass, AnnotationType annotationType);
/**
* Get the AnnotationType instance corresponding to this class.
* (This method only applies to annotation types.)
*/
AnnotationType getAnnotationType(Class klass);
/**
* Returns the elements of an enum class or null if the
* Class object does not represent an enum type;
* the result is uncloned, cached, and shared by all callers.
*/
<E extends Enum<E>> E[] getEnumConstantsShared(Class<E> klass);
/** Set thread's blocker field. */
void blockedOn(Thread t, Interruptible b);
/**
* Registers a shutdown hook.
*
* It is expected that this method with registerShutdownInProgress=true
* is only used to register DeleteOnExitHook since the first file
* may be added to the delete on exit list by the application shutdown
* hooks.
*
* @params slot the slot in the shutdown hook array, whose element
* will be invoked in order during shutdown
* @params registerShutdownInProgress true to allow the hook
* to be registered even if the shutdown is in progress.
* @params hook the hook to be registered
*
* @throw IllegalStateException if shutdown is in progress and
* the slot is not valid to register.
*/
void registerShutdownHook(int slot, boolean registerShutdownInProgress, Runnable hook);
/**
* Returns the number of stack frames represented by the given throwable.
*/
int getStackTraceDepth(Throwable t);
/**
* Returns the ith StackTraceElement for the given throwable.
*/
StackTraceElement getStackTraceElement(Throwable t, int i);
}
| {
"content_hash": "9b3170a282cddb45f4f9ce2e108ce316",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 91,
"avg_line_length": 33.98412698412698,
"alnum_prop": 0.6828584773470341,
"repo_name": "rokn/Count_Words_2015",
"id": "c61f590cddae4f125a8d8cb4bef60dd5d33db3d7",
"size": "3353",
"binary": false,
"copies": "25",
"ref": "refs/heads/master",
"path": "testing/openjdk/jdk/src/share/classes/sun/misc/JavaLangAccess.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "61802"
},
{
"name": "Ruby",
"bytes": "18888605"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>relative_humidity_wet_psychrometric — MetPy 1.1</title>
<link href="../../_static/css/theme.css" rel="stylesheet" />
<link href="../../_static/css/index.f6b7ca918bee2f46fd9abac01cfb07d5.css" rel="stylesheet" />
<link rel="stylesheet"
href="../../_static/vendor/fontawesome/5.13.0/css/all.min.css">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="../../_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="../../_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&display=swap');
</style>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/basic.css" />
<link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
<link rel="stylesheet" type="text/css" href="../../_static/gallery.css" />
<link rel="stylesheet" type="text/css" href="../../_static/gallery-binder.css" />
<link rel="stylesheet" type="text/css" href="../../_static/gallery-dataframe.css" />
<link rel="stylesheet" type="text/css" href="../../_static/gallery-rendered-html.css" />
<link rel="stylesheet" type="text/css" href="../../_static/theme-unidata.css" />
<link rel="preload" as="script" href="../../_static/js/index.1e043a052b0af929e4d8.js">
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
<script src="../../_static/doc_shared.js"></script>
<link rel="shortcut icon" href="../../_static/metpy_32x32.ico"/>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="saturation_equivalent_potential_temperature" href="metpy.calc.saturation_equivalent_potential_temperature.html" />
<link rel="prev" title="relative_humidity_from_specific_humidity" href="metpy.calc.relative_humidity_from_specific_humidity.html" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="en" />
<link rel="canonical" href="https://unidata.github.io/MetPy/latest/api/generated/metpy.calc.relative_humidity_wet_psychrometric.html" />
</head>
<body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80">
<nav class="navbar navbar-dark navbar-expand-lg bg-unidata fixed-top bd-navbar shadow" id="navbar-main"><div class="container-xl">
<a class="navbar-brand" href="../../index.html">
<img src="../../_static/metpy_horizontal.png" class="logo" alt="logo" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-menu" aria-controls="navbar-menu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar-menu" class="collapse navbar-collapse">
<ul id="navbar-main-elements" class="navbar-nav mr-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Version 1.1
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown" id="version-menu"></div>
</li>
<li class="nav-item ">
<a class="nav-link" href="../../userguide/index.html">User Guide</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="../index.html">Reference Guide</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="../../devel/index.html">Developer’s Guide</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="../../examples/index.html">Example Gallery</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="../../userguide/SUPPORT.html">Support</a>
</li>
<li class="nav-item">
<a class="nav-link nav-external" href="https://github.com/Unidata/MetPy/releases">Release Notes<i class="fas fa-external-link-alt"></i></a>
</li>
</ul>
<form class="bd-search d-flex align-items-center" action="../../search.html" method="get">
<i class="icon fas fa-search"></i>
<input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off" >
</form>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="https://github.com/Unidata/MetPy" target="_blank" rel="noopener">
<span><i class="fab fa-github-square"></i></span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://twitter.com/MetPy" target="_blank" rel="noopener">
<span><i class="fab fa-twitter-square"></i></span>
</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid" id="banner"></div>
<div class="container-xl">
<div class="row">
<!-- Only show if we have sidebars configured, else just a small margin -->
<div class="col-12 col-md-3 bd-sidebar"><nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
<div class="bd-toc-item active">
<ul class="current nav bd-sidenav">
<li class="toctree-l2">
<a class="reference internal" href="metpy.constants.html">
constants
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="metpy.units.html">
units
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="metpy.io.html">
metpy.io
</a>
</li>
<li class="toctree-l2 current active">
<a class="reference internal" href="metpy.calc.html">
calc
</a>
<ul class="current">
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.add_height_to_pressure.html">
add_height_to_pressure
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.add_pressure_to_height.html">
add_pressure_to_height
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.density.html">
density
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.dry_lapse.html">
dry_lapse
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.dry_static_energy.html">
dry_static_energy
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.geopotential_to_height.html">
geopotential_to_height
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.height_to_geopotential.html">
height_to_geopotential
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.mean_pressure_weighted.html">
mean_pressure_weighted
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.potential_temperature.html">
potential_temperature
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.sigma_to_pressure.html">
sigma_to_pressure
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.static_stability.html">
static_stability
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.temperature_from_potential_temperature.html">
temperature_from_potential_temperature
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.thickness_hydrostatic.html">
thickness_hydrostatic
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.dewpoint.html">
dewpoint
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.dewpoint_from_relative_humidity.html">
dewpoint_from_relative_humidity
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.dewpoint_from_specific_humidity.html">
dewpoint_from_specific_humidity
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.equivalent_potential_temperature.html">
equivalent_potential_temperature
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.mixing_ratio.html">
mixing_ratio
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.mixing_ratio_from_relative_humidity.html">
mixing_ratio_from_relative_humidity
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.mixing_ratio_from_specific_humidity.html">
mixing_ratio_from_specific_humidity
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.moist_lapse.html">
moist_lapse
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.moist_static_energy.html">
moist_static_energy
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.precipitable_water.html">
precipitable_water
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.psychrometric_vapor_pressure_wet.html">
psychrometric_vapor_pressure_wet
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.relative_humidity_from_dewpoint.html">
relative_humidity_from_dewpoint
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.relative_humidity_from_mixing_ratio.html">
relative_humidity_from_mixing_ratio
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.relative_humidity_from_specific_humidity.html">
relative_humidity_from_specific_humidity
</a>
</li>
<li class="toctree-l3 current active">
<a class="current reference internal" href="#">
relative_humidity_wet_psychrometric
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.saturation_equivalent_potential_temperature.html">
saturation_equivalent_potential_temperature
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.saturation_mixing_ratio.html">
saturation_mixing_ratio
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.saturation_vapor_pressure.html">
saturation_vapor_pressure
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.scale_height.html">
scale_height
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.specific_humidity_from_dewpoint.html">
specific_humidity_from_dewpoint
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.specific_humidity_from_mixing_ratio.html">
specific_humidity_from_mixing_ratio
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.thickness_hydrostatic_from_relative_humidity.html">
thickness_hydrostatic_from_relative_humidity
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.vapor_pressure.html">
vapor_pressure
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.vertical_velocity.html">
vertical_velocity
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.vertical_velocity_pressure.html">
vertical_velocity_pressure
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.virtual_potential_temperature.html">
virtual_potential_temperature
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.virtual_temperature.html">
virtual_temperature
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.wet_bulb_temperature.html">
wet_bulb_temperature
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.bulk_shear.html">
bulk_shear
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.bunkers_storm_motion.html">
bunkers_storm_motion
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.cape_cin.html">
cape_cin
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.critical_angle.html">
critical_angle
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.el.html">
el
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.lcl.html">
lcl
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.lfc.html">
lfc
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.lifted_index.html">
lifted_index
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.mixed_layer.html">
mixed_layer
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.mixed_layer_cape_cin.html">
mixed_layer_cape_cin
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.mixed_parcel.html">
mixed_parcel
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.most_unstable_cape_cin.html">
most_unstable_cape_cin
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.most_unstable_parcel.html">
most_unstable_parcel
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.parcel_profile.html">
parcel_profile
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.parcel_profile_with_lcl.html">
parcel_profile_with_lcl
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.parcel_profile_with_lcl_as_dataset.html">
parcel_profile_with_lcl_as_dataset
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.showalter_index.html">
showalter_index
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.significant_tornado.html">
significant_tornado
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.storm_relative_helicity.html">
storm_relative_helicity
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.supercell_composite.html">
supercell_composite
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.surface_based_cape_cin.html">
surface_based_cape_cin
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.absolute_momentum.html">
absolute_momentum
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.absolute_vorticity.html">
absolute_vorticity
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.advection.html">
advection
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.ageostrophic_wind.html">
ageostrophic_wind
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.coriolis_parameter.html">
coriolis_parameter
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.divergence.html">
divergence
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.exner_function.html">
exner_function
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.frontogenesis.html">
frontogenesis
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.geostrophic_wind.html">
geostrophic_wind
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.inertial_advective_wind.html">
inertial_advective_wind
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.kinematic_flux.html">
kinematic_flux
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.montgomery_streamfunction.html">
montgomery_streamfunction
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.potential_vorticity_baroclinic.html">
potential_vorticity_baroclinic
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.potential_vorticity_barotropic.html">
potential_vorticity_barotropic
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.q_vector.html">
q_vector
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.shearing_deformation.html">
shearing_deformation
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.stretching_deformation.html">
stretching_deformation
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.total_deformation.html">
total_deformation
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.vorticity.html">
vorticity
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.wind_components.html">
wind_components
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.wind_direction.html">
wind_direction
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.wind_speed.html">
wind_speed
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.brunt_vaisala_frequency.html">
brunt_vaisala_frequency
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.brunt_vaisala_frequency_squared.html">
brunt_vaisala_frequency_squared
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.brunt_vaisala_period.html">
brunt_vaisala_period
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.friction_velocity.html">
friction_velocity
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.gradient_richardson_number.html">
gradient_richardson_number
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.tke.html">
tke
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.cross_section_components.html">
cross_section_components
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.first_derivative.html">
first_derivative
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.gradient.html">
gradient
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.laplacian.html">
laplacian
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.lat_lon_grid_deltas.html">
lat_lon_grid_deltas
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.normal_component.html">
normal_component
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.second_derivative.html">
second_derivative
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.tangential_component.html">
tangential_component
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.unit_vectors_from_cross_section.html">
unit_vectors_from_cross_section
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.apparent_temperature.html">
apparent_temperature
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.heat_index.html">
heat_index
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.windchill.html">
windchill
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.altimeter_to_sea_level_pressure.html">
altimeter_to_sea_level_pressure
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.altimeter_to_station_pressure.html">
altimeter_to_station_pressure
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.height_to_pressure_std.html">
height_to_pressure_std
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.pressure_to_height_std.html">
pressure_to_height_std
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.smooth_gaussian.html">
smooth_gaussian
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.smooth_window.html">
smooth_window
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.smooth_rectangular.html">
smooth_rectangular
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.smooth_circular.html">
smooth_circular
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.smooth_n_point.html">
smooth_n_point
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.angle_to_direction.html">
angle_to_direction
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.azimuth_range_to_lat_lon.html">
azimuth_range_to_lat_lon
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.find_bounding_indices.html">
find_bounding_indices
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.find_intersections.html">
find_intersections
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.get_layer.html">
get_layer
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.get_layer_heights.html">
get_layer_heights
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.get_perturbation.html">
get_perturbation
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.isentropic_interpolation.html">
isentropic_interpolation
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.isentropic_interpolation_as_dataset.html">
isentropic_interpolation_as_dataset
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.nearest_intersection_idx.html">
nearest_intersection_idx
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.parse_angle.html">
parse_angle
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.reduce_point_density.html">
reduce_point_density
</a>
</li>
<li class="toctree-l3">
<a class="reference internal" href="metpy.calc.resample_nn_1d.html">
resample_nn_1d
</a>
</li>
</ul>
</li>
<li class="toctree-l2">
<a class="reference internal" href="metpy.plots.html">
metpy.plots
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="metpy.plots.ctables.html">
ctables
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="metpy.interpolate.html">
interpolate
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="metpy.xarray.html">
xarray
</a>
</li>
<li class="toctree-l2">
<a class="reference internal" href="../references.html">
References
</a>
</li>
</ul>
</div>
</nav>
</div>
<div class="d-none d-xl-block col-xl-2 bd-toc">
<nav id="bd-toc-nav">
</nav>
</div>
<main class="col-12 col-md-9 col-xl-7 py-md-5 pl-md-5 pr-md-4 bd-content" role="main">
<div>
<section id="relative-humidity-wet-psychrometric">
<h1>relative_humidity_wet_psychrometric<a class="headerlink" href="#relative-humidity-wet-psychrometric" title="Permalink to this headline">¶</a></h1>
<dl class="py function">
<dt class="sig sig-object py" id="metpy.calc.relative_humidity_wet_psychrometric">
<span class="sig-prename descclassname"><span class="pre">metpy.calc.</span></span><span class="sig-name descname"><span class="pre">relative_humidity_wet_psychrometric</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pressure</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dry_bulb_temperature</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wet_bulb_temperature</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#metpy.calc.relative_humidity_wet_psychrometric" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate the relative humidity with wet bulb and dry bulb temperatures.</p>
<p>This uses a psychrometric relationship as outlined in <a class="reference internal" href="../references.html#wmo8" id="id1"><span>[WMO8]</span></a>, with
coefficients from <a class="reference internal" href="../references.html#fan1987" id="id2"><span>[Fan1987]</span></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>pressure</strong> (<a class="reference external" href="https://pint.readthedocs.io/en/stable/developers_reference.html#pint.Quantity" title="(in pint v0.17)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pint.Quantity</span></code></a>) – Total atmospheric pressure</p></li>
<li><p><strong>dry_bulb_temperature</strong> (<a class="reference external" href="https://pint.readthedocs.io/en/stable/developers_reference.html#pint.Quantity" title="(in pint v0.17)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pint.Quantity</span></code></a>) – Dry bulb temperature</p></li>
<li><p><strong>wet_bulb_temperature</strong> (<a class="reference external" href="https://pint.readthedocs.io/en/stable/developers_reference.html#pint.Quantity" title="(in pint v0.17)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pint.Quantity</span></code></a>) – Wet bulb temperature</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><a class="reference external" href="https://pint.readthedocs.io/en/stable/developers_reference.html#pint.Quantity" title="(in pint v0.17)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">pint.Quantity</span></code></a> – Relative humidity</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<div class="math notranslate nohighlight">
\[RH = \frac{e}{e_s}\]</div>
<ul class="simple">
<li><p><span class="math notranslate nohighlight">\(RH\)</span> is relative humidity as a unitless ratio</p></li>
<li><p><span class="math notranslate nohighlight">\(e\)</span> is vapor pressure from the wet psychrometric calculation</p></li>
<li><p><span class="math notranslate nohighlight">\(e_s\)</span> is the saturation vapor pressure</p></li>
</ul>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 1.0: </span>Changed signature from
<code class="docutils literal notranslate"><span class="pre">(dry_bulb_temperature,</span> <span class="pre">web_bulb_temperature,</span> <span class="pre">pressure,</span> <span class="pre">**kwargs)</span></code></p>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="metpy.calc.psychrometric_vapor_pressure_wet.html#metpy.calc.psychrometric_vapor_pressure_wet" title="metpy.calc.psychrometric_vapor_pressure_wet"><code class="xref py py-obj docutils literal notranslate"><span class="pre">psychrometric_vapor_pressure_wet</span></code></a>, <a class="reference internal" href="metpy.calc.saturation_vapor_pressure.html#metpy.calc.saturation_vapor_pressure" title="metpy.calc.saturation_vapor_pressure"><code class="xref py py-obj docutils literal notranslate"><span class="pre">saturation_vapor_pressure</span></code></a></p>
</div>
</dd></dl>
<div style='clear:both'></div></section>
</div>
<div class='prev-next-bottom'>
<a class='left-prev' id="prev-link" href="metpy.calc.relative_humidity_from_specific_humidity.html" title="previous page">relative_humidity_from_specific_humidity</a>
<a class='right-next' id="next-link" href="metpy.calc.saturation_equivalent_potential_temperature.html" title="next page">saturation_equivalent_potential_temperature</a>
</div>
</main>
</div>
</div>
<script src="../../_static/js/index.1e043a052b0af929e4d8.js"></script>
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-92978945-1', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->
<footer class="footer mt-5 mt-md-0">
<div class="container">
<p>
© Copyright 2008–2021, MetPy Developers.Development is supported by Unidata and the National Science Foundation..<br/>
Last updated on Aug 09, 2021 at 17:24:01.<br/>
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 4.1.2.<br/>
</p>
</div>
</footer>
</body>
</html> | {
"content_hash": "5ea07769cf4260dd5b9f31a854a624d8",
"timestamp": "",
"source": "github",
"line_count": 929,
"max_line_length": 780,
"avg_line_length": 34.68030139935414,
"alnum_prop": 0.6339623812775467,
"repo_name": "metpy/MetPy",
"id": "4911a610aa0a5058a6ebc9b8cacae4ee31e7796a",
"size": "32233",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "v1.1/api/generated/metpy.calc.relative_humidity_wet_psychrometric.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "989941"
},
{
"name": "Python",
"bytes": "551868"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS language="uk" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Speedcoin</source>
<translation>Про Speedcoin</translation>
</message>
<message>
<location line="+39"/>
<source><b>Speedcoin</b> version</source>
<translation>Версія <b>Speedcoin'a<b></translation>
</message>
<message>
<location line="+57"/>
<source>
Speedcoin Official Website: http://www.speedcoin.co
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation>
Це програмне забезпечення є експериментальним.
Поширюється за ліцензією MIT/X11, додаткова інформація міститься у файлі COPYING, а також за адресою http://www.opensource.org/licenses/mit-license.php.
Цей продукт включає в себе програмне забезпечення, розроблене в рамках проекту OpenSSL (http://www.openssl.org/), криптографічне програмне забезпечення, написане Еріком Янгом (eay@cryptsoft.com), та функції для роботи з UPnP, написані Томасом Бернардом.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation>Авторське право</translation>
</message>
<message>
<location line="+0"/>
<source>The Speedcoin developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Адресна книга</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Двічі клікніть на адресу чи назву для їх зміни</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Створити нову адресу</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Копіювати виділену адресу в буфер обміну</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Створити адресу</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your Speedcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation>Це ваші адреси для отримання платежів. Ви можете давати різні адреси різним людям, таким чином маючи можливість відслідкувати хто конкретно і скільки вам заплатив.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>&Скопіювати адресу</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>Показати QR-&Код</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a Speedcoin address</source>
<translation>Підпишіть повідомлення щоб довести, що ви є власником цієї адреси</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>&Підписати повідомлення</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Вилучити вибрані адреси з переліку</translation>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation>Експортувати дані з поточної вкладки в файл</translation>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified Speedcoin address</source>
<translation>Перевірте повідомлення для впевненості, що воно підписано вказаною Speedcoin-адресою</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>Перевірити повідомлення</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Видалити</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your Speedcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>Скопіювати &мітку</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Редагувати</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Експортувати адресну книгу</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Файли відділені комами (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Помилка при експортуванні</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Неможливо записати у файл %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Назва</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Адреса</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(немає назви)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Діалог введення паролю</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Введіть пароль</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Новий пароль</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Повторіть пароль</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Введіть новий пароль для гаманця.<br/>Будь ласка, використовуйте паролі що містять <b>як мінімум 10 випадкових символів</b>, або <b>як мінімум 8 слів</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Зашифрувати гаманець</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Ця операція потребує пароль для розблокування гаманця.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Розблокувати гаманець</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Ця операція потребує пароль для дешифрування гаманця.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Дешифрувати гаманець</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Змінити пароль</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Ввести старий та новий паролі для гаманця.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Підтвердити шифрування гаманця</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR LITECOINS</b>!</source>
<translation>УВАГА: Якщо ви зашифруєте гаманець і забудете пароль, ви <b>ВТРАТИТЕ ВСІ СВОЇ БІТКОІНИ</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Ви дійсно хочете зашифрувати свій гаманець?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Увага: Ввімкнено Caps Lock!</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Гаманець зашифровано</translation>
</message>
<message>
<location line="-56"/>
<source>Speedcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your litecoins from being stolen by malware infecting your computer.</source>
<translation>Біткоін-клієнт буде закрито для завершення процесу шифрування. Пам'ятайте, що шифрування гаманця не може повністю захистити ваші біткоіни від крадіжки, у випадку якщо ваш комп'ютер буде інфіковано шкідливими програмами.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Не вдалося зашифрувати гаманець</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Виникла помилка під час шифрування гаманця. Ваш гаманець не було зашифровано.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>Введені паролі не співпадають.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Не вдалося розблокувати гаманець</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Введений пароль є невірним.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Не вдалося розшифрувати гаманець</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Пароль було успішно змінено.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>&Підписати повідомлення...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Синхронізація з мережею...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Огляд</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Показати загальний огляд гаманця</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>Транзакції</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Переглянути історію транзакцій</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Редагувати список збережених адрес та міток</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Показати список адрес для отримання платежів</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>&Вихід</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Вийти</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Speedcoin</source>
<translation>Показати інформацію про Speedcoin</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>&Про Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Показати інформацію про Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Параметри...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>&Шифрування гаманця...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>&Резервне копіювання гаманця...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>Змінити парол&ь...</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation>Імпорт блоків з диску...</translation>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-347"/>
<source>Send coins to a Speedcoin address</source>
<translation>Відправити монети на вказану адресу</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Speedcoin</source>
<translation>Редагувати параметри</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Резервне копіювання гаманця в інше місце</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Змінити пароль, який використовується для шифрування гаманця</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>Вікно зневадження</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Відкрити консоль зневадження і діагностики</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>Перевірити повідомлення...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>Speedcoin</source>
<translation>Speedcoin</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Гаманець</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>&About Speedcoin</source>
<translation>&Про Speedcoin</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>Показати / Приховати</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation>Показує або приховує головне вікно</translation>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your Speedcoin addresses to prove you own them</source>
<translation>Підтвердіть, що Ви є власником повідомлення підписавши його Вашою Speedcoin-адресою </translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Speedcoin addresses</source>
<translation>Перевірте повідомлення для впевненості, що воно підписано вказаною Speedcoin-адресою</translation>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Файл</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Налаштування</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Довідка</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Панель вкладок</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[тестова мережа]</translation>
</message>
<message>
<location line="+47"/>
<source>Speedcoin client</source>
<translation>Speedcoin-клієнт</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Speedcoin network</source>
<translation><numerusform>%n активне з'єднання з мережею</numerusform><numerusform>%n активні з'єднання з мережею</numerusform><numerusform>%n активних з'єднань з мережею</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation>Оброблено %1 блоків історії транзакцій.</translation>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation>Помилка</translation>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation>Увага</translation>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation>Інформація</translation>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Синхронізовано</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Синхронізується...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Підтвердити комісію</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Надіслані транзакції</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Отримані перекази</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Дата: %1
Кількість: %2
Тип: %3
Адреса: %4
</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation>Обробка URI</translation>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid Speedcoin address or malformed URI parameters.</source>
<translation>Неможливо обробити URI! Це може бути викликано неправильною Speedcoin-адресою, чи невірними параметрами URI.</translation>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation><b>Зашифрований</b> гаманець <b>розблоковано</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation><b>Зашифрований</b> гаманець <b>заблоковано</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. Speedcoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Сповіщення мережі</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Редагувати адресу</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Мітка</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Мітка, пов'язана з цим записом адресної книги</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Адреса</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>Адреса, пов'язана з цим записом адресної книги. Може бути змінено тільки для адреси відправника.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Нова адреса для отримання</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Нова адреса для відправлення</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Редагувати адресу для отримання</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Редагувати адресу для відправлення</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Введена адреса «%1» вже присутня в адресній книзі.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Speedcoin address.</source>
<translation>Введена адреса «%1» не є коректною адресою в мережі Speedcoin.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Неможливо розблокувати гаманець.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Не вдалося згенерувати нові ключі.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>Speedcoin-Qt</source>
<translation>Speedcoin-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>версія</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Використання:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>параметри командного рядка</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>Параметри інтерфейсу</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Встановлення мови, наприклад "de_DE" (типово: системна)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Запускати згорнутим</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Показувати заставку під час запуску (типово: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Параметри</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Головні</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Заплатити комісі&ю</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start Speedcoin after logging in to the system.</source>
<translation>Автоматично запускати гаманець при вході до системи.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start Speedcoin on system login</source>
<translation>&Запускати гаманець при вході в систему</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation>Скинути всі параметри клієнта на типові.</translation>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation>Скинути параметри</translation>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>&Мережа</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Speedcoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Автоматично відкривати порт для клієнту біткоін на роутері. Працює лише якщо ваш роутер підтримує UPnP і ця функція увімкнена.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Відображення порту через &UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the Speedcoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Підключатись до мережі Speedcoin через SOCKS-проксі (наприклад при використанні Tor).</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>Підключатись через &SOCKS-проксі:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>&IP проксі:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>IP-адреса проксі-сервера (наприклад 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Порт:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Порт проксі-сервера (наприклад 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS версії:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>Версія SOCKS-проксі (наприклад 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Вікно</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Показувати лише іконку в треї після згортання вікна.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>Мінімізувати &у трей</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Згортати замість закриття. Якщо ця опція включена, програма закриється лише після вибору відповідного пункту в меню.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>Згортати замість закритт&я</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Відображення</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>Мова інтерфейсу користувача:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Speedcoin.</source>
<translation>Встановлює мову інтерфейсу. Зміни набудуть чинності після перезапуску Speedcoin.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>В&имірювати монети в:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Виберіть одиницю вимірювання монет, яка буде відображатись в гаманці та при відправленні.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show Speedcoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>&Відображати адресу в списку транзакцій</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&Гаразд</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Скасувати</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Застосувати</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>типово</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation>Підтвердження скидання параметрів</translation>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation>Деякі параметри потребують перезапуск клієнта для набуття чинності.</translation>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation>Продовжувати?</translation>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>Увага</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Speedcoin.</source>
<translation>Цей параметр набуде чинності після перезапуску Speedcoin.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Невірно вказано адресу проксі.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Форма</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Speedcoin network after a connection is established, but this process has not completed yet.</source>
<translation>Показана інформація вже може бути застарілою. Ваш гаманець буде автоматично синхронізовано з мережею Speedcoin після встановлення підключення, але цей процес ще не завершено.</translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Баланс:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Непідтверджені:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Гаманець</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Недавні транзакції</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Ваш поточний баланс</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Загальна сума всіх транзакцій, які ще не підтверджені, та до цих пір не враховуються в загальному балансі</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>не синхронізовано</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start litecoin: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>Діалог QR-коду</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Запросити Платіж</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Кількість:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Мітка:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Повідомлення:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Зберегти як...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Помилка при кодуванні URI в QR-код.</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>Невірно введено кількість, будь ласка, перевірте.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>Кінцевий URI занадто довгий, спробуйте зменшити текст для мітки / повідомлення.</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>Зберегти QR-код</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG-зображення (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Назва клієнту</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation>Н/Д</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Версія клієнту</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Інформація</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Використовується OpenSSL версії</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Мережа</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Кількість підключень</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>В тестовій мережі</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Поточне число блоків</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>Відкрити</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>Параметри командного рядка</translation>
</message>
<message>
<location line="+7"/>
<source>Show the Speedcoin-Qt help message to get a list with possible Speedcoin command-line options.</source>
<translation>Показати довідку Speedcoin-Qt для отримання переліку можливих параметрів командного рядка.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>Показати</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>Консоль</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Дата збирання</translation>
</message>
<message>
<location line="-104"/>
<source>Speedcoin - Debug window</source>
<translation>Speedcoin - Вікно зневадження</translation>
</message>
<message>
<location line="+25"/>
<source>Speedcoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Файл звіту зневадження</translation>
</message>
<message>
<location line="+7"/>
<source>Open the Speedcoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Очистити консоль</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the Speedcoin RPC console.</source>
<translation>Вітаємо у консолі Speedcoin RPC.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Використовуйте стрілки вгору вниз для навігації по історії, і <b>Ctrl-L</b> для очищення екрана.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Наберіть <b>help</b> для перегляду доступних команд.</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Відправити</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Відправити на декілька адрес</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>Дод&ати одержувача</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Видалити всі поля транзакції</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Очистити &все</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Баланс:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123.456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Підтвердити відправлення</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>&Відправити</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> адресату %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Підтвердіть відправлення</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Ви впевнені що хочете відправити %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation> і </translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Адреса отримувача невірна, будь ласка перепровірте.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Кількість монет для відправлення повинна бути більшою 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Кількість монет для відправлення перевищує ваш баланс.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Сума перевищить ваш баланс, якщо комісія %1 буде додана до вашої транзакції.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Знайдено адресу що дублюється. Відправлення на кожну адресу дозволяється лише один раз на кожну операцію переказу.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation>Помилка: Не вдалося створити транзакцію!</translation>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Помилка: транзакцію було відхилено. Це може статись, якщо декілька монет з вашого гаманця вже використані, наприклад, якщо ви використовуєте одну копію гаманця (wallet.dat), а монети були використані з іншої копії, але не позначені як використані в цій.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Форма</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>&Кількість:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>&Отримувач:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. SbJtSLn5C6NsuBqfYPTfZ3rGD7idcfRXM4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Введіть мітку для цієї адреси для додавання її в адресну книгу</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Мітка:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Вибрати адресу з адресної книги</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Вставити адресу</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Видалити цього отримувача</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Speedcoin address (e.g. SbJtSLn5C6NsuBqfYPTfZ3rGD7idcfRXM4)</source>
<translation>Введіть адресу Speedcoin (наприклад SbJtSLn5C6NsuBqfYPTfZ3rGD7idcfRXM4)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Підписи - Підпис / Перевірка повідомлення</translation>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>&Підписати повідомлення</translation>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. SbJtSLn5C6NsuBqfYPTfZ3rGD7idcfRXM4)</source>
<translation>Введіть адресу Speedcoin (наприклад SbJtSLn5C6NsuBqfYPTfZ3rGD7idcfRXM4)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>Вибрати адресу з адресної книги</translation>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>Вставити адресу</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Введіть повідомлення, яке ви хочете підписати тут</translation>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation>Підпис</translation>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Копіювати поточну сигнатуру до системного буферу обміну</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Speedcoin address</source>
<translation>Підпишіть повідомлення щоб довести, що ви є власником цієї адреси</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>&Підписати повідомлення</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation>Скинути всі поля підпису повідомлення</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Очистити &все</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>Перевірити повідомлення</translation>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. SbJtSLn5C6NsuBqfYPTfZ3rGD7idcfRXM4)</source>
<translation>Введіть адресу Speedcoin (наприклад SbJtSLn5C6NsuBqfYPTfZ3rGD7idcfRXM4)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Speedcoin address</source>
<translation>Перевірте повідомлення для впевненості, що воно підписано вказаною Speedcoin-адресою</translation>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation>Перевірити повідомлення</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation>Скинути всі поля перевірки повідомлення</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Speedcoin address (e.g. SbJtSLn5C6NsuBqfYPTfZ3rGD7idcfRXM4)</source>
<translation>Введіть адресу Speedcoin (наприклад SbJtSLn5C6NsuBqfYPTfZ3rGD7idcfRXM4)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Натисніть кнопку «Підписати повідомлення», для отримання підпису</translation>
</message>
<message>
<location line="+3"/>
<source>Enter Speedcoin signature</source>
<translation>Введіть сигнатуру Speedcoin</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Введена нечинна адреса.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Будь ласка, перевірте адресу та спробуйте ще.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Не вдалося підписати повідомлення.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Повідомлення підписано.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>Підпис не можливо декодувати.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Будь ласка, перевірте підпис та спробуйте ще.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Не вдалося перевірити повідомлення.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Повідомлення перевірено.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The Speedcoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[тестова мережа]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Відкрити до %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%1/поза інтернетом</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/не підтверджено</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 підтверджень</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Статус</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Дата</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Згенеровано</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Відправник</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>Отримувач</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>Мітка</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Кредит</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>не прийнято</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Дебет</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Комісія за транзакцію</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Загальна сума</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Повідомлення</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Коментар</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>ID транзакції</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation>Після генерації монет, потрібно зачекати 120 блоків, перш ніж їх можна буде використати. Коли ви згенерували цей блок, його було відправлено в мережу для того, щоб він був доданий до ланцюжка блоків. Якщо ця процедура не вдасться, статус буде змінено на «не підтверджено» і ви не зможете потратити згенеровані монету. Таке може статись, якщо хтось інший згенерував блок на декілька секунд раніше.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Транзакція</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Кількість</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>true</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>false</translation>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, ще не було успішно розіслано</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>невідомий</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Деталі транзакції</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Даний діалог показує детальну статистику по вибраній транзакції</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Дата</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Тип</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Адреса</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Кількість</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Відкрити до %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Поза інтернетом (%1 підтверджень)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>Непідтверджено (%1 із %2 підтверджень)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Підтверджено (%1 підтверджень)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Цей блок не був отриманий жодними іншими вузлами і, ймовірно, не буде прийнятий!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Згенеровано, але не підтверджено</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Отримано</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Отримано від</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Відправлено</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Відправлено собі</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Добуто</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(недоступно)</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Статус транзакції. Наведіть вказівник на це поле, щоб показати кількість підтверджень.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Дата і час, коли транзакцію було отримано.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Тип транзакції.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Адреса отримувача транзакції.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Сума, додана чи знята з балансу.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Всі</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Сьогодні</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>На цьому тижні</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>На цьому місяці</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Минулого місяця</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Цього року</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Проміжок...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Отримані на</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Відправлені на</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Відправлені собі</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Добуті</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Інше</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Введіть адресу чи мітку для пошуку</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Мінімальна сума</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Скопіювати адресу</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Скопіювати мітку</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Копіювати кількість</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Редагувати мітку</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Показати деталі транзакції</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Експортувати дані транзакцій</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Файли, розділені комою (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Підтверджені</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Дата</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Тип</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Мітка</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Адреса</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Кількість</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>Ідентифікатор</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Помилка експорту</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Неможливо записати у файл %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Діапазон від:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>до</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>Відправити</translation>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation>Експортувати дані з поточної вкладки в файл</translation>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>Виникла помилка при спробі зберегти гаманець в новому місці.</translation>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation>Успішне створення резервної копії</translation>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation>Данні гаманця успішно збережено в новому місці призначення.</translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>Speedcoin version</source>
<translation>Версія</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Використання:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or litecoind</source>
<translation>Відправити команду серверу -server чи демону</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Список команд</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Отримати довідку по команді</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Параметри:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: litecoin.conf)</source>
<translation>Вкажіть файл конфігурації (типово: litecoin.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: litecoind.pid)</source>
<translation>Вкажіть pid-файл (типово: litecoind.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Вкажіть робочий каталог</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Встановити розмір кешу бази даних в мегабайтах (типово: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 24777 or testnet: 34777)</source>
<translation>Чекати на з'єднання на <port> (типово: 24777 або тестова мережа: 34777)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Підтримувати не більше <n> зв'язків з колегами (типово: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Поріг відключення неправильно під'єднаних пірів (типово: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Максимальній розмір вхідного буферу на одне з'єднання (типово: 86400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 24776 or testnet: 34776)</source>
<translation>Прослуховувати <port> для JSON-RPC-з'єднань (типово: 24776 або тестова мережа: 34776)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Приймати команди із командного рядка та команди JSON-RPC</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Запустити в фоновому режимі (як демон) та приймати команди</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Використовувати тестову мережу</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=litecoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "Speedcoin Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Speedcoin is probably running already. You need to look at the Speedcoin icon on your taskbar/system tray.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Помилка: транзакцію було відхилено. Це може статись, якщо декілька монет з вашого гаманця вже використані, наприклад, якщо ви використовуєте одну копію гаманця (wallet.dat), а монети були використані з іншої копії, але не позначені як використані в цій.</translation>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Увага: встановлено занадто велику комісію (-paytxfee). Комісія зніматиметься кожен раз коли ви проводитимете транзакції.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Speedcoin will not work properly.</source>
<translation>Увага: будь ласка, перевірте дату і час на своєму комп'ютері. Якщо ваш годинник йде неправильно, Speedcoin може працювати некоректно.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>Увага: помилка читання wallet.dat! Всі ключі прочитано коректно, але дані транзакцій чи записи адресної книги можуть бути пропущені, або пошкоджені.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation>Увага: файл wallet.dat пошкоджено, дані врятовано! Оригінальний wallet.dat збережено як wallet.{timestamp}.bak до %s; якщо Ваш баланс чи транзакції неправильні, Ви можете відновити їх з резервної копії. </translation>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Спроба відновити закриті ключі з пошкодженого wallet.dat</translation>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>Підключитись лише до вказаного вузла</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation>Помилка ініціалізації бази даних блоків</translation>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation>Помилка завантаження бази даних блоків</translation>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation>Помилка: Мало вільного місця на диску!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation>Помилка: Гаманець заблокований, неможливо створити транзакцію!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation>Помилка: системна помилка: </translation>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation>Скільки блоків перевіряти під час запуску (типово: 288, 0 = всі)</translation>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation>Імпорт блоків з зовнішнього файлу blk000??.dat</translation>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation>Інформація</translation>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>Помилка в адресі -tor: «%s»</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Максимальний буфер, <n>*1000 байт (типово: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Максимальній розмір вихідного буферу на одне з'єднання, <n>*1000 байт (типово: 1000)</translation>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Виводити більше налагоджувальної інформації. Мається на увазі всі шнші -debug* параметри</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>Доповнювати налагоджувальний вивід відміткою часу</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the Speedcoin Wiki for SSL setup instructions)</source>
<translation>Параметри SSL: (див. Speedcoin Wiki для налаштування SSL)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>Вибір версії socks-проксі для використання (4-5, типово: 5)</translation>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Відсилати налагоджувальну інформацію на консоль, а не у файл debug.log</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Відсилати налагоджувальну інформацію до налагоджувача</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Встановити максимальний розмір блоку у байтах (типово: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Встановити мінімальний розмір блоку у байтах (типово: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Стискати файл debug.log під час старту клієнта (типово: 1 коли відсутутній параметр -debug)</translation>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Вказати тайм-аут підключення у мілісекундах (типово: 5000)</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation>Системна помилка: </translation>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Намагатись використовувати UPnP для відображення порту, що прослуховується на роутері (default: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Намагатись використовувати UPnP для відображення порту, що прослуховується на роутері (default: 1 when listening)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>Ім'я користувача для JSON-RPC-з'єднань</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation>Попередження</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Увага: Поточна версія застаріла, необхідне оновлення!</translation>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat пошкоджено, відновлення не вдалося</translation>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>Пароль для JSON-RPC-з'єднань</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Дозволити JSON-RPC-з'єднання з вказаної IP-адреси</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Відправляти команди на вузол, запущений на <ip> (типово: 127.0.0.1)</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Модернізувати гаманець до останнього формату</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Встановити розмір пулу ключів <n> (типово: 100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Пересканувати ланцюжок блоків, в пошуку втрачених транзакцій</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Використовувати OpenSSL (https) для JSON-RPC-з'єднань</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Файл сертифіката сервера (типово: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Закритий ключ сервера (типово: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Допустимі шифри (типово: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Дана довідка</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Неможливо прив'язати до порту %s на цьому комп'ютері (bind returned error %d, %s)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Підключитись через SOCKS-проксі</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Дозволити пошук в DNS для команд -addnode, -seednode та -connect</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Завантаження адрес...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Помилка при завантаженні wallet.dat: Гаманець пошкоджено</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of Speedcoin</source>
<translation>Помилка при завантаженні wallet.dat: Гаманець потребує новішої версії Біткоін-клієнта</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Speedcoin to complete</source>
<translation>Потрібно перезаписати гаманець: перезапустіть Біткоін-клієнт для завершення</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>Помилка при завантаженні wallet.dat</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Помилка в адресі проксі-сервера: «%s»</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Невідома мережа вказана в -onlynet: «%s»</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Помилка у величині комісії -paytxfee=<amount>: «%s»</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Некоректна кількість</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Недостатньо коштів</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Завантаження індексу блоків...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Додати вузол до підключення і лишити його відкритим</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. Speedcoin is probably already running.</source>
<translation>Неможливо прив'язати до порту %s на цьому комп'ютері. Можливо гаманець вже запущено.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Комісія за КБ</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Завантаження гаманця...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>Неможливо записати типову адресу</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Сканування...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Завантаження завершене</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Помилка</translation>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>Ви мусите встановити rpcpassword=<password> в файлі конфігурації:
%s
Якщо файл не існує, створіть його із правами тільки для читання власником (owner-readable-only).</translation>
</message>
</context>
</TS> | {
"content_hash": "d990cee6c359a226906fc3562d34d376",
"timestamp": "",
"source": "github",
"line_count": 2931,
"max_line_length": 431,
"avg_line_length": 37.94916410781303,
"alnum_prop": 0.6245403626752016,
"repo_name": "studio666/Speedcoin",
"id": "1673e430d094ab9590c1f39a80d55234dece1b2f",
"size": "123620",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/qt/locale/bitcoin_uk.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "32391"
},
{
"name": "C++",
"bytes": "2613625"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Groff",
"bytes": "18420"
},
{
"name": "HTML",
"bytes": "50615"
},
{
"name": "Makefile",
"bytes": "13723"
},
{
"name": "NSIS",
"bytes": "5946"
},
{
"name": "Objective-C",
"bytes": "1052"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "69723"
},
{
"name": "QMake",
"bytes": "15264"
},
{
"name": "Shell",
"bytes": "13234"
}
],
"symlink_target": ""
} |
layout: feed
sitemap: false
lang: fr
permalink: /fr/feed.xml
--- | {
"content_hash": "86fd771abf841efe372a86a63aba88e2",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 23,
"avg_line_length": 12.8,
"alnum_prop": 0.71875,
"repo_name": "btcdrak/bitcoincore.org",
"id": "199cf697c1ae36157787514769e3e9fb6d6110c0",
"size": "68",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "assets/feeds/feed-fr.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "54357"
},
{
"name": "HTML",
"bytes": "42032"
},
{
"name": "JavaScript",
"bytes": "51513"
},
{
"name": "Ruby",
"bytes": "3753"
}
],
"symlink_target": ""
} |
ActiveRecord::Schema.define(:version => 20110901205127) do
create_table "delayed_jobs", :force => true do |t|
t.integer "priority", :default => 0
t.integer "attempts", :default => 0
t.text "handler"
t.text "last_error"
t.datetime "run_at"
t.datetime "locked_at"
t.datetime "failed_at"
t.string "locked_by"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "kublog_categories", :force => true do |t|
t.string "name"
t.string "slug"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "kublog_categories", ["name"], :name => "index_kublog_categories_on_name"
add_index "kublog_categories", ["slug"], :name => "index_kublog_categories_on_slug", :unique => true
create_table "kublog_comments", :force => true do |t|
t.text "body"
t.integer "user_id"
t.integer "post_id"
t.string "author_name"
t.string "author_email"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "kublog_comments", ["post_id"], :name => "index_kublog_comments_on_post_id"
add_index "kublog_comments", ["user_id"], :name => "index_kublog_comments_on_user_id"
create_table "kublog_images", :force => true do |t|
t.string "alt"
t.string "file"
t.integer "file_width"
t.integer "file_height"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "kublog_notifications", :force => true do |t|
t.string "kind"
t.text "content"
t.integer "provider_id"
t.integer "post_id"
t.datetime "sent_at"
t.datetime "created_at"
t.text "roles"
t.integer "times_delivered", :default => 0
end
add_index "kublog_notifications", ["kind"], :name => "index_kublog_notifications_on_kind"
add_index "kublog_notifications", ["post_id"], :name => "index_kublog_notifications_on_post_id"
create_table "kublog_posts", :force => true do |t|
t.string "title"
t.text "body"
t.integer "user_id"
t.integer "category_id"
t.string "slug"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "kublog_posts", ["category_id"], :name => "index_kublog_posts_on_category_id"
add_index "kublog_posts", ["slug"], :name => "index_kublog_posts_on_slug", :unique => true
add_index "kublog_posts", ["title"], :name => "index_kublog_posts_on_title"
add_index "kublog_posts", ["user_id"], :name => "index_kublog_posts_on_user_id"
create_table "users", :force => true do |t|
t.string "name"
t.string "email"
t.string "password_digest"
t.boolean "admin", :default => false
t.string "kind", :default => "semi-cool"
t.datetime "created_at"
t.datetime "updated_at"
end
end
| {
"content_hash": "182eb4700e035d05d6eb7eeec2823eb6",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 102,
"avg_line_length": 32.258426966292134,
"alnum_prop": 0.6161616161616161,
"repo_name": "gajon/kublog-old",
"id": "078bebedd25a33ab32a4bd9205577e35f634ca6d",
"size": "3606",
"binary": false,
"copies": "1",
"ref": "refs/heads/gajon_changes",
"path": "spec/dummy/db/schema.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "12069"
},
{
"name": "JavaScript",
"bytes": "90625"
},
{
"name": "Ruby",
"bytes": "70952"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "feb73c639eecdbcff0a491b237d382df",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "de94ddd62ca022e909d3ac2b5d85d460a7260236",
"size": "184",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Bacteria/Spirochaetes/Spirochaetes/Spirochaetales/Spirochaetaceae/Borrelia/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
template<class background_model = zero_order_background, typename DT = ereal, typename RDT = ereal >
class local_segmentation {
public:
typedef DT ftype;
struct result {
RDT score;
int a;
int b;
result() : score(0.0), a(-1), b(-1) {}
result( DT sc, int na, int nb ) : score(sc), a(na), b(nb) {}
};
protected:
typedef unsigned int uint;
// dynamic programming cell, one variable for each state
struct dpcell{
DT M;
DT Ia;
DT Ib;
};
typedef blitz::Array<dpcell,2> dparray;
// we store several precomputed values at each location
struct precomputed_values {
DT T3;
DT T4;
DT IpJx2;
DT IpJm1;
};
blitz::Array<precomputed_values,2> pv;
static int const MAX_EXT = 400;
// horizontal frontier
dparray dpr;
void init_storage();
// The main DP.
result maindp( dna_sequence_data &a, dna_sequence_data &b, int i, int j, bool forward, int ext );
result maindp_filldp( dna_sequence_data &a, dna_sequence_data &b, int i, int j, bool forward, int ext );
// probability score matrix for DNA sequences in log_sqrt(2) scale
blitz::Array<DT,2> p;
// background probabilities
blitz::TinyVector<DT,4> q;
// probabilities for gap open and gap extend also in log_sqrt(2) scale
DT p_a, p_1m2a, p_b, p_1mb, pi_m, pi_i;
double pr_a, pr_b;
// where we terminate extensions on masked sequences
bool stop_on_masked;
// initialize the scoring model with BLASTN defaults
void init_pr();
// compute the stationary distribution
void compute_sd();
// initialize a dp matrix location
void init_location( dparray &dp, int i, int j );
public:
// default constructor
local_segmentation();
// copy constructor
local_segmentation( local_segmentation const &other );
// extend forwards
result extend_forward( dna_sequence &seqa, dna_sequence &seqb, int i, int j, int ext = 200 );
// extend backwards
result extend_backward( dna_sequence &seqa, dna_sequence &seqb, int i, int j, int ext = 200 );
// set all the parameters
void set_parameters( nw_model_parameters const &mp );
// set gap open
void set_popen( double new_popen );
// set gap extend
void set_mean_gap_length( double d );
// set mutation matrix
void set_p( blitz::Array<double,2> const &newp );
// set background
void set_q( blitz::TinyVector<double,4> const &newq );
// set stop on masked flag
void set_stop_on_masked( bool );
};
template<class background_model,typename DT, typename RDT>
inline void local_segmentation<background_model,DT,RDT>::set_stop_on_masked( bool m ) {
stop_on_masked = m;
}
template<class background_model,typename DT, typename RDT>
inline void local_segmentation<background_model,DT,RDT>::set_parameters( nw_model_parameters const &mp ) {
set_q( mp.q );
set_p( mp.p );
set_popen( mp.pr_open );
set_mean_gap_length( mp.mean_gap_length );
}
template<class background_model, typename DT, typename RDT>
inline void local_segmentation<background_model,DT,RDT>::init_location( dparray &dp, int i, int j ) {
dp(i,j).M = dp(i,j).Ia = dp(i,j).Ib = 0.0;
}
// initialize storage
template<class background_model, typename DT, typename RDT>
void local_segmentation<background_model,DT,RDT>::init_storage() {
p.resize(dna_alpha::SIZE,dna_alpha::SIZE);
// precompute some values
pv.resize(MAX_EXT+1,MAX_EXT+1);
dpr.resize(MAX_EXT+1,2);
for( int i = 1; i <= MAX_EXT; ++i ) {
for( int j = 1; j <= MAX_EXT; ++j ) {
pv(i,j).T3 = (double)(i*i + j*j + 2*(i*j - i - j) + 1);
pv(i,j).T4 = (double)(4*(i*i + j*j) + 8*(i*j - i - j));
pv(i,j).IpJx2 = (double)(2*(i+j));
pv(i,j).IpJm1 = (double)(i+j-1);
}
}
}
// We assume the BLASTN default scoring scheme with Juke's/Cantor background. All logs are in base sqrt(2).
// Defaults Adjusted to remove/include the odds portion.
// Match: 1 PrMatch: log(4^{1}/16) = -4 remove odds
// Mismatch: -3 PrMismatch: log(4^{-3}/16) = -20 remove odds
// Gap open: -5 Pr gap open: log(4^{-5}) = -20 odds cancel, no need to remove
// Gap extend: -2 Pr gap extend: log(4)^{-2}) = -8 odds cancel, no need to remove
// Pr A,T,G,C: 1/4 Pr A,T,G,C: log(1/4) = -4 add up odds separately
template<class background_model, typename DT, typename RDT>
void local_segmentation<background_model, DT, RDT>::init_pr() {
DT ma = 0.25; // match
DT mm = std::pow( std::sqrt(2.0), -20.0 );
p = ma, mm, mm, mm,
mm, ma, mm, mm,
mm, mm, ma, mm,
mm, mm, mm, ma;
// background probabilities
q = ma, ma, ma, ma;
// precompute transition probabilities
set_popen( 0.001043033 );
set_mean_gap_length(1.07);
}
// set mean gap length to n
template<class background_model, typename DT, typename RDT>
void local_segmentation<background_model,DT, RDT>::set_mean_gap_length( double n ) {
// Since a gap is length 1 by the virtue of opening it, we adjust n down by 1.
// The remaining gap extension probability corresponds to the mean of a
// geometric distribution allowing zero extensions.
assert( n >= 1 );
pr_b = 1.0-1.0/n;
p_b = pr_b;
p_1mb = 1.0 - pr_b;
compute_sd();
}
// convert to log base sqrt(2)
template<class background_model,typename DT, typename RDT>
void local_segmentation<background_model,DT,RDT>::set_popen( double new_open ) {
using namespace std;
assert( new_open <= 1.0 && new_open >= 0 );
pr_a = new_open;
p_a = pr_a;
p_1m2a = 1.0-2.0*pr_a;
compute_sd();
}
template<class background_model,typename DT, typename RDT>
void local_segmentation<background_model,DT,RDT>::compute_sd() {
double base = 1.0 - pr_b + 2.0*pr_a;
pi_m = (1.0 - pr_b)/base;
pi_i = pr_a/base;
assert( (double)pi_m >= 0 && (double)pi_m <= 1.0 );
assert( (double)pi_i >= 0 && (double)pi_i <= 1.0 );
}
// convert each value to log base sqrt(2)
template<class background_model,typename DT, typename RDT>
void local_segmentation<background_model,DT,RDT>::set_q( blitz::TinyVector<double,4> const &newq ) {
using namespace std;
for( int i = 0; i < 4; i++ ) {
q(i) = newq(i);
}
}
// convert each value to log base sqrt(2)
template<class background_model,typename DT, typename RDT>
void local_segmentation<background_model,DT,RDT>::set_p( blitz::Array<double,2> const &newp ) {
using namespace std;
assert( newp.rows() == 4 );
assert( newp.cols() == 4 );
for( int i = 0; i < 4; i++ ) for( int j = 0; j < 4; j++ ) p(i,j) = newp(i,j);
}
template<class background_model,typename DT, typename RDT>
typename local_segmentation<background_model,DT,RDT>::result local_segmentation<background_model,DT,RDT>::maindp_filldp( dna_sequence_data &a, dna_sequence_data &b, int si, int sj, bool forward, int ext ) {
using namespace std;
int n = (int) a.size(), m = (int)b.size();
assert( n > 0 );
assert( m > 0 );
assert( ext > 0 );
assert( ext < MAX_EXT );
int ei = forward ? std::min(si+ext-1,n-1) : std::max(si-ext+1,0);
int ej = forward ? std::min(sj+ext-1,m-1) : std::max(sj-ext+1,0);
// indicates which row is the front
int fr = 1, ba = 0;
// precompute odds
closed_interval max_interval_a = forward ? closed_interval(si,ei) : closed_interval(ei,si);
closed_interval max_interval_b = forward ? closed_interval(sj,ej) : closed_interval(ej,sj);
background_model oddsA = background_model( q, a, max_interval_a );
background_model oddsB = background_model( q, b, max_interval_b );
// full background model
int last_i = max_interval_a.size() - 1, last_j = max_interval_b.size() - 1;
DT odds_full = oddsA.pr(closed_interval(0,last_i))*oddsB.pr(closed_interval(0,last_j));
// declare some constants and variables ahead so we don't keep reallocating them during the loop
DT odds_a, odds_b;
int ai = si, bi = sj;
// initialize top row
for( int j = 0; j <= ext; ++j ) init_location(dpr,j,ba);
// we may only start in 1,1 match position
init_location(dpr,1,fr);
dpr(1,fr).M = p((int)a[si],(int)b[sj]);
// store best score and location in matrix
DT sc, best_s = 0.0;
int best_i = 0, best_j = 0;
// here we skip 1,1 since it is set explicitly
int ext_i = abs(ei-si)+1, ext_j = abs(ej-sj)+1;
for( int i = 1, j = 2; i <= ext_i; ++i ) {
// initialize leftmost column to zero
init_location(dpr,0,fr);
for( ; j <= ext_j; ++j ) {
// Compute odds for remainder of sequence (the random part).
if( forward ) {
ai = si+i-1; bi = sj+j-1;
odds_a = ( i == ei ) ? DT(1.0) : oddsA.pr(closed_interval(i,last_i));
odds_b = ( j == ej ) ? DT(1.0) : oddsB.pr(closed_interval(j,last_j));
} else {
ai = si-i+1; bi = sj-j+1;
odds_a = ( ai - 1 < ei ) ? DT(1.0) : oddsA.pr(closed_interval(0,last_i - i));
odds_b = ( bi - 1 < ej ) ? DT(1.0) : oddsB.pr(closed_interval(0,last_j - j));
}
#ifdef VITERBI_EXTENSIONS
dpr(j,fr).M = max(p_1m2a*dpr(j-1,ba).M, p_1mb*max(dpr(j-1,ba).Ia, dpr(j-1,ba).Ib))
* p((int)a[ai],(int)b[bi]);
dpr(j,fr).Ia = max(p_a*dpr(j,ba).M, p_b*dpr(j,ba).Ia)*q((int)a[ai]);
dpr(j,fr).Ib = max(p_a*dpr(j-1,fr).M,p_b*dpr(j-1,fr).Ib)*q((int)b[bi]);
sc = (dpr(j,fr).Ia + dpr(j,fr).Ib + dpr(j,fr).M)*odds_a*odds_b/odds_full;
#else
dpr(j,fr).M = (p_1m2a*dpr(j-1,ba).M + p_1mb*(dpr(j-1,ba).Ia + dpr(j-1,ba).Ib))* p((int)a[ai],(int)b[bi]);
dpr(j,fr).Ia = (p_a*dpr(j,ba).M + p_b*dpr(j,ba).Ia)*q((int)a[ai]);
dpr(j,fr).Ib = (p_a*dpr(j-1,fr).M + p_b*dpr(j-1,fr).Ib)*q((int)b[bi]);
sc = (dpr(j,fr).Ia + dpr(j,fr).Ib + dpr(j,fr).M)*odds_a*odds_b/odds_full;
#endif
// store overall best
if( sc > best_s ) {
best_s = sc;
best_i = i;
best_j = j;
}
//cerr << i << "\t" << j << "\t" << best_s << "\t" << odds_full << endl;
// stop extension if we encounter repeat
if( a[ai].masked() && stop_on_masked ) ext_i = i;
if( b[bi].masked() && stop_on_masked ) ext_j = j;
} // for j
j = 1; // reset j
// swap rows
fr = 1 - fr; ba = 1 - ba;
} // for i
// otherwise backwards
result my_result(best_s,best_i,best_j);
return my_result;
}
template<class background_model,typename DT, typename RDT>
typename local_segmentation<background_model,DT,RDT>::result local_segmentation<background_model,DT,RDT>::maindp( dna_sequence_data &a, dna_sequence_data &b, int i, int j, bool forward, int ext ) {
return maindp_filldp( a, b, i, j, forward, ext );
}
// init pr_a and pr_b so our calcuations work out
template<class background_model,typename DT, typename RDT>
local_segmentation<background_model,DT,RDT>::local_segmentation() : pr_a(0.06), pr_b(0.05), stop_on_masked(false) {
init_storage();
init_pr();
}
// init pr_a and pr_b so our calcuations work out
template<class background_model,typename DT, typename RDT>
local_segmentation<background_model,DT,RDT>::local_segmentation( local_segmentation<background_model,DT,RDT> const &o ) : pr_a(o.pr_a), pr_b(o.pr_b), stop_on_masked(false) {
init_storage();
p = o.p;
q = o.q;
p_a = o.p_a;
p_1m2a = o.p_1m2a;
p_b = o.p_b;
p_1mb = o.p_1mb;
pi_m = o.pi_m;
pi_i = o.pi_i;
}
template<class background_model,typename DT, typename RDT>
typename local_segmentation<background_model,DT,RDT>::result local_segmentation<background_model,DT,RDT>::extend_forward( dna_sequence &seqa, dna_sequence &seqb, int i, int j, int ext ) {
return maindp( seqa.data, seqb.data, i, j, true, ext );
}
template<class background_model,typename DT, typename RDT>
typename local_segmentation<background_model,DT,RDT>::result local_segmentation<background_model,DT,RDT>::extend_backward( dna_sequence &seqa, dna_sequence &seqb, int i, int j, int ext ) {
return maindp( seqa.data, seqb.data, i, j, false, ext );
}
#endif
| {
"content_hash": "42a5dcc34d1ad6b5969191fa45184aa2",
"timestamp": "",
"source": "github",
"line_count": 346,
"max_line_length": 206,
"avg_line_length": 33.5,
"alnum_prop": 0.6371322577862134,
"repo_name": "akhudek/feast",
"id": "5e92df359cf844b57478b59bb3221a89bd9a2cd4",
"size": "11969",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/libs/alignment/local_segmentation.h",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "54708"
},
{
"name": "C++",
"bytes": "544803"
},
{
"name": "Perl",
"bytes": "2560"
}
],
"symlink_target": ""
} |
layout: home
title: "Claudia Castro"
tags: [Jekyll, theme, responsive, blog, template]
image:
feature: typewriter.jpg
---
| {
"content_hash": "966f4eac32ab09288a25498a82c92e1a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 49,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.7258064516129032,
"repo_name": "ckcastro/ckcastro.github.io",
"id": "e8675a63de3377bb75ab28389bcc1e7ed68ad338",
"size": "128",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.md",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "64936384"
},
{
"name": "JavaScript",
"bytes": "1034548"
},
{
"name": "Ruby",
"bytes": "6229"
},
{
"name": "SCSS",
"bytes": "58859"
}
],
"symlink_target": ""
} |
/**
* @file file.c
* @brief file and directory control utility
* @author Y.Mitsui
*/
#include "libstandard.h"
void arrPrint(int *arr,int num){
int i;
printf("[ ");
for(i=0;i<num;i++) printf("%d ",arr[i]);
printf(" ]");
}
static GSList* __subGetFileList(apr_pool_t *pool,GSList* r,const char *path){
DIR *dir;
struct dirent *dp;
char buf[1024];
if((dir=opendir(path))==NULL) return NULL;
while((dp=readdir(dir))){
if(*dp->d_name=='.') continue;
switch(dp->d_type){
case DT_DIR:
r=__subGetFileList(pool,r,apr_pstrcat(pool,path,"/",dp->d_name,NULL));
break;
case DT_REG:
snprintf(buf,sizeof(buf),"%s/%s",path,dp->d_name);
r=g_slist_append(r,strdup(buf));
break;
}
}
closedir(dir);
return r;
}
/******************************************************************************/
/*! @brief Get list of file name in directry designated
@param[in] dir directory name searched
@return Success:file name list of char pointer
Fail:NULL
******************************************************************************/
GSList* getFileList(const char *dir){
apr_pool_t *pool=NULL;
apr_initialize();
apr_pool_create(&pool,NULL);
GSList* r=__subGetFileList(pool,NULL,dir);
apr_pool_destroy(pool);
return r;
}
| {
"content_hash": "051755d73ef43286f74050179124f7ff",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 25.24,
"alnum_prop": 0.5618066561014263,
"repo_name": "y-mitsui/libstandard",
"id": "e9cd320c7df26d79475c636bc5064c34594535c7",
"size": "1262",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "file.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "29181"
}
],
"symlink_target": ""
} |
package remote
import (
"net/http"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/logs"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
)
// Option is a functional option for remote operations.
type Option func(*options) error
type options struct {
auth authn.Authenticator
keychain authn.Keychain
transport http.RoundTripper
platform v1.Platform
}
func makeOptions(target authn.Resource, opts ...Option) (*options, error) {
o := &options{
auth: authn.Anonymous,
transport: http.DefaultTransport,
platform: defaultPlatform,
}
for _, option := range opts {
if err := option(o); err != nil {
return nil, err
}
}
if o.keychain != nil {
auth, err := o.keychain.Resolve(target)
if err != nil {
return nil, err
}
if auth == authn.Anonymous {
logs.Warn.Println("No matching credentials were found, falling back on anonymous")
}
o.auth = auth
}
// Wrap the transport in something that logs requests and responses.
// It's expensive to generate the dumps, so skip it if we're writing
// to nothing.
if logs.Enabled(logs.Debug) {
o.transport = transport.NewLogger(o.transport)
}
// Wrap the transport in something that can retry network flakes.
o.transport = transport.NewRetry(o.transport)
return o, nil
}
// WithTransport is a functional option for overriding the default transport
// for remote operations.
//
// The default transport its http.DefaultTransport.
func WithTransport(t http.RoundTripper) Option {
return func(o *options) error {
o.transport = t
return nil
}
}
// WithAuth is a functional option for overriding the default authenticator
// for remote operations.
//
// The default authenticator is authn.Anonymous.
func WithAuth(auth authn.Authenticator) Option {
return func(o *options) error {
o.auth = auth
return nil
}
}
// WithAuthFromKeychain is a functional option for overriding the default
// authenticator for remote operations, using an authn.Keychain to find
// credentials.
//
// The default authenticator is authn.Anonymous.
func WithAuthFromKeychain(keys authn.Keychain) Option {
return func(o *options) error {
o.keychain = keys
return nil
}
}
// WithPlatform is a functional option for overriding the default platform
// that Image and Descriptor.Image use for resolving an index to an image.
//
// The default platform is amd64/linux.
func WithPlatform(p v1.Platform) Option {
return func(o *options) error {
o.platform = p
return nil
}
}
| {
"content_hash": "dfab41028483f23ebfe36504bdd02b4f",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 85,
"avg_line_length": 25.352941176470587,
"alnum_prop": 0.7304717710750194,
"repo_name": "google-octo/cloud-builders",
"id": "1de65ee79e4539cd8296194a0425fc2c54da0c9a",
"size": "3194",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "gke-deploy/vendor/github.com/google/go-containerregistry/pkg/v1/remote/options.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "5441"
},
{
"name": "Dockerfile",
"bytes": "9628"
},
{
"name": "Go",
"bytes": "335360"
},
{
"name": "HTML",
"bytes": "1433"
},
{
"name": "Java",
"bytes": "3898"
},
{
"name": "JavaScript",
"bytes": "1348"
},
{
"name": "NASL",
"bytes": "3665"
},
{
"name": "Python",
"bytes": "799"
},
{
"name": "Shell",
"bytes": "31247"
},
{
"name": "Slim",
"bytes": "1166"
},
{
"name": "Starlark",
"bytes": "2383"
}
],
"symlink_target": ""
} |
var resource = require('resource');
var config = require('../config');
//
// Use the web admin resource
//
resource.use('admin');
//
// Use the creature and account resources for demonstration purposes
//
resource.use('account', { datasource: "fs"});
resource.use('creature', { datasource: "fs"});
resource.admin.start({port:config.admin.port},function (err, server) {
var address = server.address();
resource.logger.info('admin server started on http://' + address.address + ":" + address.port + "/admin")
resource.logger.help('username and password are admin');
}); | {
"content_hash": "1b207e9045fae886e9f0757fbdf7dd21",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 107,
"avg_line_length": 30.31578947368421,
"alnum_prop": 0.6909722222222222,
"repo_name": "manjunathkg/generator-bizzns",
"id": "3f6f2aac25443f7358f871ee0ddde7fc346cd5c6",
"size": "597",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "templates/javascript/server/services/adminserver.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "698260"
},
{
"name": "CoffeeScript",
"bytes": "10558"
},
{
"name": "JavaScript",
"bytes": "1265127"
},
{
"name": "Shell",
"bytes": "1485"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven</artifactId>
<version>1.18.20.1-SNAPSHOT</version>
</parent>
<groupId>org.projectlombok.test</groupId>
<artifactId>test-maven-lombok</artifactId>
<packaging>jar</packaging>
<name>Sample Lombok Maven Project</name>
<description>This project is a simple demonstration of how to use the maven-lombok-plugin.</description>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>delombok</id>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
<configuration>
<formatPreferences>
<javaLangAsFQN>skip</javaLangAsFQN>
</formatPreferences>
<verbose>true</verbose>
</configuration>
</execution>
<execution>
<id>test-delombok</id>
<phase>generate-test-sources</phase>
<goals>
<goal>testDelombok</goal>
</goals>
<configuration>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>
| {
"content_hash": "2f00affcc02b5ee843961c1efcb031e2",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 204,
"avg_line_length": 29.86813186813187,
"alnum_prop": 0.5971302428256071,
"repo_name": "awhitford/lombok.maven",
"id": "4c51a06d0409c8bcf895d0f60667af6e82df2cb8",
"size": "2718",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test-maven-lombok/pom.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "19719"
}
],
"symlink_target": ""
} |
#include "qargumentreference_p.h"
QT_BEGIN_NAMESPACE
using namespace QPatternist;
ArgumentReference::ArgumentReference(const SequenceType::Ptr &sourceType,
const VariableSlotID slotP) : VariableReference(slotP),
m_type(sourceType)
{
Q_ASSERT(m_type);
}
bool ArgumentReference::evaluateEBV(const DynamicContext::Ptr &context) const
{
return context->expressionVariable(slot())->evaluateEBV(context);
}
Item ArgumentReference::evaluateSingleton(const DynamicContext::Ptr &context) const
{
return context->expressionVariable(slot())->evaluateSingleton(context);
}
Item::Iterator::Ptr ArgumentReference::evaluateSequence(const DynamicContext::Ptr &context) const
{
return context->expressionVariable(slot())->evaluateSequence(context);
}
SequenceType::Ptr ArgumentReference::staticType() const
{
return m_type;
}
ExpressionVisitorResult::Ptr ArgumentReference::accept(const ExpressionVisitor::Ptr &visitor) const
{
return visitor->visit(this);
}
Expression::ID ArgumentReference::id() const
{
return IDArgumentReference;
}
QT_END_NAMESPACE
| {
"content_hash": "1c554dda2fe01f46139781d8514a72b7",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 99,
"avg_line_length": 25.127659574468087,
"alnum_prop": 0.707874682472481,
"repo_name": "stephaneAG/PengPod700",
"id": "0f23e08d9453174baf9b959ed00f0df660fd3390",
"size": "3155",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "QtEsrc/qt-everywhere-opensource-src-4.8.5/src/xmlpatterns/expr/qargumentreference.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "167426"
},
{
"name": "Batchfile",
"bytes": "25368"
},
{
"name": "C",
"bytes": "3755463"
},
{
"name": "C#",
"bytes": "9282"
},
{
"name": "C++",
"bytes": "177871700"
},
{
"name": "CSS",
"bytes": "600936"
},
{
"name": "GAP",
"bytes": "758872"
},
{
"name": "GLSL",
"bytes": "32226"
},
{
"name": "Groff",
"bytes": "106542"
},
{
"name": "HTML",
"bytes": "273585110"
},
{
"name": "IDL",
"bytes": "1194"
},
{
"name": "JavaScript",
"bytes": "435912"
},
{
"name": "Makefile",
"bytes": "289373"
},
{
"name": "Objective-C",
"bytes": "1898658"
},
{
"name": "Objective-C++",
"bytes": "3222428"
},
{
"name": "PHP",
"bytes": "6074"
},
{
"name": "Perl",
"bytes": "291672"
},
{
"name": "Prolog",
"bytes": "102468"
},
{
"name": "Python",
"bytes": "22546"
},
{
"name": "QML",
"bytes": "3580408"
},
{
"name": "QMake",
"bytes": "2191574"
},
{
"name": "Scilab",
"bytes": "2390"
},
{
"name": "Shell",
"bytes": "116533"
},
{
"name": "TypeScript",
"bytes": "42452"
},
{
"name": "Visual Basic",
"bytes": "8370"
},
{
"name": "XQuery",
"bytes": "25094"
},
{
"name": "XSLT",
"bytes": "252382"
}
],
"symlink_target": ""
} |
package io.milton.http.http11.auth;
import io.milton.http.http11.auth.DigestGenerator;
import io.milton.http.Request.Method;
import junit.framework.TestCase;
/**
*
* @author brad
*/
public class DigestGeneratorTest extends TestCase {
DigestGenerator generator;
String password = "Circle Of Life";
String user = "Mufasa";
String realm = "testrealm@host.com";
String uri = "/dir/index.html";
@Override
protected void setUp() throws Exception {
generator = new DigestGenerator();
}
/**
* this test matches the example in wikipedia -
* http://en.wikipedia.org/wiki/Digest_access_authentication
*/
public void testGenerateDigest() {
DigestResponse dr = new DigestResponse(Method.GET, user, realm, "dcd98b7102dd2f0e8b11d0f600bfb0c093", uri, "", "auth", "00000001", "0a4f113b");
String resp = generator.generateDigest(dr, password);
System.out.println("server resp: " + resp);
System.out.println("expected: " + "6629fae49393a05397450978507c4ef1");
assertEquals("6629fae49393a05397450978507c4ef1", resp);
}
/**
* this matches the data in milton-test secure folder
*/
public void testGenerateDigest2() {
System.out.println("testGenerateDigest2");
DigestResponse dr = new DigestResponse(Method.PROPFIND, user, realm, "ZWY5NTdmZDgtZjg1OC00NzhhLTg4MjctMzBlNzRmMGNjNTE4", "/webdav/secure/", "", "auth", "00000001", "7cfd3b057b80f1d9e2ff691f926c31f5");
String resp = generator.generateDigest(dr, password);
System.out.println("server resp: " + resp);
System.out.println("expected: " + "2bd4ead0c52ff8191c2a0464a6e80fbb");
assertEquals("2bd4ead0c52ff8191c2a0464a6e80fbb", resp);
String a1md5 = generator.encodePasswordInA1Format(user, realm, password);
String resp2 = generator.generateDigestWithEncryptedPassword(dr, a1md5);
assertEquals(resp, resp2);
System.out.println("----");
}
public void testGenerateDigestWithEncryptedPassword() {
}
public void testEncodePasswordInA1Format() {
String enc = generator.encodePasswordInA1Format(user, realm, password);
System.out.println("enc: " + enc);
assertEquals("939e7578ed9e3c518a452acee763bce9", enc);
}
public void testencodeMethodAndUri() {
String actual = generator.encodeMethodAndUri("GET", "/dir/index.html");
assertEquals("39aff3a2bab6126f332b942af96d3366", actual);
}
public void testMD5() {
String actual = generator.md5("939e7578ed9e3c518a452acee763bce9", "dcd98b7102dd2f0e8b11d0f600bfb0c093", "00000001", "0a4f113b", "auth", "39aff3a2bab6126f332b942af96d3366");
assertEquals("6629fae49393a05397450978507c4ef1", actual);
}
}
| {
"content_hash": "23547ddaafb2322a0a186319dc5eff17",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 202,
"avg_line_length": 35.648648648648646,
"alnum_prop": 0.7308567096285065,
"repo_name": "olw/cdn",
"id": "e68928256d4d1d3824ddbe4554f5cc256e6789dc",
"size": "3460",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "milton-server-ce/src/test/java/io/milton/http/http11/auth/DigestGeneratorTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "14488"
},
{
"name": "Groovy",
"bytes": "21546"
},
{
"name": "Java",
"bytes": "4775093"
},
{
"name": "JavaScript",
"bytes": "50743"
},
{
"name": "Standard ML",
"bytes": "384"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="mdl_js_loader_test.dart" type="application/dart"></script>
<script src="packages/browser/dart.js"></script>
</head>
<body>
</body>
</html> | {
"content_hash": "d30b3d064b3be003a6b1a3b8584439fe",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 75,
"avg_line_length": 21,
"alnum_prop": 0.6349206349206349,
"repo_name": "alextekartik/mdl_js.dart",
"id": "bce0102215877e5c28f83480c97b622f6e52dc61",
"size": "252",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/mdl_js_loader_test_.html",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "382657"
},
{
"name": "Dart",
"bytes": "25572"
},
{
"name": "HTML",
"bytes": "109913"
},
{
"name": "JavaScript",
"bytes": "144871"
},
{
"name": "Shell",
"bytes": "161"
}
],
"symlink_target": ""
} |
static void setup(void) {
#ifdef USE_RPMALLOC
rpmalloc_initialize();
#endif
}
static void teardown(void) {
#ifdef USE_RPMALLOC
rpmalloc_finalize();
#endif
}
TestSuite(WSS_load_subprotocols, .init = setup, .fini = teardown);
Test(WSS_load_subprotocols, no_config) {
WSS_load_subprotocols(NULL);
cr_assert(NULL == WSS_find_subprotocol(NULL));
WSS_destroy_subprotocols();
}
Test(WSS_load_subprotocols, no_file) {
size_t length = 1;
wss_config_t *conf = (wss_config_t *) WSS_malloc(sizeof(wss_config_t));
conf->subprotocols_length = 1;
conf->subprotocols = WSS_calloc(length, sizeof(char *));
conf->subprotocols[0] = WSS_malloc(sizeof(char)*(strlen(WSS_SUBPROTOCOL_NO_FILE)+1));
sprintf(conf->subprotocols[0], "%s", WSS_SUBPROTOCOL_NO_FILE);
conf->subprotocols_config = WSS_calloc(length, sizeof(char *));
conf->subprotocols_config[0] = NULL;
WSS_load_subprotocols(conf);
cr_assert(NULL == WSS_find_subprotocol("test-sub-no-file"));
WSS_destroy_subprotocols();
WSS_free((void**) &conf->subprotocols[0]);
WSS_config_free(conf);
WSS_free((void**) &conf);
}
Test(WSS_load_subprotocols, no_set_allocators) {
size_t length = 1;
wss_config_t *conf = (wss_config_t *) WSS_malloc(sizeof(wss_config_t));
conf->subprotocols_length = 1;
conf->subprotocols = WSS_calloc(length, sizeof(char *));
conf->subprotocols[0] = WSS_malloc(sizeof(char)*(strlen(WSS_SUBPROTOCOL_NO_SET_ALLOCATORS)+1));
sprintf(conf->subprotocols[0], "%s", WSS_SUBPROTOCOL_NO_SET_ALLOCATORS);
conf->subprotocols_config = WSS_calloc(length, sizeof(char *));
conf->subprotocols_config[0] = NULL;
WSS_load_subprotocols(conf);
cr_assert(NULL == WSS_find_subprotocol("test-sub-no-set-allocators"));
WSS_destroy_subprotocols();
WSS_free((void**) &conf->subprotocols[0]);
WSS_config_free(conf);
WSS_free((void**) &conf);
}
Test(WSS_load_subprotocols, no_init) {
size_t length = 1;
wss_config_t *conf = (wss_config_t *) WSS_malloc(sizeof(wss_config_t));
conf->subprotocols_length = 1;
conf->subprotocols = WSS_calloc(length, sizeof(char *));
conf->subprotocols[0] = WSS_malloc(sizeof(char)*(strlen(WSS_SUBPROTOCOL_NO_INIT)+1));
sprintf(conf->subprotocols[0], "%s", WSS_SUBPROTOCOL_NO_INIT);
conf->subprotocols_config = WSS_calloc(length, sizeof(char *));
conf->subprotocols_config[0] = NULL;
WSS_load_subprotocols(conf);
cr_assert(NULL == WSS_find_subprotocol("test-sub-no-init"));
WSS_destroy_subprotocols();
WSS_free((void**) &conf->subprotocols[0]);
WSS_config_free(conf);
WSS_free((void**) &conf);
}
Test(WSS_load_subprotocols, no_connect) {
size_t length = 1;
wss_config_t *conf = (wss_config_t *) WSS_malloc(sizeof(wss_config_t));
conf->subprotocols_length = 1;
conf->subprotocols = WSS_calloc(length, sizeof(char *));
conf->subprotocols[0] = WSS_malloc(sizeof(char)*(strlen(WSS_SUBPROTOCOL_NO_CONNECT)+1));
sprintf(conf->subprotocols[0], "%s", WSS_SUBPROTOCOL_NO_CONNECT);
conf->subprotocols_config = WSS_calloc(length, sizeof(char *));
conf->subprotocols_config[0] = NULL;
WSS_load_subprotocols(conf);
cr_assert(NULL == WSS_find_subprotocol("test-sub-no-connect"));
WSS_destroy_subprotocols();
WSS_free((void**) &conf->subprotocols[0]);
WSS_config_free(conf);
WSS_free((void**) &conf);
}
Test(WSS_load_subprotocols, no_message) {
size_t length = 1;
wss_config_t *conf = (wss_config_t *) WSS_malloc(sizeof(wss_config_t));
conf->subprotocols_length = 1;
conf->subprotocols = WSS_calloc(length, sizeof(char *));
conf->subprotocols[0] = WSS_malloc(sizeof(char)*(strlen(WSS_SUBPROTOCOL_NO_MESSAGE)+1));
sprintf(conf->subprotocols[0], "%s", WSS_SUBPROTOCOL_NO_MESSAGE);
conf->subprotocols_config = WSS_calloc(length, sizeof(char *));
conf->subprotocols_config[0] = NULL;
WSS_load_subprotocols(conf);
cr_assert(NULL == WSS_find_subprotocol("test-sub-no-message"));
WSS_destroy_subprotocols();
WSS_free((void**) &conf->subprotocols[0]);
WSS_config_free(conf);
WSS_free((void**) &conf);
}
Test(WSS_load_subprotocols, no_write) {
size_t length = 1;
wss_config_t *conf = (wss_config_t *) WSS_malloc(sizeof(wss_config_t));
conf->subprotocols_length = 1;
conf->subprotocols = WSS_calloc(length, sizeof(char *));
conf->subprotocols[0] = WSS_malloc(sizeof(char)*(strlen(WSS_SUBPROTOCOL_NO_WRITE)+1));
sprintf(conf->subprotocols[0], "%s", WSS_SUBPROTOCOL_NO_WRITE);
conf->subprotocols_config = WSS_calloc(length, sizeof(char *));
conf->subprotocols_config[0] = NULL;
WSS_load_subprotocols(conf);
cr_assert(NULL == WSS_find_subprotocol("test-sub-no-write"));
WSS_destroy_subprotocols();
WSS_free((void**) &conf->subprotocols[0]);
WSS_config_free(conf);
WSS_free((void**) &conf);
}
Test(WSS_load_subprotocols, no_close) {
size_t length = 1;
wss_config_t *conf = (wss_config_t *) WSS_malloc(sizeof(wss_config_t));
conf->subprotocols_length = 1;
conf->subprotocols = WSS_calloc(length, sizeof(char *));
conf->subprotocols[0] = WSS_malloc(sizeof(char)*(strlen(WSS_SUBPROTOCOL_NO_CLOSE)+1));
sprintf(conf->subprotocols[0], "%s", WSS_SUBPROTOCOL_NO_CLOSE);
conf->subprotocols_config = WSS_calloc(length, sizeof(char *));
conf->subprotocols_config[0] = NULL;
WSS_load_subprotocols(conf);
cr_assert(NULL == WSS_find_subprotocol("test-sub-no-close"));
WSS_destroy_subprotocols();
WSS_free((void**) &conf->subprotocols[0]);
WSS_config_free(conf);
WSS_free((void**) &conf);
}
Test(WSS_load_subprotocols, no_destroy) {
size_t length = 1;
wss_config_t *conf = (wss_config_t *) WSS_malloc(sizeof(wss_config_t));
conf->subprotocols_length = 1;
conf->subprotocols = WSS_calloc(length, sizeof(char *));
conf->subprotocols[0] = WSS_malloc(sizeof(char)*(strlen(WSS_SUBPROTOCOL_NO_DESTROY)+1));
sprintf(conf->subprotocols[0], "%s", WSS_SUBPROTOCOL_NO_DESTROY);
conf->subprotocols_config = WSS_calloc(length, sizeof(char *));
conf->subprotocols_config[0] = NULL;
WSS_load_subprotocols(conf);
cr_assert(NULL == WSS_find_subprotocol("test-sub-no-destroy"));
WSS_destroy_subprotocols();
WSS_free((void**) &conf->subprotocols[0]);
WSS_config_free(conf);
WSS_free((void**) &conf);
}
Test(WSS_load_subprotocols, successful) {
wss_config_t *conf = (wss_config_t *) WSS_malloc(sizeof(wss_config_t));
cr_assert(WSS_SUCCESS == WSS_config_load(conf, "resources/test_wss.json"));
WSS_load_subprotocols(conf);
cr_assert(NULL != WSS_find_subprotocol("echo"));
cr_assert(NULL != WSS_find_subprotocol("broadcast"));
WSS_destroy_subprotocols();
WSS_config_free(conf);
WSS_free((void**) &conf);
}
| {
"content_hash": "880dc1a3ddbdb7daf51a470a1d39ee35",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 99,
"avg_line_length": 32.33018867924528,
"alnum_prop": 0.6587394222351911,
"repo_name": "mortzdk/Websocket",
"id": "432ad2cd9f931150586d63824af0bfb411ede0e7",
"size": "7568",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/test_subprotocols.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "823923"
},
{
"name": "C++",
"bytes": "18741"
},
{
"name": "Makefile",
"bytes": "17512"
},
{
"name": "Shell",
"bytes": "4141"
}
],
"symlink_target": ""
} |
package my.com.codeplay.android_demo.storages;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.ListView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.CursorLoader;
import androidx.loader.content.Loader;
import my.com.codeplay.android_demo.R;
public class LoaderManagerDemoActivity extends AppCompatActivity
implements LoaderManager.LoaderCallbacks<Cursor> {
private static final int URL_LOADER_ID = 1;
private MyCursorAdapter myCursorAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listview);
myCursorAdapter = new MyCursorAdapter(this, null);
ListView listView = (ListView) findViewById(android.R.id.list);
listView.setAdapter(myCursorAdapter);
getSupportLoaderManager().initLoader(URL_LOADER_ID, null, this);
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case URL_LOADER_ID:
return new CursorLoader(
this, // activity context
DatabaseProvider.CONTENT_URI, // Table content URI to query
null, // Projection. null to return all.
null, // No selection clause
null, // No selection arguments
null // Default sort order
);
default:
return null;
}
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
switch(loader.getId()) {
case URL_LOADER_ID:
myCursorAdapter.swapCursor(data);
break;
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
myCursorAdapter.changeCursor(null);
}
}
| {
"content_hash": "df450767dbdc9cec798df0d9f6ce6e5e",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 90,
"avg_line_length": 33.04615384615385,
"alnum_prop": 0.5963687150837989,
"repo_name": "CodePlay-Studio/android-demo",
"id": "970feadbc1695839fd18a712f06239902148060c",
"size": "2805",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/my/com/codeplay/android_demo/storages/LoaderManagerDemoActivity.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "22176"
},
{
"name": "Java",
"bytes": "165508"
}
],
"symlink_target": ""
} |
package org.wso2.carbon.apimgt.rest.api.store.v1;
import org.wso2.carbon.apimgt.rest.api.store.v1.dto.AlertsInfoDTO;
import org.wso2.carbon.apimgt.rest.api.store.v1.dto.AlertsInfoResponseDTO;
import org.wso2.carbon.apimgt.rest.api.store.v1.dto.ErrorDTO;
import org.wso2.carbon.apimgt.rest.api.store.v1.AlertSubscriptionsApiService;
import org.wso2.carbon.apimgt.rest.api.store.v1.impl.AlertSubscriptionsApiServiceImpl;
import org.wso2.carbon.apimgt.api.APIManagementException;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.inject.Inject;
import io.swagger.annotations.*;
import java.io.InputStream;
import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import java.util.Map;
import java.util.List;
import javax.validation.constraints.*;
@Path("/alert-subscriptions")
@Api(description = "the alert-subscriptions API")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public class AlertSubscriptionsApi {
@Context MessageContext securityContext;
AlertSubscriptionsApiService delegate = new AlertSubscriptionsApiServiceImpl();
@GET
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Get the list of API Store alert types subscribed by the user. ", notes = "This operation is used to get the list of subscribed alert types by the user. ", response = AlertsInfoDTO.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:sub_alert_manage", description = "Retrieve, subscribe and configure store alert types")
})
}, tags={ "Alert Subscriptions", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. The list of subscribed alert types are returned. ", response = AlertsInfoDTO.class),
@ApiResponse(code = 500, message = "Internal Server Error An error occurred while retrieving subscribed alert types by user. ", response = ErrorDTO.class) })
public Response getSubscribedAlertTypes() throws APIManagementException{
return delegate.getSubscribedAlertTypes(securityContext);
}
@PUT
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Subscribe to the selected alert types by the user. ", notes = "This operation is used to get the list of subscribed alert types by the user. ", response = AlertsInfoResponseDTO.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:sub_alert_manage", description = "Retrieve, subscribe and configure store alert types")
})
}, tags={ "Alert Subscriptions", })
@ApiResponses(value = {
@ApiResponse(code = 201, message = "OK. Successful response with the newly subscribed alerts. ", response = AlertsInfoResponseDTO.class),
@ApiResponse(code = 400, message = "Bad Request. Invalid Request or request validation failure. ", response = Void.class),
@ApiResponse(code = 500, message = "Internal Server Error An internal server error occurred while subscribing to alerts. ", response = ErrorDTO.class) })
public Response subscribeToAlerts(@ApiParam(value = "The alerts list and the email list to subscribe." ,required=true) AlertsInfoDTO body) throws APIManagementException{
return delegate.subscribeToAlerts(body, securityContext);
}
@DELETE
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Unsubscribe user from all the alert types. ", notes = "This operation is used to unsubscribe the respective user from all the alert types. ", response = Void.class, authorizations = {
@Authorization(value = "OAuth2Security", scopes = {
@AuthorizationScope(scope = "apim:sub_alert_manage", description = "Retrieve, subscribe and configure store alert types")
})
}, tags={ "Alert Subscriptions" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. The user is unsubscribed from the alerts successfully. ", response = Void.class),
@ApiResponse(code = 500, message = "Internal Server Error ", response = ErrorDTO.class) })
public Response unsubscribeAllAlerts() throws APIManagementException{
return delegate.unsubscribeAllAlerts(securityContext);
}
}
| {
"content_hash": "9de5c45cb49a4653113a2b21c0ee7975",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 232,
"avg_line_length": 51.53409090909091,
"alnum_prop": 0.7256890848952591,
"repo_name": "nuwand/carbon-apimgt",
"id": "3c91b8ab0644cd20f17cf89a09ab6307e200ca7d",
"size": "4535",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/store/v1/AlertSubscriptionsApi.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "11203"
},
{
"name": "CSS",
"bytes": "1846223"
},
{
"name": "HTML",
"bytes": "1894358"
},
{
"name": "Java",
"bytes": "14364942"
},
{
"name": "JavaScript",
"bytes": "12096798"
},
{
"name": "PLSQL",
"bytes": "177203"
},
{
"name": "Shell",
"bytes": "33403"
},
{
"name": "TSQL",
"bytes": "505779"
}
],
"symlink_target": ""
} |
/*
pspw_molecule.h
author - Eric Bylaska
*/
#ifndef _PSPW_MOLECULE_H_
#define _PSPW_MOLECULE_H_
/********************************/
/* the molecule list data structure */
/********************************/
#include "pspw_atom.h"
/* use a linked list for Molecular List and Atom List */
typedef struct molecule_struct {
struct molecule_struct *next;
Atom_List_Type atom;
Bond_List_Type bond;
int cyclic;
} *Molecule_List_Type;
extern int pspw_molecule_add();
extern int pspw_molecule_size();
extern void pspw_molecule_add_atom(int m, int a);
extern void pspw_molecule_cyclic(int m, int cyclic);
extern void pspw_molecule_init();
/*
extern void pspw_molecule_read(char *filename);
extern void pspw_molecule_data(int *m,
int *asize,
int *alist,
int *cyclic);
extern void pspw_molecule_end();
*/
#endif
/* $Id$ */
| {
"content_hash": "a1dcbd7330bcfce2acf6da3ecbe5a71d",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 56,
"avg_line_length": 23.45,
"alnum_prop": 0.5746268656716418,
"repo_name": "rangsimanketkaew/NWChem",
"id": "b680d4185674921d092df981512d751b0287913d",
"size": "938",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/nwpw/nwpwlib/ion/shake/pspw_molecule.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Shell",
"bytes": "67582"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>ENPM808_Final: /home/viki/Documents/ENPM808X/Final/catkin_ws/src/ENPM808_Final/src/obstacleDetection.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</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 style="padding-left: 0.5em;">
<div id="projectname">ENPM808_Final
</div>
<div id="projectbrief">Final project for ENPM 808X</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<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="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</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="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File 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)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a></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="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">obstacleDetection.cpp File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><a class="el" href="classObstacleDetection.html" title="ObstacleDetection class handles determining if the vehicle is going to collide using laser scans...">ObstacleDetection</a> class implementation.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include <stdlib.h></code><br/>
<code>#include <ros/ros.h></code><br/>
<code>#include "<a class="el" href="obstacleDetection_8hpp_source.html">obstacleDetection.hpp</a>"</code><br/>
</div><a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classObstacleDetection.html" title="ObstacleDetection class handles determining if the vehicle is going to collide using laser scans...">ObstacleDetection</a> class implementation. </p>
<p>Implementation of the ROS <a class="el" href="classObstacleDetection.html" title="ObstacleDetection class handles determining if the vehicle is going to collide using laser scans...">ObstacleDetection</a> support methods. </p>
<dl class="section author"><dt>Author</dt><dd>Patrick Nolan (patnolan33) </dd></dl>
<dl class="section copyright"><dt>Copyright</dt><dd>BSD </dd></dl>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue May 9 2017 15:20:59 for ENPM808_Final by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
| {
"content_hash": "10c0cc1c86950c4829817d0ca5731147",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 546,
"avg_line_length": 51.372727272727275,
"alnum_prop": 0.6768713502035038,
"repo_name": "patnolan33/ENPM808_Final",
"id": "6ab988821f5cf1e69b2692ffc3dac27a5648714e",
"size": "5651",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/html/obstacleDetection_8cpp.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C++",
"bytes": "47860"
},
{
"name": "CMake",
"bytes": "1380"
}
],
"symlink_target": ""
} |
function CallProveedores()
{
ClearGenerica(1);
$(ventana1).html(QT.GetTable(5));
$(ventana1).dialog({
autoOpen: true,
height: 600,
width:800,
resizable: false,
title:'Proveedores',
buttons:{
Agregar: function(){
create_form(0);
}
}
});
}
function create_form(cod)
{
ClearGenerica(2);
$(ventana2).html(QT.GetForm(5, cod));
$('#cb_empresa').menu();
$(ventana2).dialog({
autoOpen: true,
height: 660,
width:700,
resizable: false,
title:'Proveedores',
buttons: {
Agregar: function() {
if (GuardarProveedor())
{
growcall('Productos / Distribuidores', 'Agregado Correctamente');
$(this).dialog('close');
$(ventana1).html(QT.GetTable(5));
}
}
}
});
}
function GuardarProveedor()
{
if(!ValidateTXT($('#txt_persona_Nombre')))
return false;
if(!ValidateTXT($('#txt_persona_telefono1')))
return false;
if(!ValidateTXT($('#txt_persona_telefono2')))
return false;
if(!ValidateTXT($('#txt_persona_email')))
return false;
if(!ValidateTXT($('#txt_persona_cedula')))
return false;
if($('#cb_empresa option:selected').val() === '-1')
{
mensajebox("Seleccione una empresa");
return false;
}
if(!ValidateTXT($('#txt_persona_direccion')))
return false;
var request = {'Cod_persona':$('#Cod_persona').val(), 'nombre':$('#txt_persona_Nombre').val(),'tel1':$('#txt_persona_telefono1').val(),
'tel2':$('#txt_persona_telefono2').val(),'email':$('#txt_persona_email').val(),
'cedula':$('#txt_persona_cedula').val(),'empre':$('#cb_empresa option:selected').val(),
'direccion':$('#txt_persona_direccion').val()};
if(!QT.Guardar(5,parseToString(request)))
{
mensajebox(QT.GetError());
return false;
}
return true;
}
function getProveedorByID(cod)
{
create_form(cod);
}
function DeleteProveedorByID(cod)
{
if(!QT.Borrar(5,cod))
{
alert(QT.GetError());
}
else
{
growcall('Productos / Distribuidores','Registro borrado correctamente')
$(ventana1).html(QT.GetTable(5));
}
} | {
"content_hash": "82698e0b5de7f4fcaf2ee2a2d282dbd5",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 139,
"avg_line_length": 26.22826086956522,
"alnum_prop": 0.5230004144218815,
"repo_name": "kmv50/GMS",
"id": "64a92ebffd676acde2db66958c79ab452fe51b21",
"size": "2413",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "html/Scripts/JSProveedores.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "245"
},
{
"name": "C++",
"bytes": "36114"
},
{
"name": "CSS",
"bytes": "10448"
},
{
"name": "IDL",
"bytes": "633"
},
{
"name": "JavaScript",
"bytes": "36533"
}
],
"symlink_target": ""
} |
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import {PromiseObservable} from 'rxjs/observable/PromiseObservable';
import { Http, Response } from '@angular/http';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import '../../interfaces.service'
import { DataService } from '../../pouchdb.service'
//var PouchDB = require('pouchdb');
@Injectable()
export class DataServiceSousTraitant extends DataService {
//data: any;
constructor(){ super(); }
ngOnInit() {
}
getAllByName() {
let options = {
include_docs: true
}
return PromiseObservable.create(this.db.query('sousTraitant/getAllByName', options));
//agences/_design/Agences/_view/GetAllByRef
}
getByName(ref) {
let options = {
include_docs: true,
key: ref,
}
return PromiseObservable.create(this.db.query('sousTraitant/getAllByName', options));
//agences/_design/Agences/_view/GetAllByRef
}
}
| {
"content_hash": "382bf4830478186b0dd4170501a2b3ef",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 89,
"avg_line_length": 25.17948717948718,
"alnum_prop": 0.685336048879837,
"repo_name": "julien-noblet/calcoo",
"id": "fa4bae3056ce7f77320c2745b3c6ec1118ec793c",
"size": "982",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/pages/sousTraitant/sousTraitant.service.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "109677"
},
{
"name": "HTML",
"bytes": "94269"
},
{
"name": "JavaScript",
"bytes": "38479"
},
{
"name": "Shell",
"bytes": "153"
},
{
"name": "TypeScript",
"bytes": "226915"
}
],
"symlink_target": ""
} |
package com.ukefu.webim.service.repository;
import com.ukefu.webim.web.model.AgentService;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
public abstract interface AgentServiceRepository
extends JpaRepository<AgentService, String>
{
public abstract AgentService findByIdAndOrgi(String paramString , String orgi);
public abstract List<AgentService> findByUseridAndOrgi(String paramString, String orgi);
public abstract Page<AgentService> findByOrgi(String orgi, Pageable paramPageable);
public abstract Page<AgentService> findByOrgiAndStatus(String orgi ,String status , Pageable paramPageable);
public abstract List<AgentService> findByAgentnoAndStatusAndOrgi(String agentno, String status , String orgi);
public abstract int countByUseridAndOrgiAndStatus(String userid, String orgi, String status);
public abstract List<AgentService> findByUseridAndOrgiAndStatus(String userid, String orgi, String status);
}
| {
"content_hash": "94d7a2b0bfe4dbc254d19db8f9e9fea3",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 112,
"avg_line_length": 44.12,
"alnum_prop": 0.8014505893019039,
"repo_name": "gtison/kf",
"id": "5869de8e84ac30c3c359d361f7b434a0cb6a6f2c",
"size": "1103",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/ukefu/webim/service/repository/AgentServiceRepository.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "163878"
},
{
"name": "HTML",
"bytes": "885584"
},
{
"name": "Java",
"bytes": "1857106"
},
{
"name": "JavaScript",
"bytes": "2120915"
}
],
"symlink_target": ""
} |
@class FLTimer;
@interface FLLengthyOperation : FLOperation {
@private
FLTimer* _timer;
}
@property (readwrite, assign) NSTimeInterval timeoutInterval;
- (void) updateActivityTimestamp;
- (void) startTimeoutTimer;
- (void) stopTimeoutTimer;
// optional override
- (void) operationDidTimeout;
@end
| {
"content_hash": "4c93116a73115425d04faf65e4d2653a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 61,
"avg_line_length": 17.055555555555557,
"alnum_prop": 0.752442996742671,
"repo_name": "fishlamp-released/FishLamp3",
"id": "9e4ea4e0f95b833b842c67e96904ca59373c4d95",
"size": "421",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Classes/Async/Operations/FLLengthyOperation.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "34265"
},
{
"name": "C++",
"bytes": "20186"
},
{
"name": "MATLAB",
"bytes": "1247"
},
{
"name": "Objective-C",
"bytes": "1923708"
},
{
"name": "Ruby",
"bytes": "17531"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_13) on Thu Feb 13 10:50:46 CST 2014 -->
<title>M-Index</title>
<meta name="date" content="2014-02-13">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="M-Index";
}
//-->
</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>Package</li>
<li>Class</li>
<li>Use</li>
<li><a href="../overview-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-10.html">Prev Letter</a></li>
<li><a href="index-12.html">Next Letter</a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-filesindex-11.html" target="_top">Frames</a></li>
<li><a href="index-11.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="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">L</a> <a href="index-11.html">M</a> <a href="index-12.html">N</a> <a href="index-13.html">O</a> <a href="index-14.html">P</a> <a href="index-15.html">R</a> <a href="index-16.html">S</a> <a href="index-17.html">T</a> <a href="index-18.html">U</a> <a href="index-19.html">V</a> <a href="index-20.html">W</a> <a href="index-21.html">X</a> <a href="index-22.html">Y</a> <a href="index-23.html">Z</a> <a name="_M_">
<!-- -->
</a>
<h2 class="title">M</h2>
<dl>
<dt><a href="../com/radaee/pdf/Matrix.html" title="class in com.radaee.pdf"><span class="strong">Matrix</span></a> - Class in <a href="../com/radaee/pdf/package-summary.html">com.radaee.pdf</a></dt>
<dd>
<div class="block">class for PDF Matrix.</div>
</dd>
<dt><span class="strong"><a href="../com/radaee/pdf/Matrix.html#Matrix(float, float, float, float, float, float)">Matrix(float, float, float, float, float, float)</a></span> - Constructor for class com.radaee.pdf.<a href="../com/radaee/pdf/Matrix.html" title="class in com.radaee.pdf">Matrix</a></dt>
<dd>
<div class="block">constructor for full values.</div>
</dd>
<dt><span class="strong"><a href="../com/radaee/pdf/Matrix.html#Matrix(float, float, float, float)">Matrix(float, float, float, float)</a></span> - Constructor for class com.radaee.pdf.<a href="../com/radaee/pdf/Matrix.html" title="class in com.radaee.pdf">Matrix</a></dt>
<dd>
<div class="block">constructor for scaled values.<br/>
xx = sx;<br/>
yx = 0;<br/>
xy = 0;<br/>
yx = sy;</div>
</dd>
<dt><span class="strong"><a href="../com/radaee/pdf/Document.html#MovePage(int, int)">MovePage(int, int)</a></span> - Method in class com.radaee.pdf.<a href="../com/radaee/pdf/Document.html" title="class in com.radaee.pdf">Document</a></dt>
<dd>
<div class="block">move the page to other position.<br/>
a premium license is needed for this method.</div>
</dd>
<dt><span class="strong"><a href="../com/radaee/pdf/Path.html#MoveTo(float, float)">MoveTo(float, float)</a></span> - Method in class com.radaee.pdf.<a href="../com/radaee/pdf/Path.html" title="class in com.radaee.pdf">Path</a></dt>
<dd>
<div class="block">move to operation</div>
</dd>
<dt><span class="strong"><a href="../com/radaee/pdf/Page.Annotation.html#MoveToPage(com.radaee.pdf.Page, float[])">MoveToPage(Page, float[])</a></span> - Method in class com.radaee.pdf.<a href="../com/radaee/pdf/Page.Annotation.html" title="class in com.radaee.pdf">Page.Annotation</a></dt>
<dd>
<div class="block">move annotation to another page.<be/>
this method valid in professional or premium version.<br/>
this method just like invoke Page.CopyAnnot() and Annotation.RemoveFromPage(), but, less data generated.<br/>
Notice: ObjsStart or RenderXXX shall be invoked for dst_page.</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">L</a> <a href="index-11.html">M</a> <a href="index-12.html">N</a> <a href="index-13.html">O</a> <a href="index-14.html">P</a> <a href="index-15.html">R</a> <a href="index-16.html">S</a> <a href="index-17.html">T</a> <a href="index-18.html">U</a> <a href="index-19.html">V</a> <a href="index-20.html">W</a> <a href="index-21.html">X</a> <a href="index-22.html">Y</a> <a href="index-23.html">Z</a> </div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li>Use</li>
<li><a href="../overview-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-10.html">Prev Letter</a></li>
<li><a href="index-12.html">Next Letter</a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-filesindex-11.html" target="_top">Frames</a></li>
<li><a href="index-11.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 ======= -->
</body>
</html>
| {
"content_hash": "fd9ea4686502970ac4b64e87270aa5ab",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 840,
"avg_line_length": 49.67333333333333,
"alnum_prop": 0.6279694000805262,
"repo_name": "gearit/RadaeePDF-B4A",
"id": "06d05b18ca4cc20552da84e6129afb2bcdfb2177",
"size": "7451",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Documentation/javadoc/index-files/index-11.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "23226"
},
{
"name": "Java",
"bytes": "772169"
},
{
"name": "Visual Basic",
"bytes": "2739"
}
],
"symlink_target": ""
} |
layout: default
---
<div class="post">
<article class="post-content">
{{ content }}
</article>
</div>
| {
"content_hash": "8b3caf372a0fd470bb7fefdfd6ba8d13",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 32,
"avg_line_length": 9,
"alnum_prop": 0.5555555555555556,
"repo_name": "unionpod/unionpod.github.io",
"id": "fc41b93a86a4977e4c13f22f32ba2200a4c6bb9d",
"size": "121",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_layouts/page.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6973"
},
{
"name": "HTML",
"bytes": "20041"
},
{
"name": "JavaScript",
"bytes": "1936"
},
{
"name": "Python",
"bytes": "2564"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/abs_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="multipleChoiceModal"
android:fastScrollEnabled="true" />
</FrameLayout> | {
"content_hash": "d756c145ed822df19e4fea37a3c3bda6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 71,
"avg_line_length": 36.84615384615385,
"alnum_prop": 0.6889352818371608,
"repo_name": "lenworthrose/music-app",
"id": "6a3b5f976944446a5c1e4037a083a263023dbbb0",
"size": "479",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/list_view.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "660447"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
namespace CM.Payments.Client.SampleWebApp.Models
{
public enum Status
{
Open = 1,
Cancelled = 2,
Paid = 3
}
public class Order
{
public virtual Account Account { get; set; }
public int AccountId { get; set; }
public DateTime Created { get; set; }
public int Id { get; set; }
public virtual ICollection<OrderItem> OrderItems { get; set; }
public DateTime? PaidOn { get; set; }
public Status Status { get; set; }
public double GetTotalCost()
{
var total = this.OrderItems.Sum(e => e.GetTotalPrice());
return double.Parse(total.ToString("F"));
}
}
} | {
"content_hash": "c6aa92fb08eed0d510e35c1f6474b80e",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 70,
"avg_line_length": 25.633333333333333,
"alnum_prop": 0.5786736020806242,
"repo_name": "cmpayments/payments-sdk-net",
"id": "1981ecf7cf8fcc87918d208a31376a55f591327b",
"size": "771",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Sample/CM.Payments.Client.SampleWebApp/Models/Order.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "597146"
}
],
"symlink_target": ""
} |
<?php
namespace RunOpenCode\AbstractBuilder\Command\Question;
use RunOpenCode\AbstractBuilder\Ast\Metadata\ParameterMetadata;
/**
* Class MethodChoice
*
* @package RunOpenCode\AbstractBuilder\Command\Question
*/
abstract class MethodChoice
{
protected $parameter;
public function __construct(ParameterMetadata $parameter)
{
$this->parameter = $parameter;
}
public function getParameter()
{
return $this->parameter;
}
abstract public function getMethodName();
abstract public function __toString();
}
| {
"content_hash": "e5f0023cb5e041f2a282be2e8a5bcf0d",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 63,
"avg_line_length": 19.551724137931036,
"alnum_prop": 0.7037037037037037,
"repo_name": "RunOpenCode/abstract-builder",
"id": "18810fce3c1c81d4e445d9b88087c89b351405e5",
"size": "808",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/RunOpenCode/AbstractBuilder/Command/Question/MethodChoice.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "98102"
}
],
"symlink_target": ""
} |
- OVC
- Monitoring for monitoring [issue](https://github.com/openvcloud/openvcloud/issues/13)
- 0-orchestration
- Import / export for containers [specs](https://github.com/zero-os/0-orchestrator/issues/664)
- 0-disk
- Import / export [specs](https://github.com/zero-os/0-Disk/issues/296)
- Clone
- Template [specs](https://github.com/zero-os/0-Disk/issues/297)
- Feed statistics into redis via core-0 statistics logging via stdout
- Cockpit
- Full OpenvCloud API AYS support for Account / Cloudspace / vDisk / VM api’s [Waffle](https://waffle.io/Jumpscale/home?milestone=9.1.1)
| {
"content_hash": "d4602a50ac60433ff7705c5772888167",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 138,
"avg_line_length": 53.81818181818182,
"alnum_prop": 0.731418918918919,
"repo_name": "g8os/home",
"id": "2392c6f51ecb493b504110a5305844323422b76a",
"size": "594",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "release_notes/1.1.0-alpha-8.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<div class="row spacer">
<div class="col-md-3">
</div>
<form class="form col-md-9">
<div class="input-group col-md-12">
<input class="form-control" id="appendedInputButton" ng-model="searchForm.text" type="text" />
<span class="input-group-btn">
<button ng-click="search()" class="btn btn-primary" type="submit">Search</button>
</span>
</div>
</form>
</div>
<br /><br />
<div class="row">
<div class="col-md-3">
<div ng-repeat="(facetGroupName, facetGroupValue) in facets" class="panel panel-default">
<div class="panel-heading">{{ facetGroupName | facetGroupLabel }}</div>
<ul class="list-group">
<li class="list-group-item" ng-repeat="facetValue in facetGroupValue.facetValues">{{ facetValue.name }} ({{ facetValue.count }})</li>
</ul>
</div>
</div><!--/span-->
<div class="col-md-9">
<div class="jumbotron">
<h3>Hello, world!</h3>
<p>This is a demo of using <a href="http://angularjs.org/">AngularJS</a> and <a href="http://twitter.github.io/bootstrap/">Twitter Bootstrap</a> with the MarkLogic REST API.</p>
<p><a href="#" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div ng-repeat="resultGroup in results" class="row">
<div ng-repeat="result in resultGroup" class="col-md-4">
<h4>{{ result.metadata | getMetadata:'film-title'}}</h4>
<p><b>Nominee:</b> {{ result.metadata | getMetadata:'name' }}</p>
<p><b>Award:</b> {{ result.metadata | getMetadata:'nominee_award' }}</p>
<p><b>Year:</b> {{ result.metadata | getMetadata:'nominee_year' }}</p>
</div>
</div>
</div><!--/span-->
</div><!--/row-->
| {
"content_hash": "efbf01ec5ae4b258c9ba5de02f807ea8",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 189,
"avg_line_length": 42.13636363636363,
"alnum_prop": 0.5431499460625674,
"repo_name": "peterskim12/angularjs-mlrest",
"id": "a3747d56d3fa3cc4bddb801b9ccd71e2bc8bd17e",
"size": "1854",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/views/main.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "486633"
},
{
"name": "JavaScript",
"bytes": "3566617"
},
{
"name": "Ruby",
"bytes": "207531"
},
{
"name": "Shell",
"bytes": "10437"
},
{
"name": "XProc",
"bytes": "45656"
},
{
"name": "XQuery",
"bytes": "291515"
}
],
"symlink_target": ""
} |
/* $Id$ */
package org.apache.xmlgraphics.image.codec.tiff;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.xmlgraphics.image.codec.util.PropertyUtil;
import org.apache.xmlgraphics.image.codec.util.SeekableStream;
// CSOFF: ConstantName
// CSOFF: EmptyStatement
// CSOFF: InnerAssignment
// CSOFF: LocalVariableName
// CSOFF: MemberName
// CSOFF: MultipleVariableDeclarations
// CSOFF: NeedBraces
// CSOFF: ParameterName
// CSOFF: WhitespaceAround
/**
* A class representing an Image File Directory (IFD) from a TIFF 6.0
* stream. The TIFF file format is described in more detail in the
* comments for the TIFFDescriptor class.
*
* <p> A TIFF IFD consists of a set of TIFFField tags. Methods are
* provided to query the set of tags and to obtain the raw field
* array. In addition, convenience methods are provided for acquiring
* the values of tags that contain a single value that fits into a
* byte, int, long, float, or double.
*
* <p> Every TIFF file is made up of one or more public IFDs that are
* joined in a linked list, rooted in the file header. A file may
* also contain so-called private IFDs that are referenced from
* tag data and do not appear in the main list.
*
* <p><b> This class is not a committed part of the JAI API. It may
* be removed or changed in future releases of JAI.</b>
*
* @see TIFFField
* @version $Id$
*/
public class TIFFDirectory implements Serializable {
private static final long serialVersionUID = 2007844835460959003L;
/** A boolean storing the endianness of the stream. */
boolean isBigEndian;
/** The number of entries in the IFD. */
int numEntries;
/** An array of TIFFFields. */
TIFFField[] fields;
/** A Hashtable indexing the fields by tag number. */
Map fieldIndex = new HashMap();
/** The offset of this IFD. */
long ifdOffset = 8;
/** The offset of the next IFD. */
long nextIFDOffset;
/** The default constructor. */
TIFFDirectory() { }
private static boolean isValidEndianTag(int endian) {
return ((endian == 0x4949) || (endian == 0x4d4d));
}
/**
* Constructs a TIFFDirectory from a SeekableStream.
* The directory parameter specifies which directory to read from
* the linked list present in the stream; directory 0 is normally
* read but it is possible to store multiple images in a single
* TIFF file by maintaing multiple directories.
*
* @param stream a SeekableStream to read from.
* @param directory the index of the directory to read.
*/
public TIFFDirectory(SeekableStream stream, int directory)
throws IOException {
long globalSaveOffset = stream.getFilePointer();
long ifdOffset;
// Read the TIFF header
stream.seek(0L);
int endian = stream.readUnsignedShort();
if (!isValidEndianTag(endian)) {
throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory1"));
}
isBigEndian = (endian == 0x4d4d);
int magic = readUnsignedShort(stream);
if (magic != 42) {
throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory2"));
}
// Get the initial ifd offset as an unsigned int (using a long)
ifdOffset = readUnsignedInt(stream);
for (int i = 0; i < directory; i++) {
if (ifdOffset == 0L) {
throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory3"));
}
stream.seek(ifdOffset);
long entries = readUnsignedShort(stream);
stream.skip(12 * entries);
ifdOffset = readUnsignedInt(stream);
}
if (ifdOffset == 0L) {
throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory3"));
}
stream.seek(ifdOffset);
initialize(stream);
stream.seek(globalSaveOffset);
}
/**
* Constructs a TIFFDirectory by reading a SeekableStream.
* The ifd_offset parameter specifies the stream offset from which
* to begin reading; this mechanism is sometimes used to store
* private IFDs within a TIFF file that are not part of the normal
* sequence of IFDs.
*
* @param stream a SeekableStream to read from.
* @param ifdOffset the long byte offset of the directory.
* @param directory the index of the directory to read beyond the
* one at the current stream offset; zero indicates the IFD
* at the current offset.
*/
public TIFFDirectory(SeekableStream stream, long ifdOffset, int directory)
throws IOException {
long globalSaveOffset = stream.getFilePointer();
stream.seek(0L);
int endian = stream.readUnsignedShort();
if (!isValidEndianTag(endian)) {
throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory1"));
}
isBigEndian = (endian == 0x4d4d);
// Seek to the first IFD.
stream.seek(ifdOffset);
// Seek to desired IFD if necessary.
int dirNum = 0;
while (dirNum < directory) {
// Get the number of fields in the current IFD.
long numEntries = readUnsignedShort(stream);
// Skip to the next IFD offset value field.
stream.seek(ifdOffset + 12 * numEntries);
// Read the offset to the next IFD beyond this one.
ifdOffset = readUnsignedInt(stream);
// Seek to the next IFD.
stream.seek(ifdOffset);
// Increment the directory.
dirNum++;
}
initialize(stream);
stream.seek(globalSaveOffset);
}
private static final int[] SIZE_OF_TYPE = {
0, // 0 = n/a
1, // 1 = byte
1, // 2 = ascii
2, // 3 = short
4, // 4 = long
8, // 5 = rational
1, // 6 = sbyte
1, // 7 = undefined
2, // 8 = sshort
4, // 9 = slong
8, // 10 = srational
4, // 11 = float
8 // 12 = double
};
private void initialize(SeekableStream stream) throws IOException {
long nextTagOffset;
int i;
int j;
ifdOffset = stream.getFilePointer();
numEntries = readUnsignedShort(stream);
fields = new TIFFField[numEntries];
for (i = 0; i < numEntries; i++) {
int tag = readUnsignedShort(stream);
int type = readUnsignedShort(stream);
int count = (int)(readUnsignedInt(stream));
int value = 0;
// The place to return to to read the next tag
nextTagOffset = stream.getFilePointer() + 4;
try {
// If the tag data can't fit in 4 bytes, the next 4 bytes
// contain the starting offset of the data
if (count * SIZE_OF_TYPE[type] > 4) {
value = (int)(readUnsignedInt(stream));
stream.seek(value);
}
} catch (ArrayIndexOutOfBoundsException ae) {
// System.err.println(tag + " " + "TIFFDirectory4"); TODO - log this message
// if the data type is unknown we should skip this TIFF Field
stream.seek(nextTagOffset);
continue;
}
fieldIndex.put(tag, i);
Object obj = null;
switch (type) {
case TIFFField.TIFF_BYTE:
case TIFFField.TIFF_SBYTE:
case TIFFField.TIFF_UNDEFINED:
case TIFFField.TIFF_ASCII:
byte[] bvalues = new byte[count];
stream.readFully(bvalues, 0, count);
if (type == TIFFField.TIFF_ASCII) {
// Can be multiple strings
int index = 0;
int prevIndex = 0;
List v = new ArrayList();
while (index < count) {
while ((index < count) && (bvalues[index++] != 0)) {
// NOP
}
// When we encountered zero, means one string has ended
v.add(new String(bvalues, prevIndex,
(index - prevIndex), "UTF-8"));
prevIndex = index;
}
count = v.size();
String[] strings = new String[count];
v.toArray(strings);
obj = strings;
} else {
obj = bvalues;
}
break;
case TIFFField.TIFF_SHORT:
char[] cvalues = new char[count];
for (j = 0; j < count; j++) {
cvalues[j] = (char)(readUnsignedShort(stream));
}
obj = cvalues;
break;
case TIFFField.TIFF_LONG:
long[] lvalues = new long[count];
for (j = 0; j < count; j++) {
lvalues[j] = readUnsignedInt(stream);
}
obj = lvalues;
break;
case TIFFField.TIFF_RATIONAL:
long[][] llvalues = new long[count][2];
for (j = 0; j < count; j++) {
llvalues[j][0] = readUnsignedInt(stream);
llvalues[j][1] = readUnsignedInt(stream);
}
obj = llvalues;
break;
case TIFFField.TIFF_SSHORT:
short[] svalues = new short[count];
for (j = 0; j < count; j++) {
svalues[j] = readShort(stream);
}
obj = svalues;
break;
case TIFFField.TIFF_SLONG:
int[] ivalues = new int[count];
for (j = 0; j < count; j++) {
ivalues[j] = readInt(stream);
}
obj = ivalues;
break;
case TIFFField.TIFF_SRATIONAL:
int[][] iivalues = new int[count][2];
for (j = 0; j < count; j++) {
iivalues[j][0] = readInt(stream);
iivalues[j][1] = readInt(stream);
}
obj = iivalues;
break;
case TIFFField.TIFF_FLOAT:
float[] fvalues = new float[count];
for (j = 0; j < count; j++) {
fvalues[j] = readFloat(stream);
}
obj = fvalues;
break;
case TIFFField.TIFF_DOUBLE:
double[] dvalues = new double[count];
for (j = 0; j < count; j++) {
dvalues[j] = readDouble(stream);
}
obj = dvalues;
break;
default:
throw new RuntimeException(PropertyUtil.getString("TIFFDirectory0"));
}
fields[i] = new TIFFField(tag, type, count, obj);
stream.seek(nextTagOffset);
}
// Read the offset of the next IFD.
nextIFDOffset = readUnsignedInt(stream);
}
/** Returns the number of directory entries. */
public int getNumEntries() {
return numEntries;
}
/**
* Returns the value of a given tag as a TIFFField,
* or null if the tag is not present.
*/
public TIFFField getField(int tag) {
Integer i = (Integer)fieldIndex.get(tag);
if (i == null) {
return null;
} else {
return fields[i];
}
}
/**
* Returns true if a tag appears in the directory.
*/
public boolean isTagPresent(int tag) {
return fieldIndex.containsKey(tag);
}
/**
* Returns an ordered array of ints indicating the tag
* values.
*/
public int[] getTags() {
int[] tags = new int[fieldIndex.size()];
Iterator iter = fieldIndex.keySet().iterator();
int i = 0;
while (iter.hasNext()) {
tags[i++] = (Integer) iter.next();
}
return tags;
}
/**
* Returns an array of TIFFFields containing all the fields
* in this directory.
*/
public TIFFField[] getFields() {
return fields;
}
/**
* Returns the value of a particular index of a given tag as a
* byte. The caller is responsible for ensuring that the tag is
* present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or
* TIFF_UNDEFINED.
*/
public byte getFieldAsByte(int tag, int index) {
Integer i = (Integer)fieldIndex.get(tag);
byte [] b = (fields[i]).getAsBytes();
return b[index];
}
/**
* Returns the value of index 0 of a given tag as a
* byte. The caller is responsible for ensuring that the tag is
* present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or
* TIFF_UNDEFINED.
*/
public byte getFieldAsByte(int tag) {
return getFieldAsByte(tag, 0);
}
/**
* Returns the value of a particular index of a given tag as a
* long. The caller is responsible for ensuring that the tag is
* present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED,
* TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG.
*/
public long getFieldAsLong(int tag, int index) {
Integer i = (Integer)fieldIndex.get(tag);
return (fields[i]).getAsLong(index);
}
/**
* Returns the value of index 0 of a given tag as a
* long. The caller is responsible for ensuring that the tag is
* present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED,
* TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG.
*/
public long getFieldAsLong(int tag) {
return getFieldAsLong(tag, 0);
}
/**
* Returns the value of a particular index of a given tag as a
* float. The caller is responsible for ensuring that the tag is
* present and has numeric type (all but TIFF_UNDEFINED and
* TIFF_ASCII).
*/
public float getFieldAsFloat(int tag, int index) {
Integer i = (Integer)fieldIndex.get(tag);
return fields[i].getAsFloat(index);
}
/**
* Returns the value of index 0 of a given tag as a float. The
* caller is responsible for ensuring that the tag is present and
* has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII).
*/
public float getFieldAsFloat(int tag) {
return getFieldAsFloat(tag, 0);
}
/**
* Returns the value of a particular index of a given tag as a
* double. The caller is responsible for ensuring that the tag is
* present and has numeric type (all but TIFF_UNDEFINED and
* TIFF_ASCII).
*/
public double getFieldAsDouble(int tag, int index) {
Integer i = (Integer)fieldIndex.get(tag);
return fields[i].getAsDouble(index);
}
/**
* Returns the value of index 0 of a given tag as a double. The
* caller is responsible for ensuring that the tag is present and
* has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII).
*/
public double getFieldAsDouble(int tag) {
return getFieldAsDouble(tag, 0);
}
// Methods to read primitive data types from the stream
private short readShort(SeekableStream stream)
throws IOException {
if (isBigEndian) {
return stream.readShort();
} else {
return stream.readShortLE();
}
}
private int readUnsignedShort(SeekableStream stream)
throws IOException {
if (isBigEndian) {
return stream.readUnsignedShort();
} else {
return stream.readUnsignedShortLE();
}
}
private int readInt(SeekableStream stream)
throws IOException {
if (isBigEndian) {
return stream.readInt();
} else {
return stream.readIntLE();
}
}
private long readUnsignedInt(SeekableStream stream)
throws IOException {
if (isBigEndian) {
return stream.readUnsignedInt();
} else {
return stream.readUnsignedIntLE();
}
}
// private long readLong(SeekableStream stream)
// throws IOException {
// if (isBigEndian) {
// return stream.readLong();
// } else {
// return stream.readLongLE();
// }
// }
private float readFloat(SeekableStream stream)
throws IOException {
if (isBigEndian) {
return stream.readFloat();
} else {
return stream.readFloatLE();
}
}
private double readDouble(SeekableStream stream)
throws IOException {
if (isBigEndian) {
return stream.readDouble();
} else {
return stream.readDoubleLE();
}
}
private static int readUnsignedShort(SeekableStream stream,
boolean isBigEndian)
throws IOException {
if (isBigEndian) {
return stream.readUnsignedShort();
} else {
return stream.readUnsignedShortLE();
}
}
private static long readUnsignedInt(SeekableStream stream,
boolean isBigEndian)
throws IOException {
if (isBigEndian) {
return stream.readUnsignedInt();
} else {
return stream.readUnsignedIntLE();
}
}
// Utilities
/**
* Returns the number of image directories (subimages) stored in a
* given TIFF file, represented by a <code>SeekableStream</code>.
*/
public static int getNumDirectories(SeekableStream stream)
throws IOException {
long pointer = stream.getFilePointer(); // Save stream pointer
stream.seek(0L);
int endian = stream.readUnsignedShort();
if (!isValidEndianTag(endian)) {
throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory1"));
}
boolean isBigEndian = (endian == 0x4d4d);
int magic = readUnsignedShort(stream, isBigEndian);
if (magic != 42) {
throw new IllegalArgumentException(PropertyUtil.getString("TIFFDirectory2"));
}
stream.seek(4L);
long offset = readUnsignedInt(stream, isBigEndian);
int numDirectories = 0;
while (offset != 0L) {
++numDirectories;
stream.seek(offset);
long entries = readUnsignedShort(stream, isBigEndian);
stream.skip(12 * entries);
offset = readUnsignedInt(stream, isBigEndian);
}
stream.seek(pointer); // Reset stream pointer
return numDirectories;
}
/**
* Returns a boolean indicating whether the byte order used in the
* the TIFF file is big-endian. That is, whether the byte order is from
* the most significant to the least significant.
*/
public boolean isBigEndian() {
return isBigEndian;
}
/**
* Returns the offset of the IFD corresponding to this
* <code>TIFFDirectory</code>.
*/
public long getIFDOffset() {
return ifdOffset;
}
/**
* Returns the offset of the next IFD after the IFD corresponding to this
* <code>TIFFDirectory</code>.
*/
public long getNextIFDOffset() {
return nextIFDOffset;
}
}
| {
"content_hash": "d361331c1e075b3ceb3690dff144b153",
"timestamp": "",
"source": "github",
"line_count": 626,
"max_line_length": 93,
"avg_line_length": 31.47444089456869,
"alnum_prop": 0.5614880982591484,
"repo_name": "apache/xml-graphics-commons",
"id": "6d23a135d800e5de2d54ad481b93833d547c5b97",
"size": "20505",
"binary": false,
"copies": "2",
"ref": "refs/heads/trunk",
"path": "src/main/java/org/apache/xmlgraphics/image/codec/tiff/TIFFDirectory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "27688"
},
{
"name": "Java",
"bytes": "2338162"
},
{
"name": "Shell",
"bytes": "321"
}
],
"symlink_target": ""
} |
<?php
namespace Flarum\Migrations\Core;
use Illuminate\Database\Schema\Blueprint;
use Flarum\Migrations\Migration;
class RenameNotificationReadTime extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->table('users', function (Blueprint $table) {
$table->renameColumn('notification_read_time', 'notifications_read_time');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$this->schema->table('users', function (Blueprint $table) {
$table->renameColumn('notifications_read_time', 'notification_read_time');
});
}
}
| {
"content_hash": "254c0924943d5d3aa24d4c54821b40c9",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 86,
"avg_line_length": 22.060606060606062,
"alnum_prop": 0.5947802197802198,
"repo_name": "flarumone/flarumone",
"id": "e10511463f305e5620f59d6d0c04b0976f1caa06",
"size": "728",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "flarum/vendor/flarum/core/migrations/2015_09_22_030432_rename_notification_read_time.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "603"
},
{
"name": "CSS",
"bytes": "15057"
},
{
"name": "HTML",
"bytes": "379"
},
{
"name": "JavaScript",
"bytes": "132399"
},
{
"name": "PHP",
"bytes": "227291"
}
],
"symlink_target": ""
} |
export {};
class SomeClass {
private x: number;
}
const variableWithFunctionTypeUsingThis: (this: SomeClass, a: string) => number = () => 1;
// Has only a single this arg, no more parameters.
function foo(): ((this: string) => string)|undefined {
return undefined;
}
class UnrelatedType {}
class ThisThisReturnsThisAsThis {
// This (!) reproduces a situtation where tsickle would erroneously produce an @THIS tag for the
// explicitly passed this type, plus one for the template'd this type, which is an error in
// Closure.
thisThisReturnsThisAsThis(this: UnrelatedType): this {
return this as this;
}
}
| {
"content_hash": "1d513bdb9b132fdeb04b1ae5ff86346e",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 98,
"avg_line_length": 28.5,
"alnum_prop": 0.7161084529505582,
"repo_name": "alexeagle/tsickle",
"id": "bd2ca89858a69d740b2999425c7c276b8afc76bf",
"size": "627",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test_files/this_type/this_type.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "214209"
},
{
"name": "Python",
"bytes": "6415"
},
{
"name": "TypeScript",
"bytes": "420618"
}
],
"symlink_target": ""
} |
using System;
using System.Net;
using System.Security;
using System.Security.Permissions;
using System.Web;
#endregion
namespace DotNetNuke.Framework
{
public class SecurityPolicy
{
public const string ReflectionPermission = "ReflectionPermission";
public const string WebPermission = "WebPermission";
public const string AspNetHostingPermission = "AspNetHostingPermission";
public const string UnManagedCodePermission = "UnManagedCodePermission";
private static bool m_Initialized;
private static bool m_ReflectionPermission;
private static bool m_WebPermission;
private static bool m_AspNetHostingPermission;
private static bool m_UnManagedCodePermission;
public static string Permissions
{
get
{
string strPermissions = "";
if (HasReflectionPermission())
{
strPermissions += ", " + ReflectionPermission;
}
if (HasWebPermission())
{
strPermissions += ", " + WebPermission;
}
if (HasAspNetHostingPermission())
{
strPermissions += ", " + AspNetHostingPermission;
}
if (!String.IsNullOrEmpty(strPermissions))
{
strPermissions = strPermissions.Substring(2);
}
return strPermissions;
}
}
private static void GetPermissions()
{
if (!m_Initialized)
{
//test RelectionPermission
CodeAccessPermission securityTest;
try
{
securityTest = new ReflectionPermission(PermissionState.Unrestricted);
securityTest.Demand();
m_ReflectionPermission = true;
}
catch
{
//code access security error
m_ReflectionPermission = false;
}
//test WebPermission
try
{
securityTest = new WebPermission(PermissionState.Unrestricted);
securityTest.Demand();
m_WebPermission = true;
}
catch
{
//code access security error
m_WebPermission = false;
}
//test WebHosting Permission (Full Trust)
try
{
securityTest = new AspNetHostingPermission(AspNetHostingPermissionLevel.Unrestricted);
securityTest.Demand();
m_AspNetHostingPermission = true;
}
catch
{
//code access security error
m_AspNetHostingPermission = false;
}
m_Initialized = true;
//Test for Unmanaged Code permission
try
{
securityTest = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);
securityTest.Demand();
m_UnManagedCodePermission = true;
}
catch (Exception)
{
m_UnManagedCodePermission = false;
}
}
}
public static bool HasAspNetHostingPermission()
{
GetPermissions();
return m_AspNetHostingPermission;
}
public static bool HasReflectionPermission()
{
GetPermissions();
return m_ReflectionPermission;
}
public static bool HasWebPermission()
{
GetPermissions();
return m_WebPermission;
}
public static bool HasUnManagedCodePermission()
{
GetPermissions();
return m_UnManagedCodePermission;
}
public static bool HasPermissions(string permissions, ref string permission)
{
bool _HasPermission = true;
if (!String.IsNullOrEmpty(permissions))
{
foreach (string per in (permissions + ";").Split(Convert.ToChar(";")))
{
if (!String.IsNullOrEmpty(per.Trim()))
{
permission = per;
switch (permission)
{
case AspNetHostingPermission:
if (HasAspNetHostingPermission() == false)
{
_HasPermission = false;
}
break;
case ReflectionPermission:
if (HasReflectionPermission() == false)
{
_HasPermission = false;
}
break;
case UnManagedCodePermission:
if (HasUnManagedCodePermission() == false)
{
_HasPermission = false;
}
break;
case WebPermission:
if (HasWebPermission() == false)
{
_HasPermission = false;
}
break;
}
}
}
}
return _HasPermission;
}
[Obsolete("Replaced by correctly spelt method")]
public static bool HasRelectionPermission()
{
GetPermissions();
return m_ReflectionPermission;
}
}
} | {
"content_hash": "50a5e44bd44fe494efc4af7ed233f2c6",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 106,
"avg_line_length": 34.62637362637363,
"alnum_prop": 0.42780069819105043,
"repo_name": "janjonas/Dnn.Platform",
"id": "78000cd438fcb57fe4d35eac5d682e9e7ddde2b1",
"size": "7544",
"binary": false,
"copies": "2",
"ref": "refs/heads/development",
"path": "DNN Platform/Library/Framework/SecurityPolicy.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "564664"
},
{
"name": "Batchfile",
"bytes": "2674"
},
{
"name": "C#",
"bytes": "20115609"
},
{
"name": "CSS",
"bytes": "908052"
},
{
"name": "HTML",
"bytes": "468183"
},
{
"name": "JavaScript",
"bytes": "3821935"
},
{
"name": "PowerShell",
"bytes": "2157"
},
{
"name": "Smalltalk",
"bytes": "2410"
},
{
"name": "Visual Basic",
"bytes": "139321"
},
{
"name": "XSLT",
"bytes": "10488"
}
],
"symlink_target": ""
} |
package com.cloud.api.query.dao;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.cloudstack.api.response.NicResponse;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.utils.CloudStackVersion;
import com.cloud.api.ApiResponseHelper;
import com.cloud.api.query.vo.DomainRouterJoinVO;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
@Component
public class DomainRouterJoinDaoImpl extends GenericDaoBase<DomainRouterJoinVO, Long> implements DomainRouterJoinDao {
public static final Logger s_logger = Logger.getLogger(DomainRouterJoinDaoImpl.class);
@Inject
private ConfigurationDao _configDao;
@Inject
public AccountManager _accountMgr;
private final SearchBuilder<DomainRouterJoinVO> vrSearch;
private final SearchBuilder<DomainRouterJoinVO> vrIdSearch;
protected DomainRouterJoinDaoImpl() {
vrSearch = createSearchBuilder();
vrSearch.and("idIN", vrSearch.entity().getId(), SearchCriteria.Op.IN);
vrSearch.done();
vrIdSearch = createSearchBuilder();
vrIdSearch.and("id", vrIdSearch.entity().getId(), SearchCriteria.Op.EQ);
vrIdSearch.done();
_count = "select count(distinct id) from domain_router_view WHERE ";
}
@Override
public DomainRouterResponse newDomainRouterResponse(DomainRouterJoinVO router, Account caller) {
DomainRouterResponse routerResponse = new DomainRouterResponse();
routerResponse.setId(router.getUuid());
routerResponse.setZoneId(router.getDataCenterUuid());
routerResponse.setName(router.getName());
routerResponse.setTemplateId(router.getTemplateUuid());
routerResponse.setCreated(router.getCreated());
routerResponse.setState(router.getState());
routerResponse.setIsRedundantRouter(router.isRedundantRouter());
routerResponse.setScriptsVersion(router.getScriptsVersion());
if (router.getRedundantState() != null) {
routerResponse.setRedundantState(router.getRedundantState().toString());
}
if (router.getTemplateVersion() != null) {
String routerVersion = CloudStackVersion.trimRouterVersion(router.getTemplateVersion());
routerResponse.setVersion(routerVersion);
routerResponse.setRequiresUpgrade((CloudStackVersion.compare(routerVersion, NetworkOrchestrationService.MinVRVersion.valueIn(router.getDataCenterId())) < 0));
} else {
routerResponse.setVersion("UNKNOWN");
routerResponse.setRequiresUpgrade(true);
}
if (caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN
|| _accountMgr.isRootAdmin(caller.getId())) {
if (router.getHostId() != null) {
routerResponse.setHostId(router.getHostUuid());
routerResponse.setHostName(router.getHostName());
routerResponse.setHypervisor(router.getHypervisorType().toString());
}
routerResponse.setPodId(router.getPodUuid());
long nic_id = router.getNicId();
if (nic_id > 0) {
TrafficType ty = router.getTrafficType();
if (ty != null) {
// legacy code, public/control/guest nic info is kept in
// nics response object
if (ty == TrafficType.Public) {
routerResponse.setPublicIp(router.getIpAddress());
routerResponse.setPublicMacAddress(router.getMacAddress());
routerResponse.setPublicNetmask(router.getNetmask());
routerResponse.setGateway(router.getGateway());
routerResponse.setPublicNetworkId(router.getNetworkUuid());
} else if (ty == TrafficType.Control) {
routerResponse.setLinkLocalIp(router.getIpAddress());
routerResponse.setLinkLocalMacAddress(router.getMacAddress());
routerResponse.setLinkLocalNetmask(router.getNetmask());
routerResponse.setLinkLocalNetworkId(router.getNetworkUuid());
} else if (ty == TrafficType.Guest) {
routerResponse.setGuestIpAddress(router.getIpAddress());
routerResponse.setGuestMacAddress(router.getMacAddress());
routerResponse.setGuestNetmask(router.getNetmask());
routerResponse.setGuestNetworkId(router.getNetworkUuid());
routerResponse.setGuestNetworkName(router.getNetworkName());
routerResponse.setNetworkDomain(router.getNetworkDomain());
}
}
NicResponse nicResponse = new NicResponse();
nicResponse.setId(router.getNicUuid());
nicResponse.setIpaddress(router.getIpAddress());
nicResponse.setGateway(router.getGateway());
nicResponse.setNetmask(router.getNetmask());
nicResponse.setNetworkid(router.getNetworkUuid());
nicResponse.setNetworkName(router.getNetworkName());
nicResponse.setMacAddress(router.getMacAddress());
nicResponse.setIp6Address(router.getIp6Address());
nicResponse.setIp6Gateway(router.getIp6Gateway());
nicResponse.setIp6Cidr(router.getIp6Cidr());
if (router.getBroadcastUri() != null) {
nicResponse.setBroadcastUri(router.getBroadcastUri().toString());
}
if (router.getIsolationUri() != null) {
nicResponse.setIsolationUri(router.getIsolationUri().toString());
}
if (router.getTrafficType() != null) {
nicResponse.setTrafficType(router.getTrafficType().toString());
}
if (router.getGuestType() != null) {
nicResponse.setType(router.getGuestType().toString());
}
nicResponse.setIsDefault(router.isDefaultNic());
nicResponse.setObjectName("nic");
routerResponse.addNic(nicResponse);
}
}
routerResponse.setServiceOfferingId(router.getServiceOfferingUuid());
routerResponse.setServiceOfferingName(router.getServiceOfferingName());
// populate owner.
ApiResponseHelper.populateOwner(routerResponse, router);
routerResponse.setDomainId(router.getDomainUuid());
routerResponse.setDomainName(router.getDomainName());
routerResponse.setZoneName(router.getDataCenterName());
routerResponse.setDns1(router.getDns1());
routerResponse.setDns2(router.getDns2());
routerResponse.setIp6Dns1(router.getIp6Dns1());
routerResponse.setIp6Dns2(router.getIp6Dns2());
routerResponse.setVpcId(router.getVpcUuid());
routerResponse.setVpcName(router.getVpcName());
routerResponse.setRole(router.getRole().toString());
// set async job
if (router.getJobId() != null) {
routerResponse.setJobId(router.getJobUuid());
routerResponse.setJobStatus(router.getJobStatus());
}
if (router.getRole() == Role.INTERNAL_LB_VM) {
routerResponse.setObjectName("internalloadbalancervm");
} else {
routerResponse.setObjectName("router");
}
return routerResponse;
}
@Override
public DomainRouterResponse setDomainRouterResponse(DomainRouterResponse vrData, DomainRouterJoinVO vr) {
long nic_id = vr.getNicId();
if (nic_id > 0) {
TrafficType ty = vr.getTrafficType();
if (ty != null) {
// legacy code, public/control/guest nic info is kept in
// nics response object
if (ty == TrafficType.Public) {
vrData.setPublicIp(vr.getIpAddress());
vrData.setPublicMacAddress(vr.getMacAddress());
vrData.setPublicNetmask(vr.getNetmask());
vrData.setGateway(vr.getGateway());
vrData.setPublicNetworkId(vr.getNetworkUuid());
} else if (ty == TrafficType.Control) {
vrData.setLinkLocalIp(vr.getIpAddress());
vrData.setLinkLocalMacAddress(vr.getMacAddress());
vrData.setLinkLocalNetmask(vr.getNetmask());
vrData.setLinkLocalNetworkId(vr.getNetworkUuid());
} else if (ty == TrafficType.Guest) {
vrData.setGuestIpAddress(vr.getIpAddress());
vrData.setGuestMacAddress(vr.getMacAddress());
vrData.setGuestNetmask(vr.getNetmask());
vrData.setGuestNetworkId(vr.getNetworkUuid());
vrData.setGuestNetworkName(vr.getNetworkName());
vrData.setNetworkDomain(vr.getNetworkDomain());
}
}
NicResponse nicResponse = new NicResponse();
nicResponse.setId(vr.getNicUuid());
nicResponse.setIpaddress(vr.getIpAddress());
nicResponse.setGateway(vr.getGateway());
nicResponse.setNetmask(vr.getNetmask());
nicResponse.setNetworkid(vr.getNetworkUuid());
nicResponse.setNetworkName(vr.getNetworkName());
nicResponse.setMacAddress(vr.getMacAddress());
nicResponse.setIp6Address(vr.getIp6Address());
nicResponse.setIp6Gateway(vr.getIp6Gateway());
nicResponse.setIp6Cidr(vr.getIp6Cidr());
if (vr.getBroadcastUri() != null) {
nicResponse.setBroadcastUri(vr.getBroadcastUri().toString());
}
if (vr.getIsolationUri() != null) {
nicResponse.setIsolationUri(vr.getIsolationUri().toString());
}
if (vr.getTrafficType() != null) {
nicResponse.setTrafficType(vr.getTrafficType().toString());
}
if (vr.getGuestType() != null) {
nicResponse.setType(vr.getGuestType().toString());
}
nicResponse.setIsDefault(vr.isDefaultNic());
nicResponse.setObjectName("nic");
vrData.addNic(nicResponse);
}
return vrData;
}
@Override
public List<DomainRouterJoinVO> searchByIds(Long... vrIds) {
// set detail batch query size
int DETAILS_BATCH_SIZE = 2000;
String batchCfg = _configDao.getValue("detail.batch.query.size");
if (batchCfg != null) {
DETAILS_BATCH_SIZE = Integer.parseInt(batchCfg);
}
// query details by batches
List<DomainRouterJoinVO> uvList = new ArrayList<DomainRouterJoinVO>();
// query details by batches
int curr_index = 0;
if (vrIds.length > DETAILS_BATCH_SIZE) {
while ((curr_index + DETAILS_BATCH_SIZE) <= vrIds.length) {
Long[] ids = new Long[DETAILS_BATCH_SIZE];
for (int k = 0, j = curr_index; j < curr_index + DETAILS_BATCH_SIZE; j++, k++) {
ids[k] = vrIds[j];
}
SearchCriteria<DomainRouterJoinVO> sc = vrSearch.create();
sc.setParameters("idIN", ids);
List<DomainRouterJoinVO> vms = searchIncludingRemoved(sc, null, null, false);
if (vms != null) {
uvList.addAll(vms);
}
curr_index += DETAILS_BATCH_SIZE;
}
}
if (curr_index < vrIds.length) {
int batch_size = (vrIds.length - curr_index);
// set the ids value
Long[] ids = new Long[batch_size];
for (int k = 0, j = curr_index; j < curr_index + batch_size; j++, k++) {
ids[k] = vrIds[j];
}
SearchCriteria<DomainRouterJoinVO> sc = vrSearch.create();
sc.setParameters("idIN", ids);
List<DomainRouterJoinVO> vms = searchIncludingRemoved(sc, null, null, false);
if (vms != null) {
uvList.addAll(vms);
}
}
return uvList;
}
@Override
public List<DomainRouterJoinVO> newDomainRouterView(VirtualRouter vr) {
SearchCriteria<DomainRouterJoinVO> sc = vrIdSearch.create();
sc.setParameters("id", vr.getId());
return searchIncludingRemoved(sc, null, null, false);
}
}
| {
"content_hash": "240df77af2dde2c243ac4eb61ad37f53",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 170,
"avg_line_length": 45.86759581881533,
"alnum_prop": 0.6143269522941355,
"repo_name": "DaanHoogland/cloudstack",
"id": "8252a2a5a18f730b305b9f061819c0f35aafc3eb",
"size": "13965",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "server/src/main/java/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "9979"
},
{
"name": "C#",
"bytes": "2356211"
},
{
"name": "CSS",
"bytes": "343148"
},
{
"name": "Dockerfile",
"bytes": "2375"
},
{
"name": "FreeMarker",
"bytes": "4887"
},
{
"name": "Groovy",
"bytes": "146420"
},
{
"name": "HTML",
"bytes": "153560"
},
{
"name": "Java",
"bytes": "36818077"
},
{
"name": "JavaScript",
"bytes": "8264908"
},
{
"name": "Python",
"bytes": "12533840"
},
{
"name": "Ruby",
"bytes": "22732"
},
{
"name": "SCSS",
"bytes": "362625"
},
{
"name": "Shell",
"bytes": "708848"
},
{
"name": "XSLT",
"bytes": "57835"
}
],
"symlink_target": ""
} |
package org.apache.shardingsphere.elasticjob.http.executor;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.executor.JobFacade;
import org.apache.shardingsphere.elasticjob.http.executor.fixture.InternalController;
import org.apache.shardingsphere.elasticjob.http.props.HttpJobProperties;
import org.apache.shardingsphere.elasticjob.infra.exception.JobConfigurationException;
import org.apache.shardingsphere.elasticjob.infra.exception.JobExecutionException;
import org.apache.shardingsphere.elasticjob.restful.NettyRestfulService;
import org.apache.shardingsphere.elasticjob.restful.NettyRestfulServiceConfiguration;
import org.apache.shardingsphere.elasticjob.restful.RestfulService;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public final class HttpJobExecutorTest {
private static final int PORT = 9876;
private static final String HOST = "localhost";
private static RestfulService restfulService;
@Mock
private ElasticJob elasticJob;
@Mock
private JobConfiguration jobConfig;
@Mock
private JobFacade jobFacade;
@Mock
private Properties properties;
@Mock
private ShardingContext shardingContext;
private HttpJobExecutor jobExecutor;
@BeforeClass
public static void init() {
NettyRestfulServiceConfiguration configuration = new NettyRestfulServiceConfiguration(PORT);
configuration.setHost(HOST);
configuration.addControllerInstances(new InternalController());
restfulService = new NettyRestfulService(configuration);
restfulService.startup();
}
@Before
public void setUp() {
when(jobConfig.getProps()).thenReturn(properties);
jobExecutor = new HttpJobExecutor();
}
@AfterClass
public static void close() {
if (null != restfulService) {
restfulService.shutdown();
}
}
@Test(expected = JobConfigurationException.class)
public void assertUrlEmpty() {
when(jobConfig.getProps().getProperty(HttpJobProperties.URI_KEY)).thenReturn("");
jobExecutor.process(elasticJob, jobConfig, jobFacade, shardingContext);
}
@Test(expected = JobConfigurationException.class)
public void assertMethodEmpty() {
when(jobConfig.getProps().getProperty(HttpJobProperties.URI_KEY)).thenReturn(getRequestUri("/getName"));
when(jobConfig.getProps().getProperty(HttpJobProperties.METHOD_KEY)).thenReturn("");
jobExecutor.process(elasticJob, jobConfig, jobFacade, shardingContext);
}
@Test
public void assertProcessWithoutSuccessCode() {
when(jobConfig.getProps().getProperty(HttpJobProperties.URI_KEY)).thenReturn(getRequestUri("/unknownMethod"));
when(jobConfig.getProps().getProperty(HttpJobProperties.METHOD_KEY)).thenReturn("GET");
when(jobConfig.getProps().getProperty(HttpJobProperties.DATA_KEY)).thenReturn("");
when(jobConfig.getProps().getProperty(HttpJobProperties.CONNECT_TIMEOUT_KEY, "3000")).thenReturn("4000");
when(jobConfig.getProps().getProperty(HttpJobProperties.READ_TIMEOUT_KEY, "5000")).thenReturn("5000");
jobExecutor.process(elasticJob, jobConfig, jobFacade, shardingContext);
}
@Test
public void assertProcessWithGet() {
when(jobConfig.getProps().getProperty(HttpJobProperties.URI_KEY)).thenReturn(getRequestUri("/getName"));
when(jobConfig.getProps().getProperty(HttpJobProperties.METHOD_KEY)).thenReturn("GET");
when(jobConfig.getProps().getProperty(HttpJobProperties.DATA_KEY)).thenReturn("");
when(jobConfig.getProps().getProperty(HttpJobProperties.CONNECT_TIMEOUT_KEY, "3000")).thenReturn("4000");
when(jobConfig.getProps().getProperty(HttpJobProperties.READ_TIMEOUT_KEY, "5000")).thenReturn("5000");
jobExecutor.process(elasticJob, jobConfig, jobFacade, shardingContext);
}
@Test
public void assertProcessHeader() {
when(jobConfig.getProps().getProperty(HttpJobProperties.URI_KEY)).thenReturn(getRequestUri("/getShardingContext"));
when(jobConfig.getProps().getProperty(HttpJobProperties.METHOD_KEY)).thenReturn("GET");
when(jobConfig.getProps().getProperty(HttpJobProperties.CONNECT_TIMEOUT_KEY, "3000")).thenReturn("4000");
when(jobConfig.getProps().getProperty(HttpJobProperties.READ_TIMEOUT_KEY, "5000")).thenReturn("5000");
jobExecutor.process(elasticJob, jobConfig, jobFacade, shardingContext);
}
@Test
public void assertProcessWithPost() {
when(jobConfig.getProps().getProperty(HttpJobProperties.URI_KEY)).thenReturn(getRequestUri("/updateName"));
when(jobConfig.getProps().getProperty(HttpJobProperties.METHOD_KEY)).thenReturn("POST");
when(jobConfig.getProps().getProperty(HttpJobProperties.DATA_KEY)).thenReturn("name=elasticjob");
when(jobConfig.getProps().getProperty(HttpJobProperties.CONNECT_TIMEOUT_KEY, "3000")).thenReturn("4000");
when(jobConfig.getProps().getProperty(HttpJobProperties.READ_TIMEOUT_KEY, "5000")).thenReturn("5000");
when(jobConfig.getProps().getProperty(HttpJobProperties.CONTENT_TYPE_KEY)).thenReturn("application/x-www-form-urlencoded");
jobExecutor.process(elasticJob, jobConfig, jobFacade, shardingContext);
}
@Test(expected = JobExecutionException.class)
public void assertProcessWithIOException() {
when(jobConfig.getProps().getProperty(HttpJobProperties.URI_KEY)).thenReturn(getRequestUri("/postWithTimeout"));
when(jobConfig.getProps().getProperty(HttpJobProperties.METHOD_KEY)).thenReturn("POST");
when(jobConfig.getProps().getProperty(HttpJobProperties.DATA_KEY)).thenReturn("name=elasticjob");
when(jobConfig.getProps().getProperty(HttpJobProperties.CONNECT_TIMEOUT_KEY, "3000")).thenReturn("1");
when(jobConfig.getProps().getProperty(HttpJobProperties.READ_TIMEOUT_KEY, "5000")).thenReturn("1");
jobExecutor.process(elasticJob, jobConfig, jobFacade, shardingContext);
}
@Test
public void assertGetType() {
assertThat(jobExecutor.getType(), is("HTTP"));
}
private String getRequestUri(final String path) {
return "http://" + HOST + ":" + PORT + path;
}
}
| {
"content_hash": "aca0f11cb8bd5f232d80b5381c96c030",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 131,
"avg_line_length": 45.87248322147651,
"alnum_prop": 0.7353328456474031,
"repo_name": "elasticjob/elastic-job",
"id": "c89b0fad2ac54c01ecf9aead1750bd854545edf8",
"size": "7636",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "elasticjob-ecosystem/elasticjob-executor/elasticjob-executor-type/elasticjob-http-executor/src/test/java/org/apache/shardingsphere/elasticjob/http/executor/HttpJobExecutorTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "553"
},
{
"name": "CSS",
"bytes": "102201"
},
{
"name": "HTML",
"bytes": "189227"
},
{
"name": "Java",
"bytes": "1743175"
},
{
"name": "JavaScript",
"bytes": "704805"
},
{
"name": "Shell",
"bytes": "1889"
}
],
"symlink_target": ""
} |
This is a very simple initial version of the app.
At this moment it only can use some linear algorithms, SquareLevels, Support Vector Regression and a basic linear regression based on Cumulative Moving Averages.
Next steps:
* apply something more sophisticated as prediction algorithm, being able to make a complete technical analysis of the stock historical values.
* gather information about the stock from Twitter and financial news, to build a sentiment graph around the stock, to affect the predictions.
* apply some ML to find patterns between the stock value evolution and other stocks in the same segment, to affect the predictions.
* ...¿?
## Installation
**Install PHP 7.2 and Git in your local machine** *(Example for Mac)*
Install Homebrew (package manager) if you don't have it yet, and install Git + PHP 7.2 + Composer:
```bash
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)`
$ brew install git php composer
```
**Download app and install all dependencies**
```bash
$ git clone https://github.com/obokaman-com/stock-forecast
$ cd stock-forecast
$ composer install
```
## Examples
#### Forecast
You can try it with `bin/console forecast:stock <base_currency> <stock/crypto code> <date_interval_magnitude (minutes/hours/days)>`
```bash
$ bin/console forecast:stock USD BTC days
```
This will generate a table with the historical price information and a prevision for the next period based in the historical data, giving you three estimations,
based on short-term, medium-term and long-term.
**Output:**
```
===== BUILDING FORECAST FOR BTC - USD USING DATA FROM LAST 30 days =====
Last real measurements:
+------------------+----------+----------+----------+------------+----------+----------+------------+---------------+
| Date | Open | Close | Change | Change (%) | High | Low | Volatility | Volume |
+------------------+----------+----------+----------+------------+----------+----------+------------+---------------+
| 2017-11-15 00:00 | 6597.06 | 7283.22 | 686.16 | 10.4% | 7330.06 | 6596.94 | 733.12 | 922828348.24 |
| 2017-11-16 00:00 | 7283.02 | 7853.68 | 570.66 | 7.84% | 7964.64 | 7119.17 | 845.47 | 1009996825.41 |
| ------...------- | --...--- | --...--- | ---...-- | ----...--- | ---...-- | ---...-- | ----...--- | -----...----- |
| 2017-12-13 00:00 | 17083.9 | 16286.82 | -797.08 | -4.67% | 17267.96 | 15669.86 | 1598.1 | 2575900534.34 |
| 2017-12-14 00:00 | 16286.82 | 16459.79 | 172.97 | 1.06% | 16941.08 | 16023.64 | 917.44 | 1744832688.08 |
+------------------+----------+----------+----------+------------+----------+----------+------------+---------------+
Forecast for next days:
+---------------+----------+----------+---------+------------+----------+----------+------------+---------------+
| Date interval | Open | Close | Change | Change (%) | High | Low | Volatility | Volume |
+---------------+----------+----------+---------+------------+----------+----------+------------+---------------+
| Short term | 16459.79 | 16014.7 | -445.09 | -2.7% | 17645.78 | 17189.89 | 455.88 | 1708072344.68 |
| Medium term | 16459.79 | 16648.77 | 188.98 | 1.15% | 19085.95 | 16795.52 | 2290.42 | 3094114369.44 |
| Long term | 16459.79 | 16886.1 | 426.31 | 2.59% | 17608.83 | 15276.44 | 2332.38 | 2923450650.25 |
+---------------+----------+----------+---------+------------+----------+----------+------------+---------------+
```
#### Insights & signals
You can try it with `bin/console forecast:signal <base_currency> <stock/crypto code> -t (optional for including forecast table)`
```bash
$ bin/console forecast:signals EUR ETC
```
This will output some signals and score built based on last month / day / hour for given currency / crypto pair, or the default pairs if
none are given.
**Output:**
```
===== SOME SIGNALS FOR EUR - ETC ON Jan 14th, 15:21h =====
Signals based on last hour (Score: 0):
- Stable in this period.
Signals based on last day (Score: -1):
- Loosing value in short term.
Signals based on last month (Score: 3):
- Improving exponentially.
- Recovering value in short term.
- Having a noticeable improvement recently (6.62%).
```
There is a `forecast:test` command too that allow you to test different predicition strategies with sample sequences.
#### Telegram bot (@CryptoInsightsBot)
You can use this project to run a robo-advisor using Telegram. You'll find some commands and callbacks implemented under `App/Controller/Telegram`
If you want to test with your own bot, you should add an environment variable called `TELEGRAM_BOT_TOKEN`, with your assigned token. More information about creating your own Telegram bot on https://core.telegram.org/bots
An example Telegram bot is running as @CryptoInsightsBot. You can test it at https://t.me/CryptoInsightsBot
It implements two simple commands:
* `/insights`: allow you to view signals for choosen currency - crypto pair
* `/subscribe`: allow you to receive real-time alerts with relevant signals for choosen currency - crypto pair signal.
 | {
"content_hash": "76c9699adfb4119d6d06757dcb88f6a1",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 221,
"avg_line_length": 47.285714285714285,
"alnum_prop": 0.5900679758308157,
"repo_name": "obokaman-com/stock-forecast",
"id": "e39914603c60b6295ebc3b23223ae2c41f714633",
"size": "5336",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "1126"
},
{
"name": "PHP",
"bytes": "120443"
}
],
"symlink_target": ""
} |
package io.Pushjet.api.Async;
import io.Pushjet.api.PushjetApi.PushjetService;
public interface RefreshServiceCallback {
void onComplete(PushjetService[] services);
}
| {
"content_hash": "adeb4746ab40c49d12b14858724728d1",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 48,
"avg_line_length": 21.75,
"alnum_prop": 0.7988505747126436,
"repo_name": "Pushjet/Pushjet-Android",
"id": "392347cbd7274874b8f9e2ff7e76ca31ce033678",
"size": "174",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/io/Pushjet/api/Async/RefreshServiceCallback.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Java",
"bytes": "92331"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Rhythmic Code</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/business-frontpage.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="inc/shim/Base64.js" type="text/javascript"></script>
<script src="inc/shim/Base64binary.js" type="text/javascript"></script>
<script src="inc/shim/WebAudioAPI.js" type="text/javascript"></script>
<!-- midi.js package -->
<script src="js/midi/audioDetect.js" type="text/javascript"></script>
<script src="js/midi/gm.js" type="text/javascript"></script>
<script src="js/midi/loader.js" type="text/javascript"></script>
<script src="js/midi/plugin.audiotag.js" type="text/javascript"></script>
<script src="js/midi/plugin.webaudio.js" type="text/javascript"></script>
<script src="js/midi/plugin.webmidi.js" type="text/javascript"></script>
<!-- utils -->
<script src="js/util/dom_request_xhr.js" type="text/javascript"></script>
<script src="js/util/dom_request_script.js" type="text/javascript"></script>
<script src="js/play.js" type="text/javascript"></script>
<script>
window.onload = function () {
MIDI.loadPlugin({
soundfontUrl: "./soundfont/",
instrument: ["acoustic_grand_piano","violin","flute"],
onprogress: function(state, progress) {
console.log(state, progress);
}
});
}
</script>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php">Rhythmic</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="activities.php">Lessons</a>
</li>
<li>
<a href="test.php">Activities</a>
</li>
<li>
<a href="#">About</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Image Background Page Header -->
<!-- Note: The background image is set within the business-casual.css file. -->
<!-- Page Content -->
<div class="container">
<hr>
<h4>Select Your Rhythm...!</h4>
<hr>
<div>
<?php include 'sidemenu.php'; ?>
</div>
<div class="col-lg-9">
<div class="col-lg-12">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Language <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="#">Js</a></li>
<li><a href="#">Python</a></li>
<li><a href="#">pseudo code</a></li>
</ul>
</div>
<div class="btn btn-success" onclick="tryIt()">Play</div>
</div>
<div class="col-lg-7">
<?php include "piano.php" ?>
</div>
<div class="col-lg-5">
<h1>if-else Statement</h1>
</div>
<div id="loadaction">
<div class="col-lg-12 textfields" >
<div class="col-lg-6 text01" id="editor">
var instrument="piano";
play("piano","C");
play("piano","C");
if(instrument=="piano"){
play("piano","G");
play("piano","G");
play("piano","G");
play("piano","G");
}
play("piano","C");
play("piano","C");
</div>
<script src="src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/javascript");
</script>
<div class="col-lg-6 text02" id="test">
Change value of the instrument variable to a value of your choice and play the script. Did you notice any Different?
<a onclick="f1()"> Next Step >></a>
</div>
</div>
</div>
</div>
<script>
function f1(){
$("#loadaction").load("ifelse2.php");
}
function f2(){
$("#loadaction").load("ifelse3.php");
}
</script>
<hr>
<!-- Footer -->
<footer>
<div class="row">
<div class="col-lg-12">
<p>Copyright © Rhythmic Code 2015 || Graphics from <a href="http://www.freepik.com">freepik.com</a></p>
</div>
</div>
<!-- /.row -->
</footer>
</div>
<!-- /.container -->
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "663cf3daf0e1e005fa230ae74cfd48df",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 148,
"avg_line_length": 33.34634146341463,
"alnum_prop": 0.48186073727325923,
"repo_name": "PMArtz92/rhythmicCode",
"id": "c6c66b31896cdf8b9c8aee90efcc4352d6201fed",
"size": "6836",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ifelse1.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1223"
},
{
"name": "HTML",
"bytes": "6613"
},
{
"name": "JavaScript",
"bytes": "23553924"
},
{
"name": "Ruby",
"bytes": "5953"
}
],
"symlink_target": ""
} |
require File.dirname(__FILE__) + '/test_helper'
require 'satellite'
# Hpricot search paths
def pages; search_body "//div[@id='page-list']/ul/li"; end
def uploads; search_body "//div[@id='upload-list']/ul/li"; end
describe 'A list page for a blank wiki' do
setup_and_teardown(:empty)
it 'should have a title' do
with @ctx do
get '/list'
should.be.ok
should.match '<h2>All pages and uploads</h2>'
end
end
it 'should not have any pages listed' do
with @ctx do
get '/list'
pages.should.be.empty
end
end
it 'should not have any uploads listed' do
with @ctx do
get '/list'
uploads.should.be.empty
end
end
end
describe 'A list page for a populated wiki' do
setup_and_teardown(:populated)
it 'should have a title' do
with @ctx do
get '/list'
should.be.ok
should.match '<h2>All pages and uploads</h2>'
end
end
it 'should have some pages listed' do
with @ctx do
get '/list'
pages.size.should.be > 0
end
end
it 'should list pages in (case-insensitive) alphabetical order, with Home first' do
with @ctx do
get '/list'
pages[0].to_s.should.match 'Home'
pages[1].to_s.should.match 'bazz'
pages[2].to_s.should.match 'Bozz'
pages[3].to_s.should.match 'Fizz'
end
end
it 'should have some uploads listed' do
with @ctx do
get '/list'
uploads.size.should.be > 0
end
end
it 'should list uploads in (case-insensitive) alphabetical order' do
with @ctx do
get '/list'
uploads[0].to_s.should.match 'Baaa.txt'
uploads[1].to_s.should.match 'blam.txt'
uploads[2].to_s.should.match 'Hello World.txt'
end
end
end
| {
"content_hash": "0250e0ae163977361cb9753fee1b3e6a",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 85,
"avg_line_length": 22.493506493506494,
"alnum_prop": 0.6224018475750578,
"repo_name": "kenpratt/satellite",
"id": "ffee1c1e236b8f48b10283bc0bf0e639327ea985",
"size": "1732",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/spec_list_page.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "63195"
},
{
"name": "Ruby",
"bytes": "76044"
}
],
"symlink_target": ""
} |
package com.microsoft.azure.applicationinsights.query.models;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Client performance information.
*/
public class EventsClientPerformanceInfo {
/**
* The name of the client performance.
*/
@JsonProperty(value = "name")
private String name;
/**
* Get the name of the client performance.
*
* @return the name value
*/
public String name() {
return this.name;
}
/**
* Set the name of the client performance.
*
* @param name the name value to set
* @return the EventsClientPerformanceInfo object itself.
*/
public EventsClientPerformanceInfo withName(String name) {
this.name = name;
return this;
}
}
| {
"content_hash": "0349584c13c11c415b864a0bdca3c9cc",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 62,
"avg_line_length": 21,
"alnum_prop": 0.6344916344916345,
"repo_name": "navalev/azure-sdk-for-java",
"id": "2edbd1bf59591c15de566d635db7e82e5a1f283c",
"size": "1007",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sdk/applicationinsights/microsoft-azure-applicationinsights-query/src/main/java/com/microsoft/azure/applicationinsights/query/models/EventsClientPerformanceInfo.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "7230"
},
{
"name": "CSS",
"bytes": "5411"
},
{
"name": "Groovy",
"bytes": "1570436"
},
{
"name": "HTML",
"bytes": "29221"
},
{
"name": "Java",
"bytes": "250218562"
},
{
"name": "JavaScript",
"bytes": "15605"
},
{
"name": "PowerShell",
"bytes": "30924"
},
{
"name": "Python",
"bytes": "42119"
},
{
"name": "Shell",
"bytes": "1408"
}
],
"symlink_target": ""
} |
package model;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import common.DBConnection;
/**
* Servlet implementation class AddComment
*/
@WebServlet("/AddComment")
public class AddComment extends HttpServlet {
private static final String STATEMENT_INSERT = "insert into USER_COMMENT_ITEM_ (ID,USER_ID,ITEM_ID,COMM,RATING, GOOD_TAGS, BAD_TAGS, DATA) values (?,?,?,?,?,?,?,?)";
private static final String STATEMENT_SELECT = "select * from USER_COMMENT_ITEM_ c join USER_ u on u.id = c.user_id where c.item_id = ?";
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public AddComment() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
response.setContentType("application/json");
response.setHeader("Cache-control", "no-cache, no-store");
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "-1");
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST");
response.setHeader("Access-Control-Allow-Headers", "Content-Type");
response.setHeader("Access-Control-Max-Age", "86400");
String comment = request.getParameter("comment");
String rating = request.getParameter("rating");
String productId = request.getParameter("product");
String goodTags = request.getParameter("goodTags");
String badTags = request.getParameter("badTags");
java.util.Date utilDate = new Date();
java.sql.Date date = new java.sql.Date((System.currentTimeMillis()));
System.out.println("taguri "+goodTags+badTags);
System.out.println("comment "+comment);
System.out.println("rating "+rating);
System.out.println("product "+productId);
String userId = (String) request.getSession().getAttribute("user_id");
String userProfilePicture =(String) request.getSession().getAttribute("urlImage");
System.out.println("image frm user "+userProfilePicture);
Connection connection = DBConnection.getConnection();
StringBuilder sb = new StringBuilder();
sb.append("");
sb.append( ((userId.hashCode()<0)? (userId.hashCode()*(-1)) : (userId.hashCode())) + (( comment.hashCode()<0) ?comment.hashCode()*(-1) : comment.hashCode()) );
String id = sb.toString();
try {
PreparedStatement pstmt = connection.prepareStatement(STATEMENT_INSERT);
pstmt.setString(1, id);
pstmt.setString(2, userId);
//System.out.println(new BigInteger(userName.trim().hashCode()).toString());
pstmt.setString(3, productId);
if (comment.equals(""))
{
pstmt.setString(4, "");
}else
pstmt.setString(4, comment);
if (rating.equals(""))
{
pstmt.setString(5, " ");
}
else pstmt.setString(5, rating);
pstmt.setString(6, goodTags);
pstmt.setString(7, badTags);
pstmt.setTimestamp(8, new Timestamp(System.currentTimeMillis()));
if ( !(rating.equals("") && comment.equals(" ") ))
{
pstmt.executeUpdate();
pstmt.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Gson jSon = new Gson();
JsonObject myObj = new JsonObject();
JsonElement element = null;
try {
element = jSon.toJsonTree(getComments(request,productId), new TypeToken<List<Comment>>() {}.getType());
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
myObj.addProperty("success", true);
myObj.add("comments", element);
out.println(myObj.toString());
System.out.println(myObj.toString());
out.close();
}
private List<Comment> getComments(HttpServletRequest request, String productId) throws SQLException
{
Connection connection = DBConnection.getConnection();
PreparedStatement st = null;
List<Comment> comments = new ArrayList<Comment>();
try {
st = (PreparedStatement) connection.prepareStatement(STATEMENT_SELECT);
st.setString(1, productId);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ResultSet resultSet = st.executeQuery();
while (resultSet.next())
{
String commentId = resultSet.getString(1);
String userID = resultSet.getString(2);
String comment = resultSet.getString(4);
String rating = resultSet.getString(5);
String goodTags = resultSet.getString(6);
String badTags = resultSet.getString(7);
java.sql.Timestamp date = resultSet.getTimestamp(8);
String userImage = resultSet.getString(12);
String userName = resultSet.getString(13);
System.out.println(comment+" "+userImage+" "+userName);
Comment commentObj = new Comment();
commentObj.setComment(comment);
commentObj.setRating(rating);
commentObj.setGoodTags(goodTags);
commentObj.setBadTags(badTags);
commentObj.setUserId(userID);
commentObj.setUserImage(userImage);
commentObj.setCommentId(commentId);
commentObj.setUserName(userName);
commentObj.setDate(date);
if (userID.equals(request.getSession().getAttribute("user_id")))
{
commentObj.setCanEdit("true");
}
else
{
commentObj.setCanEdit("false");
}
comments.add(commentObj);
System.out.println(comment+" meeeeh");
}
Collections.sort(comments);
return comments;
}
}
| {
"content_hash": "2a0270fbc5928e3e8d14ff4141b1e7d3",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 166,
"avg_line_length": 29.84304932735426,
"alnum_prop": 0.6927122464312547,
"repo_name": "rareschelmus/proiectCondr",
"id": "ee83c8a9175f7ed9098f48e898cf9512daade148",
"size": "6655",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Web/src/model/AddComment.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "237031"
},
{
"name": "HTML",
"bytes": "132544"
},
{
"name": "Java",
"bytes": "84005"
},
{
"name": "JavaScript",
"bytes": "60132"
},
{
"name": "Shell",
"bytes": "296"
}
],
"symlink_target": ""
} |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.devtestlabs.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactSourceInner;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/** The response of a list operation. */
@Fluent
public final class ArtifactSourceList {
@JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactSourceList.class);
/*
* Results of the list operation.
*/
@JsonProperty(value = "value")
private List<ArtifactSourceInner> value;
/*
* Link for next set of results.
*/
@JsonProperty(value = "nextLink")
private String nextLink;
/**
* Get the value property: Results of the list operation.
*
* @return the value value.
*/
public List<ArtifactSourceInner> value() {
return this.value;
}
/**
* Set the value property: Results of the list operation.
*
* @param value the value value to set.
* @return the ArtifactSourceList object itself.
*/
public ArtifactSourceList withValue(List<ArtifactSourceInner> value) {
this.value = value;
return this;
}
/**
* Get the nextLink property: Link for next set of results.
*
* @return the nextLink value.
*/
public String nextLink() {
return this.nextLink;
}
/**
* Set the nextLink property: Link for next set of results.
*
* @param nextLink the nextLink value to set.
* @return the ArtifactSourceList object itself.
*/
public ArtifactSourceList withNextLink(String nextLink) {
this.nextLink = nextLink;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (value() != null) {
value().forEach(e -> e.validate());
}
}
}
| {
"content_hash": "437c97527818c7464920a53389ef27b4",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 95,
"avg_line_length": 27.45679012345679,
"alnum_prop": 0.6560251798561151,
"repo_name": "Azure/azure-sdk-for-java",
"id": "f804d23214fd65e25ccd22b1e792da96a0b2b1d4",
"size": "2224",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSourceList.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "8762"
},
{
"name": "Bicep",
"bytes": "15055"
},
{
"name": "CSS",
"bytes": "7676"
},
{
"name": "Dockerfile",
"bytes": "2028"
},
{
"name": "Groovy",
"bytes": "3237482"
},
{
"name": "HTML",
"bytes": "42090"
},
{
"name": "Java",
"bytes": "432409546"
},
{
"name": "JavaScript",
"bytes": "36557"
},
{
"name": "Jupyter Notebook",
"bytes": "95868"
},
{
"name": "PowerShell",
"bytes": "737517"
},
{
"name": "Python",
"bytes": "240542"
},
{
"name": "Scala",
"bytes": "1143898"
},
{
"name": "Shell",
"bytes": "18488"
},
{
"name": "XSLT",
"bytes": "755"
}
],
"symlink_target": ""
} |
/* $chaos: capability.c,v 1.6 2002/10/24 21:52:22 per Exp $ */
/* Abstract: Capabilities support. */
/* Author: Per Lundberg <per@chaosdev.org> */
/* Copyright 2002 chaos development. */
/* Use freely under the terms listed in the file LICENSE. */
#include <storm/storm.h>
#include <storm/ia32/capability.h>
#include <storm/ia32/debug.h>
#include <storm/ia32/memory.h>
#include <storm/ia32/process.h>
#include <storm/ia32/spinlock.h>
#include <storm/ia32/string.h>
/* Find out whether the given capability is in the list. Inner
function for capability_has. */
static bool capability_find (capability_t *list,
const char *capability_class,
const char *capability_name)
{
while (list != NULL)
{
if (string_compare (capability_class, list->class) == 0 &&
string_compare (capability_name, list->name) == 0)
{
return TRUE;
}
list = (capability_t *) list->next;
}
return FALSE;
}
/* Has the current process the given capability. */
return_t capability_has (process_id_t process_id,
process_t *process_parameter,
const char *capability_class,
const char *capability_name, bool *result)
{
process_t *process;
if (process_parameter == NULL)
{
process = process_find (process_id);
}
else
{
process = process_parameter;
}
/* For bad code that doesn't check the return value, we start by
making it FALSE. */
*result = FALSE;
if (process == NULL)
{
return STORM_RETURN_INVALID_ARGUMENT;
}
/* Check input parameters. */
if (capability_class == NULL ||
capability_name == NULL)
{
return STORM_RETURN_INVALID_ARGUMENT;
}
if (string_length (capability_class) > CAPABILITY_CLASS_LENGTH - 1 ||
string_length (capability_name) > CAPABILITY_NAME_LENGTH - 1)
{
return STORM_RETURN_INVALID_ARGUMENT;
}
*result = capability_find (process->capability_list,
capability_class, capability_name);
/* Fall back to class::super_user. */
if (! *result)
{
*result = capability_find (process->capability_list,
capability_class, CAPABILITY_SUPER_USER);
}
/* Fall back to kernel::super_user (global super-user
capability). */
if (! *result)
{
*result = capability_find (process->capability_list,
CAPABILITY_CLASS_KERNEL,
CAPABILITY_SUPER_USER);
}
return STORM_RETURN_SUCCESS;
}
/* Add a capability to a process. */
return_t capability_add (process_id_t process_id,
process_t *process_parameter,
const char *capability_class,
const char *capability_name)
{
process_t *process;
if (process_parameter == NULL)
{
process = process_find (process_id);
}
else
{
process = process_parameter;
}
if (process == NULL)
{
return STORM_RETURN_INVALID_ARGUMENT;
}
capability_t *capability_list = process->capability_list;
capability_t *capability;
/* Check the input. */
if (capability_class == NULL ||
capability_name == NULL)
{
return STORM_RETURN_INVALID_ARGUMENT;
}
if (string_length (capability_class) > CAPABILITY_CLASS_LENGTH - 1 ||
string_length (capability_name) > CAPABILITY_NAME_LENGTH - 1)
{
return STORM_RETURN_INVALID_ARGUMENT;
}
return_t return_value = memory_global_allocate ((void **) &capability, sizeof (capability_t));
if (return_value != STORM_RETURN_SUCCESS)
{
return return_value;
}
string_copy (capability->class, capability_class);
string_copy (capability->name, capability_name);
capability->previous = (struct capability_t *) capability_list;
capability->next = NULL;
/* If we already have a list, add this capability to that list. */
if (capability_list != NULL)
{
capability_list->next = (struct capability_t *) capability;
}
/* Okay, things are set up properly. Now go ahead and add it to
the capability list that we have in the process. */
spin_lock_interrupt (&process->lock);
process->capability_list = capability;
spin_unlock (&process->lock);
return STORM_RETURN_NOT_IMPLEMENTED;
}
/* Clone a capability list. */
return_t capability_clone (capability_t **target,
capability_t *source)
{
if (target == NULL ||
source == NULL)
{
return STORM_RETURN_INVALID_ARGUMENT;
}
capability_t *list = source;
capability_t *capability;
while (list != NULL)
{
return_t return_value = memory_global_allocate ((void **) &capability,sizeof (capability_t));
if (return_value != STORM_RETURN_SUCCESS)
{
// FIXME: This is very bad, we will break in the
// middle. We should go through the list of what we've
// done so far and undo it.
return return_value;
}
if (*target != NULL)
{
(*target)->next = (struct capability_t *) capability;
}
capability->previous = (struct capability_t *) *target;
capability->next = NULL;
string_copy (capability->class, list->class);
string_copy (capability->name, list->name);
*target = capability;
list = (capability_t *) list->next;
}
return STORM_RETURN_SUCCESS;
}
| {
"content_hash": "8945a7a1d94b4413051576efec9eaedd",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 101,
"avg_line_length": 28.678391959798994,
"alnum_prop": 0.5785876993166287,
"repo_name": "chaos4ever/stormG3",
"id": "6556c0fe8547a1bc86381f8aa8c37bdcc75b311e",
"size": "5707",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "stormG3/source/ia32/capability.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "8282"
},
{
"name": "C",
"bytes": "656591"
},
{
"name": "C++",
"bytes": "19622"
},
{
"name": "Objective-C",
"bytes": "2801"
},
{
"name": "Perl",
"bytes": "4568"
},
{
"name": "Shell",
"bytes": "3229"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.honeycode.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.honeycode.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* AccessDeniedException JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AccessDeniedExceptionUnmarshaller extends EnhancedJsonErrorUnmarshaller {
private AccessDeniedExceptionUnmarshaller() {
super(com.amazonaws.services.honeycode.model.AccessDeniedException.class, "AccessDeniedException");
}
@Override
public com.amazonaws.services.honeycode.model.AccessDeniedException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {
com.amazonaws.services.honeycode.model.AccessDeniedException accessDeniedException = new com.amazonaws.services.honeycode.model.AccessDeniedException(
null);
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return accessDeniedException;
}
private static AccessDeniedExceptionUnmarshaller instance;
public static AccessDeniedExceptionUnmarshaller getInstance() {
if (instance == null)
instance = new AccessDeniedExceptionUnmarshaller();
return instance;
}
}
| {
"content_hash": "81bf3f433167d8c647b097c9f64a8676",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 158,
"avg_line_length": 35.93650793650794,
"alnum_prop": 0.6771201413427562,
"repo_name": "aws/aws-sdk-java",
"id": "52c13d42b5c0dfd680ed3d329ece5105f22b2c10",
"size": "2844",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-honeycode/src/main/java/com/amazonaws/services/honeycode/model/transform/AccessDeniedExceptionUnmarshaller.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.sunshine.app" >
<uses-feature android:name="android.hardware.type.watch" />
<!-- Required to act as a custom watch face. -->
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@android:style/Theme.DeviceDefault" >
<service
android:name=".WatchFace"
android:label="@string/my_digital_name"
android:permission="android.permission.BIND_WALLPAPER" >
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/preview_digital" />
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="@drawable/preview_digital_circular" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
| {
"content_hash": "e22222ae1d290874df027bf2111888a8",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 101,
"avg_line_length": 41.52173913043478,
"alnum_prop": 0.6193717277486911,
"repo_name": "TheUserFormerlyKnownAsBendix/Go-Ubiquitous",
"id": "d1838b9ff0f2114e859ac8e812fc9a9b9e69c2ea",
"size": "1910",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "watch/src/main/AndroidManifest.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "256362"
}
],
"symlink_target": ""
} |
ENV["SINATRA_ENV"] = "test"
require_relative '../config/environment'
# require 'spec_helper'
require_all 'spec/spec_helper'
# include RoutesHelper
# include TitlesHelper
# include TaglinesHelper | {
"content_hash": "1266e5680858bb427dbd8bf2fab559c6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 40,
"avg_line_length": 21.77777777777778,
"alnum_prop": 0.7602040816326531,
"repo_name": "lair001/a-most-byzantine-forum",
"id": "224c416b0251f83c7f13dc8ea1fc9d241e736b3b",
"size": "305",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/sinatra_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4693"
},
{
"name": "HTML",
"bytes": "27890"
},
{
"name": "JavaScript",
"bytes": "59"
},
{
"name": "Ruby",
"bytes": "162135"
}
],
"symlink_target": ""
} |
package com.tools.qaa.interfaces;
/**
* Author: Sergey Korol.
*/
import com.tools.qaa.annotations.HTML;
import org.openqa.selenium.WebDriver;
import java.lang.annotation.Annotation;
import java.lang.reflect.*;
import java.util.*;
import java.util.stream.Stream;
import static com.codepoetics.protonpack.StreamUtils.*;
import static org.springframework.util.ReflectionUtils.*;
import static org.apache.commons.lang3.ArrayUtils.*;
import static org.apache.commons.lang3.ClassUtils.*;
public interface ElementsSupplier {
default <T> void initElements(final T targetPage) {
final Stream<Class> pageChain = Stream.iterate(targetPage.getClass(), Class::getSuperclass);
takeWhile(pageChain, pageObject -> !pageObject.equals(Object.class))
.flatMap(pageObject -> Stream.of(pageObject.getDeclaredFields()))
.filter(field -> field.isAnnotationPresent(HTML.class))
.forEach(field -> initElement(targetPage, field, field.getAnnotation(HTML.class)));
}
default <T> void initElement(final T page, final Field field, final Annotation annotation) {
getSupportedDrivers()
.map(driver -> createInstance(field.getType(), add(getValues(annotation), 0, driver)))
.filter(Optional::isPresent)
.findAny()
.ifPresent(value -> {
makeAccessible(field);
setField(field, page, value.get());
});
}
@SuppressWarnings("unchecked")
default Optional<?> createInstance(final Class<?> classToInit, final Object... args) {
try {
return Optional.of(classToInit.getConstructor(Stream.of(args)
.map(arg -> convertType(arg.getClass(), WebDriver.class))
.toArray(Class<?>[]::new))
.newInstance(args));
} catch (Exception ignored) {
return Optional.empty();
}
}
default Object[] getValues(final Annotation annotation) {
try {
return Stream.of(annotation.annotationType().getDeclaredMethods())
.sorted(methodsComparator())
.map(method -> invokeMethod(method, annotation))
.toArray();
} catch (Exception ignored) {
return new Object[0];
}
}
default Comparator<Method> methodsComparator() {
return (m1, m2) -> m1.getName().compareTo(m2.getName());
}
default Class<?> convertType(final Class<?> fieldType, final Class<?>... types) {
if (isPrimitiveWrapper(fieldType)) {
return wrapperToPrimitive(fieldType);
}
return Stream.of(types)
.filter(type -> type.isAssignableFrom(fieldType) && !fieldType.equals(Object.class))
.findAny()
.orElse(fieldType);
}
Stream<?> getSupportedDrivers();
}
| {
"content_hash": "4a177c99d6aa13a1bd1ec5dd8aab36ba",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 94,
"avg_line_length": 31.1875,
"alnum_prop": 0.7158316633266533,
"repo_name": "atinfo/at.info-knowledge-base",
"id": "59aa23a540e6b220e5b5a216ea0ad11885fc07d3",
"size": "2495",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "functional test automation/webdriver/select2-wrapper/src/main/java/com/tools/qaa/interfaces/ElementsSupplier.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1752"
},
{
"name": "CSS",
"bytes": "5330"
},
{
"name": "HTML",
"bytes": "2624"
},
{
"name": "Java",
"bytes": "251903"
},
{
"name": "JavaScript",
"bytes": "86922"
},
{
"name": "Python",
"bytes": "17259"
},
{
"name": "RobotFramework",
"bytes": "1144"
},
{
"name": "Ruby",
"bytes": "860"
}
],
"symlink_target": ""
} |
package org.dhatim.safesql;
/**
* A query parameter requiring special literalization.
*/
public interface SafeSqlLiteralizable {
void appendLiteralized(SafeSqlBuilder sb);
}
| {
"content_hash": "b2eafaa342fbb185e166a4b1aadbd280",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 54,
"avg_line_length": 20.22222222222222,
"alnum_prop": 0.7692307692307693,
"repo_name": "dhatim/safesql",
"id": "b6187e1b300038ce89c0debf2ec4f2a517a9915f",
"size": "773",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "safesql/src/main/java/org/dhatim/safesql/SafeSqlLiteralizable.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "140342"
},
{
"name": "Shell",
"bytes": "947"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_151) on Wed May 02 00:35:11 MST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.wildfly.swarm.config.BatchJBeret (BOM: * : All 2018.5.0 API)</title>
<meta name="date" content="2018-05-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.wildfly.swarm.config.BatchJBeret (BOM: * : All 2018.5.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/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">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">WildFly Swarm API, 2018.5.0</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/config/class-use/BatchJBeret.html" target="_top">Frames</a></li>
<li><a href="BatchJBeret.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.wildfly.swarm.config.BatchJBeret" class="title">Uses of Class<br>org.wildfly.swarm.config.BatchJBeret</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.wildfly.swarm.batch.jberet">org.wildfly.swarm.batch.jberet</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#org.wildfly.swarm.config">org.wildfly.swarm.config</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.wildfly.swarm.batch.jberet">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a> in <a href="../../../../../org/wildfly/swarm/batch/jberet/package-summary.html">org.wildfly.swarm.batch.jberet</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation">
<caption><span>Subclasses of <a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a> in <a href="../../../../../org/wildfly/swarm/batch/jberet/package-summary.html">org.wildfly.swarm.batch.jberet</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/batch/jberet/BatchFraction.html" title="class in org.wildfly.swarm.batch.jberet">BatchFraction</a></span></code>
<div class="block">A batch (JSR-352) fraction implemented by JBeret.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.wildfly.swarm.config">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a> in <a href="../../../../../org/wildfly/swarm/config/package-summary.html">org.wildfly.swarm.config</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../../org/wildfly/swarm/config/package-summary.html">org.wildfly.swarm.config</a> with type parameters of type <a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a><T extends <a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a><T>></span></code>
<div class="block">Batch Subsystem (JSR-352)</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>interface </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/config/BatchJBeretConsumer.html" title="interface in org.wildfly.swarm.config">BatchJBeretConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a><T>></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>interface </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/config/BatchJBeretSupplier.html" title="interface in org.wildfly.swarm.config">BatchJBeretSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a>></span></code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/wildfly/swarm/config/package-summary.html">org.wildfly.swarm.config</a> that return <a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">BatchJBeret</a></code></td>
<td class="colLast"><span class="typeNameLabel">BatchJBeretSupplier.</span><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/config/BatchJBeretSupplier.html#get--">get</a></span>()</code>
<div class="block">Constructed instance of BatchJBeret resource</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/wildfly/swarm/config/BatchJBeret.html" title="class in org.wildfly.swarm.config">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">WildFly Swarm API, 2018.5.0</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/config/class-use/BatchJBeret.html" target="_top">Frames</a></li>
<li><a href="BatchJBeret.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 © 2018 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "a7cdbd8a6a83e17090ed7984fbbdf4be",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 375,
"avg_line_length": 47.63133640552996,
"alnum_prop": 0.6523800309597523,
"repo_name": "wildfly-swarm/wildfly-swarm-javadocs",
"id": "a0da01741bc1fd1d5df40fdda18ca20f03542867",
"size": "10336",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "2018.5.0/apidocs/org/wildfly/swarm/config/class-use/BatchJBeret.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
namespace {
constexpr char kCloseAction[] = "LensUnifiedSidePanel.HideSidePanel";
constexpr char kExpectedSidePanelContentUrlRegex[] =
".*ep=ccm&re=dcsp&s=csp&st=\\d+&p=somepayload&sideimagesearch=1";
constexpr char kExpectedNewTabContentUrlRegex[] = ".*p=somepayload";
// Maintains image search test state. In particular, note that |menu_observer_|
// must live until the right-click completes asynchronously.
class SearchImageWithUnifiedSidePanel : public InProcessBrowserTest {
protected:
void SetUp() override {
// The test server must start first, so that we know the port that the test
// server is using.
ASSERT_TRUE(embedded_test_server()->Start());
// Lens side panel throttle requests outside of the initial subdomain so
// need to set the HomepageURLForLens to be the same host as our embedded
// test server.
base::test::ScopedFeatureList features;
features.InitWithFeaturesAndParameters(
{{lens::features::kLensStandalone,
{{lens::features::kEnableSidePanelForLens.name, "true"},
{lens::features::kHomepageURLForLens.name,
GetLensImageSearchURL().spec()}}},
{features::kUnifiedSidePanel, {{}}},
{lens::features::kEnableImageSearchSidePanelFor3PDse, {{}}}},
{});
InProcessBrowserTest::SetUp();
}
void SetupUnifiedSidePanel() {
SetupAndLoadValidImagePage();
// Ensures that the lens side panel coordinator is open and is valid when
// running the search.
lens::CreateLensUnifiedSidePanelEntryForTesting(browser());
// The browser should open a side panel with the image.
AttemptLensImageSearch();
// We need to verify the contents before opening the side panel.
content::WebContents* contents =
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser());
// Wait for the side panel to open and finish loading web contents.
content::TestNavigationObserver nav_observer(contents);
nav_observer.Wait();
}
void SetupAndLoadValidImagePage() {
constexpr char kValidImage[] = "/image_search/valid.png";
SetupAndLoadImagePage(kValidImage);
}
void SetupAndLoadImagePage(const std::string& image_path) {
// Go to a page with an image in it. The test server doesn't serve the image
// with the right MIME type, so use a data URL to make a page containing it.
GURL image_url(embedded_test_server()->GetURL(image_path));
GURL page("data:text/html,<img src='" + image_url.spec() + "'>");
ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), page));
}
void AttemptLensImageSearch() {
// |menu_observer_| will cause the search lens for image menu item to be
// clicked.
menu_observer_ = std::make_unique<ContextMenuNotificationObserver>(
IDC_CONTENT_CONTEXT_SEARCHLENSFORIMAGE);
RightClickImage();
}
void Attempt3pDseImageSearch() {
// |menu_observer_| will cause the search web for image menu item to be
// clicked.
menu_observer_ = std::make_unique<ContextMenuNotificationObserver>(
IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE);
RightClickImage();
}
// Right-click where the image should be.
void RightClickImage() {
content::WebContents* tab =
browser()->tab_strip_model()->GetActiveWebContents();
content::SimulateMouseClickAt(tab, 0, blink::WebMouseEvent::Button::kRight,
gfx::Point(15, 15));
}
GURL GetImageSearchURL() {
constexpr char kImageSearchURL[] = "/imagesearch?p=somepayload";
return embedded_test_server()->GetURL(kImageSearchURL);
}
GURL GetLensImageSearchURL() {
constexpr char kLensImageSearchURL[] = "/imagesearch?p=somepayload&ep=ccm";
return embedded_test_server()->GetURL(kLensImageSearchURL);
}
GURL GetBadLensImageSearchURL() {
constexpr char kBadLensImageSearchURL[] = "/imagesearch";
return embedded_test_server()->GetURL(kBadLensImageSearchURL);
}
void SetupImageSearchEngine() {
constexpr char16_t kShortName[] = u"test";
constexpr char kSearchURL[] = "/search?q={searchTerms}";
constexpr char kImageSearchPostParams[] = "thumb={google:imageThumbnail}";
TemplateURLService* model =
TemplateURLServiceFactory::GetForProfile(browser()->profile());
ASSERT_TRUE(model);
search_test_utils::WaitForTemplateURLServiceToLoad(model);
ASSERT_TRUE(model->loaded());
TemplateURLData data;
data.SetShortName(kShortName);
data.SetKeyword(data.short_name());
data.SetURL(embedded_test_server()->GetURL(kSearchURL).spec());
data.image_url = GetImageSearchURL().spec();
data.image_url_post_params = kImageSearchPostParams;
data.side_image_search_param = "sideimagesearch";
TemplateURL* template_url = model->Add(std::make_unique<TemplateURL>(data));
ASSERT_TRUE(template_url);
model->SetUserSelectedDefaultSearchProvider(template_url);
}
void TearDownInProcessBrowserTestFixture() override {
menu_observer_.reset();
}
SidePanelCoordinator* GetSidePanelCoordinator() {
return BrowserView::GetBrowserViewForBrowser(browser())
->side_panel_coordinator();
}
LensSidePanelCoordinator* GetLensSidePanelCoordinator() {
return LensSidePanelCoordinator::GetOrCreateForBrowser(browser());
}
SidePanel* GetUnifiedSidePanel() {
auto* browser_view = BrowserView::GetBrowserViewForBrowser(browser());
return browser_view->unified_side_panel();
}
std::unique_ptr<ContextMenuNotificationObserver> menu_observer_;
base::UserActionTester user_action_tester;
};
IN_PROC_BROWSER_TEST_F(SearchImageWithUnifiedSidePanel,
ImageSearchWithValidImageOpensUnifiedSidePanel) {
SetupImageSearchEngine();
SetupUnifiedSidePanel();
EXPECT_TRUE(GetUnifiedSidePanel()->GetVisible());
content::WebContents* contents =
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser());
std::string expected_content = GetLensImageSearchURL().GetContent();
std::string side_panel_content = contents->GetLastCommittedURL().GetContent();
// Match strings up to the query.
std::size_t query_start_pos = side_panel_content.find("?");
EXPECT_EQ(expected_content.substr(0, query_start_pos),
side_panel_content.substr(0, query_start_pos));
EXPECT_TRUE(GetLensSidePanelCoordinator()->IsLaunchButtonEnabledForTesting());
// Match the query parameters, without the value of start_time.
EXPECT_THAT(side_panel_content,
testing::MatchesRegex(kExpectedSidePanelContentUrlRegex));
}
IN_PROC_BROWSER_TEST_F(SearchImageWithUnifiedSidePanel,
EnablesOpenInNewTabForLensErrorUrl) {
SetupUnifiedSidePanel();
EXPECT_TRUE(GetUnifiedSidePanel()->GetVisible());
// Make URL have payload param with no value ("p=")
auto error_url = embedded_test_server()->GetURL("/imagesearch?p=&ep=ccm");
auto url_params = content::OpenURLParams(
error_url, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB,
ui::PAGE_TRANSITION_LINK, false);
auto load_url_params =
content::NavigationController::LoadURLParams(url_params);
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser())
->GetController()
.LoadURLWithParams(load_url_params);
// Wait for the side panel to open and finish loading web contents.
content::TestNavigationObserver nav_observer(
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser()));
nav_observer.Wait();
EXPECT_TRUE(GetLensSidePanelCoordinator()->IsLaunchButtonEnabledForTesting());
}
IN_PROC_BROWSER_TEST_F(SearchImageWithUnifiedSidePanel,
EnablesOpenInNewTabForLensAlternateErrorUrl) {
SetupUnifiedSidePanel();
EXPECT_TRUE(GetUnifiedSidePanel()->GetVisible());
// Make URL have payload param with no value ("p=")
auto error_url = embedded_test_server()->GetURL("/imagesearch?p");
auto url_params = content::OpenURLParams(
error_url, content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB,
ui::PAGE_TRANSITION_LINK, false);
auto load_url_params =
content::NavigationController::LoadURLParams(url_params);
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser())
->GetController()
.LoadURLWithParams(load_url_params);
// Wait for the side panel to open and finish loading web contents.
content::TestNavigationObserver nav_observer(
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser()));
nav_observer.Wait();
EXPECT_TRUE(GetLensSidePanelCoordinator()->IsLaunchButtonEnabledForTesting());
}
IN_PROC_BROWSER_TEST_F(SearchImageWithUnifiedSidePanel,
EnablesOpenInNewTabForAnyUrlForNonGoogleDse) {
SetupImageSearchEngine();
SetupUnifiedSidePanel();
EXPECT_TRUE(GetUnifiedSidePanel()->GetVisible());
// Make URL have no payload param ("p=")
auto url =
content::OpenURLParams(GetBadLensImageSearchURL(), content::Referrer(),
WindowOpenDisposition::NEW_FOREGROUND_TAB,
ui::PAGE_TRANSITION_LINK, false);
auto load_url_params = content::NavigationController::LoadURLParams(url);
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser())
->GetController()
.LoadURLWithParams(load_url_params);
// Wait for the side panel to open and finish loading web contents.
content::TestNavigationObserver nav_observer(
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser()));
nav_observer.Wait();
EXPECT_TRUE(GetLensSidePanelCoordinator()->IsLaunchButtonEnabledForTesting());
}
IN_PROC_BROWSER_TEST_F(SearchImageWithUnifiedSidePanel,
ClosingSidePanelDeregistersLensViewAndLogsCloseMetric) {
SetupUnifiedSidePanel();
EXPECT_TRUE(GetUnifiedSidePanel()->GetVisible());
GetSidePanelCoordinator()->Close();
EXPECT_FALSE(GetUnifiedSidePanel()->GetVisible());
auto* last_active_entry =
GetSidePanelCoordinator()->GetCurrentSidePanelEntryForTesting();
EXPECT_EQ(last_active_entry, nullptr);
EXPECT_EQ(
GetSidePanelCoordinator()->GetGlobalSidePanelRegistry()->GetEntryForKey(
SidePanelEntry::Key(SidePanelEntry::Id::kLens)),
nullptr);
EXPECT_EQ(1, user_action_tester.GetActionCount(kCloseAction));
}
IN_PROC_BROWSER_TEST_F(SearchImageWithUnifiedSidePanel,
OpenInNewTabOpensInNewTabAndClosesSidePanel) {
SetupUnifiedSidePanel();
EXPECT_TRUE(GetUnifiedSidePanel()->GetVisible());
auto did_open_results =
GetLensSidePanelCoordinator()->OpenResultsInNewTabForTesting();
EXPECT_TRUE(did_open_results);
EXPECT_FALSE(GetUnifiedSidePanel()->GetVisible());
}
IN_PROC_BROWSER_TEST_F(SearchImageWithUnifiedSidePanel,
UserClickToSameDomainProceedsInSidePanel) {
SetupUnifiedSidePanel();
EXPECT_TRUE(GetUnifiedSidePanel()->GetVisible());
// Simulate a user click
GURL nav_url = embedded_test_server()->GetURL("/new_path");
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser())
->GetController()
.LoadURL(nav_url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
std::string());
// Wait for the side panel to finish loading web contents.
content::TestNavigationObserver nav_observer(
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser()));
nav_observer.Wait();
content::WebContents* contents =
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser());
auto side_panel_url = contents->GetLastCommittedURL();
EXPECT_EQ(side_panel_url, nav_url);
}
IN_PROC_BROWSER_TEST_F(SearchImageWithUnifiedSidePanel,
UserClickToSeperateDomainOpensNewTab) {
SetupUnifiedSidePanel();
EXPECT_TRUE(GetUnifiedSidePanel()->GetVisible());
ui_test_utils::AllBrowserTabAddedWaiter add_tab;
GURL nav_url = GURL("http://new.domain.com/");
auto* side_panel_contents =
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser());
// Simulate a user click
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser())
->GetController()
.LoadURL(nav_url, content::Referrer(), ui::PAGE_TRANSITION_LINK,
std::string());
// Get the result URL in the new tab to verify.
content::WebContents* new_tab = add_tab.Wait();
content::WaitForLoadStop(new_tab);
GURL side_panel_content = side_panel_contents->GetLastCommittedURL();
GURL new_tab_contents = new_tab->GetLastCommittedURL();
EXPECT_NE(side_panel_content, nav_url);
EXPECT_EQ(GetImageSearchURL().host(), side_panel_content.host());
EXPECT_EQ(new_tab_contents, nav_url);
}
class SearchImageWithSidePanel3PDseDisabled
: public SearchImageWithUnifiedSidePanel {
protected:
void SetUp() override {
// The test server must start first, so that we know the port that the test
// server is using.
ASSERT_TRUE(embedded_test_server()->Start());
base::test::ScopedFeatureList features;
features.InitWithFeaturesAndParameters(
{{lens::features::kLensStandalone,
{{lens::features::kEnableSidePanelForLens.name, "true"},
{lens::features::kHomepageURLForLens.name,
GetLensImageSearchURL().spec()}}},
{features::kUnifiedSidePanel, {{}}}},
{lens::features::kEnableImageSearchSidePanelFor3PDse});
InProcessBrowserTest::SetUp();
}
};
IN_PROC_BROWSER_TEST_F(SearchImageWithSidePanel3PDseDisabled,
ImageSearchFor3PDSEWithValidImageOpensInNewTab) {
SetupImageSearchEngine();
SetupAndLoadValidImagePage();
// Ensures that the lens side panel coordinator is open and is valid when
// running the search.
lens::CreateLensUnifiedSidePanelEntryForTesting(browser());
EXPECT_TRUE(GetUnifiedSidePanel()->GetVisible());
ui_test_utils::AllBrowserTabAddedWaiter add_tab;
// The browser should open in a new tab with the image.
Attempt3pDseImageSearch();
// Get the result URL in the new tab and verify.
content::WebContents* new_tab = add_tab.Wait();
content::WaitForLoadStop(new_tab);
std::string new_tab_content = new_tab->GetLastCommittedURL().GetContent();
EXPECT_THAT(new_tab_content,
testing::MatchesRegex(kExpectedNewTabContentUrlRegex));
content::WebContents* contents =
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser());
std::string side_panel_content = contents->GetLastCommittedURL().GetContent();
EXPECT_NE(side_panel_content, new_tab_content);
}
IN_PROC_BROWSER_TEST_F(SearchImageWithSidePanel3PDseDisabled,
ImageSearchForLensWithValidImageOpensInSidePanel) {
SetupImageSearchEngine();
SetupUnifiedSidePanel();
EXPECT_TRUE(GetUnifiedSidePanel()->GetVisible());
content::WebContents* contents =
lens::GetLensUnifiedSidePanelWebContentsForTesting(browser());
std::string expected_content = GetLensImageSearchURL().GetContent();
std::string side_panel_content = contents->GetLastCommittedURL().GetContent();
// Match strings up to the query.
std::size_t query_start_pos = side_panel_content.find("?");
EXPECT_EQ(expected_content.substr(0, query_start_pos),
side_panel_content.substr(0, query_start_pos));
EXPECT_TRUE(GetLensSidePanelCoordinator()->IsLaunchButtonEnabledForTesting());
// Match the query parameters, without the value of start_time.
EXPECT_THAT(side_panel_content,
testing::MatchesRegex(kExpectedSidePanelContentUrlRegex));
}
} // namespace
| {
"content_hash": "cc56fb2c7a57d6b060944a59145fbae3",
"timestamp": "",
"source": "github",
"line_count": 389,
"max_line_length": 80,
"avg_line_length": 39.53470437017995,
"alnum_prop": 0.721373301254958,
"repo_name": "chromium/chromium",
"id": "d5116d5189638e69e007b1e0e11fb964e58e5198",
"size": "17679",
"binary": false,
"copies": "5",
"ref": "refs/heads/main",
"path": "chrome/browser/ui/views/side_panel/lens/lens_side_panel_coordinator_browsertest.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
import argparse
import base64
import hashlib
import re
import os
import sys
def ComputeIntegrity(input_path):
hasher = hashlib.sha256()
with open(input_path, 'rb') as f:
hasher.update(f.read())
return base64.b64encode(hasher.digest())
def WriteHeader(input_paths_and_integrity, output_path):
with open(output_path, 'w') as f:
f.write('// DO NOT MODIFY THIS FILE DIRECTLY!\n')
f.write('// IT IS GENERATED BY generate_integrity_header.py\n')
f.write('// FROM:\n')
for (input_filename, _) in input_paths_and_integrity:
f.write('// * ' + input_filename + '\n')
f.write('\n')
for (input_filename, integrity) in input_paths_and_integrity:
define_name = re.sub('\W', '_', input_filename.upper())
define_name = define_name + '_INTEGRITY'
f.write('#define ' + define_name + ' "' + integrity.decode() + '"\n')
f.write('\n')
def main():
parser = argparse.ArgumentParser(
description='Generate a C++ header containing a sha256 checksum of the '
'input files.')
parser.add_argument('input_path', help='Path to an input file.', nargs='+')
parser.add_argument('--output_path', help='Path to an output header file.')
args = parser.parse_args()
input_paths = args.input_path
output_path = args.output_path
input_paths_and_integrity = [(os.path.basename(path), ComputeIntegrity(path))
for path in input_paths]
WriteHeader(input_paths_and_integrity, output_path)
return 0
if __name__ == '__main__':
sys.exit(main())
| {
"content_hash": "9af33d7af196f89558af8288fa52c2bd",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 79,
"avg_line_length": 28.51851851851852,
"alnum_prop": 0.6441558441558441,
"repo_name": "nwjs/chromium.src",
"id": "fcb8bdf3e5739ab6ca8b37709eb0f97b84f4541f",
"size": "1703",
"binary": false,
"copies": "6",
"ref": "refs/heads/nw70",
"path": "chrome/browser/search/tools/generate_integrity_header.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
package net.chrisrichardson.foodToGo.creditCardProcessing;
/**
* Gateway to the credit card processor
*/
public interface CreditCardProcessor {
public AuthorizationTransaction authorize(PaymentInformation info)
throws CreditCardProcessingException;
}
| {
"content_hash": "65020d4cf2ee3ac09a6e7569fc666462",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 70,
"avg_line_length": 20.5,
"alnum_prop": 0.7456445993031359,
"repo_name": "cer/pia",
"id": "efa6023b16fa23bbecda0c1584a21a35fb8cfbf1",
"size": "908",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pia-ch-03-domain-model/src/main/java/net/chrisrichardson/foodToGo/creditCardProcessing/CreditCardProcessor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "712638"
}
],
"symlink_target": ""
} |
package org.maziarz.jadeit.dao;
import org.maziarz.jadeit.model.Project;
public interface ProjectDao extends BaseDao<Project> {
}
| {
"content_hash": "a133a180a6c645f53509c138a97873ab",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 54,
"avg_line_length": 19,
"alnum_prop": 0.7969924812030075,
"repo_name": "kKEo/jadeit",
"id": "292eca5eba243a5d67a9da74345ac93db5356cbc",
"size": "133",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/maziarz/jadeit/dao/ProjectDao.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1313"
},
{
"name": "Java",
"bytes": "41680"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gluonhq.samples.connect.file" android:versionCode="1" android:versionName="1.0">
<supports-screens android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="21"/>
<application android:label="GluonConnectFileProvider" android:name="android.support.multidex.MultiDexApplication" android:icon="@mipmap/ic_launcher">
<activity android:name="javafxports.android.FXActivity" android:label="GluonConnectFileProvider" android:configChanges="orientation|screenSize">
<meta-data android:name="main.class" android:value="com.gluonhq.samples.connect.file.Main"/>
<meta-data android:name="debug.port" android:value="0"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
| {
"content_hash": "9bb6858b809688b5da10eb3e3ab4684d",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 162,
"avg_line_length": 78.27777777777777,
"alnum_prop": 0.652235628105039,
"repo_name": "erwin1/gluon-samples",
"id": "fac747b0bcf2712e9f84f62d40aa2a627b5f2a5c",
"size": "1409",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gluon-connect-file-provider/src/android/AndroidManifest.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "55251"
},
{
"name": "FreeMarker",
"bytes": "4223"
},
{
"name": "HTML",
"bytes": "20832"
},
{
"name": "Java",
"bytes": "868455"
},
{
"name": "Objective-C",
"bytes": "1968"
},
{
"name": "Scala",
"bytes": "23000"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.TeamFoundation.DistributedTask.WebApi;
using Microsoft.VisualStudio.Services.Agent.Util;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;
using Newtonsoft.Json;
using Pipelines = Microsoft.TeamFoundation.DistributedTask.Pipelines;
namespace Agent.Sdk
{
public interface IAgentTaskPlugin
{
Guid Id { get; }
string Version { get; }
string Stage { get; }
Task RunAsync(AgentTaskPluginExecutionContext executionContext, CancellationToken token);
}
public class AgentTaskPluginExecutionContext : ITraceWriter
{
private VssConnection _connection;
private readonly object _stdoutLock = new object();
public AgentTaskPluginExecutionContext()
{
this.Endpoints = new List<ServiceEndpoint>();
this.Inputs = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
this.Repositories = new List<Pipelines.RepositoryResource>();
this.TaskVariables = new Dictionary<string, VariableValue>(StringComparer.OrdinalIgnoreCase);
this.Variables = new Dictionary<string, VariableValue>(StringComparer.OrdinalIgnoreCase);
}
public List<ServiceEndpoint> Endpoints { get; set; }
public List<Pipelines.RepositoryResource> Repositories { get; set; }
public Dictionary<string, VariableValue> Variables { get; set; }
public Dictionary<string, VariableValue> TaskVariables { get; set; }
public Dictionary<string, string> Inputs { get; set; }
[JsonIgnore]
public VssConnection VssConnection
{
get
{
if (_connection == null)
{
_connection = InitializeVssConnection();
}
return _connection;
}
}
public VssConnection InitializeVssConnection()
{
var headerValues = new List<ProductInfoHeaderValue>();
headerValues.Add(new ProductInfoHeaderValue($"VstsAgentCore-Plugin", Variables.GetValueOrDefault("agent.version")?.Value ?? "Unknown"));
headerValues.Add(new ProductInfoHeaderValue($"({RuntimeInformation.OSDescription.Trim()})"));
if (VssClientHttpRequestSettings.Default.UserAgent != null && VssClientHttpRequestSettings.Default.UserAgent.Count > 0)
{
headerValues.AddRange(VssClientHttpRequestSettings.Default.UserAgent);
}
VssClientHttpRequestSettings.Default.UserAgent = headerValues;
var certSetting = GetCertConfiguration();
if (certSetting != null)
{
if (!string.IsNullOrEmpty(certSetting.ClientCertificateArchiveFile))
{
VssClientHttpRequestSettings.Default.ClientCertificateManager = new AgentClientCertificateManager(certSetting.ClientCertificateArchiveFile, certSetting.ClientCertificatePassword);
}
if (certSetting.SkipServerCertificateValidation)
{
VssClientHttpRequestSettings.Default.ServerCertificateValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
}
}
var proxySetting = GetProxyConfiguration();
if (proxySetting != null)
{
if (!string.IsNullOrEmpty(proxySetting.ProxyAddress))
{
VssHttpMessageHandler.DefaultWebProxy = new AgentWebProxy(proxySetting.ProxyAddress, proxySetting.ProxyUsername, proxySetting.ProxyPassword, proxySetting.ProxyBypassList);
}
}
ServiceEndpoint systemConnection = this.Endpoints.FirstOrDefault(e => string.Equals(e.Name, WellKnownServiceEndpointNames.SystemVssConnection, StringComparison.OrdinalIgnoreCase));
ArgUtil.NotNull(systemConnection, nameof(systemConnection));
ArgUtil.NotNull(systemConnection.Url, nameof(systemConnection.Url));
VssCredentials credentials = VssUtil.GetVssCredential(systemConnection);
ArgUtil.NotNull(credentials, nameof(credentials));
return VssUtil.CreateConnection(systemConnection.Url, credentials);
}
public string GetInput(string name, bool required = false)
{
string value = null;
if (this.Inputs.ContainsKey(name))
{
value = this.Inputs[name];
}
if (string.IsNullOrEmpty(value) && required)
{
throw new ArgumentNullException(name);
}
return value;
}
public void Info(string message)
{
Debug(message);
}
public void Verbose(string message)
{
#if DEBUG
Debug(message);
#else
string vstsAgentTrace = Environment.GetEnvironmentVariable("VSTSAGENT_TRACE");
if (!string.IsNullOrEmpty(vstsAgentTrace))
{
Debug(message);
}
#endif
}
public void Error(string message)
{
Output($"##vso[task.logissue type=error;]{Escape(message)}");
Output($"##vso[task.complete result=Failed;]");
}
public void Debug(string message)
{
Output($"##vso[task.debug]{Escape(message)}");
}
public void Warning(string message)
{
Output($"##vso[task.logissue type=warning;]{Escape(message)}");
}
public void Output(string message)
{
lock (_stdoutLock)
{
Console.WriteLine(message);
}
}
public void PrependPath(string directory)
{
PathUtil.PrependPath(directory);
Output($"##vso[task.prependpath]{Escape(directory)}");
}
public void Progress(int progress, string operation)
{
if (progress < 0 || progress > 100)
{
throw new ArgumentOutOfRangeException(nameof(progress));
}
Output($"##vso[task.setprogress value={progress}]{Escape(operation)}");
}
public void SetSecret(string secret)
{
Output($"##vso[task.setsecret]{Escape(secret)}");
}
public void SetVariable(string variable, string value, bool isSecret = false)
{
this.Variables[variable] = new VariableValue(value, isSecret);
Output($"##vso[task.setvariable variable={Escape(variable)};issecret={isSecret.ToString()};]{Escape(value)}");
}
public void SetTaskVariable(string variable, string value, bool isSecret = false)
{
this.TaskVariables[variable] = new VariableValue(value, isSecret);
Output($"##vso[task.settaskvariable variable={Escape(variable)};issecret={isSecret.ToString()};]{Escape(value)}");
}
public void Command(string command)
{
Output($"##[command]{Escape(command)}");
}
public AgentCertificateSettings GetCertConfiguration()
{
bool skipCertValidation = StringUtil.ConvertToBoolean(this.Variables.GetValueOrDefault("Agent.SkipCertValidation")?.Value);
string caFile = this.Variables.GetValueOrDefault("Agent.CAInfo")?.Value;
string clientCertFile = this.Variables.GetValueOrDefault("Agent.ClientCert")?.Value;
if (!string.IsNullOrEmpty(caFile) || !string.IsNullOrEmpty(clientCertFile) || skipCertValidation)
{
var certConfig = new AgentCertificateSettings();
certConfig.SkipServerCertificateValidation = skipCertValidation;
certConfig.CACertificateFile = caFile;
if (!string.IsNullOrEmpty(clientCertFile))
{
certConfig.ClientCertificateFile = clientCertFile;
string clientCertKey = this.Variables.GetValueOrDefault("Agent.ClientCertKey")?.Value;
string clientCertArchive = this.Variables.GetValueOrDefault("Agent.ClientCertArchive")?.Value;
string clientCertPassword = this.Variables.GetValueOrDefault("Agent.ClientCertPassword")?.Value;
certConfig.ClientCertificatePrivateKeyFile = clientCertKey;
certConfig.ClientCertificateArchiveFile = clientCertArchive;
certConfig.ClientCertificatePassword = clientCertPassword;
certConfig.VssClientCertificateManager = new AgentClientCertificateManager(clientCertArchive, clientCertPassword);
}
return certConfig;
}
else
{
return null;
}
}
public AgentWebProxySettings GetProxyConfiguration()
{
string proxyUrl = this.Variables.GetValueOrDefault("Agent.ProxyUrl")?.Value;
if (!string.IsNullOrEmpty(proxyUrl))
{
string proxyUsername = this.Variables.GetValueOrDefault("Agent.ProxyUsername")?.Value;
string proxyPassword = this.Variables.GetValueOrDefault("Agent.ProxyPassword")?.Value;
List<string> proxyBypassHosts = StringUtil.ConvertFromJson<List<string>>(this.Variables.GetValueOrDefault("Agent.ProxyBypassList")?.Value ?? "[]");
return new AgentWebProxySettings()
{
ProxyAddress = proxyUrl,
ProxyUsername = proxyUsername,
ProxyPassword = proxyPassword,
ProxyBypassList = proxyBypassHosts,
WebProxy = new AgentWebProxy(proxyUrl, proxyUsername, proxyPassword, proxyBypassHosts)
};
}
else
{
return null;
}
}
private string Escape(string input)
{
foreach (var mapping in _commandEscapeMappings)
{
input = input.Replace(mapping.Key, mapping.Value);
}
return input;
}
private Dictionary<string, string> _commandEscapeMappings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{
";", "%3B"
},
{
"\r", "%0D"
},
{
"\n", "%0A"
},
{
"]", "%5D"
},
};
}
}
| {
"content_hash": "5108bceac9f946b02066849841019ddb",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 199,
"avg_line_length": 38.255319148936174,
"alnum_prop": 0.6016870596959585,
"repo_name": "kasubram/vsts-agent",
"id": "71322abbaf26373a38a00fa58137e3c6fb34d491",
"size": "10790",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Agent.Sdk/TaskPlugin.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "5134"
},
{
"name": "C#",
"bytes": "3235107"
},
{
"name": "HTML",
"bytes": "4543"
},
{
"name": "JavaScript",
"bytes": "3935"
},
{
"name": "PowerShell",
"bytes": "71748"
},
{
"name": "Shell",
"bytes": "69073"
},
{
"name": "xBase",
"bytes": "638"
}
],
"symlink_target": ""
} |
package io.github.proxyprint.kitchen.models.printshops;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import java.util.Objects;
/**
*
* @author josesousa
*/
@Entity
@Table(name = "register_requests")
public class RegisterRequest implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false, name = "manager_name")
private String managerName;
@Column(nullable = false, name = "manager_username")
private String managerUsername;
@Column(nullable = false, name = "manager_email")
private String managerEmail;
@Column(nullable = false, name = "manager_password")
private String managerPassword;
@Column(nullable = false, name = "pshop_address")
private String pShopAddress;
@Column(nullable = false, name = "pshop_latitude")
private Double pShopLatitude;
@Column(nullable = false, name = "pshop_longitude")
private Double pShopLongitude;
@Column(nullable = false, name = "pshop_nif")
private String pShopNIF;
@Column(nullable = false, name = "pshop_name")
private String pShopName;
@JsonIgnore
@Column(nullable = false, name = "accepted")
private boolean accepted = false;
@Column(nullable = false, name = "pshop_date_request")
private String pShopDateRequest;
@Column(nullable = true, name = "pshop_date_request_accepted")
private String pShopDateRequestAccepted;
public RegisterRequest() {
// Return a Calendar based on default Locale and TimeZone
this.pShopDateRequest = GregorianCalendarToString((GregorianCalendar) GregorianCalendar.getInstance());
this.pShopDateRequestAccepted = null;
}
public RegisterRequest(String managerName, String managerUsername, String managerEmail, String managerPassword, String pShopAddress, Double pShopLatitude, Double pShopLongitude, String pShopNIF, String pShopName, boolean accepted) {
this.managerName = managerName;
this.managerUsername = managerUsername;
this.managerEmail = managerEmail;
this.managerPassword = managerPassword;
this.pShopAddress = pShopAddress;
this.pShopLatitude = pShopLatitude;
this.pShopLongitude = pShopLongitude;
this.pShopNIF = pShopNIF;
this.pShopName = pShopName;
this.accepted = accepted;
this.pShopDateRequest = GregorianCalendarToString((GregorianCalendar) GregorianCalendar.getInstance());
this.pShopDateRequestAccepted = null;
}
public long getId() {
return id;
}
public String getManagerName() {
return managerName;
}
public void setManagerName(String managerName) {
this.managerName = managerName;
}
public void setId(long id) {
this.id = id;
}
public String getManagerUsername() {
return managerUsername;
}
public void setManagerUsername(String managerUsername) {
this.managerUsername = managerUsername;
}
public String getManagerEmail() {
return managerEmail;
}
public void setManagerEmail(String managerEmail) {
this.managerEmail = managerEmail;
}
public String getManagerPassword() {
return managerPassword;
}
public void setManagerPassword(String managerPassword) {
this.managerPassword = managerPassword;
}
public String getpShopAddress() {
return pShopAddress;
}
public void setpShopAddress(String pShopAddress) {
this.pShopAddress = pShopAddress;
}
public Double getpShopLatitude() {
return pShopLatitude;
}
public void setpShopLatitude(Double pShopLatitude) {
this.pShopLatitude = pShopLatitude;
}
public Double getpShopLongitude() {
return pShopLongitude;
}
public void setpShopLongitude(Double pShopLongitude) {
this.pShopLongitude = pShopLongitude;
}
public String getpShopNIF() {
return pShopNIF;
}
public void setpShopNIF(String pShopNIF) {
this.pShopNIF = pShopNIF;
}
public String getpShopName() {
return pShopName;
}
public void setpShopName(String pShopName) {
this.pShopName = pShopName;
}
public boolean isAccepted() {
return accepted;
}
public void setAccepted(boolean accepted) {
this.accepted = accepted;
}
public String getpShopDateRequest() {
return pShopDateRequest;
}
public String getpShopDateRequestAccepted() {
return pShopDateRequestAccepted;
}
public void setpShopDateRequestAccepted(GregorianCalendar date) {
this.pShopDateRequestAccepted = GregorianCalendarToString(date);
}
public RegisterRequest(long id, String managerName, String managerUsername, String managerEmail, String managerPassword, String pShopAddress, Double pShopLatitude, Double pShopLongitude, String pShopNIF, String pShopName, String pShopDateRequest, String pShopDateRequestAccepted) {
this.id = id;
this.managerName = managerName;
this.managerUsername = managerUsername;
this.managerEmail = managerEmail;
this.managerPassword = managerPassword;
this.pShopAddress = pShopAddress;
this.pShopLatitude = pShopLatitude;
this.pShopLongitude = pShopLongitude;
this.pShopNIF = pShopNIF;
this.pShopName = pShopName;
this.pShopDateRequest = pShopDateRequest;
this.pShopDateRequestAccepted = pShopDateRequestAccepted;
}
@Override
public String toString() {
return "RegisterRequest{" + "id=" + id + ", managerName=" + managerName + ", managerUsername=" + managerUsername + ", managerEmail=" + managerEmail + ", managerPassword=" + managerPassword + ", pShopAddress=" + pShopAddress + ", pShopLatitude=" + pShopLatitude + ", pShopLongitude=" + pShopLongitude + ", pShopNIF=" + pShopNIF + ", pShopName=" + pShopName + ", accepted=" + accepted + ", pShopDateRequest=" + pShopDateRequest + ", pShopDateRequestAccepted=" + pShopDateRequestAccepted + '}';
}
@Override
public int hashCode() {
int hash = 5;
hash = 67 * hash + (int) (this.id ^ (this.id >>> 32));
hash = 67 * hash + Objects.hashCode(this.managerName);
hash = 67 * hash + Objects.hashCode(this.managerUsername);
hash = 67 * hash + Objects.hashCode(this.managerEmail);
hash = 67 * hash + Objects.hashCode(this.managerPassword);
hash = 67 * hash + Objects.hashCode(this.pShopAddress);
hash = 67 * hash + Objects.hashCode(this.pShopLatitude);
hash = 67 * hash + Objects.hashCode(this.pShopLongitude);
hash = 67 * hash + Objects.hashCode(this.pShopNIF);
hash = 67 * hash + Objects.hashCode(this.pShopName);
hash = 67 * hash + (this.accepted ? 1 : 0);
hash = 67 * hash + Objects.hashCode(this.pShopDateRequest);
hash = 67 * hash + Objects.hashCode(this.pShopDateRequestAccepted);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final RegisterRequest other = (RegisterRequest) obj;
if (this.id != other.id) {
return false;
}
if (this.accepted != other.accepted) {
return false;
}
if (!Objects.equals(this.managerName, other.managerName)) {
return false;
}
if (!Objects.equals(this.managerUsername, other.managerUsername)) {
return false;
}
if (!Objects.equals(this.managerEmail, other.managerEmail)) {
return false;
}
if (!Objects.equals(this.managerPassword, other.managerPassword)) {
return false;
}
if (!Objects.equals(this.pShopAddress, other.pShopAddress)) {
return false;
}
if (!Objects.equals(this.pShopNIF, other.pShopNIF)) {
return false;
}
if (!Objects.equals(this.pShopName, other.pShopName)) {
return false;
}
if (!Objects.equals(this.pShopDateRequest, other.pShopDateRequest)) {
return false;
}
if (!Objects.equals(this.pShopDateRequestAccepted, other.pShopDateRequestAccepted)) {
return false;
}
if (!Objects.equals(this.pShopLatitude, other.pShopLatitude)) {
return false;
}
if (!Objects.equals(this.pShopLongitude, other.pShopLongitude)) {
return false;
}
return true;
}
/**
* From GregoriaCalendar to String.
*
* @param c, GregorianCalendar instance
* @return Well formated string for display
*/
private String GregorianCalendarToString(GregorianCalendar c) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm");
sdf.setCalendar(c);
String dateFormatted = sdf.format(c.getTime());
return dateFormatted;
}
}
| {
"content_hash": "7aa6251067a4767671f9e5c11c42fa8d",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 499,
"avg_line_length": 33.72727272727273,
"alnum_prop": 0.6520754716981132,
"repo_name": "EMResearch/EMB",
"id": "6729161a227a84ae41c2cc93b583512c9d20909f",
"size": "9924",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jdk_8_maven/cs/rest/original/proxyprint/src/main/java/io/github/proxyprint/kitchen/models/printshops/RegisterRequest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "17751"
},
{
"name": "C#",
"bytes": "314780"
},
{
"name": "CSS",
"bytes": "155749"
},
{
"name": "Dockerfile",
"bytes": "6278"
},
{
"name": "EJS",
"bytes": "13193"
},
{
"name": "HTML",
"bytes": "1980397"
},
{
"name": "Java",
"bytes": "13878146"
},
{
"name": "JavaScript",
"bytes": "4551141"
},
{
"name": "Kotlin",
"bytes": "62153"
},
{
"name": "Less",
"bytes": "29035"
},
{
"name": "Lex",
"bytes": "1418"
},
{
"name": "Perl",
"bytes": "82062"
},
{
"name": "Procfile",
"bytes": "26"
},
{
"name": "Pug",
"bytes": "3626"
},
{
"name": "Python",
"bytes": "129221"
},
{
"name": "Ruby",
"bytes": "683"
},
{
"name": "Shell",
"bytes": "51395"
},
{
"name": "Smarty",
"bytes": "2380"
},
{
"name": "Starlark",
"bytes": "23296"
},
{
"name": "TSQL",
"bytes": "4320"
},
{
"name": "Thrift",
"bytes": "1245"
},
{
"name": "TypeScript",
"bytes": "701370"
},
{
"name": "XSLT",
"bytes": "18724"
}
],
"symlink_target": ""
} |
DropdownToggle is a simple directive which will toggle a dropdown link on click.
Simply put it on the <code><a></code> tag of the toggler-element,
and it will find the nearest dropdown menu and toggle it when the <code><a class="dropdown-toggle"></code> is clicked. | {
"content_hash": "336b4a739be37d61e29d0a1c67626b78",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 124,
"avg_line_length": 93,
"alnum_prop": 0.7598566308243727,
"repo_name": "angular-dart-ui/bootstrap",
"id": "d913a40d5c07ad5df1c0b1116267eab6f4c4975d",
"size": "279",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/dropdown_toggle/dropdownToggleDemo.doc.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "5838"
},
{
"name": "Dart",
"bytes": "57095"
},
{
"name": "JavaScript",
"bytes": "1883"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
using System.Linq;
namespace System.Windows.Controls.WpfPropertyGrid
{
internal static class PropertyGridUtils
{
public static IEnumerable<T> GetAttributes<T>(object target)
{
if (target == null) throw new ArgumentNullException("target");
return GetAttributes<T>(target.GetType());
}
public static IEnumerable<T> GetAttributes<T>(Type type)
{
if (type == null) throw new ArgumentNullException("type");
var attributes =
from T attribute
in type.GetCustomAttributes(typeof(T), true)
select attribute;
return attributes;
}
}
}
| {
"content_hash": "4767b00e0c9bfc9bd328538ae4a05e80",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 68,
"avg_line_length": 24.333333333333332,
"alnum_prop": 0.6666666666666666,
"repo_name": "DenisVuyka/WPG",
"id": "3b9cb827221293e1d2486409ed40b4f505ebd9bb",
"size": "1258",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Main/WpfPropertyGrid/PropertyGridUtils.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "459349"
}
],
"symlink_target": ""
} |
import PageManager from './page-manager';
import $ from 'jquery';
import _ from 'lodash';
import giftCertCheck from './common/gift-certificate-validator';
import utils from '@bigcommerce/stencil-utils';
import ShippingEstimator from './cart/shipping-estimator';
import { defaultModal } from './global/modal';
export default class Cart extends PageManager {
loaded(next) {
this.$cartContent = $('[data-cart-content]');
this.$cartMessages = $('[data-cart-status]');
this.$cartTotals = $('[data-cart-totals]');
this.$overlay = $('[data-cart] .loadingOverlay')
.hide(); // TODO: temporary until roper pulls in his cart components
this.bindEvents();
next();
}
cartUpdate($target) {
const itemId = $target.data('cart-itemid');
const $el = $(`#qty-${itemId}`);
const oldQty = parseInt($el.val(), 10);
const maxQty = parseInt($el.data('quantity-max'), 10);
const minQty = parseInt($el.data('quantity-min'), 10);
const minError = $el.data('quantity-min-error');
const maxError = $el.data('quantity-max-error');
const newQty = $target.data('action') === 'inc' ? oldQty + 1 : oldQty - 1;
// Does not quality for min/max quantity
if (newQty < minQty) {
return alert(minError);
} else if (newQty > maxQty) {
return alert(maxError);
}
this.$overlay.show();
utils.api.cart.itemUpdate(itemId, newQty, (err, response) => {
this.$overlay.hide();
if (response.data.status === 'succeed') {
// if the quantity is changed "1" from "0", we have to remove the row.
const remove = (newQty === 0);
this.refreshContent(remove);
} else {
$el.val(oldQty);
alert(response.data.errors.join('\n'));
}
});
}
cartRemoveItem(itemId) {
this.$overlay.show();
utils.api.cart.itemRemove(itemId, (err, response) => {
if (response.data.status === 'succeed') {
this.refreshContent(true);
} else {
alert(response.data.errors.join('\n'));
}
});
}
cartEditOptions(itemId) {
const modal = defaultModal();
const options = {
template: 'cart/modals/configure-product',
};
modal.open();
utils.api.productAttributes.configureInCart(itemId, options, (err, response) => {
modal.updateContent(response.content);
this.bindGiftWrappingForm();
});
utils.hooks.on('product-option-change', (event, option) => {
const $changedOption = $(option);
const $form = $changedOption.parents('form');
const $submit = $('input.button', $form);
const $messageBox = $('.alertMessageBox');
const item = $('[name="item_id"]', $form).attr('value');
utils.api.productAttributes.optionChange(item, $form.serialize(), (err, result) => {
const data = result.data || {};
if (err) {
alert(err);
return false;
}
if (data.purchasing_message) {
$('p.alertBox-message', $messageBox).text(data.purchasing_message);
$submit.prop('disabled', true);
$messageBox.show();
} else {
$submit.prop('disabled', false);
$messageBox.hide();
}
if (!data.purchasable || !data.instock) {
$submit.prop('disabled', true);
} else {
$submit.prop('disabled', false);
}
});
});
}
refreshContent(remove) {
const $cartItemsRows = $('[data-item-row]', this.$cartContent);
const $cartPageTitle = $('[data-cart-page-title]');
const options = {
template: {
content: 'cart/content',
totals: 'cart/totals',
pageTitle: 'cart/page-title',
statusMessages: 'cart/status-messages',
},
};
this.$overlay.show();
// Remove last item from cart? Reload
if (remove && $cartItemsRows.length === 1) {
return window.location.reload();
}
utils.api.cart.getContent(options, (err, response) => {
this.$cartContent.html(response.content);
this.$cartTotals.html(response.totals);
this.$cartMessages.html(response.statusMessages);
$cartPageTitle.replaceWith(response.pageTitle);
this.bindEvents();
this.$overlay.hide();
const quantity = $('[data-cart-quantity]', this.$cartContent).data('cart-quantity') || 0;
$('body').trigger('cart-quantity-update', quantity);
});
}
bindCartEvents() {
const debounceTimeout = 400;
const cartUpdate = _.bind(_.debounce(this.cartUpdate, debounceTimeout), this);
const cartRemoveItem = _.bind(_.debounce(this.cartRemoveItem, debounceTimeout), this);
// cart update
$('[data-cart-update]', this.$cartContent).on('click', (event) => {
const $target = $(event.currentTarget);
event.preventDefault();
// update cart quantity
cartUpdate($target);
});
$('.cart-remove', this.$cartContent).on('click', (event) => {
const itemId = $(event.currentTarget).data('cart-itemid');
const openTime = new Date();
const result = confirm($(event.currentTarget).data('confirm-delete'));
const delta = new Date() - openTime;
event.preventDefault();
// Delta workaround for Chrome's "prevent popup"
if (!result && delta > 10) {
return;
}
// remove item from cart
cartRemoveItem(itemId);
});
$('[data-item-edit]', this.$cartContent).on('click', (event) => {
const itemId = $(event.currentTarget).data('item-edit');
event.preventDefault();
// edit item in cart
this.cartEditOptions(itemId);
});
}
bindPromoCodeEvents() {
const $couponContainer = $('.coupon-code');
const $couponForm = $('.coupon-form');
const $codeInput = $('[name="couponcode"]', $couponForm);
$('.coupon-code-add').on('click', (event) => {
event.preventDefault();
$(event.currentTarget).hide();
$couponContainer.show();
$('.coupon-code-cancel').show();
$codeInput.focus();
});
$('.coupon-code-cancel').on('click', (event) => {
event.preventDefault();
$couponContainer.hide();
$('.coupon-code-cancel').hide();
$('.coupon-code-add').show();
});
$couponForm.on('submit', (event) => {
const code = $codeInput.val();
event.preventDefault();
// Empty code
if (!code) {
return alert($codeInput.data('error'));
}
utils.api.cart.applyCode(code, (err, response) => {
if (response.data.status === 'success') {
this.refreshContent();
} else {
alert(response.data.errors.join('\n'));
}
});
});
}
bindGiftCertificateEvents() {
const $certContainer = $('.gift-certificate-code');
const $certForm = $('.cart-gift-certificate-form');
const $certInput = $('[name="certcode"]', $certForm);
$('.gift-certificate-add').on('click', (event) => {
event.preventDefault();
$(event.currentTarget).toggle();
$certContainer.toggle();
$('.gift-certificate-cancel').toggle();
});
$('.gift-certificate-cancel').on('click', (event) => {
event.preventDefault();
$certContainer.toggle();
$('.gift-certificate-add').toggle();
$('.gift-certificate-cancel').toggle();
});
$certForm.on('submit', (event) => {
const code = $certInput.val();
event.preventDefault();
if (!giftCertCheck(code)) {
return alert($certInput.data('error'));
}
utils.api.cart.applyGiftCertificate(code, (err, resp) => {
if (resp.data.status === 'success') {
this.refreshContent();
} else {
alert(resp.data.errors.join('\n'));
}
});
});
}
bindGiftWrappingEvents() {
const modal = defaultModal();
$('[data-item-giftwrap]').on('click', (event) => {
const itemId = $(event.currentTarget).data('item-giftwrap');
const options = {
template: 'cart/modals/gift-wrapping-form',
};
event.preventDefault();
modal.open();
utils.api.cart.getItemGiftWrappingOptions(itemId, options, (err, response) => {
modal.updateContent(response.content);
this.bindGiftWrappingForm();
});
});
}
bindGiftWrappingForm() {
$('.giftWrapping-select').change((event) => {
const $select = $(event.currentTarget);
const id = $select.val();
const index = $select.data('index');
if (!id) {
return;
}
const allowMessage = $select.find(`option[value=${id}]`).data('allow-message');
$(`.giftWrapping-image-${index}`).hide();
$(`#giftWrapping-image-${index}-${id}`).show();
if (allowMessage) {
$(`#giftWrapping-message-${index}`).show();
} else {
$(`#giftWrapping-message-${index}`).hide();
}
});
$('.giftWrapping-select').trigger('change');
function toggleViews() {
const value = $('input:radio[name ="giftwraptype"]:checked').val();
const $singleForm = $('.giftWrapping-single');
const $multiForm = $('.giftWrapping-multiple');
if (value === 'same') {
$singleForm.show();
$multiForm.hide();
} else {
$singleForm.hide();
$multiForm.show();
}
}
$('[name="giftwraptype"]').click(toggleViews);
toggleViews();
}
bindEvents() {
this.bindCartEvents();
this.bindPromoCodeEvents();
this.bindGiftWrappingEvents();
this.bindGiftCertificateEvents();
// initiate shipping estimator module
this.shippingEstimator = new ShippingEstimator($('[data-shipping-estimator]'));
}
}
| {
"content_hash": "51c1cb0bf26c8284fec63924d46e4b32",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 101,
"avg_line_length": 32.442815249266864,
"alnum_prop": 0.5043839826448522,
"repo_name": "aaronrodier84/rouxbrands",
"id": "18cd984cf450b62c49a279b2c7c0fa0d1f56e4eb",
"size": "11063",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "assets/js/theme/cart.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "342381"
},
{
"name": "HTML",
"bytes": "411203"
},
{
"name": "JavaScript",
"bytes": "202357"
},
{
"name": "Ruby",
"bytes": "291"
}
],
"symlink_target": ""
} |
FROM balenalib/hummingboard-debian:bullseye-build
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
\
# .NET Core dependencies
libc6 \
libgcc1 \
libgssapi-krb5-2 \
libicu67 \
libssl1.1 \
libstdc++6 \
zlib1g \
&& rm -rf /var/lib/apt/lists/*
# Configure web servers to bind to port 80 when present
ENV ASPNETCORE_URLS=http://+:80 \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true
# Install .NET Core
ENV DOTNET_VERSION 3.1.21
RUN curl -SL --output dotnet.tar.gz "https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$DOTNET_VERSION/dotnet-runtime-$DOTNET_VERSION-linux-arm.tar.gz" \
&& dotnet_sha512='9c3fb0f5f860f53ab4d15124c2c23a83412ea916ad6155c0f39f066057dcbb3ca6911ae26daf8a36dbfbc09c17d6565c425fbdf3db9114a28c66944382b71000' \
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
ENV ASPNETCORE_VERSION 3.1.21
RUN curl -SL --output aspnetcore.tar.gz "https://dotnetcli.blob.core.windows.net/dotnet/aspnetcore/Runtime/$ASPNETCORE_VERSION/aspnetcore-runtime-$ASPNETCORE_VERSION-linux-arm.tar.gz" \
&& aspnetcore_sha512='3f7e1839946c65c437a8b55f1f66b15f8faa729abd19874cb2507c10fb5ae6a572c7d4943141b8a450ee74082c3719d4f146c79f2fabf48716ff28be2720effa' \
&& echo "$aspnetcore_sha512 aspnetcore.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf aspnetcore.tar.gz -C /usr/share/dotnet ./shared/Microsoft.AspNetCore.App \
&& rm aspnetcore.tar.gz
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/44e597e40f2010cdde15b3ba1e397aea3a5c5271/scripts/assets/tests/test-stack@dotnet.sh" \
&& echo "Running test-stack@dotnet" \
&& chmod +x test-stack@dotnet.sh \
&& bash test-stack@dotnet.sh \
&& rm -rf test-stack@dotnet.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Bullseye \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \ndotnet 3.1-aspnet \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | {
"content_hash": "dbb9fe4477a0dbcc31e3f9427142e52d",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 683,
"avg_line_length": 55.607142857142854,
"alnum_prop": 0.7154784842646115,
"repo_name": "resin-io-library/base-images",
"id": "a6fe651e4a0363d4c45c985df1c0809241649f2b",
"size": "3135",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/dotnet/hummingboard/debian/bullseye/3.1-aspnet/build/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "71234697"
},
{
"name": "JavaScript",
"bytes": "13096"
},
{
"name": "Shell",
"bytes": "12051936"
},
{
"name": "Smarty",
"bytes": "59789"
}
],
"symlink_target": ""
} |
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.235
//
// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
// der Code neu generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BLPExample.Properties
{
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
// über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BLPExample.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
| {
"content_hash": "230bd02a9fae5b08c2e2d1ed6ee76df0",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 176,
"avg_line_length": 41.74647887323944,
"alnum_prop": 0.6251686909581646,
"repo_name": "icyblade/aleph",
"id": "419d0d9d6d34f38427b6b620c79746f644ed1060",
"size": "2974",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CASCExplorer/SereniaBLPLib/BLPExample/Properties/Resources.Designer.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "24455"
},
{
"name": "C#",
"bytes": "726542"
},
{
"name": "C++",
"bytes": "612242"
},
{
"name": "Python",
"bytes": "26314"
},
{
"name": "Shell",
"bytes": "180"
}
],
"symlink_target": ""
} |
layout: post
categories: [music, blogovision, blogovision2013]
share: true
comments: true
title: 'No.05 Moonface - Julia With Blue Jeans On'
date: '2013-12-16T23:27:00+01:00'
tags: [albums, blogovision2013]
redirect_from: "/blog/blogovision2013-no05/"
link: http://themicronaut.tumblr.com/post/70227687177/blogovision2013-no05
---
(check content on tumblr, click on the title of the post)
#The complete list:
* [#02 The National - Trouble Will Find Me](/music/blogovision/blogovision2013/blogovision2013-no02)
* [#03 Chelsea Wolfe - Pain is Beauty](/music/blogovision/blogovision2013/blogovision2013-no03)
* [#04 Lanterns on the Lake - Until The Colours Run](/music/blogovision/blogovision2013/blogovision2013-no04)
* [#05 Moonface - Julia With Blue Jeans On](/music/blogovision/blogovision2013/blogovision2013-no05)
* [#06 Phosphorescent - Muchacho](/music/blogovision/blogovision2013/blogovision2013-no06)
* [#07 Russian Circles - Memorial](/music/blogovision/blogovision2013/blogovision2013-no07)
* [#08 ERAAS - Initiation](/music/blogovision/blogovision2013/blogovision2013-no08)
* [#09 Laura Marling - Once I Was an Eagle](/music/blogovision/blogovision2013/blogovision2013-no09)
* [#10 Agnes Obel - Aventine](/music/blogovision/blogovision2013/blogovision2013-no10)
* [#11 Darkside - Psychic](/music/blogovision/blogovision2013/blogovision2013-no11)
* [#12 Arctic Monkeys - AM](/music/blogovision/blogovision2013/blogovision2013-no12)
* [#13 Emily Jane White - Blood / Lines](/music/blogovision/blogovision2013/blogovision2013-no13)
* [#14 IAMX - The Unified Field](/music/blogovision/blogovision2013/blogovision2013-no14)
* [#15 Torres - TORRES](/music/blogovision/blogovision2013/blogovision2013-no15)
* [#16 Haruko - Feathers & Driftwood](/music/blogovision/blogovision2013/blogovision2013-no16)
* [#17 Arcade Fire - Reflektor](/music/blogovision/blogovision2013/blogovision2013-no17)
* [#18 Low - The Invisible Way](/music/blogovision/blogovision2013/blogovision2013-no18)
* [#19 Vàli - Skoglandskap](/music/blogovision/blogovision2013/blogovision2013-no19)
* [#20 Bastille - Bad Blood](/music/blogovision/blogovision2013/blogovision2013-no20)
#Check also this…
* [#Blogovision: The Roaring Twenties](/music/blogovision/blogovision2013/the-roaring-twenties)
* [#Blogovision: The Dirty Thirties](/music/blogovision/blogovision2013/blogovision-the-dirty-thirties)
* [#Blogovision: The Beauty Above 40](/music/blogovision/blogovision2013/beauty-above-40)
* [#Blogovision: Notable outcasts from my Top50 (part-2)](/music/blogovision/blogovision2013/notable-outcasts-part2)
* [#Blogovision: Notable outcasts from my Top50 (part-1)](/music/blogovision/blogovision2013/notable-outcasts-part1)
* [#Blogovision : My own list of 2013 nominees (albums)](/music/blogovision/blogovision2013/blogovision-my-own-list-of-2013-nominees-albums) | {
"content_hash": "dbe56c91a0aedd13b3ee6c8ae86f1908",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 140,
"avg_line_length": 66.06976744186046,
"alnum_prop": 0.7888067581837381,
"repo_name": "TheMicronaut/TheMicronaut.github.io",
"id": "72584ff63f8544161e992dec554d061388def239",
"size": "2848",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/_blogovision2013/blogovision2013-no05.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "512"
},
{
"name": "CSS",
"bytes": "97650"
},
{
"name": "HTML",
"bytes": "85303"
},
{
"name": "JavaScript",
"bytes": "89888"
},
{
"name": "Ruby",
"bytes": "1432"
}
],
"symlink_target": ""
} |
package org.jbpm.workbench.ht.client.editors.taskcomments;
import java.util.Date;
import com.google.gwtmockito.GwtMockitoTestRunner;
import org.jbpm.workbench.ht.client.editors.taskcomments.TaskCommentsPresenter.TaskCommentsView;
import org.jbpm.workbench.ht.model.events.TaskRefreshedEvent;
import org.jbpm.workbench.ht.model.events.TaskSelectionEvent;
import org.jbpm.workbench.ht.service.TaskService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.uberfire.mocks.CallerMock;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;
@RunWith(GwtMockitoTestRunner.class)
public class TaskCommentsPresenterTest {
private static final Long TASK_ID = 1L;
private static final Long COMMENT_ID = 1L;
private CallerMock<TaskService> callerMock;
@Mock
private TaskService commentsServiceMock;
@Mock
private TaskCommentsView viewMock;
//Thing under test
private TaskCommentsPresenter presenter;
@Before
public void setupMocks() {
//Mock that actually calls the callbacks
callerMock = new CallerMock<TaskService>(commentsServiceMock);
presenter = new TaskCommentsPresenter(viewMock,
callerMock);
}
@Test
public void commentsUpdatedWhenTaskSelectedOrRefreshed() {
//When task selected
presenter.onTaskSelectionEvent(new TaskSelectionEvent(TASK_ID));
//Then comments for given task loaded & comment grid refreshed
verify(commentsServiceMock).getTaskComments(null,
null,
TASK_ID);
verify(viewMock).redrawDataGrid();
//When task Refreshed
presenter.onTaskRefreshedEvent(new TaskRefreshedEvent(TASK_ID));
//Then comments for given task loaded & comment grid refreshed
verify(commentsServiceMock,
times(2)).getTaskComments(null,
null,
TASK_ID);
verify(viewMock,
times(2)).redrawDataGrid();
}
@Test
public void emptyCommentNotAccepted() {
//when comment input area is empty and add button is clicked
presenter.addTaskComment("");
//No comment is added toTaskCommentService
verify(commentsServiceMock,
never())
.addTaskComment(anyString(),
anyString(),
anyLong(),
anyString(),
any(Date.class));
//User notified
verify(viewMock).displayNotification("CommentCannotBeEmpty");
}
@Test
public void commentInputClearedAfterCommetAdded() {
String comment = "Working on it, man.";
presenter.addTaskComment(comment);
// Comment added
verify(commentsServiceMock)
.addTaskComment(anyString(),
anyString(),
anyLong(),
eq(comment),
any(Date.class));
// Input cleared
verify(viewMock).clearCommentInput();
}
@Test
public void removeCommentAdded() {
presenter.removeTaskComment(COMMENT_ID);
// Comment removed
verify(commentsServiceMock)
.deleteTaskComment(anyString(),
anyString(),
anyLong(),
eq(COMMENT_ID));
// Input cleared
verify(viewMock).clearCommentInput();
verify(commentsServiceMock).getTaskComments(anyString(),
anyString(),
anyLong());
verify(viewMock).redrawDataGrid();
}
}
| {
"content_hash": "59b74ccac8c019d3ed67fc44241450cb",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 96,
"avg_line_length": 33.92622950819672,
"alnum_prop": 0.5822662478859628,
"repo_name": "rbarriuso/jbpm-wb",
"id": "2216376f6d3ca88a648748c3dafa125168ba6cb8",
"size": "4760",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jbpm-wb-human-tasks/jbpm-wb-human-tasks-client/src/test/java/org/jbpm/workbench/ht/client/editors/taskcomments/TaskCommentsPresenterTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "33090"
},
{
"name": "FreeMarker",
"bytes": "2262"
},
{
"name": "HTML",
"bytes": "77130"
},
{
"name": "Java",
"bytes": "2871118"
},
{
"name": "Visual Basic",
"bytes": "18136"
}
],
"symlink_target": ""
} |
<def-group>
<definition class="compliance" id="aide_periodic_cron_checking" version="1">
<metadata>
<title>Configure Periodic Execution of AIDE</title>
<affected family="unix">
<platform>Red Hat Enterprise Linux 6</platform>
<platform>Red Hat Enterprise Linux 7</platform>
</affected>
<description>By default, AIDE does not install itself for periodic
execution. Periodically running AIDE is necessary to reveal
unexpected changes in installed files.
</description>
<reference source="galford" ref_id="20140808" ref_url="test_attestation" />
</metadata>
<criteria operator="OR">
<extend_definition comment="Aide is installed" negate="true" definition_ref="package_aide_installed" />
<criterion comment="run aide daily with cron" test_ref="test_aide_periodic_cron_checking" />
<criterion comment="run aide daily with cron" test_ref="test_aide_crond_checking" />
</criteria>
</definition>
<ind:textfilecontent54_test check="all" check_existence="all_exist" comment="run aide daily with cron" id="test_aide_periodic_cron_checking" version="1">
<ind:object object_ref="object_test_aide_periodic_cron_checking" />
</ind:textfilecontent54_test>
<ind:textfilecontent54_object comment="run aide daily with cron" id="object_test_aide_periodic_cron_checking" version="1">
<ind:filepath>/etc/crontab</ind:filepath>
<ind:pattern operation="pattern match">^[0-9]*[\s]*[0-9]*[\s]*\*[\s]*\*[\s]*\*[\s]*root[\s]*/usr/sbin/aide[\s]*\-\-check+$</ind:pattern>
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
</ind:textfilecontent54_object>
<ind:textfilecontent54_test check="all" check_existence="all_exist" comment="run aide daily with cron" id="test_aide_crond_checking" version="1">
<ind:object object_ref="object_test_aide_crond_checking" />
</ind:textfilecontent54_test>
<ind:textfilecontent54_object comment="run aide daily with cron" id="object_test_aide_crond_checking" version="1">
<ind:path>/etc/cron.d</ind:path>
<ind:filename operation="pattern match">^.*$</ind:filename>
<ind:pattern operation="pattern match">^[0-9]*[\s]*[0-9]*[\s]*\*[\s]*\*[\s]*\*[\s]*root[\s]*/usr/sbin/aide[\s]*\-\-check+$</ind:pattern>
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
</ind:textfilecontent54_object>
</def-group>
| {
"content_hash": "e8decfd3b683d53ea2ff1ff680db2f1e",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 155,
"avg_line_length": 60.375,
"alnum_prop": 0.6919254658385093,
"repo_name": "ykhodorkovskiy/clip",
"id": "ec675f597cf8b1856d01a66a300cd7fe174a55df",
"size": "2415",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "packages/scap-security-guide/scap-security-guide-0.1.20/shared/oval/aide_periodic_cron_checking.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "209"
},
{
"name": "C",
"bytes": "13809"
},
{
"name": "Groff",
"bytes": "246662"
},
{
"name": "HTML",
"bytes": "1333"
},
{
"name": "Makefile",
"bytes": "88495"
},
{
"name": "Python",
"bytes": "95048"
},
{
"name": "Shell",
"bytes": "17539"
}
],
"symlink_target": ""
} |
package eu.freme.broker.security;
import java.io.IOException;
import java.util.ArrayList;
import javax.annotation.PostConstruct;
import javax.servlet.Filter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.security.access.AccessDecisionVoter;
import org.springframework.security.access.vote.AffirmativeBased;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.ProviderNotFoundException;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
import eu.freme.broker.security.tools.PasswordHasher;
import eu.freme.common.persistence.model.User;
import eu.freme.common.persistence.repository.UserRepository;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
/**
* @author Jan Nehring - jan.nehring@dfki.de
*/
@Configuration
@EnableWebMvcSecurity
@EnableScheduling
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter implements
ApplicationContextAware {
Logger logger = Logger.getLogger(SecurityConfig.class);
@Autowired
UserRepository userRepository;
@Value("${admin.username:default}")
private String adminUsername;
@Value("${admin.password:default}")
private String adminPassword;
@Value("${admin.create:false}")
private boolean createAdminUser;
@PostConstruct
public void init() {
// create or promote admin user if it does not exist
if( createAdminUser && adminUsername != null){
createAdminUser();
}
}
private void createAdminUser(){
User admin = userRepository.findOneByName(adminUsername);
if (admin == null) {
logger.info("create new admin user");
String saltedHashedPassword;
try {
saltedHashedPassword = PasswordHasher
.getSaltedHash(adminPassword);
} catch (Exception e) {
logger.error(e);
return;
}
admin = new User(adminUsername, saltedHashedPassword,
User.roleAdmin);
userRepository.save(admin);
} else if (!admin.getRole().equals(User.roleAdmin)) {
logger.info("promote user and change password");
admin.setRole(User.roleAdmin);
String saltedHashedPassword;
try {
saltedHashedPassword = PasswordHasher
.getSaltedHash(adminPassword);
} catch (Exception e) {
logger.error(e);
return;
}
admin.setPassword(saltedHashedPassword);
userRepository.save(admin);
}
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.exceptionHandling()
.authenticationEntryPoint(unauthorizedEntryPoint());
AuthenticationFilter authenticationFilter = new AuthenticationFilter(authenticationManager());
//FilterRegistrationBean registration = new FilterRegistrationBean(authenticationFilter);
//registration.setOrder(0);
http.addFilterBefore(authenticationFilter,
BasicAuthenticationFilter.class).addFilterBefore(
new ManagementEndpointAuthenticationFilter(
authenticationManager()),
BasicAuthenticationFilter.class);
}
@Bean
public AuthenticationManager authenticationManager() {
return new AuthenticationManager() {
@Autowired
AuthenticationProvider[] authenticationProviders;
@Override
public Authentication authenticate(Authentication authentication)
throws ProviderNotFoundException {
for (AuthenticationProvider auth : authenticationProviders) {
if (auth.supports(authentication.getClass())) {
return auth.authenticate(authentication);
}
}
throw new ProviderNotFoundException(
"No AuthenticationProvider found for "
+ authentication.getClass());
}
};
}
@Bean
public TokenService tokenService() {
return new TokenService();
}
@Bean
public AuthenticationProvider databaseAuthenticationProvider() {
return new DatabaseAuthenticationProvider();
}
@Bean
public AuthenticationProvider tokenAuthenticationProvider() {
return new TokenAuthenticationProvider(tokenService());
}
@Bean
public AuthenticationEntryPoint unauthorizedEntryPoint() {
return new AuthenticationEntryPoint() {
@Override
public void commence(HttpServletRequest request,
HttpServletResponse response,
AuthenticationException authException) throws IOException,
ServletException {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
}
};
}
@Autowired
@Qualifier(AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME)
Filter securityFilter;
@Bean
public FilterRegistrationBean securityFilterChain() {
FilterRegistrationBean registration = new FilterRegistrationBean(securityFilter);
registration.setOrder(0);
registration
.setName(AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME);
return registration;
}
/*
@Bean
public AffirmativeBased defaultAccessDecisionManager() {
@SuppressWarnings("rawtypes")
ArrayList<AccessDecisionVoter> list = new ArrayList<AccessDecisionVoter>();
list.add(new UserAccessDecisionVoter());
list.add(new OwnedResourceAccessDecisionVoter());
AffirmativeBased ab = new AffirmativeBased(list);
return ab;
}
@Bean
public AccessLevelHelper accessLevelHelper() {
return new AccessLevelHelper();
}
*/
} | {
"content_hash": "521bd7c849ef96458c334e060ed0b901",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 102,
"avg_line_length": 32.453658536585365,
"alnum_prop": 0.7985871035623027,
"repo_name": "freme-project/Broker",
"id": "c9798d1b5010a3542ed07cf0dc802bc86aa0a0e1",
"size": "7480",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/eu/freme/broker/security/SecurityConfig.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "304703"
},
{
"name": "Java",
"bytes": "371047"
},
{
"name": "Shell",
"bytes": "5450"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<title>django-treenav</title>
<style type="text/css">
body {
font-family: Arial, "MS Trebuchet", sans-serif;
}
a {
color: blue;
}
a.active-menu-item-link {
color: green;
}
ul {
background-color: #EEE;
}
</style>
</head>
<body>
{% load treenav_tags %}
<h1>django-treenav</h1>
<p>
To view a demo, create a new menu tree in the Django <a href='{% url 'admin:index' %}'>admin</a> and
set the root MenuItem slug to "primary-nav", and its link to "/". Create as many child
MenuItems under the root making sure that the link values for each child is a valid
child link of its parent. For example, you could create a root MenuItem with a link of
"/", a child of the root with a link of "/one", and a child of that with a link of
"/one/two". Django Treenav uses the values in the links to determine where in the
hierarchy you are.
</p>
<h2>show_treenav</h2>
{% show_treenav "primary-nav" %}
<h2>single_level_menu</h2>
<h3>Level 0</h3>
{% single_level_menu "primary-nav" 0 %}
<h3>Level 1</h3>
{% single_level_menu "primary-nav" 1 %}
<h2>show_menu_crumbs</h2>
{% show_menu_crumbs "primary-nav" %}
</body>
</html>
| {
"content_hash": "0dbedf49b99a864c82974858b5cc826b",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 112,
"avg_line_length": 36.19047619047619,
"alnum_prop": 0.5125,
"repo_name": "caktus/django-treenav",
"id": "6d6e0a60d11a3de9246755ac085d01dc32d60047",
"size": "1520",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "templates/base.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "3790"
},
{
"name": "Python",
"bytes": "53243"
}
],
"symlink_target": ""
} |
<?php
namespace Project\AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class ValidateEvaluationType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('studentEvaluations', 'collection', array('type' => new StudentEvaluationType()));
}
/**
* @param OptionsResolverInterface $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Project\AppBundle\Entity\Evaluation',
'cascade_validation' => true
));
}
/**
* @return string
*/
public function getName()
{
return 'project_app_evaluation_validate';
}
}
| {
"content_hash": "fc796549ace839d2f6090f99c5a195a1",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 104,
"avg_line_length": 25.657894736842106,
"alnum_prop": 0.6656410256410257,
"repo_name": "vrap/project-b",
"id": "8c9d4db37880419d52d19342f55f39561bbda11a",
"size": "975",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Project/AppBundle/Form/ValidateEvaluationType.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "52132"
},
{
"name": "JavaScript",
"bytes": "4685"
},
{
"name": "PHP",
"bytes": "285483"
},
{
"name": "SQL",
"bytes": "6292"
}
],
"symlink_target": ""
} |
#include "arm_compute/runtime/CL/functions/CLBitwiseOr.h"
#include "src/core/CL/kernels/CLBitwiseKernel.h"
#include "src/common/utils/Log.h"
#include <utility>
namespace arm_compute
{
void CLBitwiseOr::configure(const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output)
{
configure(CLKernelLibrary::get().get_compile_context(), input1, input2, output);
}
void CLBitwiseOr::configure(const CLCompileContext &compile_context, const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output)
{
ARM_COMPUTE_LOG_PARAMS(input1, input2, output);
auto k = std::make_unique<CLBitwiseKernel>();
k->configure(compile_context, input1, input2, output, BitwiseOperation::OR);
_kernel = std::move(k);
}
} // namespace arm_compute | {
"content_hash": "34be8759138d6e05717ca21bce5f2fb2",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 137,
"avg_line_length": 31.458333333333332,
"alnum_prop": 0.7443708609271523,
"repo_name": "ARM-software/ComputeLibrary",
"id": "a07bf17bb29e9b16619b498f637d0e0dcd509863",
"size": "1911",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/runtime/CL/functions/CLBitwiseOr.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "3062248"
},
{
"name": "C++",
"bytes": "34872664"
},
{
"name": "Go",
"bytes": "4183"
},
{
"name": "Python",
"bytes": "122193"
},
{
"name": "Shell",
"bytes": "3515"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
in Pooprang, Boonpragob & Elix, Mycotaxon 71: 113 (1999)
#### Original name
Hypotrachyna ramkhamhaengiana Elix & Pooprang
### Remarks
null | {
"content_hash": "2768c632fd1fb66a307034da8ea65535",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 56,
"avg_line_length": 17.46153846153846,
"alnum_prop": 0.73568281938326,
"repo_name": "mdoering/backbone",
"id": "5cebbd9704ac91208615d38e987dc0884f162076",
"size": "296",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Lecanoromycetes/Lecanorales/Parmeliaceae/Hypotrachyna/Hypotrachyna ramkhamhaengiana/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package com.newlandframework.avatarmq.broker.strategy;
import com.newlandframework.avatarmq.msg.Message;
import com.newlandframework.avatarmq.broker.ConsumerMessageListener;
import com.newlandframework.avatarmq.broker.ProducerMessageListener;
import com.newlandframework.avatarmq.model.RequestMessage;
import com.newlandframework.avatarmq.model.ResponseMessage;
import io.netty.channel.ChannelHandlerContext;
/**
* @filename:BrokerProducerMessageStrategy.java
* @description:BrokerProducerMessageStrategy功能模块
* @author tangjie<https://github.com/tang-jie>
* @blog http://www.cnblogs.com/jietang/
* @since 2016-8-11
*/
public class BrokerProducerMessageStrategy implements BrokerStrategy {
private ProducerMessageListener hookProducer;
private ChannelHandlerContext channelHandler;
public BrokerProducerMessageStrategy() {
}
public void messageDispatch(RequestMessage request, ResponseMessage response) {
Message message = (Message) request.getMsgParams();
hookProducer.hookProducerMessage(message, request.getMsgId(), channelHandler.channel());
}
public void setHookProducer(ProducerMessageListener hookProducer) {
this.hookProducer = hookProducer;
}
public void setChannelHandler(ChannelHandlerContext channelHandler) {
this.channelHandler = channelHandler;
}
public void setHookConsumer(ConsumerMessageListener hookConsumer) {
}
}
| {
"content_hash": "ab9b2585f58293a81536b7dc54669b5c",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 96,
"avg_line_length": 33.25581395348837,
"alnum_prop": 0.7888111888111888,
"repo_name": "tang-jie/AvatarMQ",
"id": "06cb38fb45c302dd87bc87dd18292ac5a52f2eb7",
"size": "2055",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/newlandframework/avatarmq/broker/strategy/BrokerProducerMessageStrategy.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "194756"
}
],
"symlink_target": ""
} |
package de.javagl.flow.modules.basic.selectable.f;
import de.javagl.flow.module.Module;
import de.javagl.flow.module.ModuleInfo;
import de.javagl.flow.module.ModuleInfos;
import de.javagl.flow.module.creation.AbstractModuleCreator;
import de.javagl.flow.module.creation.ModuleCreator;
import de.javagl.flow.module.view.ModuleView;
import de.javagl.flow.module.view.ModuleViewType;
import de.javagl.flow.module.view.ModuleViewTypes;
/**
* Implementation of a {@link ModuleCreator} that creates
* {@link SelectableFloatModule} instances
*/
public final class SelectableFloatModuleCreator
extends AbstractModuleCreator implements ModuleCreator
{
/**
* The {@link ModuleInfo}
*/
private static final ModuleInfo MODULE_INFO = ModuleInfos.create(
"Selectable Float", "Provides user-defined Floats")
.addOutput(Float.class, "Float", "The provided Float")
.build();
/**
* Default constructor
*/
public SelectableFloatModuleCreator()
{
super(MODULE_INFO);
setSupportedModuleViewTypes(ModuleViewTypes.CONFIGURATION_VIEW);
}
@Override
public Module createModule()
{
return new SelectableFloatModule(getModuleInfo());
}
@Override
public ModuleView createModuleView(ModuleViewType moduleViewType)
{
if (moduleViewType.equals(ModuleViewTypes.CONFIGURATION_VIEW))
{
return new SelectableFloatModuleView();
}
return null;
}
}
| {
"content_hash": "0ff6e447e296f939e97857b98caee4fd",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 72,
"avg_line_length": 28.925925925925927,
"alnum_prop": 0.678617157490397,
"repo_name": "javagl/Flow",
"id": "fd4c55a580c6877eaec5ffc9d9d2008a224e92a7",
"size": "1662",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "flow-module-definitions-basic/src/main/java/de/javagl/flow/modules/basic/selectable/f/SelectableFloatModuleCreator.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1013270"
}
],
"symlink_target": ""
} |
import {
CODE_TOGGLE,
SIDEBAR_TOGGLE,
DISABLE_ANIMATE
} from '../actions';
const left_width=.25
const initialState = {
sb: true,
cb: false,
animateCode:false,
left:left_width
};
export default function(state = initialState, action) {
switch (action.type) {
case SIDEBAR_TOGGLE:
const left = state.sb ? 0 : left_width;
return {...state,
sb: !state.sb,
animateCode:true,
left
};
case CODE_TOGGLE:
return {...state,
cb: !state.cb,
animateCode:true
};
case DISABLE_ANIMATE:
return {...state,
animateCode:false
};
default:
return state;
}
}
| {
"content_hash": "9925b9ecdc26d6a3efa9b67b8543fce4",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 55,
"avg_line_length": 21.594594594594593,
"alnum_prop": 0.4793491864831039,
"repo_name": "ekatzenstein/three.js-live",
"id": "487f74b3a2ea6cfb60ccb97bd9e6609bd285568e",
"size": "799",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/reducers/display.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1571"
},
{
"name": "HTML",
"bytes": "5270"
},
{
"name": "JavaScript",
"bytes": "24574"
}
],
"symlink_target": ""
} |
package com.sentenial.ws.client.dd;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for ResponseReverseDirectDebit complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ResponseReverseDirectDebit">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="returnCode" type="{urn:com:sentenial:origix:ws:common:types}ReturnCode"/>
* <element name="returnDesc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="Creditor" type="{urn:com:sentenial:origix:ws:common:commontypes}Creditor"/>
* <element name="MandateInfo" type="{urn:com:sentenial:origix:ws:common:commontypes}MandateInfo" minOccurs="0"/>
* <element name="DirectDebitInfo" type="{urn:com:sentenial:origix:ws:common:commontypes}DirectDebitInfo" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResponseReverseDirectDebit", propOrder = {
"returnCode",
"returnDesc",
"creditor",
"mandateInfo",
"directDebitInfo"
})
@XmlSeeAlso({
ReverseDirectDebitResponse.class
})
public class ResponseReverseDirectDebit {
@XmlElement(required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String returnCode;
protected String returnDesc;
@XmlElement(name = "Creditor", required = true)
protected Creditor creditor;
@XmlElement(name = "MandateInfo")
protected MandateInfo mandateInfo;
@XmlElement(name = "DirectDebitInfo")
protected DirectDebitInfo directDebitInfo;
/**
* Gets the value of the returnCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getReturnCode() {
return returnCode;
}
/**
* Sets the value of the returnCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReturnCode(String value) {
this.returnCode = value;
}
/**
* Gets the value of the returnDesc property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getReturnDesc() {
return returnDesc;
}
/**
* Sets the value of the returnDesc property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReturnDesc(String value) {
this.returnDesc = value;
}
/**
* Gets the value of the creditor property.
*
* @return
* possible object is
* {@link Creditor }
*
*/
public Creditor getCreditor() {
return creditor;
}
/**
* Sets the value of the creditor property.
*
* @param value
* allowed object is
* {@link Creditor }
*
*/
public void setCreditor(Creditor value) {
this.creditor = value;
}
/**
* Gets the value of the mandateInfo property.
*
* @return
* possible object is
* {@link MandateInfo }
*
*/
public MandateInfo getMandateInfo() {
return mandateInfo;
}
/**
* Sets the value of the mandateInfo property.
*
* @param value
* allowed object is
* {@link MandateInfo }
*
*/
public void setMandateInfo(MandateInfo value) {
this.mandateInfo = value;
}
/**
* Gets the value of the directDebitInfo property.
*
* @return
* possible object is
* {@link DirectDebitInfo }
*
*/
public DirectDebitInfo getDirectDebitInfo() {
return directDebitInfo;
}
/**
* Sets the value of the directDebitInfo property.
*
* @param value
* allowed object is
* {@link DirectDebitInfo }
*
*/
public void setDirectDebitInfo(DirectDebitInfo value) {
this.directDebitInfo = value;
}
}
| {
"content_hash": "6d4537c8f041f8d228cfd9a11358fd39",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 132,
"avg_line_length": 25.073863636363637,
"alnum_prop": 0.5948334466349422,
"repo_name": "whelanp/sentenial-ws-client",
"id": "cfc9da306359d138eae5f6463b37dd285de7c516",
"size": "4413",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/com/sentenial/ws/client/dd/ResponseReverseDirectDebit.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "793008"
}
],
"symlink_target": ""
} |
package androidx.media2.test.service.tests;
import static androidx.media2.test.common.CommonConstants.CLIENT_PACKAGE_NAME;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.media2.common.MediaItem;
import androidx.media2.common.MediaMetadata;
import androidx.media2.common.SessionPlayer;
import androidx.media2.session.MediaSession;
import androidx.media2.session.MediaSession.ControllerInfo;
import androidx.media2.session.SessionCommandGroup;
import androidx.media2.test.common.TestUtils;
import androidx.media2.test.service.MediaTestUtils;
import androidx.media2.test.service.MockPlayer;
import androidx.media2.test.service.RemoteMediaController;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SdkSuppress;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* Tests whether the methods of {@link SessionPlayer} are triggered by the
* session/controller.
*/
@SdkSuppress(maxSdkVersion = 32) // b/244312419
@RunWith(AndroidJUnit4.class)
@LargeTest
public class SessionPlayerTest extends MediaSessionTestBase {
MediaSession mSession;
MockPlayer mPlayer;
RemoteMediaController mController;
@Before
@Override
public void setUp() throws Exception {
// b/204596299
assumeTrue(Build.VERSION.SDK_INT != 17);
super.setUp();
mPlayer = new MockPlayer(1);
mSession = new MediaSession.Builder(mContext, mPlayer)
.setSessionCallback(sHandlerExecutor, new MediaSession.SessionCallback() {
@Override
public SessionCommandGroup onConnect(@NonNull MediaSession session,
@NonNull MediaSession.ControllerInfo controller) {
if (CLIENT_PACKAGE_NAME.equals(controller.getPackageName())) {
return super.onConnect(session, controller);
}
return null;
}
@Override
public MediaItem onCreateMediaItem(@NonNull MediaSession session,
@NonNull ControllerInfo controller, @NonNull String mediaId) {
return MediaTestUtils.createMediaItem(mediaId);
}
}).build();
// Create a default MediaController in client app.
mController = createRemoteController(mSession.getToken());
}
@After
@Override
public void cleanUp() throws Exception {
super.cleanUp();
if (mSession != null) {
mSession.close();
}
}
@Test
public void playBySession() throws Exception {
mSession.getPlayer().play();
assertTrue(mPlayer.mPlayCalled);
}
@Test
public void playByController() {
mController.play();
try {
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
} catch (InterruptedException e) {
fail(e.getMessage());
}
assertTrue(mPlayer.mPlayCalled);
}
@Test
public void pauseBySession() throws Exception {
mSession.getPlayer().pause();
assertTrue(mPlayer.mPauseCalled);
}
@Test
public void pauseByController() {
mController.pause();
try {
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
} catch (InterruptedException e) {
fail(e.getMessage());
}
assertTrue(mPlayer.mPauseCalled);
}
@Test
public void prepareBySession() throws Exception {
mSession.getPlayer().prepare();
assertTrue(mPlayer.mPrepareCalled);
}
@Test
public void prepareByController() {
mController.prepare();
try {
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
} catch (InterruptedException e) {
fail(e.getMessage());
}
assertTrue(mPlayer.mPrepareCalled);
}
@Test
public void seekToBySession() throws Exception {
final long pos = 1004L;
mSession.getPlayer().seekTo(pos);
assertTrue(mPlayer.mSeekToCalled);
assertEquals(pos, mPlayer.mSeekPosition);
}
@Test
public void seekToByController() {
final long seekPosition = 12125L;
mController.seekTo(seekPosition);
try {
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
} catch (InterruptedException e) {
fail(e.getMessage());
}
assertTrue(mPlayer.mSeekToCalled);
assertEquals(seekPosition, mPlayer.mSeekPosition);
}
@Test
public void setPlaybackSpeedBySession() throws Exception {
final float speed = 1.5f;
mSession.getPlayer().setPlaybackSpeed(speed);
assertTrue(mPlayer.mSetPlaybackSpeedCalled);
assertEquals(speed, mPlayer.mPlaybackSpeed, 0.0f);
}
@Test
public void setPlaybackSpeedByController() throws Exception {
final float speed = 1.5f;
mController.setPlaybackSpeed(speed);
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertEquals(speed, mPlayer.mPlaybackSpeed, 0.0f);
}
@Test
public void setPlaylistBySession() {
final List<MediaItem> list = MediaTestUtils.createPlaylist(2);
mSession.getPlayer().setPlaylist(list, null);
assertTrue(mPlayer.mSetPlaylistCalled);
assertSame(list, mPlayer.mPlaylist);
assertNull(mPlayer.mMetadata);
}
@Test
public void setPlaylistByController() throws InterruptedException {
final List<String> list = MediaTestUtils.createMediaIds(2);
mController.setPlaylist(list, null /* metadata */);
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mSetPlaylistCalled);
assertNull(mPlayer.mMetadata);
assertNotNull(mPlayer.mPlaylist);
assertEquals(list.size(), mPlayer.mPlaylist.size());
for (int i = 0; i < list.size(); i++) {
assertEquals(list.get(i), mPlayer.mPlaylist.get(i).getMediaId());
}
}
@Test
@LargeTest
public void setPlaylistByControllerWithLongPlaylist() throws InterruptedException {
final int listSize = 5000;
// Make client app to generate a long list, and call setPlaylist() with it.
mController.createAndSetFakePlaylist(listSize, null /* metadata */);
assertTrue(mPlayer.mCountDownLatch.await(10, TimeUnit.SECONDS));
assertTrue(mPlayer.mSetPlaylistCalled);
assertNull(mPlayer.mMetadata);
assertNotNull(mPlayer.mPlaylist);
assertEquals(listSize, mPlayer.mPlaylist.size());
for (int i = 0; i < listSize; i++) {
// Each item's media ID will be same as its index.
assertEquals(TestUtils.getMediaIdInFakeList(i), mPlayer.mPlaylist.get(i).getMediaId());
}
}
@Test
public void updatePlaylistMetadataBySession() {
final MediaMetadata testMetadata = MediaTestUtils.createMetadata();
mSession.getPlayer().updatePlaylistMetadata(testMetadata);
assertTrue(mPlayer.mUpdatePlaylistMetadataCalled);
assertSame(testMetadata, mPlayer.mMetadata);
}
@Test
public void updatePlaylistMetadataByController() throws InterruptedException {
final MediaMetadata testMetadata = MediaTestUtils.createMetadata();
mController.updatePlaylistMetadata(testMetadata);
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mUpdatePlaylistMetadataCalled);
assertNotNull(mPlayer.mMetadata);
assertEquals(testMetadata.getMediaId(), mPlayer.mMetadata.getMediaId());
}
@Test
public void addPlaylistItemBySession() {
final int testIndex = 12;
final MediaItem testMediaItem = MediaTestUtils.createMediaItemWithMetadata();
mSession.getPlayer().addPlaylistItem(testIndex, testMediaItem);
assertTrue(mPlayer.mAddPlaylistItemCalled);
assertEquals(testIndex, mPlayer.mIndex);
assertSame(testMediaItem, mPlayer.mItem);
}
@Test
public void addPlaylistItemByController() throws InterruptedException {
final int testIndex = 12;
final String testMediaId = "testAddPlaylistItemByController";
mController.addPlaylistItem(testIndex, testMediaId);
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mAddPlaylistItemCalled);
assertEquals(testIndex, mPlayer.mIndex);
// MediaController.addPlaylistItem does not ensure the equality of the items.
assertEquals(testMediaId, mPlayer.mItem.getMediaId());
}
@Test
public void removePlaylistItemBySession() {
final List<MediaItem> list = MediaTestUtils.createPlaylist(2);
mSession.getPlayer().setPlaylist(list, null);
mSession.getPlayer().removePlaylistItem(0);
assertTrue(mPlayer.mRemovePlaylistItemCalled);
assertSame(0, mPlayer.mIndex);
}
@Test
public void removePlaylistItemByController() throws InterruptedException {
mPlayer.mPlaylist = MediaTestUtils.createPlaylist(2);
mController.removePlaylistItem(0);
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mRemovePlaylistItemCalled);
assertEquals(0, mPlayer.mIndex);
}
@Test
public void replacePlaylistItemBySession() throws InterruptedException {
final int testIndex = 12;
final MediaItem testMediaItem = MediaTestUtils.createMediaItemWithMetadata();
mSession.getPlayer().replacePlaylistItem(testIndex, testMediaItem);
assertTrue(mPlayer.mReplacePlaylistItemCalled);
assertEquals(testIndex, mPlayer.mIndex);
assertSame(testMediaItem, mPlayer.mItem);
}
@Test
public void replacePlaylistItemByController() throws InterruptedException {
final int testIndex = 12;
final String testMediaId = "testReplacePlaylistItemByController";
mController.replacePlaylistItem(testIndex, testMediaId);
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mReplacePlaylistItemCalled);
// MediaController.replacePlaylistItem does not ensure the equality of the items.
assertEquals(testMediaId, mPlayer.mItem.getMediaId());
}
@Test
public void movePlaylistItemsBySession() throws InterruptedException {
final int fromIdx = 3;
final int toIdx = 20;
final MediaItem testMediaItem = MediaTestUtils.createMediaItemWithMetadata();
mSession.getPlayer().movePlaylistItem(fromIdx, toIdx);
assertTrue(mPlayer.mMovePlaylistItemCalled);
assertEquals(fromIdx, mPlayer.mIndex);
assertEquals(toIdx, mPlayer.mIndex2);
}
@Test
public void movePlaylistItemByController() throws InterruptedException {
final int testIndex1 = 3;
final int testIndex2 = 20;
mController.movePlaylistItem(testIndex1, testIndex2);
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mMovePlaylistItemCalled);
assertEquals(testIndex1, mPlayer.mIndex);
assertEquals(testIndex2, mPlayer.mIndex2);
}
@Test
public void skipToPreviousItemBySession() {
mSession.getPlayer().skipToPreviousPlaylistItem();
assertTrue(mPlayer.mSkipToPreviousItemCalled);
}
@Test
public void skipToPreviousItemByController() throws InterruptedException {
mController.skipToPreviousItem();
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mSkipToPreviousItemCalled);
}
@Test
public void skipToNextItemBySession() throws Exception {
mSession.getPlayer().skipToNextPlaylistItem();
assertTrue(mPlayer.mSkipToNextItemCalled);
}
@Test
public void skipToNextItemByController() throws InterruptedException {
mController.skipToNextItem();
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mSkipToNextItemCalled);
}
@Test
public void skipToPlaylistItemBySession() throws Exception {
final List<MediaItem> list = MediaTestUtils.createPlaylist(2);
int targetIndex = 0;
mSession.getPlayer().setPlaylist(list, null);
mSession.getPlayer().skipToPlaylistItem(targetIndex);
assertTrue(mPlayer.mSkipToPlaylistItemCalled);
assertSame(targetIndex, mPlayer.mIndex);
}
@Test
public void skipToPlaylistItemByController() throws InterruptedException {
mPlayer.mPlaylist = MediaTestUtils.createPlaylist(3);
int targetIndex = 2;
mController.skipToPlaylistItem(targetIndex);
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mSkipToPlaylistItemCalled);
assertEquals(targetIndex, mPlayer.mIndex);
}
@Test
public void setShuffleModeBySession() {
final int testShuffleMode = SessionPlayer.SHUFFLE_MODE_GROUP;
mSession.getPlayer().setShuffleMode(testShuffleMode);
assertTrue(mPlayer.mSetShuffleModeCalled);
assertEquals(testShuffleMode, mPlayer.mShuffleMode);
}
@Test
public void setShuffleModeByController() throws InterruptedException {
final int testShuffleMode = SessionPlayer.SHUFFLE_MODE_GROUP;
mController.setShuffleMode(testShuffleMode);
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mSetShuffleModeCalled);
assertEquals(testShuffleMode, mPlayer.mShuffleMode);
}
@Test
public void setRepeatModeBySession() {
final int testRepeatMode = SessionPlayer.REPEAT_MODE_GROUP;
mSession.getPlayer().setRepeatMode(testRepeatMode);
assertTrue(mPlayer.mSetRepeatModeCalled);
assertEquals(testRepeatMode, mPlayer.mRepeatMode);
}
@Test
public void setRepeatModeByController() throws InterruptedException {
final int testRepeatMode = SessionPlayer.REPEAT_MODE_GROUP;
mController.setRepeatMode(testRepeatMode);
assertTrue(mPlayer.mCountDownLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
assertTrue(mPlayer.mSetRepeatModeCalled);
assertEquals(testRepeatMode, mPlayer.mRepeatMode);
}
}
| {
"content_hash": "579ce04e13e03b28ce5fe8afe7947333",
"timestamp": "",
"source": "github",
"line_count": 417,
"max_line_length": 99,
"avg_line_length": 36.2589928057554,
"alnum_prop": 0.6926587301587301,
"repo_name": "AndroidX/androidx",
"id": "badc0353a1b9583efbdf5878548bb46b982f2019",
"size": "15735",
"binary": false,
"copies": "3",
"ref": "refs/heads/androidx-main",
"path": "media2/media2-session/version-compat-tests/current/service/src/androidTest/java/androidx/media2/test/service/tests/SessionPlayerTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AIDL",
"bytes": "263978"
},
{
"name": "ANTLR",
"bytes": "19860"
},
{
"name": "C",
"bytes": "4764"
},
{
"name": "C++",
"bytes": "9020585"
},
{
"name": "CMake",
"bytes": "11999"
},
{
"name": "HTML",
"bytes": "21175"
},
{
"name": "Java",
"bytes": "59499889"
},
{
"name": "JavaScript",
"bytes": "1343"
},
{
"name": "Kotlin",
"bytes": "66123157"
},
{
"name": "Python",
"bytes": "292398"
},
{
"name": "Shell",
"bytes": "167367"
},
{
"name": "Swift",
"bytes": "3153"
},
{
"name": "TypeScript",
"bytes": "7599"
}
],
"symlink_target": ""
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_wchar_t_snprintf_01.cpp
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805.string.label.xml
Template File: sources-sink-01.tmpl.cpp
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Allocate using new[] and set data pointer to a small buffer
* GoodSource: Allocate using new[] and set data pointer to a large buffer
* Sink: snprintf
* BadSink : Copy string to data using snprintf
* Flow Variant: 01 Baseline
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define SNPRINTF _snwprintf
#else
#define SNPRINTF snprintf
#endif
namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_wchar_t_snprintf_01
{
#ifndef OMITBAD
void bad()
{
wchar_t * data;
data = NULL;
/* FLAW: Allocate using new[] and point data to a small buffer that is smaller than the large buffer used in the sinks */
data = new wchar_t[50];
data[0] = L'\0'; /* null terminate */
{
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 */
SNPRINTF(data, 100, L"%s", source);
printWLine(data);
delete [] data;
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
wchar_t * data;
data = NULL;
/* FIX: Allocate using new[] and point data to a large buffer that is at least as large as the large buffer used in the sink */
data = new wchar_t[100];
data[0] = L'\0'; /* null terminate */
{
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 */
SNPRINTF(data, 100, L"%s", source);
printWLine(data);
delete [] data;
}
}
void good()
{
goodG2B();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
using namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_wchar_t_snprintf_01; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| {
"content_hash": "a7f2736c6a7ad4d20128748c6713f2c9",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 131,
"avg_line_length": 28.166666666666668,
"alnum_prop": 0.626232741617357,
"repo_name": "maurer/tiamat",
"id": "b46ea75e4c9a1b09d2ac39bfd9a033b31deacdbd",
"size": "3042",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "samples/Juliet/testcases/CWE122_Heap_Based_Buffer_Overflow/s04/CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_wchar_t_snprintf_01.cpp",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>coalgebras: 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.12.0 / coalgebras - 8.8.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
coalgebras
<small>
8.8.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-04-25 08:43:03 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-04-25 08:43:03 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
coq 8.12.0 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: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/coalgebras"
license: "LGPL"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Coalgebras"]
depends: [
"ocaml"
"coq" {>= "8.8" & < "8.9~"}
]
tags: [
"keyword: coalgebra"
"keyword: bisimulation"
"keyword: weakly final"
"keyword: coiteration"
"keyword: co-inductive types"
"category: Mathematics/Category Theory"
"date: 2008-10"
]
authors: [ "Milad Niqui <M.Niqui@cwi.nl> [http://www.cwi.nl/~milad]" ]
bug-reports: "https://github.com/coq-contribs/coalgebras/issues"
dev-repo: "git+https://github.com/coq-contribs/coalgebras.git"
synopsis: "Coalgebras, bisimulation and lambda-coiteration"
description:
"This contribution contains a formalisation of coalgebras, bisimulation on coalgebras, weakly final coalgebras, lambda-coiteration definition scheme (including primitive corecursion) and a version of lambda-bisimulation. The formalisation is modular. The implementation of the module types for streams and potentially infinite Peano numbers are provided using the coinductive types."
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/coalgebras/archive/v8.8.0.tar.gz"
checksum: "md5=203f9bfcfcbddf4b5a4bf7392c9f2bd8"
}
</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-coalgebras.8.8.0 coq.8.12.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.12.0).
The following dependencies couldn't be met:
- coq-coalgebras -> 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-coalgebras.8.8.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "2dc7162a39d89141e232a8440bab6a79",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 395,
"avg_line_length": 42.28654970760234,
"alnum_prop": 0.5574609320979118,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "8d453012bb0c97d03a0fc88e9502b8cc091b00ce",
"size": "7256",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.09.1-2.0.6/released/8.12.0/coalgebras/8.8.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<title>{% block title %} {% block title_text %} {% endblock %} - Experiment Repository {% endblock %} </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet" media="screen">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="../../assets/js/html5shiv.js"></script>
<script src="../../assets/js/respond.min.js"></script>
<![endif]-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<style type="text/css">
.footer {
color: #555555;
text-align: center;
}
.footer p {
font-size: 12px;
}
</style>
{% block extra_head %}
{% endblock %}
</head>
<body>
{% block body %}
{% block header %}
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% url 'repo-home' %}">Experiment Repository</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li {% block navbar-home-attr %} {% endblock %}><a href="{% url 'repo-home' %}">Home</a></li>
<li {% block navbar-user-attr %} {% endblock %}><a href="{% url 'experiment_user:home' %}">Users</a></li>
<li {% block navbar-create-attr %} {% endblock %}><a href="{% url 'experiment:create' %}">Create New Post</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
{% if not request.user.is_authenticated %}
<li><a href="{% url 'account_login' %}">Register / Login</a></li>
{% else %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Account <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ request.user.get_absolute_url }}">Profile</a></li>
<li><a href="{% url 'account_logout' %}">Logout</a></li>
</ul>
</li>
{% endif %}
</ul>
<form action="{% url 'experiment:home' %}" class="navbar-form navbar-right form-inline" role="search">
<div class="form-group">
{% for field in search_form %}
{{field}}
{% endfor %}
</div>
<div class="btn-group">
<button type="submit" class="btn btn-default">
<span class="glyphicon glyphicon-search"></span>
</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Advanced Search</a></li>
</ul>
</div>
</form>
</div>
</nav>
{% endblock %}
{% block content %}
<h1>Hello, world!</h1>
{% endblock %}
{% block footer %}
<div class="row footer">
<div class="col-md-12">
<p>Open Networking Lab 2013
</div>
</div>
{% endblock %}
{% endblock %}
</body>
</html>
| {
"content_hash": "ffc919883b039e12ce7b4bbbabc529f3",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 138,
"avg_line_length": 46.471698113207545,
"alnum_prop": 0.4321965083231831,
"repo_name": "heryandi/experiment_repo",
"id": "6512fa418edaa0ec705db8feda90e73e0c4cdfab",
"size": "4926",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "experiment_repo/templates/base/base.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "136711"
},
{
"name": "JavaScript",
"bytes": "80259"
},
{
"name": "Python",
"bytes": "22597"
}
],
"symlink_target": ""
} |
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [sip.js](./sip.js.md) > [DialogState](./sip.js.dialogstate.md) > [remoteTarget](./sip.js.dialogstate.remotetarget.md)
## DialogState.remoteTarget property
<b>Signature:</b>
```typescript
remoteTarget: URI;
```
| {
"content_hash": "41554b457859cdc5939bb227b510faec",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 147,
"avg_line_length": 30.545454545454547,
"alnum_prop": 0.6696428571428571,
"repo_name": "onsip/SIP.js",
"id": "bf603947adb64b1bef66af23707bef1d7c46979b",
"size": "336",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "docs/core/sip.js.dialogstate.remotetarget.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "8816"
},
{
"name": "PEG.js",
"bytes": "35381"
},
{
"name": "TypeScript",
"bytes": "1511252"
}
],
"symlink_target": ""
} |
package com.hazelcast.config;
import com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig;
import com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig.DurationConfig;
import com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig.TimedExpiryPolicyFactoryConfig;
import com.hazelcast.config.CacheSimpleConfig.ExpiryPolicyFactoryConfig.TimedExpiryPolicyFactoryConfig.ExpiryPolicyType;
import com.hazelcast.config.EvictionConfig.MaxSizePolicy;
import com.hazelcast.config.LoginModuleConfig.LoginModuleUsage;
import com.hazelcast.config.PartitionGroupConfig.MemberGroupType;
import com.hazelcast.config.PermissionConfig.PermissionType;
import com.hazelcast.config.UserCodeDeploymentConfig.ClassCacheMode;
import com.hazelcast.config.UserCodeDeploymentConfig.ProviderMode;
import com.hazelcast.core.HazelcastException;
import com.hazelcast.logging.ILogger;
import com.hazelcast.logging.Logger;
import com.hazelcast.map.eviction.MapEvictionPolicy;
import com.hazelcast.mapreduce.TopologyChangedStrategy;
import com.hazelcast.nio.ClassLoaderUtil;
import com.hazelcast.nio.IOUtil;
import com.hazelcast.quorum.QuorumType;
import com.hazelcast.spi.ServiceConfigurationParser;
import com.hazelcast.topic.TopicOverloadPolicy;
import com.hazelcast.util.ExceptionUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import static com.hazelcast.config.MapStoreConfig.InitialLoadMode;
import static com.hazelcast.config.XmlElements.CACHE;
import static com.hazelcast.config.XmlElements.CARDINALITY_ESTIMATOR;
import static com.hazelcast.config.XmlElements.DURABLE_EXECUTOR_SERVICE;
import static com.hazelcast.config.XmlElements.EXECUTOR_SERVICE;
import static com.hazelcast.config.XmlElements.GROUP;
import static com.hazelcast.config.XmlElements.HOT_RESTART_PERSISTENCE;
import static com.hazelcast.config.XmlElements.IMPORT;
import static com.hazelcast.config.XmlElements.INSTANCE_NAME;
import static com.hazelcast.config.XmlElements.JOB_TRACKER;
import static com.hazelcast.config.XmlElements.LICENSE_KEY;
import static com.hazelcast.config.XmlElements.LIST;
import static com.hazelcast.config.XmlElements.LISTENERS;
import static com.hazelcast.config.XmlElements.LITE_MEMBER;
import static com.hazelcast.config.XmlElements.LOCK;
import static com.hazelcast.config.XmlElements.MANAGEMENT_CENTER;
import static com.hazelcast.config.XmlElements.MAP;
import static com.hazelcast.config.XmlElements.MEMBER_ATTRIBUTES;
import static com.hazelcast.config.XmlElements.MULTIMAP;
import static com.hazelcast.config.XmlElements.NATIVE_MEMORY;
import static com.hazelcast.config.XmlElements.NETWORK;
import static com.hazelcast.config.XmlElements.PARTITION_GROUP;
import static com.hazelcast.config.XmlElements.PROPERTIES;
import static com.hazelcast.config.XmlElements.QUEUE;
import static com.hazelcast.config.XmlElements.QUORUM;
import static com.hazelcast.config.XmlElements.RELIABLE_TOPIC;
import static com.hazelcast.config.XmlElements.REPLICATED_MAP;
import static com.hazelcast.config.XmlElements.RINGBUFFER;
import static com.hazelcast.config.XmlElements.SCHEDULED_EXECUTOR_SERVICE;
import static com.hazelcast.config.XmlElements.SECURITY;
import static com.hazelcast.config.XmlElements.SEMAPHORE;
import static com.hazelcast.config.XmlElements.SERIALIZATION;
import static com.hazelcast.config.XmlElements.SERVICES;
import static com.hazelcast.config.XmlElements.SET;
import static com.hazelcast.config.XmlElements.TOPIC;
import static com.hazelcast.config.XmlElements.USER_CODE_DEPLOYMENT;
import static com.hazelcast.config.XmlElements.WAN_REPLICATION;
import static com.hazelcast.config.XmlElements.canOccurMultipleTimes;
import static com.hazelcast.instance.BuildInfoProvider.HAZELCAST_INTERNAL_OVERRIDE_VERSION;
import static com.hazelcast.internal.config.ConfigValidator.checkEvictionConfig;
import static com.hazelcast.util.Preconditions.checkHasText;
import static com.hazelcast.util.Preconditions.checkNotNull;
import static com.hazelcast.util.StringUtil.LINE_SEPARATOR;
import static com.hazelcast.util.StringUtil.isNullOrEmpty;
import static com.hazelcast.util.StringUtil.lowerCaseInternal;
import static com.hazelcast.util.StringUtil.upperCaseInternal;
import static java.lang.Boolean.parseBoolean;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
/**
* A XML {@link ConfigBuilder} implementation.
*/
public class XmlConfigBuilder extends AbstractConfigBuilder implements ConfigBuilder {
private static final int THOUSAND_FACTOR = 5;
private static final ILogger LOGGER = Logger.getLogger(XmlConfigBuilder.class);
private final Set<String> occurrenceSet = new HashSet<String>();
private final InputStream in;
private Properties properties = System.getProperties();
private File configurationFile;
private URL configurationUrl;
private Config config;
/**
* Constructs a XmlConfigBuilder that reads from the provided XML file.
*
* @param xmlFileName the name of the XML file that the XmlConfigBuilder reads from
* @throws FileNotFoundException if the file can't be found.
*/
public XmlConfigBuilder(String xmlFileName) throws FileNotFoundException {
this(new FileInputStream(xmlFileName));
this.configurationFile = new File(xmlFileName);
}
/**
* Constructs a XmlConfigBuilder that reads from the given InputStream.
*
* @param inputStream the InputStream containing the XML configuration.
* @throws IllegalArgumentException if inputStream is null.
*/
public XmlConfigBuilder(InputStream inputStream) {
if (inputStream == null) {
throw new IllegalArgumentException("inputStream can't be null");
}
this.in = inputStream;
}
/**
* Constructs a XMLConfigBuilder that reads from the given URL.
*
* @param url the given url that the XMLConfigBuilder reads from
* @throws IOException if URL is invalid
*/
public XmlConfigBuilder(URL url) throws IOException {
checkNotNull(url, "URL is null!");
this.in = url.openStream();
this.configurationUrl = url;
}
/**
* Constructs a XmlConfigBuilder that tries to find a usable XML configuration file.
*/
public XmlConfigBuilder() {
XmlConfigLocator locator = new XmlConfigLocator();
this.in = locator.getIn();
this.configurationFile = locator.getConfigurationFile();
this.configurationUrl = locator.getConfigurationUrl();
}
/**
* Gets the current used properties. Can be null if no properties are set.
*
* @return the current used properties.
* @see #setProperties(java.util.Properties)
*/
@Override
public Properties getProperties() {
return properties;
}
/**
* Sets the used properties. Can be null if no properties should be used.
* <p/>
* Properties are used to resolve ${variable} occurrences in the XML file.
*
* @param properties the new properties.
* @return the XmlConfigBuilder
*/
public XmlConfigBuilder setProperties(Properties properties) {
this.properties = properties;
return this;
}
@Override
protected ConfigType getXmlType() {
return ConfigType.SERVER;
}
@Override
public Config build() {
return build(new Config());
}
Config build(Config config) {
config.setConfigurationFile(configurationFile);
config.setConfigurationUrl(configurationUrl);
try {
parseAndBuildConfig(config);
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
return config;
}
private void parseAndBuildConfig(Config config) throws Exception {
this.config = config;
Document doc = parse(in);
Element root = doc.getDocumentElement();
checkRootElement(root);
try {
root.getTextContent();
} catch (Throwable e) {
domLevel3 = false;
}
process(root);
if (shouldValidateTheSchema()) {
schemaValidation(root.getOwnerDocument());
}
handleConfig(root);
}
private void checkRootElement(Element root) {
String rootNodeName = root.getNodeName();
if (!XmlElements.HAZELCAST.isEqual(rootNodeName)) {
throw new InvalidConfigurationException("Invalid root element in xml configuration! "
+ "Expected: <" + XmlElements.HAZELCAST.name + ">, Actual: <" + rootNodeName + ">.");
}
}
private boolean shouldValidateTheSchema() {
// in case of overridden hazelcast version there may be no schema with that version
// this feature is used only in simulator testing.
return System.getProperty(HAZELCAST_INTERNAL_OVERRIDE_VERSION) == null;
}
@Override
protected Document parse(InputStream is) throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
DocumentBuilder builder = dbf.newDocumentBuilder();
Document doc;
try {
doc = builder.parse(is);
} catch (Exception e) {
if (configurationFile != null) {
String msg = "Failed to parse " + configurationFile
+ LINE_SEPARATOR + "Exception: " + e.getMessage()
+ LINE_SEPARATOR + "Hazelcast startup interrupted.";
LOGGER.severe(msg);
} else if (configurationUrl != null) {
String msg = "Failed to parse " + configurationUrl
+ LINE_SEPARATOR + "Exception: " + e.getMessage()
+ LINE_SEPARATOR + "Hazelcast startup interrupted.";
LOGGER.severe(msg);
} else {
String msg = "Failed to parse the inputstream"
+ LINE_SEPARATOR + "Exception: " + e.getMessage()
+ LINE_SEPARATOR + "Hazelcast startup interrupted.";
LOGGER.severe(msg);
}
throw new InvalidConfigurationException(e.getMessage(), e);
} finally {
IOUtil.closeResource(is);
}
return doc;
}
private void handleConfig(Element docElement) throws Exception {
for (Node node : childElements(docElement)) {
String nodeName = cleanNodeName(node);
if (occurrenceSet.contains(nodeName)) {
throw new InvalidConfigurationException(
"Duplicate '" + nodeName + "' definition found in XML configuration.");
}
if (handleXmlNode(node, nodeName)) {
continue;
}
if (!canOccurMultipleTimes(nodeName)) {
occurrenceSet.add(nodeName);
}
}
}
private boolean handleXmlNode(Node node, String nodeName) throws Exception {
if (INSTANCE_NAME.isEqual(nodeName)) {
handleInstanceName(node);
} else if (NETWORK.isEqual(nodeName)) {
handleNetwork(node);
} else if (IMPORT.isEqual(nodeName)) {
throw new HazelcastException("Non-expanded <import> element found");
} else if (GROUP.isEqual(nodeName)) {
handleGroup(node);
} else if (PROPERTIES.isEqual(nodeName)) {
fillProperties(node, config.getProperties());
} else if (WAN_REPLICATION.isEqual(nodeName)) {
handleWanReplication(node);
} else if (EXECUTOR_SERVICE.isEqual(nodeName)) {
handleExecutor(node);
} else if (DURABLE_EXECUTOR_SERVICE.isEqual(nodeName)) {
handleDurableExecutor(node);
} else if (SCHEDULED_EXECUTOR_SERVICE.isEqual(nodeName)) {
handleScheduledExecutor(node);
} else if (SERVICES.isEqual(nodeName)) {
handleServices(node);
} else if (QUEUE.isEqual(nodeName)) {
handleQueue(node);
} else if (MAP.isEqual(nodeName)) {
handleMap(node);
} else if (MULTIMAP.isEqual(nodeName)) {
handleMultiMap(node);
} else if (REPLICATED_MAP.isEqual(nodeName)) {
handleReplicatedMap(node);
} else if (LIST.isEqual(nodeName)) {
handleList(node);
} else if (SET.isEqual(nodeName)) {
handleSet(node);
} else if (TOPIC.isEqual(nodeName)) {
handleTopic(node);
} else if (RELIABLE_TOPIC.isEqual(nodeName)) {
handleReliableTopic(node);
} else if (CACHE.isEqual(nodeName)) {
handleCache(node);
} else if (NATIVE_MEMORY.isEqual(nodeName)) {
fillNativeMemoryConfig(node, config.getNativeMemoryConfig());
} else if (JOB_TRACKER.isEqual(nodeName)) {
handleJobTracker(node);
} else if (SEMAPHORE.isEqual(nodeName)) {
handleSemaphore(node);
} else if (LOCK.isEqual(nodeName)) {
handleLock(node);
} else if (RINGBUFFER.isEqual(nodeName)) {
handleRingbuffer(node);
} else if (LISTENERS.isEqual(nodeName)) {
handleListeners(node);
} else if (PARTITION_GROUP.isEqual(nodeName)) {
handlePartitionGroup(node);
} else if (SERIALIZATION.isEqual(nodeName)) {
handleSerialization(node);
} else if (SECURITY.isEqual(nodeName)) {
handleSecurity(node);
} else if (MEMBER_ATTRIBUTES.isEqual(nodeName)) {
handleMemberAttributes(node);
} else if (LICENSE_KEY.isEqual(nodeName)) {
config.setLicenseKey(getTextContent(node));
} else if (MANAGEMENT_CENTER.isEqual(nodeName)) {
handleManagementCenterConfig(node);
} else if (QUORUM.isEqual(nodeName)) {
handleQuorum(node);
} else if (LITE_MEMBER.isEqual(nodeName)) {
handleLiteMember(node);
} else if (HOT_RESTART_PERSISTENCE.isEqual(nodeName)) {
handleHotRestartPersistence(node);
} else if (USER_CODE_DEPLOYMENT.isEqual(nodeName)) {
handleUserCodeDeployment(node);
} else if (CARDINALITY_ESTIMATOR.isEqual(nodeName)) {
handleCardinalityEstimator(node);
} else {
return true;
}
return false;
}
private void handleInstanceName(Node node) {
String instanceName = getTextContent(node);
if (instanceName.isEmpty()) {
throw new InvalidConfigurationException("Instance name in XML configuration is empty");
}
config.setInstanceName(instanceName);
}
private void handleUserCodeDeployment(Node dcRoot) {
UserCodeDeploymentConfig dcConfig = new UserCodeDeploymentConfig();
Node attrEnabled = dcRoot.getAttributes().getNamedItem("enabled");
boolean enabled = getBooleanValue(getTextContent(attrEnabled));
dcConfig.setEnabled(enabled);
String classCacheModeName = "class-cache-mode";
String providerModeName = "provider-mode";
String blacklistPrefixesName = "blacklist-prefixes";
String whitelistPrefixesName = "whitelist-prefixes";
String providerFilterName = "provider-filter";
for (Node n : childElements(dcRoot)) {
String name = cleanNodeName(n);
if (classCacheModeName.equals(name)) {
String value = getTextContent(n);
ClassCacheMode classCacheMode = ClassCacheMode.valueOf(value);
dcConfig.setClassCacheMode(classCacheMode);
} else if (providerModeName.equals(name)) {
String value = getTextContent(n);
ProviderMode providerMode = ProviderMode.valueOf(value);
dcConfig.setProviderMode(providerMode);
} else if (blacklistPrefixesName.equals(name)) {
String value = getTextContent(n);
dcConfig.setBlacklistedPrefixes(value);
} else if (whitelistPrefixesName.equals(name)) {
String value = getTextContent(n);
dcConfig.setWhitelistedPrefixes(value);
} else if (providerFilterName.equals(name)) {
String value = getTextContent(n);
dcConfig.setProviderFilter(value);
}
}
config.setUserCodeDeploymentConfig(dcConfig);
}
private void handleHotRestartPersistence(Node hrRoot) {
final HotRestartPersistenceConfig hrConfig = new HotRestartPersistenceConfig()
.setEnabled(getBooleanValue(getAttribute(hrRoot, "enabled")));
final String parallelismName = "parallelism";
final String validationTimeoutName = "validation-timeout-seconds";
final String dataLoadTimeoutName = "data-load-timeout-seconds";
final String clusterDataRecoveryPolicyName = "cluster-data-recovery-policy";
for (Node n : childElements(hrRoot)) {
final String name = cleanNodeName(n);
if ("base-dir".equals(name)) {
hrConfig.setBaseDir(new File(getTextContent(n)).getAbsoluteFile());
} else if ("backup-dir".equals(name)) {
hrConfig.setBackupDir(new File(getTextContent(n)).getAbsoluteFile());
} else if (parallelismName.equals(name)) {
hrConfig.setParallelism(getIntegerValue(parallelismName, getTextContent(n)));
} else if (validationTimeoutName.equals(name)) {
hrConfig.setValidationTimeoutSeconds(getIntegerValue(validationTimeoutName, getTextContent(n)));
} else if (dataLoadTimeoutName.equals(name)) {
hrConfig.setDataLoadTimeoutSeconds(getIntegerValue(dataLoadTimeoutName, getTextContent(n)));
} else if (clusterDataRecoveryPolicyName.equals(name)) {
hrConfig.setClusterDataRecoveryPolicy(HotRestartClusterDataRecoveryPolicy
.valueOf(upperCaseInternal(getTextContent(n))));
}
}
config.setHotRestartPersistenceConfig(hrConfig);
}
private void handleLiteMember(Node node) {
Node attrEnabled = node.getAttributes().getNamedItem("enabled");
boolean liteMember = attrEnabled != null && getBooleanValue(getTextContent(attrEnabled));
this.config.setLiteMember(liteMember);
}
private void handleQuorum(Node node) {
QuorumConfig quorumConfig = new QuorumConfig();
String name = getAttribute(node, "name");
quorumConfig.setName(name);
Node attrEnabled = node.getAttributes().getNamedItem("enabled");
boolean enabled = attrEnabled != null && getBooleanValue(getTextContent(attrEnabled));
quorumConfig.setEnabled(enabled);
for (Node n : childElements(node)) {
String value = getTextContent(n).trim();
String nodeName = cleanNodeName(n);
if ("quorum-size".equals(nodeName)) {
quorumConfig.setSize(getIntegerValue("quorum-size", value));
} else if ("quorum-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(n)) {
if ("quorum-listener".equals(cleanNodeName(listenerNode))) {
String listenerClass = getTextContent(listenerNode);
quorumConfig.addListenerConfig(new QuorumListenerConfig(listenerClass));
}
}
} else if ("quorum-type".equals(nodeName)) {
quorumConfig.setType(QuorumType.valueOf(upperCaseInternal(value)));
} else if ("quorum-function-class-name".equals(nodeName)) {
quorumConfig.setQuorumFunctionClassName(value);
}
}
this.config.addQuorumConfig(quorumConfig);
}
private void handleServices(Node node) {
Node attDefaults = node.getAttributes().getNamedItem("enable-defaults");
boolean enableDefaults = attDefaults == null || getBooleanValue(getTextContent(attDefaults));
ServicesConfig servicesConfig = config.getServicesConfig();
servicesConfig.setEnableDefaults(enableDefaults);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("service".equals(nodeName)) {
ServiceConfig serviceConfig = new ServiceConfig();
String enabledValue = getAttribute(child, "enabled");
boolean enabled = getBooleanValue(enabledValue);
serviceConfig.setEnabled(enabled);
for (Node n : childElements(child)) {
String value = cleanNodeName(n);
if ("name".equals(value)) {
String name = getTextContent(n);
serviceConfig.setName(name);
} else if ("class-name".equals(value)) {
String className = getTextContent(n);
serviceConfig.setClassName(className);
} else if ("properties".equals(value)) {
fillProperties(n, serviceConfig.getProperties());
} else if ("configuration".equals(value)) {
Node parserNode = n.getAttributes().getNamedItem("parser");
String parserClass = getTextContent(parserNode);
if (parserNode == null || parserClass == null) {
throw new InvalidConfigurationException("Parser is required!");
}
try {
ServiceConfigurationParser parser = ClassLoaderUtil.newInstance(config.getClassLoader(), parserClass);
Object obj = parser.parse((Element) n);
serviceConfig.setConfigObject(obj);
} catch (Exception e) {
ExceptionUtil.sneakyThrow(e);
}
}
}
servicesConfig.addServiceConfig(serviceConfig);
}
}
}
private void handleWanReplication(Node node) throws Exception {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
WanReplicationConfig wanReplicationConfig = new WanReplicationConfig();
wanReplicationConfig.setName(name);
for (Node nodeTarget : childElements(node)) {
String nodeName = cleanNodeName(nodeTarget);
if ("wan-publisher".equals(nodeName)) {
WanPublisherConfig publisherConfig = new WanPublisherConfig();
publisherConfig.setGroupName(getAttribute(nodeTarget, "group-name"));
for (Node targetChild : childElements(nodeTarget)) {
handleWanPublisherConfig(publisherConfig, targetChild);
}
wanReplicationConfig.addWanPublisherConfig(publisherConfig);
} else if ("wan-consumer".equals(nodeName)) {
WanConsumerConfig consumerConfig = new WanConsumerConfig();
for (Node targetChild : childElements(nodeTarget)) {
handleWanConsumerConfig(consumerConfig, targetChild);
}
wanReplicationConfig.setWanConsumerConfig(consumerConfig);
}
}
config.addWanReplicationConfig(wanReplicationConfig);
}
private void handleWanPublisherConfig(WanPublisherConfig publisherConfig, Node targetChild) {
String targetChildName = cleanNodeName(targetChild);
if ("class-name".equals(targetChildName)) {
publisherConfig.setClassName(getTextContent(targetChild));
} else if ("queue-full-behavior".equals(targetChildName)) {
String queueFullBehavior = getTextContent(targetChild);
publisherConfig.setQueueFullBehavior(WANQueueFullBehavior.valueOf(upperCaseInternal(queueFullBehavior)));
} else if ("queue-capacity".equals(targetChildName)) {
int queueCapacity = getIntegerValue("queue-capacity", getTextContent(targetChild));
publisherConfig.setQueueCapacity(queueCapacity);
} else if ("properties".equals(targetChildName)) {
fillProperties(targetChild, publisherConfig.getProperties());
}
}
private void handleWanConsumerConfig(WanConsumerConfig consumerConfig, Node targetChild) {
String targetChildName = cleanNodeName(targetChild);
if ("class-name".equals(targetChildName)) {
consumerConfig.setClassName(getTextContent(targetChild));
} else if ("properties".equals(targetChildName)) {
fillProperties(targetChild, consumerConfig.getProperties());
}
}
private void handleNetwork(Node node) throws Exception {
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("reuse-address".equals(nodeName)) {
String value = getTextContent(child).trim();
config.getNetworkConfig().setReuseAddress(getBooleanValue(value));
} else if ("port".equals(nodeName)) {
handlePort(child);
} else if ("outbound-ports".equals(nodeName)) {
handleOutboundPorts(child);
} else if ("public-address".equals(nodeName)) {
String address = getTextContent(child);
config.getNetworkConfig().setPublicAddress(address);
} else if ("join".equals(nodeName)) {
handleJoin(child);
} else if ("interfaces".equals(nodeName)) {
handleInterfaces(child);
} else if ("symmetric-encryption".equals(nodeName)) {
handleViaReflection(child, config.getNetworkConfig(), new SymmetricEncryptionConfig());
} else if ("ssl".equals(nodeName)) {
handleSSLConfig(child);
} else if ("socket-interceptor".equals(nodeName)) {
handleSocketInterceptorConfig(child);
}
}
}
private void handleExecutor(Node node) throws Exception {
ExecutorConfig executorConfig = new ExecutorConfig();
handleViaReflection(node, config, executorConfig);
}
private void handleDurableExecutor(Node node) throws Exception {
final DurableExecutorConfig durableExecutorConfig = new DurableExecutorConfig();
handleViaReflection(node, config, durableExecutorConfig);
}
private void handleScheduledExecutor(Node node) throws Exception {
ScheduledExecutorConfig scheduledExecutorConfig = new ScheduledExecutorConfig();
handleViaReflection(node, config, scheduledExecutorConfig);
}
private void handleCardinalityEstimator(Node node) throws Exception {
CardinalityEstimatorConfig cardinalityEstimatorConfig = new CardinalityEstimatorConfig();
handleViaReflection(node, config, cardinalityEstimatorConfig);
}
private void handleGroup(Node node) {
for (Node n : childElements(node)) {
String value = getTextContent(n).trim();
String nodeName = cleanNodeName(n);
if ("name".equals(nodeName)) {
config.getGroupConfig().setName(value);
} else if ("password".equals(nodeName)) {
config.getGroupConfig().setPassword(value);
}
}
}
private void handleInterfaces(Node node) {
NamedNodeMap atts = node.getAttributes();
InterfacesConfig interfaces = config.getNetworkConfig().getInterfaces();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
if ("enabled".equals(att.getNodeName())) {
String value = att.getNodeValue();
interfaces.setEnabled(getBooleanValue(value));
}
}
for (Node n : childElements(node)) {
if ("interface".equals(lowerCaseInternal(cleanNodeName(n)))) {
String value = getTextContent(n).trim();
interfaces.addInterface(value);
}
}
}
private void handleViaReflection(Node node, Object parent, Object child) throws Exception {
NamedNodeMap atts = node.getAttributes();
if (atts != null) {
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
invokeSetter(child, att, att.getNodeValue());
}
}
for (Node n : childElements(node)) {
if (n instanceof Element) {
invokeSetter(child, n, getTextContent(n).trim());
}
}
attachChildConfig(parent, child);
}
private static void invokeSetter(Object target, Node node, String argument) {
Method method = getMethod(target, "set" + toPropertyName(cleanNodeName(node)), true);
if (method == null) {
throw new InvalidConfigurationException("Invalid element/attribute name in XML configuration: " + node);
}
Class<?> arg = method.getParameterTypes()[0];
Object coercedArg =
arg == String.class ? argument
: arg == int.class ? Integer.valueOf(argument)
: arg == long.class ? Long.valueOf(argument)
: arg == boolean.class ? getBooleanValue(argument)
: null;
if (coercedArg == null) {
throw new HazelcastException(String.format(
"Method %s has unsupported argument type %s", method.getName(), arg.getSimpleName()));
}
try {
method.invoke(target, coercedArg);
} catch (Exception e) {
throw new HazelcastException(e);
}
}
private static void attachChildConfig(Object parent, Object child) throws Exception {
String targetName = child.getClass().getSimpleName();
Method attacher = getMethod(parent, "set" + targetName, false);
if (attacher == null) {
attacher = getMethod(parent, "add" + targetName, false);
}
if (attacher == null) {
throw new HazelcastException(String.format(
"%s doesn't accept %s as child", parent.getClass().getSimpleName(), targetName));
}
attacher.invoke(parent, child);
}
private static Method getMethod(Object target, String methodName, boolean requiresArg) {
Method[] methods = target.getClass().getMethods();
for (Method method : methods) {
if (method.getName().equalsIgnoreCase(methodName)) {
if (!requiresArg) {
return method;
}
Class<?>[] args = method.getParameterTypes();
if (args.length != 1) {
continue;
}
Class<?> arg = method.getParameterTypes()[0];
if (arg == String.class || arg == int.class || arg == long.class || arg == boolean.class) {
return method;
}
}
}
return null;
}
private static String toPropertyName(String element) {
StringBuilder sb = new StringBuilder();
char[] chars = element.toCharArray();
boolean upper = true;
for (char c : chars) {
if (c == '_' || c == '-' || c == '.') {
upper = true;
} else if (upper) {
sb.append(Character.toUpperCase(c));
upper = false;
} else {
sb.append(c);
}
}
return sb.toString();
}
private void handleJoin(Node node) {
for (Node child : childElements(node)) {
String name = cleanNodeName(child);
if ("multicast".equals(name)) {
handleMulticast(child);
} else if ("tcp-ip".equals(name)) {
handleTcpIp(child);
} else if ("aws".equals(name)) {
handleAWS(child);
} else if ("discovery-strategies".equals(name)) {
handleDiscoveryStrategies(child);
}
}
JoinConfig joinConfig = config.getNetworkConfig().getJoin();
joinConfig.verify();
}
private void handleDiscoveryStrategies(Node node) {
JoinConfig join = config.getNetworkConfig().getJoin();
DiscoveryConfig discoveryConfig = join.getDiscoveryConfig();
for (Node child : childElements(node)) {
String name = cleanNodeName(child);
if ("discovery-strategy".equals(name)) {
handleDiscoveryStrategy(child, discoveryConfig);
} else if ("node-filter".equals(name)) {
handleDiscoveryNodeFilter(child, discoveryConfig);
}
}
}
private void handleDiscoveryNodeFilter(Node node, DiscoveryConfig discoveryConfig) {
NamedNodeMap atts = node.getAttributes();
Node att = atts.getNamedItem("class");
if (att != null) {
discoveryConfig.setNodeFilterClass(getTextContent(att).trim());
}
}
private void handleDiscoveryStrategy(Node node, DiscoveryConfig discoveryConfig) {
NamedNodeMap atts = node.getAttributes();
boolean enabled = false;
String clazz = null;
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if ("enabled".equals(lowerCaseInternal(att.getNodeName()))) {
enabled = getBooleanValue(value);
} else if ("class".equals(att.getNodeName())) {
clazz = value;
}
}
if (!enabled || clazz == null) {
return;
}
Map<String, Comparable> properties = new HashMap<String, Comparable>();
for (Node child : childElements(node)) {
String name = cleanNodeName(child);
if ("properties".equals(name)) {
fillProperties(child, properties);
}
}
discoveryConfig.addDiscoveryStrategyConfig(new DiscoveryStrategyConfig(clazz, properties));
}
private void handleAWS(Node node) {
JoinConfig join = config.getNetworkConfig().getJoin();
NamedNodeMap atts = node.getAttributes();
AwsConfig awsConfig = join.getAwsConfig();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if ("enabled".equals(lowerCaseInternal(att.getNodeName()))) {
awsConfig.setEnabled(getBooleanValue(value));
} else if (att.getNodeName().equals("connection-timeout-seconds")) {
awsConfig.setConnectionTimeoutSeconds(getIntegerValue("connection-timeout-seconds", value));
}
}
for (Node n : childElements(node)) {
String value = getTextContent(n).trim();
if ("secret-key".equals(cleanNodeName(n))) {
awsConfig.setSecretKey(value);
} else if ("access-key".equals(cleanNodeName(n))) {
awsConfig.setAccessKey(value);
} else if ("region".equals(cleanNodeName(n))) {
awsConfig.setRegion(value);
} else if ("host-header".equals(cleanNodeName(n))) {
awsConfig.setHostHeader(value);
} else if ("security-group-name".equals(cleanNodeName(n))) {
awsConfig.setSecurityGroupName(value);
} else if ("tag-key".equals(cleanNodeName(n))) {
awsConfig.setTagKey(value);
} else if ("tag-value".equals(cleanNodeName(n))) {
awsConfig.setTagValue(value);
} else if ("iam-role".equals(cleanNodeName(n))) {
awsConfig.setIamRole(value);
}
}
}
private void handleMulticast(Node node) {
JoinConfig join = config.getNetworkConfig().getJoin();
NamedNodeMap atts = node.getAttributes();
MulticastConfig multicastConfig = join.getMulticastConfig();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if ("enabled".equals(lowerCaseInternal(att.getNodeName()))) {
multicastConfig.setEnabled(getBooleanValue(value));
} else if ("loopbackmodeenabled".equals(lowerCaseInternal(att.getNodeName()))) {
multicastConfig.setLoopbackModeEnabled(getBooleanValue(value));
}
}
for (Node n : childElements(node)) {
String value = getTextContent(n).trim();
if ("multicast-group".equals(cleanNodeName(n))) {
multicastConfig.setMulticastGroup(value);
} else if ("multicast-port".equals(cleanNodeName(n))) {
multicastConfig.setMulticastPort(parseInt(value));
} else if ("multicast-timeout-seconds".equals(cleanNodeName(n))) {
multicastConfig.setMulticastTimeoutSeconds(parseInt(value));
} else if ("multicast-time-to-live-seconds".equals(cleanNodeName(n))) {
//we need this line for the time being to prevent not reading the multicast-time-to-live-seconds property
//for more info see: https://github.com/hazelcast/hazelcast/issues/752
multicastConfig.setMulticastTimeToLive(parseInt(value));
} else if ("multicast-time-to-live".equals(cleanNodeName(n))) {
multicastConfig.setMulticastTimeToLive(parseInt(value));
} else if ("trusted-interfaces".equals(cleanNodeName(n))) {
for (Node child : childElements(n)) {
if ("interface".equals(lowerCaseInternal(cleanNodeName(child)))) {
multicastConfig.addTrustedInterface(getTextContent(child).trim());
}
}
}
}
}
private void handleTcpIp(Node node) {
NamedNodeMap atts = node.getAttributes();
JoinConfig join = config.getNetworkConfig().getJoin();
TcpIpConfig tcpIpConfig = join.getTcpIpConfig();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if (att.getNodeName().equals("enabled")) {
tcpIpConfig.setEnabled(getBooleanValue(value));
} else if (att.getNodeName().equals("connection-timeout-seconds")) {
tcpIpConfig.setConnectionTimeoutSeconds(getIntegerValue("connection-timeout-seconds", value));
}
}
Set<String> memberTags = new HashSet<String>(Arrays.asList("interface", "member", "members"));
for (Node n : childElements(node)) {
String value = getTextContent(n).trim();
if (cleanNodeName(n).equals("member-list")) {
handleMemberList(n);
} else if (cleanNodeName(n).equals("required-member")) {
if (tcpIpConfig.getRequiredMember() != null) {
throw new InvalidConfigurationException("Duplicate required-member"
+ " definition found in XML configuration. ");
}
tcpIpConfig.setRequiredMember(value);
} else if (memberTags.contains(cleanNodeName(n))) {
tcpIpConfig.addMember(value);
}
}
}
private void handleMemberList(Node node) {
JoinConfig join = config.getNetworkConfig().getJoin();
TcpIpConfig tcpIpConfig = join.getTcpIpConfig();
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
if ("member".equals(nodeName)) {
String value = getTextContent(n).trim();
tcpIpConfig.addMember(value);
}
}
}
private void handlePort(Node node) {
String portStr = getTextContent(node).trim();
NetworkConfig networkConfig = config.getNetworkConfig();
if (portStr != null && portStr.length() > 0) {
networkConfig.setPort(parseInt(portStr));
}
NamedNodeMap atts = node.getAttributes();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if ("auto-increment".equals(att.getNodeName())) {
networkConfig.setPortAutoIncrement(getBooleanValue(value));
} else if ("port-count".equals(att.getNodeName())) {
int portCount = parseInt(value);
networkConfig.setPortCount(portCount);
}
}
}
private void handleOutboundPorts(Node child) {
NetworkConfig networkConfig = config.getNetworkConfig();
for (Node n : childElements(child)) {
String nodeName = cleanNodeName(n);
if ("ports".equals(nodeName)) {
String value = getTextContent(n);
networkConfig.addOutboundPortDefinition(value);
}
}
}
private void handleLock(Node node) {
final String name = getAttribute(node, "name");
final LockConfig lockConfig = new LockConfig();
lockConfig.setName(name);
for (Node n : childElements(node)) {
final String nodeName = cleanNodeName(n);
final String value = getTextContent(n).trim();
if ("quorum-ref".equals(nodeName)) {
lockConfig.setQuorumName(value);
}
}
this.config.addLockConfig(lockConfig);
}
private void handleQueue(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
QueueConfig qConfig = new QueueConfig();
qConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("max-size".equals(nodeName)) {
qConfig.setMaxSize(getIntegerValue("max-size", value));
} else if ("backup-count".equals(nodeName)) {
qConfig.setBackupCount(getIntegerValue("backup-count", value));
} else if ("async-backup-count".equals(nodeName)) {
qConfig.setAsyncBackupCount(getIntegerValue("async-backup-count", value));
} else if ("item-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(n)) {
if ("item-listener".equals(cleanNodeName(listenerNode))) {
NamedNodeMap attrs = listenerNode.getAttributes();
boolean incValue = getBooleanValue(getTextContent(attrs.getNamedItem("include-value")));
String listenerClass = getTextContent(listenerNode);
qConfig.addItemListenerConfig(new ItemListenerConfig(listenerClass, incValue));
}
}
} else if ("statistics-enabled".equals(nodeName)) {
qConfig.setStatisticsEnabled(getBooleanValue(value));
} else if ("queue-store".equals(nodeName)) {
QueueStoreConfig queueStoreConfig = createQueueStoreConfig(n);
qConfig.setQueueStoreConfig(queueStoreConfig);
} else if ("quorum-ref".equals(nodeName)) {
qConfig.setQuorumName(value);
} else if ("empty-queue-ttl".equals(nodeName)) {
qConfig.setEmptyQueueTtl(getIntegerValue("empty-queue-ttl", value));
}
}
this.config.addQueueConfig(qConfig);
}
private void handleList(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
ListConfig lConfig = new ListConfig();
lConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("max-size".equals(nodeName)) {
lConfig.setMaxSize(getIntegerValue("max-size", value));
} else if ("backup-count".equals(nodeName)) {
lConfig.setBackupCount(getIntegerValue("backup-count", value));
} else if ("async-backup-count".equals(nodeName)) {
lConfig.setAsyncBackupCount(getIntegerValue("async-backup-count", value));
} else if ("item-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(n)) {
if ("item-listener".equals(cleanNodeName(listenerNode))) {
NamedNodeMap attrs = listenerNode.getAttributes();
boolean incValue = getBooleanValue(getTextContent(attrs.getNamedItem("include-value")));
String listenerClass = getTextContent(listenerNode);
lConfig.addItemListenerConfig(new ItemListenerConfig(listenerClass, incValue));
}
}
} else if ("statistics-enabled".equals(nodeName)) {
lConfig.setStatisticsEnabled(getBooleanValue(value));
}
}
this.config.addListConfig(lConfig);
}
private void handleSet(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
SetConfig sConfig = new SetConfig();
sConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("max-size".equals(nodeName)) {
sConfig.setMaxSize(getIntegerValue("max-size", value));
} else if ("backup-count".equals(nodeName)) {
sConfig.setBackupCount(getIntegerValue("backup-count", value));
} else if ("async-backup-count".equals(nodeName)) {
sConfig.setAsyncBackupCount(getIntegerValue("async-backup-count", value));
} else if ("item-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(n)) {
if ("item-listener".equals(cleanNodeName(listenerNode))) {
NamedNodeMap attrs = listenerNode.getAttributes();
boolean incValue = getBooleanValue(getTextContent(attrs.getNamedItem("include-value")));
String listenerClass = getTextContent(listenerNode);
sConfig.addItemListenerConfig(new ItemListenerConfig(listenerClass, incValue));
}
}
} else if ("statistics-enabled".equals(nodeName)) {
sConfig.setStatisticsEnabled(getBooleanValue(value));
}
}
this.config.addSetConfig(sConfig);
}
private void handleMultiMap(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
MultiMapConfig multiMapConfig = new MultiMapConfig();
multiMapConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("value-collection-type".equals(nodeName)) {
multiMapConfig.setValueCollectionType(value);
} else if ("backup-count".equals(nodeName)) {
multiMapConfig.setBackupCount(getIntegerValue("backup-count"
, value));
} else if ("async-backup-count".equals(nodeName)) {
multiMapConfig.setAsyncBackupCount(getIntegerValue("async-backup-count"
, value));
} else if ("entry-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(n)) {
if ("entry-listener".equals(cleanNodeName(listenerNode))) {
NamedNodeMap attrs = listenerNode.getAttributes();
boolean incValue = getBooleanValue(getTextContent(attrs.getNamedItem("include-value")));
boolean local = getBooleanValue(getTextContent(attrs.getNamedItem("local")));
String listenerClass = getTextContent(listenerNode);
multiMapConfig.addEntryListenerConfig(new EntryListenerConfig(listenerClass, local, incValue));
}
}
} else if ("statistics-enabled".equals(nodeName)) {
multiMapConfig.setStatisticsEnabled(getBooleanValue(value));
} else if ("binary".equals(nodeName)) {
multiMapConfig.setBinary(getBooleanValue(value));
}
}
this.config.addMultiMapConfig(multiMapConfig);
}
private void handleReplicatedMap(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
ReplicatedMapConfig replicatedMapConfig = new ReplicatedMapConfig();
replicatedMapConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("concurrency-level".equals(nodeName)) {
replicatedMapConfig.setConcurrencyLevel(getIntegerValue("concurrency-level"
, value));
} else if ("in-memory-format".equals(nodeName)) {
replicatedMapConfig.setInMemoryFormat(InMemoryFormat.valueOf(upperCaseInternal(value)));
} else if ("replication-delay-millis".equals(nodeName)) {
replicatedMapConfig.setReplicationDelayMillis(getIntegerValue("replication-delay-millis"
, value));
} else if ("async-fillup".equals(nodeName)) {
replicatedMapConfig.setAsyncFillup(getBooleanValue(value));
} else if ("statistics-enabled".equals(nodeName)) {
replicatedMapConfig.setStatisticsEnabled(getBooleanValue(value));
} else if ("entry-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(n)) {
if ("entry-listener".equals(cleanNodeName(listenerNode))) {
NamedNodeMap attrs = listenerNode.getAttributes();
boolean incValue = getBooleanValue(getTextContent(attrs.getNamedItem("include-value")));
boolean local = getBooleanValue(getTextContent(attrs.getNamedItem("local")));
String listenerClass = getTextContent(listenerNode);
replicatedMapConfig.addEntryListenerConfig(new EntryListenerConfig(listenerClass, local, incValue));
}
}
} else if ("merge-policy".equals(nodeName)) {
replicatedMapConfig.setMergePolicy(value);
}
}
this.config.addReplicatedMapConfig(replicatedMapConfig);
}
//CHECKSTYLE:OFF
private void handleMap(Node parentNode) throws Exception {
String name = getAttribute(parentNode, "name");
MapConfig mapConfig = new MapConfig();
mapConfig.setName(name);
for (Node node : childElements(parentNode)) {
String nodeName = cleanNodeName(node);
String value = getTextContent(node).trim();
if ("backup-count".equals(nodeName)) {
mapConfig.setBackupCount(getIntegerValue("backup-count", value));
} else if ("in-memory-format".equals(nodeName)) {
mapConfig.setInMemoryFormat(InMemoryFormat.valueOf(upperCaseInternal(value)));
} else if ("async-backup-count".equals(nodeName)) {
mapConfig.setAsyncBackupCount(getIntegerValue("async-backup-count", value));
} else if ("eviction-policy".equals(nodeName)) {
if (mapConfig.getMapEvictionPolicy() == null) {
mapConfig.setEvictionPolicy(EvictionPolicy.valueOf(upperCaseInternal(value)));
}
} else if ("max-size".equals(nodeName)) {
MaxSizeConfig msc = mapConfig.getMaxSizeConfig();
Node maxSizePolicy = node.getAttributes().getNamedItem("policy");
if (maxSizePolicy != null) {
msc.setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.valueOf(
upperCaseInternal(getTextContent(maxSizePolicy))));
}
int size = sizeParser(value);
msc.setSize(size);
} else if ("eviction-percentage".equals(nodeName)) {
mapConfig.setEvictionPercentage(getIntegerValue("eviction-percentage", value
));
} else if ("min-eviction-check-millis".equals(nodeName)) {
mapConfig.setMinEvictionCheckMillis(getLongValue("min-eviction-check-millis", value
));
} else if ("time-to-live-seconds".equals(nodeName)) {
mapConfig.setTimeToLiveSeconds(getIntegerValue("time-to-live-seconds", value
));
} else if ("max-idle-seconds".equals(nodeName)) {
mapConfig.setMaxIdleSeconds(getIntegerValue("max-idle-seconds", value
));
} else if ("map-store".equals(nodeName)) {
MapStoreConfig mapStoreConfig = createMapStoreConfig(node);
mapConfig.setMapStoreConfig(mapStoreConfig);
} else if ("near-cache".equals(nodeName)) {
mapConfig.setNearCacheConfig(handleNearCacheConfig(node));
} else if ("merge-policy".equals(nodeName)) {
mapConfig.setMergePolicy(value);
} else if ("hot-restart".equals(nodeName)) {
mapConfig.setHotRestartConfig(createHotRestartConfig(node));
} else if ("read-backup-data".equals(nodeName)) {
mapConfig.setReadBackupData(getBooleanValue(value));
} else if ("statistics-enabled".equals(nodeName)) {
mapConfig.setStatisticsEnabled(getBooleanValue(value));
} else if ("optimize-queries".equals(nodeName)) {
mapConfig.setOptimizeQueries(getBooleanValue(value));
} else if ("cache-deserialized-values".equals(nodeName)) {
CacheDeserializedValues cacheDeserializedValues = CacheDeserializedValues.parseString(value);
mapConfig.setCacheDeserializedValues(cacheDeserializedValues);
} else if ("wan-replication-ref".equals(nodeName)) {
mapWanReplicationRefHandle(node, mapConfig);
} else if ("indexes".equals(nodeName)) {
mapIndexesHandle(node, mapConfig);
} else if ("attributes".equals(nodeName)) {
mapAttributesHandle(node, mapConfig);
} else if ("entry-listeners".equals(nodeName)) {
mapEntryListenerHandle(node, mapConfig);
} else if ("partition-lost-listeners".equals(nodeName)) {
mapPartitionLostListenerHandle(node, mapConfig);
} else if ("partition-strategy".equals(nodeName)) {
mapConfig.setPartitioningStrategyConfig(new PartitioningStrategyConfig(value));
} else if ("quorum-ref".equals(nodeName)) {
mapConfig.setQuorumName(value);
} else if ("query-caches".equals(nodeName)) {
mapQueryCacheHandler(node, mapConfig);
} else if ("map-eviction-policy-class-name".equals(nodeName)) {
String className = checkHasText(getTextContent(node), "map-eviction-policy-class-name cannot be null or empty");
try {
MapEvictionPolicy mapEvictionPolicy = ClassLoaderUtil.newInstance(config.getClassLoader(), className);
mapConfig.setMapEvictionPolicy(mapEvictionPolicy);
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
}
this.config.addMapConfig(mapConfig);
}
//CHECKSTYLE:ON
private NearCacheConfig handleNearCacheConfig(Node node) {
String name = getAttribute(node, "name");
NearCacheConfig nearCacheConfig = new NearCacheConfig(name);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
String value = getTextContent(child).trim();
if ("max-size".equals(nodeName)) {
nearCacheConfig.setMaxSize(Integer.parseInt(value));
LOGGER.warning("The element <max-size/> for <near-cache/> is deprecated, please use <eviction/> instead!");
} else if ("time-to-live-seconds".equals(nodeName)) {
nearCacheConfig.setTimeToLiveSeconds(Integer.parseInt(value));
} else if ("max-idle-seconds".equals(nodeName)) {
nearCacheConfig.setMaxIdleSeconds(Integer.parseInt(value));
} else if ("eviction-policy".equals(nodeName)) {
nearCacheConfig.setEvictionPolicy(value);
LOGGER.warning("The element <eviction-policy/> for <near-cache/> is deprecated, please use <eviction/> instead!");
} else if ("in-memory-format".equals(nodeName)) {
nearCacheConfig.setInMemoryFormat(InMemoryFormat.valueOf(upperCaseInternal(value)));
} else if ("invalidate-on-change".equals(nodeName)) {
nearCacheConfig.setInvalidateOnChange(Boolean.parseBoolean(value));
} else if ("cache-local-entries".equals(nodeName)) {
nearCacheConfig.setCacheLocalEntries(Boolean.parseBoolean(value));
} else if ("local-update-policy".equals(nodeName)) {
NearCacheConfig.LocalUpdatePolicy policy = NearCacheConfig.LocalUpdatePolicy.valueOf(value);
nearCacheConfig.setLocalUpdatePolicy(policy);
} else if ("eviction".equals(nodeName)) {
nearCacheConfig.setEvictionConfig(getEvictionConfig(child, true));
}
}
return nearCacheConfig;
}
private HotRestartConfig createHotRestartConfig(Node node) {
HotRestartConfig hotRestartConfig = new HotRestartConfig();
Node attrEnabled = node.getAttributes().getNamedItem("enabled");
boolean enabled = getBooleanValue(getTextContent(attrEnabled));
hotRestartConfig.setEnabled(enabled);
for (Node n : childElements(node)) {
String name = cleanNodeName(n);
if ("fsync".equals(name)) {
hotRestartConfig.setFsync(getBooleanValue(getTextContent(n)));
}
}
return hotRestartConfig;
}
private void handleCache(Node node) throws Exception {
String name = getAttribute(node, "name");
CacheSimpleConfig cacheConfig = new CacheSimpleConfig();
cacheConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("key-type".equals(nodeName)) {
cacheConfig.setKeyType(getAttribute(n, "class-name"));
} else if ("value-type".equals(nodeName)) {
cacheConfig.setValueType(getAttribute(n, "class-name"));
} else if ("statistics-enabled".equals(nodeName)) {
cacheConfig.setStatisticsEnabled(getBooleanValue(value));
} else if ("management-enabled".equals(nodeName)) {
cacheConfig.setManagementEnabled(getBooleanValue(value));
} else if ("read-through".equals(nodeName)) {
cacheConfig.setReadThrough(getBooleanValue(value));
} else if ("write-through".equals(nodeName)) {
cacheConfig.setWriteThrough(getBooleanValue(value));
} else if ("cache-loader-factory".equals(nodeName)) {
cacheConfig.setCacheLoaderFactory(getAttribute(n, "class-name"));
} else if ("cache-loader".equals(nodeName)) {
cacheConfig.setCacheLoader(getAttribute(n, "class-name"));
} else if ("cache-writer-factory".equals(nodeName)) {
cacheConfig.setCacheWriterFactory(getAttribute(n, "class-name"));
} else if ("cache-writer".equals(nodeName)) {
cacheConfig.setCacheWriter(getAttribute(n, "class-name"));
} else if ("expiry-policy-factory".equals(nodeName)) {
cacheConfig.setExpiryPolicyFactoryConfig(getExpiryPolicyFactoryConfig(n));
} else if ("cache-entry-listeners".equals(nodeName)) {
cacheListenerHandle(n, cacheConfig);
} else if ("in-memory-format".equals(nodeName)) {
cacheConfig.setInMemoryFormat(InMemoryFormat.valueOf(upperCaseInternal(value)));
} else if ("backup-count".equals(nodeName)) {
cacheConfig.setBackupCount(getIntegerValue("backup-count", value));
} else if ("async-backup-count".equals(nodeName)) {
cacheConfig.setAsyncBackupCount(getIntegerValue("async-backup-count", value));
} else if ("wan-replication-ref".equals(nodeName)) {
cacheWanReplicationRefHandle(n, cacheConfig);
} else if ("eviction".equals(nodeName)) {
cacheConfig.setEvictionConfig(getEvictionConfig(n, false));
} else if ("quorum-ref".equals(nodeName)) {
cacheConfig.setQuorumName(value);
} else if ("partition-lost-listeners".equals(nodeName)) {
cachePartitionLostListenerHandle(n, cacheConfig);
} else if ("merge-policy".equals(nodeName)) {
cacheConfig.setMergePolicy(value);
} else if ("hot-restart".equals(nodeName)) {
cacheConfig.setHotRestartConfig(createHotRestartConfig(n));
} else if ("disable-per-entry-invalidation-events".equals(nodeName)) {
cacheConfig.setDisablePerEntryInvalidationEvents(getBooleanValue(value));
}
}
this.config.addCacheConfig(cacheConfig);
}
private ExpiryPolicyFactoryConfig getExpiryPolicyFactoryConfig(Node node) {
String className = getAttribute(node, "class-name");
if (!isNullOrEmpty(className)) {
return new ExpiryPolicyFactoryConfig(className);
} else {
TimedExpiryPolicyFactoryConfig timedExpiryPolicyFactoryConfig = null;
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
if ("timed-expiry-policy-factory".equals(nodeName)) {
timedExpiryPolicyFactoryConfig = getTimedExpiryPolicyFactoryConfig(n);
}
}
if (timedExpiryPolicyFactoryConfig == null) {
throw new InvalidConfigurationException(
"One of the \"class-name\" or \"timed-expire-policy-factory\" configuration "
+ "is needed for expiry policy factory configuration");
} else {
return new ExpiryPolicyFactoryConfig(timedExpiryPolicyFactoryConfig);
}
}
}
private TimedExpiryPolicyFactoryConfig getTimedExpiryPolicyFactoryConfig(Node node) {
String expiryPolicyTypeStr = getAttribute(node, "expiry-policy-type");
String durationAmountStr = getAttribute(node, "duration-amount");
String timeUnitStr = getAttribute(node, "time-unit");
ExpiryPolicyType expiryPolicyType = ExpiryPolicyType.valueOf(upperCaseInternal(expiryPolicyTypeStr));
if (expiryPolicyType != ExpiryPolicyType.ETERNAL && (isNullOrEmpty(durationAmountStr) || isNullOrEmpty(timeUnitStr))) {
throw new InvalidConfigurationException(
"Both of the \"duration-amount\" or \"time-unit\" attributes "
+ "are required for expiry policy factory configuration "
+ "(except \"ETERNAL\" expiry policy type)");
}
DurationConfig durationConfig = null;
if (expiryPolicyType != ExpiryPolicyType.ETERNAL) {
long durationAmount;
try {
durationAmount = parseLong(durationAmountStr);
} catch (NumberFormatException e) {
throw new InvalidConfigurationException(
"Invalid value for duration amount: " + durationAmountStr, e);
}
if (durationAmount <= 0) {
throw new InvalidConfigurationException(
"Duration amount must be positive: " + durationAmount);
}
TimeUnit timeUnit;
try {
timeUnit = TimeUnit.valueOf(upperCaseInternal(timeUnitStr));
} catch (IllegalArgumentException e) {
throw new InvalidConfigurationException(
"Invalid value for time unit: " + timeUnitStr, e);
}
durationConfig = new DurationConfig(durationAmount, timeUnit);
}
return new TimedExpiryPolicyFactoryConfig(expiryPolicyType, durationConfig);
}
private EvictionConfig getEvictionConfig(Node node, boolean isNearCache) {
EvictionConfig evictionConfig = new EvictionConfig();
Node size = node.getAttributes().getNamedItem("size");
Node maxSizePolicy = node.getAttributes().getNamedItem("max-size-policy");
Node evictionPolicy = node.getAttributes().getNamedItem("eviction-policy");
Node comparatorClassName = node.getAttributes().getNamedItem("comparator-class-name");
if (size != null) {
evictionConfig.setSize(parseInt(getTextContent(size)));
}
if (maxSizePolicy != null) {
evictionConfig.setMaximumSizePolicy(MaxSizePolicy.valueOf(upperCaseInternal(getTextContent(maxSizePolicy)))
);
}
if (evictionPolicy != null) {
evictionConfig.setEvictionPolicy(EvictionPolicy.valueOf(upperCaseInternal(getTextContent(evictionPolicy)))
);
}
if (comparatorClassName != null) {
evictionConfig.setComparatorClassName(getTextContent(comparatorClassName));
}
try {
checkEvictionConfig(evictionConfig, isNearCache);
} catch (IllegalArgumentException e) {
throw new InvalidConfigurationException(e.getMessage());
}
return evictionConfig;
}
private void cacheWanReplicationRefHandle(Node n, CacheSimpleConfig cacheConfig) {
WanReplicationRef wanReplicationRef = new WanReplicationRef();
String wanName = getAttribute(n, "name");
wanReplicationRef.setName(wanName);
for (Node wanChild : childElements(n)) {
String wanChildName = cleanNodeName(wanChild);
String wanChildValue = getTextContent(wanChild);
if ("merge-policy".equals(wanChildName)) {
wanReplicationRef.setMergePolicy(wanChildValue);
} else if ("filters".equals(wanChildName)) {
handleWanFilters(wanChild, wanReplicationRef);
} else if ("republishing-enabled".equals(wanChildName)) {
wanReplicationRef.setRepublishingEnabled(getBooleanValue(wanChildValue));
}
}
cacheConfig.setWanReplicationRef(wanReplicationRef);
}
private void handleWanFilters(Node wanChild, WanReplicationRef wanReplicationRef) {
for (Node filter : childElements(wanChild)) {
if ("filter-impl".equals(cleanNodeName(filter))) {
wanReplicationRef.addFilter(getTextContent(filter));
}
}
}
private void cachePartitionLostListenerHandle(Node n, CacheSimpleConfig cacheConfig) {
for (Node listenerNode : childElements(n)) {
if ("partition-lost-listener".equals(cleanNodeName(listenerNode))) {
String listenerClass = getTextContent(listenerNode);
cacheConfig.addCachePartitionLostListenerConfig(
new CachePartitionLostListenerConfig(listenerClass));
}
}
}
private void cacheListenerHandle(Node n, CacheSimpleConfig cacheSimpleConfig) {
for (Node listenerNode : childElements(n)) {
if ("cache-entry-listener".equals(cleanNodeName(listenerNode))) {
CacheSimpleEntryListenerConfig listenerConfig = new CacheSimpleEntryListenerConfig();
for (Node listenerChildNode : childElements(listenerNode)) {
if ("cache-entry-listener-factory".equals(cleanNodeName(listenerChildNode))) {
listenerConfig.setCacheEntryListenerFactory(getAttribute(listenerChildNode, "class-name"));
}
if ("cache-entry-event-filter-factory".equals(cleanNodeName(listenerChildNode))) {
listenerConfig.setCacheEntryEventFilterFactory(getAttribute(listenerChildNode, "class-name"));
}
}
NamedNodeMap attrs = listenerNode.getAttributes();
listenerConfig.setOldValueRequired(getBooleanValue(getTextContent(attrs.getNamedItem("old-value-required"))));
listenerConfig.setSynchronous(getBooleanValue(getTextContent(attrs.getNamedItem("synchronous"))));
cacheSimpleConfig.addEntryListenerConfig(listenerConfig);
}
}
}
private void mapWanReplicationRefHandle(Node n, MapConfig mapConfig) {
WanReplicationRef wanReplicationRef = new WanReplicationRef();
String wanName = getAttribute(n, "name");
wanReplicationRef.setName(wanName);
for (Node wanChild : childElements(n)) {
String wanChildName = cleanNodeName(wanChild);
String wanChildValue = getTextContent(wanChild);
if ("merge-policy".equals(wanChildName)) {
wanReplicationRef.setMergePolicy(wanChildValue);
} else if ("republishing-enabled".equals(wanChildName)) {
wanReplicationRef.setRepublishingEnabled(getBooleanValue(wanChildValue));
} else if ("filters".equals(wanChildName)) {
handleWanFilters(wanChild, wanReplicationRef);
}
}
mapConfig.setWanReplicationRef(wanReplicationRef);
}
private void mapIndexesHandle(Node n, MapConfig mapConfig) {
for (Node indexNode : childElements(n)) {
if ("index".equals(cleanNodeName(indexNode))) {
NamedNodeMap attrs = indexNode.getAttributes();
boolean ordered = getBooleanValue(getTextContent(attrs.getNamedItem("ordered")));
String attribute = getTextContent(indexNode);
mapConfig.addMapIndexConfig(new MapIndexConfig(attribute, ordered));
}
}
}
private void queryCacheIndexesHandle(Node n, QueryCacheConfig queryCacheConfig) {
for (Node indexNode : childElements(n)) {
if ("index".equals(cleanNodeName(indexNode))) {
NamedNodeMap attrs = indexNode.getAttributes();
boolean ordered = getBooleanValue(getTextContent(attrs.getNamedItem("ordered")));
String attribute = getTextContent(indexNode);
queryCacheConfig.addIndexConfig(new MapIndexConfig(attribute, ordered));
}
}
}
private void mapAttributesHandle(Node n, MapConfig mapConfig) {
for (Node extractorNode : childElements(n)) {
if ("attribute".equals(cleanNodeName(extractorNode))) {
NamedNodeMap attrs = extractorNode.getAttributes();
String extractor = getTextContent(attrs.getNamedItem("extractor"));
String name = getTextContent(extractorNode);
mapConfig.addMapAttributeConfig(new MapAttributeConfig(name, extractor));
}
}
}
private void mapEntryListenerHandle(Node n, MapConfig mapConfig) {
for (Node listenerNode : childElements(n)) {
if ("entry-listener".equals(cleanNodeName(listenerNode))) {
NamedNodeMap attrs = listenerNode.getAttributes();
boolean incValue = getBooleanValue(getTextContent(attrs.getNamedItem("include-value")));
boolean local = getBooleanValue(getTextContent(attrs.getNamedItem("local")));
String listenerClass = getTextContent(listenerNode);
mapConfig.addEntryListenerConfig(new EntryListenerConfig(listenerClass, local, incValue));
}
}
}
private void mapPartitionLostListenerHandle(Node n, MapConfig mapConfig) {
for (Node listenerNode : childElements(n)) {
if ("partition-lost-listener".equals(cleanNodeName(listenerNode))) {
String listenerClass = getTextContent(listenerNode);
mapConfig.addMapPartitionLostListenerConfig(new MapPartitionLostListenerConfig(listenerClass));
}
}
}
private void mapQueryCacheHandler(Node n, MapConfig mapConfig) {
for (Node queryCacheNode : childElements(n)) {
if ("query-cache".equals(cleanNodeName(queryCacheNode))) {
NamedNodeMap attrs = queryCacheNode.getAttributes();
String cacheName = getTextContent(attrs.getNamedItem("name"));
QueryCacheConfig queryCacheConfig = new QueryCacheConfig(cacheName);
for (Node childNode : childElements(queryCacheNode)) {
String nodeName = cleanNodeName(childNode);
if ("entry-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(childNode)) {
if ("entry-listener".equals(cleanNodeName(listenerNode))) {
NamedNodeMap listenerNodeAttributes = listenerNode.getAttributes();
boolean incValue = getBooleanValue(
getTextContent(listenerNodeAttributes.getNamedItem("include-value")));
boolean local = getBooleanValue(getTextContent(listenerNodeAttributes.getNamedItem("local")));
String listenerClass = getTextContent(listenerNode);
queryCacheConfig.addEntryListenerConfig(new EntryListenerConfig(listenerClass, local, incValue));
}
}
} else {
String textContent = getTextContent(childNode);
if ("include-value".equals(nodeName)) {
boolean includeValue = getBooleanValue(textContent);
queryCacheConfig.setIncludeValue(includeValue);
} else if ("batch-size".equals(nodeName)) {
int batchSize = getIntegerValue("batch-size", textContent.trim());
queryCacheConfig.setBatchSize(batchSize);
} else if ("buffer-size".equals(nodeName)) {
int bufferSize = getIntegerValue("buffer-size", textContent.trim());
queryCacheConfig.setBufferSize(bufferSize);
} else if ("delay-seconds".equals(nodeName)) {
int delaySeconds = getIntegerValue("delay-seconds", textContent.trim());
queryCacheConfig.setDelaySeconds(delaySeconds);
} else if ("in-memory-format".equals(nodeName)) {
String value = textContent.trim();
queryCacheConfig.setInMemoryFormat(InMemoryFormat.valueOf(upperCaseInternal(value)));
} else if ("coalesce".equals(nodeName)) {
boolean coalesce = getBooleanValue(textContent);
queryCacheConfig.setCoalesce(coalesce);
} else if ("populate".equals(nodeName)) {
boolean populate = getBooleanValue(textContent);
queryCacheConfig.setPopulate(populate);
} else if ("indexes".equals(nodeName)) {
queryCacheIndexesHandle(childNode, queryCacheConfig);
} else if ("predicate".equals(nodeName)) {
queryCachePredicateHandler(childNode, queryCacheConfig);
} else if ("eviction".equals(nodeName)) {
queryCacheConfig.setEvictionConfig(getEvictionConfig(childNode, false));
}
}
}
mapConfig.addQueryCacheConfig(queryCacheConfig);
}
}
}
private void queryCachePredicateHandler(Node childNode, QueryCacheConfig queryCacheConfig) {
NamedNodeMap predicateAttributes = childNode.getAttributes();
String predicateType = getTextContent(predicateAttributes.getNamedItem("type"));
String textContent = getTextContent(childNode);
PredicateConfig predicateConfig = new PredicateConfig();
if ("class-name".equals(predicateType)) {
predicateConfig.setClassName(textContent);
} else if ("sql".equals(predicateType)) {
predicateConfig.setSql(textContent);
}
queryCacheConfig.setPredicateConfig(predicateConfig);
}
private int sizeParser(String value) {
int size;
if (value.length() < 2) {
size = parseInt(value);
} else {
char last = value.charAt(value.length() - 1);
int type = 0;
if (last == 'g' || last == 'G') {
type = 1;
} else if (last == 'm' || last == 'M') {
type = 2;
}
if (type == 0) {
size = parseInt(value);
} else if (type == 1) {
size = parseInt(value.substring(0, value.length() - 1)) * THOUSAND_FACTOR;
} else {
size = parseInt(value.substring(0, value.length() - 1));
}
}
return size;
}
private MapStoreConfig createMapStoreConfig(Node node) {
MapStoreConfig mapStoreConfig = new MapStoreConfig();
NamedNodeMap atts = node.getAttributes();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if ("enabled".equals(att.getNodeName())) {
mapStoreConfig.setEnabled(getBooleanValue(value));
} else if ("initial-mode".equals(att.getNodeName())) {
InitialLoadMode mode = InitialLoadMode.valueOf(upperCaseInternal(getTextContent(att)));
mapStoreConfig.setInitialLoadMode(mode);
}
}
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
if ("class-name".equals(nodeName)) {
mapStoreConfig.setClassName(getTextContent(n).trim());
} else if ("factory-class-name".equals(nodeName)) {
mapStoreConfig.setFactoryClassName(getTextContent(n).trim());
} else if ("write-delay-seconds".equals(nodeName)) {
mapStoreConfig.setWriteDelaySeconds(getIntegerValue("write-delay-seconds", getTextContent(n).trim()
));
} else if ("write-batch-size".equals(nodeName)) {
mapStoreConfig.setWriteBatchSize(getIntegerValue("write-batch-size", getTextContent(n).trim()
));
} else if ("write-coalescing".equals(nodeName)) {
String writeCoalescing = getTextContent(n).trim();
if (isNullOrEmpty(writeCoalescing)) {
mapStoreConfig.setWriteCoalescing(MapStoreConfig.DEFAULT_WRITE_COALESCING);
} else {
mapStoreConfig.setWriteCoalescing(getBooleanValue(writeCoalescing));
}
} else if ("properties".equals(nodeName)) {
fillProperties(n, mapStoreConfig.getProperties());
}
}
return mapStoreConfig;
}
private RingbufferStoreConfig createRingbufferStoreConfig(Node node) {
final RingbufferStoreConfig config = new RingbufferStoreConfig();
final NamedNodeMap atts = node.getAttributes();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if (att.getNodeName().equals("enabled")) {
config.setEnabled(getBooleanValue(value));
}
}
for (Node n : childElements(node)) {
final String nodeName = cleanNodeName(n);
if ("class-name".equals(nodeName)) {
config.setClassName(getTextContent(n).trim());
} else if ("factory-class-name".equals(nodeName)) {
config.setFactoryClassName(getTextContent(n).trim());
}
}
return config;
}
private QueueStoreConfig createQueueStoreConfig(Node node) {
QueueStoreConfig queueStoreConfig = new QueueStoreConfig();
NamedNodeMap atts = node.getAttributes();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if (att.getNodeName().equals("enabled")) {
queueStoreConfig.setEnabled(getBooleanValue(value));
}
}
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
if ("class-name".equals(nodeName)) {
queueStoreConfig.setClassName(getTextContent(n).trim());
} else if ("factory-class-name".equals(nodeName)) {
queueStoreConfig.setFactoryClassName(getTextContent(n).trim());
} else if ("properties".equals(nodeName)) {
fillProperties(n, queueStoreConfig.getProperties());
}
}
return queueStoreConfig;
}
private void handleSSLConfig(Node node) {
SSLConfig sslConfig = new SSLConfig();
NamedNodeMap atts = node.getAttributes();
Node enabledNode = atts.getNamedItem("enabled");
boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode).trim());
sslConfig.setEnabled(enabled);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
if ("factory-class-name".equals(nodeName)) {
sslConfig.setFactoryClassName(getTextContent(n).trim());
} else if ("properties".equals(nodeName)) {
fillProperties(n, sslConfig.getProperties());
}
}
config.getNetworkConfig().setSSLConfig(sslConfig);
}
private void handleSocketInterceptorConfig(Node node) {
SocketInterceptorConfig socketInterceptorConfig = parseSocketInterceptorConfig(node);
config.getNetworkConfig().setSocketInterceptorConfig(socketInterceptorConfig);
}
private void handleTopic(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
TopicConfig tConfig = new TopicConfig();
tConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
if (nodeName.equals("global-ordering-enabled")) {
tConfig.setGlobalOrderingEnabled(getBooleanValue(getTextContent(n)));
} else if ("message-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(n)) {
if ("message-listener".equals(cleanNodeName(listenerNode))) {
tConfig.addMessageListenerConfig(new ListenerConfig(getTextContent(listenerNode)));
}
}
} else if ("statistics-enabled".equals(nodeName)) {
tConfig.setStatisticsEnabled(getBooleanValue(getTextContent(n)));
} else if ("multi-threading-enabled".equals(nodeName)) {
tConfig.setMultiThreadingEnabled(getBooleanValue(getTextContent(n)));
}
}
config.addTopicConfig(tConfig);
}
private void handleReliableTopic(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
ReliableTopicConfig topicConfig = new ReliableTopicConfig(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
if ("read-batch-size".equals(nodeName)) {
String batchSize = getTextContent(n);
topicConfig.setReadBatchSize(getIntegerValue("read-batch-size", batchSize));
} else if ("statistics-enabled".equals(nodeName)) {
topicConfig.setStatisticsEnabled(getBooleanValue(getTextContent(n)));
} else if ("topic-overload-policy".equals(nodeName)) {
TopicOverloadPolicy topicOverloadPolicy = TopicOverloadPolicy.valueOf(upperCaseInternal(getTextContent(n)));
topicConfig.setTopicOverloadPolicy(topicOverloadPolicy);
} else if ("message-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(n)) {
if ("message-listener".equals(cleanNodeName(listenerNode))) {
topicConfig.addMessageListenerConfig(new ListenerConfig(getTextContent(listenerNode)));
}
}
}
}
config.addReliableTopicConfig(topicConfig);
}
private void handleJobTracker(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
JobTrackerConfig jConfig = new JobTrackerConfig();
jConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("max-thread-size".equals(nodeName)) {
jConfig.setMaxThreadSize(getIntegerValue("max-thread-size", value));
} else if ("queue-size".equals(nodeName)) {
jConfig.setQueueSize(getIntegerValue("queue-size", value));
} else if ("retry-count".equals(nodeName)) {
jConfig.setRetryCount(getIntegerValue("retry-count", value));
} else if ("chunk-size".equals(nodeName)) {
jConfig.setChunkSize(getIntegerValue("chunk-size", value));
} else if ("communicate-stats".equals(nodeName)) {
jConfig.setCommunicateStats(value == null || value.length() == 0
? JobTrackerConfig.DEFAULT_COMMUNICATE_STATS : parseBoolean(value));
} else if ("topology-changed-stategy".equals(nodeName)) {
TopologyChangedStrategy topologyChangedStrategy = JobTrackerConfig.DEFAULT_TOPOLOGY_CHANGED_STRATEGY;
for (TopologyChangedStrategy temp : TopologyChangedStrategy.values()) {
if (temp.name().equals(value)) {
topologyChangedStrategy = temp;
}
}
jConfig.setTopologyChangedStrategy(topologyChangedStrategy);
}
}
config.addJobTrackerConfig(jConfig);
}
private void handleSemaphore(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
SemaphoreConfig sConfig = new SemaphoreConfig();
sConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("initial-permits".equals(nodeName)) {
sConfig.setInitialPermits(getIntegerValue("initial-permits", value));
} else if ("backup-count".equals(nodeName)) {
sConfig.setBackupCount(getIntegerValue("backup-count"
, value));
} else if ("async-backup-count".equals(nodeName)) {
sConfig.setAsyncBackupCount(getIntegerValue("async-backup-count"
, value));
}
}
config.addSemaphoreConfig(sConfig);
}
private void handleRingbuffer(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
RingbufferConfig rbConfig = new RingbufferConfig(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("capacity".equals(nodeName)) {
int capacity = getIntegerValue("capacity", value);
rbConfig.setCapacity(capacity);
} else if ("backup-count".equals(nodeName)) {
int backupCount = getIntegerValue("backup-count", value);
rbConfig.setBackupCount(backupCount);
} else if ("async-backup-count".equals(nodeName)) {
int asyncBackupCount = getIntegerValue("async-backup-count", value);
rbConfig.setAsyncBackupCount(asyncBackupCount);
} else if ("time-to-live-seconds".equals(nodeName)) {
int timeToLiveSeconds = getIntegerValue("time-to-live-seconds", value);
rbConfig.setTimeToLiveSeconds(timeToLiveSeconds);
} else if ("in-memory-format".equals(nodeName)) {
InMemoryFormat inMemoryFormat = InMemoryFormat.valueOf(upperCaseInternal(value));
rbConfig.setInMemoryFormat(inMemoryFormat);
} else if ("ringbuffer-store".equals(nodeName)) {
final RingbufferStoreConfig ringbufferStoreConfig = createRingbufferStoreConfig(n);
rbConfig.setRingbufferStoreConfig(ringbufferStoreConfig);
}
}
config.addRingBufferConfig(rbConfig);
}
private void handleListeners(Node node) throws Exception {
for (Node child : childElements(node)) {
if ("listener".equals(cleanNodeName(child))) {
String listenerClass = getTextContent(child);
config.addListenerConfig(new ListenerConfig(listenerClass));
}
}
}
private void handlePartitionGroup(Node node) {
NamedNodeMap atts = node.getAttributes();
Node enabledNode = atts.getNamedItem("enabled");
boolean enabled = enabledNode != null ? getBooleanValue(getTextContent(enabledNode)) : false;
config.getPartitionGroupConfig().setEnabled(enabled);
Node groupTypeNode = atts.getNamedItem("group-type");
MemberGroupType groupType = groupTypeNode != null
? MemberGroupType.valueOf(upperCaseInternal(getTextContent(groupTypeNode)))
: MemberGroupType.PER_MEMBER;
config.getPartitionGroupConfig().setGroupType(groupType);
for (Node child : childElements(node)) {
if ("member-group".equals(cleanNodeName(child))) {
handleMemberGroup(child);
}
}
}
private void handleMemberGroup(Node node) {
MemberGroupConfig memberGroupConfig = new MemberGroupConfig();
for (Node child : childElements(node)) {
if ("interface".equals(cleanNodeName(child))) {
String value = getTextContent(child);
memberGroupConfig.addInterface(value);
}
}
config.getPartitionGroupConfig().addMemberGroupConfig(memberGroupConfig);
}
private void handleSerialization(Node node) {
SerializationConfig serializationConfig = parseSerialization(node);
config.setSerializationConfig(serializationConfig);
}
private void handleManagementCenterConfig(Node node) {
NamedNodeMap attrs = node.getAttributes();
Node enabledNode = attrs.getNamedItem("enabled");
boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode));
Node intervalNode = attrs.getNamedItem("update-interval");
int interval = intervalNode != null ? getIntegerValue("update-interval",
getTextContent(intervalNode)) : ManagementCenterConfig.UPDATE_INTERVAL;
String url = getTextContent(node);
ManagementCenterConfig managementCenterConfig = config.getManagementCenterConfig();
managementCenterConfig.setEnabled(enabled);
managementCenterConfig.setUpdateInterval(interval);
managementCenterConfig.setUrl("".equals(url) ? null : url);
}
private void handleSecurity(Node node) throws Exception {
NamedNodeMap atts = node.getAttributes();
Node enabledNode = atts.getNamedItem("enabled");
boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode));
config.getSecurityConfig().setEnabled(enabled);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("member-credentials-factory".equals(nodeName)) {
handleCredentialsFactory(child);
} else if ("member-login-modules".equals(nodeName)) {
handleLoginModules(child, true);
} else if ("client-login-modules".equals(nodeName)) {
handleLoginModules(child, false);
} else if ("client-permission-policy".equals(nodeName)) {
handlePermissionPolicy(child);
} else if ("client-permissions".equals(nodeName)) {
handleSecurityPermissions(child);
} else if ("security-interceptors".equals(nodeName)) {
handleSecurityInterceptors(child);
}
}
}
private void handleSecurityInterceptors(Node node) throws Exception {
SecurityConfig cfg = config.getSecurityConfig();
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("interceptor".equals(nodeName)) {
NamedNodeMap attrs = child.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
cfg.addSecurityInterceptorConfig(new SecurityInterceptorConfig(className));
}
}
}
private void handleMemberAttributes(Node node) {
for (Node n : childElements(node)) {
String name = cleanNodeName(n);
if (!"attribute".equals(name)) {
continue;
}
String attributeName = getTextContent(n.getAttributes().getNamedItem("name"));
String attributeType = getTextContent(n.getAttributes().getNamedItem("type"));
String value = getTextContent(n);
if ("string".equals(attributeType)) {
config.getMemberAttributeConfig().setStringAttribute(attributeName, value);
} else if ("boolean".equals(attributeType)) {
config.getMemberAttributeConfig().setBooleanAttribute(attributeName, parseBoolean(value));
} else if ("byte".equals(attributeType)) {
config.getMemberAttributeConfig().setByteAttribute(attributeName, Byte.parseByte(value));
} else if ("double".equals(attributeType)) {
config.getMemberAttributeConfig().setDoubleAttribute(attributeName, Double.parseDouble(value));
} else if ("float".equals(attributeType)) {
config.getMemberAttributeConfig().setFloatAttribute(attributeName, Float.parseFloat(value));
} else if ("int".equals(attributeType)) {
config.getMemberAttributeConfig().setIntAttribute(attributeName, parseInt(value));
} else if ("long".equals(attributeType)) {
config.getMemberAttributeConfig().setLongAttribute(attributeName, parseLong(value));
} else if ("short".equals(attributeType)) {
config.getMemberAttributeConfig().setShortAttribute(attributeName, Short.parseShort(value));
} else {
config.getMemberAttributeConfig().setStringAttribute(attributeName, value);
}
}
}
private void handleCredentialsFactory(Node node) throws Exception {
NamedNodeMap attrs = node.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
SecurityConfig cfg = config.getSecurityConfig();
CredentialsFactoryConfig credentialsFactoryConfig = new CredentialsFactoryConfig(className);
cfg.setMemberCredentialsConfig(credentialsFactoryConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("properties".equals(nodeName)) {
fillProperties(child, credentialsFactoryConfig.getProperties());
break;
}
}
}
private void handleLoginModules(Node node, boolean member) throws Exception {
SecurityConfig cfg = config.getSecurityConfig();
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("login-module".equals(nodeName)) {
LoginModuleConfig lm = handleLoginModule(child);
if (member) {
cfg.addMemberLoginModuleConfig(lm);
} else {
cfg.addClientLoginModuleConfig(lm);
}
}
}
}
private LoginModuleConfig handleLoginModule(Node node) throws Exception {
NamedNodeMap attrs = node.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
Node usageNode = attrs.getNamedItem("usage");
LoginModuleUsage usage = usageNode != null ? LoginModuleUsage.get(getTextContent(usageNode))
: LoginModuleUsage.REQUIRED;
LoginModuleConfig moduleConfig = new LoginModuleConfig(className, usage);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("properties".equals(nodeName)) {
fillProperties(child, moduleConfig.getProperties());
break;
}
}
return moduleConfig;
}
private void handlePermissionPolicy(Node node) throws Exception {
NamedNodeMap attrs = node.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
SecurityConfig cfg = config.getSecurityConfig();
PermissionPolicyConfig policyConfig = new PermissionPolicyConfig(className);
cfg.setClientPolicyConfig(policyConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("properties".equals(nodeName)) {
fillProperties(child, policyConfig.getProperties());
break;
}
}
}
private void handleSecurityPermissions(Node node) throws Exception {
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
PermissionType type;
if ("map-permission".equals(nodeName)) {
type = PermissionType.MAP;
} else if ("queue-permission".equals(nodeName)) {
type = PermissionType.QUEUE;
} else if ("multimap-permission".equals(nodeName)) {
type = PermissionType.MULTIMAP;
} else if ("topic-permission".equals(nodeName)) {
type = PermissionType.TOPIC;
} else if ("list-permission".equals(nodeName)) {
type = PermissionType.LIST;
} else if ("set-permission".equals(nodeName)) {
type = PermissionType.SET;
} else if ("lock-permission".equals(nodeName)) {
type = PermissionType.LOCK;
} else if ("atomic-long-permission".equals(nodeName)) {
type = PermissionType.ATOMIC_LONG;
} else if ("countdown-latch-permission".equals(nodeName)) {
type = PermissionType.COUNTDOWN_LATCH;
} else if ("semaphore-permission".equals(nodeName)) {
type = PermissionType.SEMAPHORE;
} else if ("id-generator-permission".equals(nodeName)) {
type = PermissionType.ID_GENERATOR;
} else if ("executor-service-permission".equals(nodeName)) {
type = PermissionType.EXECUTOR_SERVICE;
} else if ("transaction-permission".equals(nodeName)) {
type = PermissionType.TRANSACTION;
} else if ("all-permissions".equals(nodeName)) {
type = PermissionType.ALL;
} else {
continue;
}
handleSecurityPermission(child, type);
}
}
private void handleSecurityPermission(Node node, PermissionType type) throws Exception {
SecurityConfig cfg = config.getSecurityConfig();
NamedNodeMap attrs = node.getAttributes();
Node nameNode = attrs.getNamedItem("name");
String name = nameNode != null ? getTextContent(nameNode) : "*";
Node principalNode = attrs.getNamedItem("principal");
String principal = principalNode != null ? getTextContent(principalNode) : "*";
PermissionConfig permConfig = new PermissionConfig(type, name, principal);
cfg.addClientPermissionConfig(permConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("endpoints".equals(nodeName)) {
handleSecurityPermissionEndpoints(child, permConfig);
} else if ("actions".equals(nodeName)) {
handleSecurityPermissionActions(child, permConfig);
}
}
}
private void handleSecurityPermissionEndpoints(Node node, PermissionConfig permConfig) throws Exception {
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("endpoint".equals(nodeName)) {
permConfig.addEndpoint(getTextContent(child).trim());
}
}
}
private void handleSecurityPermissionActions(Node node, PermissionConfig permConfig) throws Exception {
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("action".equals(nodeName)) {
permConfig.addAction(getTextContent(child).trim());
}
}
}
}
| {
"content_hash": "3b1e17d3a30a53e26c0080342ab6a5d2",
"timestamp": "",
"source": "github",
"line_count": 2139,
"max_line_length": 130,
"avg_line_length": 48.51472650771389,
"alnum_prop": 0.6149961936149094,
"repo_name": "emrahkocaman/hazelcast",
"id": "0dd780f50c7c564c6a34112bebb221a277521799",
"size": "104398",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hazelcast/src/main/java/com/hazelcast/config/XmlConfigBuilder.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1449"
},
{
"name": "Java",
"bytes": "30517986"
},
{
"name": "Shell",
"bytes": "12217"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.