text stringlengths 2 1.04M | meta dict |
|---|---|
import os
import tempfile
import numpy
import skimage.io
import tensorflow
import microscopeimagequality.dataset_creation
import microscopeimagequality.degrade
test_data_directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
test_dir = tempfile.mkdtemp()
tensorflow.logging.info("Loaded test data")
degrader = microscopeimagequality.degrade.ImageDegrader(random_seed=0, photoelectron_factor=65535.0, sensor_offset_in_photoelectrons=0.0)
def get_test_image(name):
path = os.path.join(test_data_directory, name)
return microscopeimagequality.dataset_creation.read_16_bit_greyscale(path)
def test_set_exposure_golden():
exposure_factor = 100.0
image = get_test_image("cell_image.tiff")
exposure_adjusted_image = degrader.set_exposure(image, exposure_factor)
# Check image is saturated.
assert 1.0 == numpy.max(exposure_adjusted_image)
expected_image = get_test_image("cell_image_saturated.png")
numpy.testing.assert_almost_equal(expected_image, exposure_adjusted_image, 4)
def test_set_exposure_golden2():
exposure_factor = 0.0001
image = get_test_image("cell_image.tiff")
exposure_adjusted_image = degrader.set_exposure(image, exposure_factor)
numpy.testing.assert_almost_equal(exposure_factor, numpy.max(exposure_adjusted_image) / numpy.max(image), 4)
def test_set_exposure_with_offset_golden():
exposure_factor = 100.0
image = get_test_image("cell_image.tiff")
degrader = microscopeimagequality.degrade.ImageDegrader(random_seed=0, photoelectron_factor=65535.0, sensor_offset_in_photoelectrons=100.0)
exposure_adjusted_image = degrader.set_exposure(image, exposure_factor)
# Check image is saturated.
assert 1.0 == numpy.max(exposure_adjusted_image)
expected_image = get_test_image("cell_image_saturated_with_offset.png")
numpy.testing.assert_almost_equal(expected_image, exposure_adjusted_image, 4)
def test_set_exposure_no_exposure_change():
exposure_factor = 1.0
image = get_test_image("cell_image.tiff")
exposure_adjusted_image = degrader.set_exposure(image, exposure_factor)
numpy.testing.assert_almost_equal(image, exposure_adjusted_image, 4)
def test_apply_poisson_noise():
image = get_test_image("cell_image.tiff")
noisy_image = degrader.random_noise(image)
expected_image = get_test_image("cell_image_poisson_noise_py.png")
numpy.testing.assert_almost_equal(expected_image, noisy_image)
def test_get_airy_psf():
image = get_test_image("cell_image.tiff")
psf = get_test_image("psf.png")
blurred_image = degrader.apply_blur_kernel(image, psf)
expected_image = get_test_image("cell_image_airy_blurred.png")
numpy.testing.assert_almost_equal(expected_image, blurred_image, 4)
def test_evaluate_airy_psf_at_point():
psf_value = microscopeimagequality.degrade.get_airy_psf(1, 1e-6, 0.0, 500e-9, 0.5, 1.0, False)[0]
numpy.testing.assert_almost_equal(psf_value, .25, 5)
psf_value = microscopeimagequality.degrade.get_airy_psf(1, 1e-6, 1e-6, 500e-9, 0.5, 1.0, False)[0]
numpy.testing.assert_almost_equal(psf_value, .20264, 5)
psf_value = microscopeimagequality.degrade.get_airy_psf(3, 3e-6, 0.0, 500e-9, 0.5, 1.0, False)[0, 1]
numpy.testing.assert_almost_equal(psf_value, .00114255, 7)
def test_get_airy_psf_golden():
psf = microscopeimagequality.degrade.get_airy_psf(21, 5e-6, 4.0e-6, 500e-9, 0.5, 1.0)
expected_psf = get_test_image("psf.png")
numpy.testing.assert_almost_equal(expected_psf, psf, 4)
def test_get_airy_psf_golden_zero_depth():
psf = microscopeimagequality.degrade.get_airy_psf(5, 5e-6, 0.0e-6, 500e-9, 0.5, 1.0)
# This should be a delta function for large enough pixel sizes.
expected_psf = numpy.zeros((5, 5))
expected_psf[2, 2] = 1.0
numpy.testing.assert_almost_equal(expected_psf, psf, 2)
def test_read_write_png():
image = get_test_image("cell_image.tiff")
output_path = os.path.join(test_dir, "cell_image2.png")
skimage.io.imsave(output_path, image, "pil")
image2 = microscopeimagequality.dataset_creation.read_16_bit_greyscale(output_path)
numpy.testing.assert_almost_equal(image, image2, 4)
def test_degrade_images():
glob = os.path.join(test_data_directory, "cell_image.tiff*")
output_path = test_dir
microscopeimagequality.degrade.degrade_images(glob, output_path, 20e-6, 1.0, 0, 65535, 0, psf_width_pixels=21, pixel_size_meters=5e-6 / 21)
degraded_image = microscopeimagequality.dataset_creation.read_16_bit_greyscale(os.path.join(output_path, "cell_image.png"))
expected_image = get_test_image("cell_image_degraded.png")
numpy.testing.assert_almost_equal(expected_image, degraded_image, 4)
def test_degrade_images_no_change():
glob = os.path.join(test_data_directory, "cell_image.tiff*")
output_path = os.path.join(test_dir, 'no_change')
microscopeimagequality.degrade.degrade_images(glob, output_path, 0e-6, 1.0, 0, 65535, 0, psf_width_pixels=21, pixel_size_meters=40e-6 / 21, skip_apply_poisson_noise=True)
degraded_image = microscopeimagequality.dataset_creation.read_16_bit_greyscale(os.path.join(output_path, "cell_image.png"))
expected_image = get_test_image("cell_image.tiff")
numpy.testing.assert_almost_equal(expected_image, degraded_image, 4)
| {
"content_hash": "7cdaa244e3e05e6dc3ae8bace13b360e",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 174,
"avg_line_length": 31.615384615384617,
"alnum_prop": 0.7196331648886394,
"repo_name": "google/microscopeimagequality",
"id": "573913aeeaa3fd859bc72c34bfd2249701a97efb",
"size": "5343",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "tests/test_degrade.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ImageJ Macro",
"bytes": "15295"
},
{
"name": "Java",
"bytes": "8238"
},
{
"name": "Python",
"bytes": "192907"
}
],
"symlink_target": ""
} |
#include <aws/application-autoscaling/model/StepAdjustment.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace ApplicationAutoScaling
{
namespace Model
{
StepAdjustment::StepAdjustment() :
m_metricIntervalLowerBound(0.0),
m_metricIntervalLowerBoundHasBeenSet(false),
m_metricIntervalUpperBound(0.0),
m_metricIntervalUpperBoundHasBeenSet(false),
m_scalingAdjustment(0),
m_scalingAdjustmentHasBeenSet(false)
{
}
StepAdjustment::StepAdjustment(JsonView jsonValue) :
m_metricIntervalLowerBound(0.0),
m_metricIntervalLowerBoundHasBeenSet(false),
m_metricIntervalUpperBound(0.0),
m_metricIntervalUpperBoundHasBeenSet(false),
m_scalingAdjustment(0),
m_scalingAdjustmentHasBeenSet(false)
{
*this = jsonValue;
}
StepAdjustment& StepAdjustment::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("MetricIntervalLowerBound"))
{
m_metricIntervalLowerBound = jsonValue.GetDouble("MetricIntervalLowerBound");
m_metricIntervalLowerBoundHasBeenSet = true;
}
if(jsonValue.ValueExists("MetricIntervalUpperBound"))
{
m_metricIntervalUpperBound = jsonValue.GetDouble("MetricIntervalUpperBound");
m_metricIntervalUpperBoundHasBeenSet = true;
}
if(jsonValue.ValueExists("ScalingAdjustment"))
{
m_scalingAdjustment = jsonValue.GetInteger("ScalingAdjustment");
m_scalingAdjustmentHasBeenSet = true;
}
return *this;
}
JsonValue StepAdjustment::Jsonize() const
{
JsonValue payload;
if(m_metricIntervalLowerBoundHasBeenSet)
{
payload.WithDouble("MetricIntervalLowerBound", m_metricIntervalLowerBound);
}
if(m_metricIntervalUpperBoundHasBeenSet)
{
payload.WithDouble("MetricIntervalUpperBound", m_metricIntervalUpperBound);
}
if(m_scalingAdjustmentHasBeenSet)
{
payload.WithInteger("ScalingAdjustment", m_scalingAdjustment);
}
return payload;
}
} // namespace Model
} // namespace ApplicationAutoScaling
} // namespace Aws
| {
"content_hash": "56682088d466a9f87b94bef4570fa55e",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 81,
"avg_line_length": 22.380434782608695,
"alnum_prop": 0.7620203982515784,
"repo_name": "cedral/aws-sdk-cpp",
"id": "fc6ebb09ba243d5bc7ff34ee68aef9e41b4e7dd2",
"size": "2178",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-application-autoscaling/source/model/StepAdjustment.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "294220"
},
{
"name": "C++",
"bytes": "428637022"
},
{
"name": "CMake",
"bytes": "862025"
},
{
"name": "Dockerfile",
"bytes": "11688"
},
{
"name": "HTML",
"bytes": "7904"
},
{
"name": "Java",
"bytes": "352201"
},
{
"name": "Python",
"bytes": "106761"
},
{
"name": "Shell",
"bytes": "10891"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/example_animation.iml" filepath="$PROJECT_DIR$/example_animation.iml" />
</modules>
</component>
</project>
| {
"content_hash": "da1e58512f0d4d0513dcb1f79f1a0b15",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 116,
"avg_line_length": 37.3,
"alnum_prop": 0.6648793565683646,
"repo_name": "RENX/example_animation",
"id": "c5ce6b8f1e6191ed0e1c149b24b441c8cd12d9db",
"size": "373",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".idea/modules.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "995"
},
{
"name": "Java",
"bytes": "14262"
}
],
"symlink_target": ""
} |
package org.apache.lucene.index;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import java.io.*;
import java.util.*;
/*
Verify we can read the pre-2.1 file format, do searches
against it, and add documents to it.
*/
public class TestIndexFileDeleter extends LuceneTestCase {
public void testDeleteLeftoverFiles() throws IOException {
MockDirectoryWrapper dir = newDirectory();
dir.setPreventDoubleWrite(false);
IndexWriterConfig conf = newIndexWriterConfig(
TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
.setMaxBufferedDocs(10);
LogMergePolicy mergePolicy = newLogMergePolicy(true, 10);
mergePolicy.setNoCFSRatio(1); // This test expects all of its segments to be in CFS
conf.setMergePolicy(mergePolicy);
IndexWriter writer = new IndexWriter(
dir,
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).
setMaxBufferedDocs(10).
setMergePolicy(mergePolicy)
);
writer.setInfoStream(VERBOSE ? System.out : null);
int i;
for(i=0;i<35;i++) {
addDoc(writer, i);
}
mergePolicy.setUseCompoundFile(false);
for(;i<45;i++) {
addDoc(writer, i);
}
writer.close();
// Delete one doc so we get a .del file:
IndexReader reader = IndexReader.open(dir, false);
Term searchTerm = new Term("id", "7");
int delCount = reader.deleteDocuments(searchTerm);
assertEquals("didn't delete the right number of documents", 1, delCount);
// Set one norm so we get a .s0 file:
reader.setNorm(21, "content", (float) 1.5);
reader.close();
// Now, artificially create an extra .del file & extra
// .s0 file:
String[] files = dir.listAll();
/*
for(int j=0;j<files.length;j++) {
System.out.println(j + ": " + files[j]);
}
*/
// The numbering of fields can vary depending on which
// JRE is in use. On some JREs we see content bound to
// field 0; on others, field 1. So, here we have to
// figure out which field number corresponds to
// "content", and then set our expected file names below
// accordingly:
CompoundFileReader cfsReader = new CompoundFileReader(dir, "_2.cfs");
FieldInfos fieldInfos = new FieldInfos(cfsReader, "_2.fnm");
int contentFieldIndex = -1;
for(i=0;i<fieldInfos.size();i++) {
FieldInfo fi = fieldInfos.fieldInfo(i);
if (fi.name.equals("content")) {
contentFieldIndex = i;
break;
}
}
cfsReader.close();
assertTrue("could not locate the 'content' field number in the _2.cfs segment", contentFieldIndex != -1);
String normSuffix = "s" + contentFieldIndex;
// Create a bogus separate norms file for a
// segment/field that actually has a separate norms file
// already:
copyFile(dir, "_2_1." + normSuffix, "_2_2." + normSuffix);
// Create a bogus separate norms file for a
// segment/field that actually has a separate norms file
// already, using the "not compound file" extension:
copyFile(dir, "_2_1." + normSuffix, "_2_2.f" + contentFieldIndex);
// Create a bogus separate norms file for a
// segment/field that does not have a separate norms
// file already:
copyFile(dir, "_2_1." + normSuffix, "_1_1." + normSuffix);
// Create a bogus separate norms file for a
// segment/field that does not have a separate norms
// file already using the "not compound file" extension:
copyFile(dir, "_2_1." + normSuffix, "_1_1.f" + contentFieldIndex);
// Create a bogus separate del file for a
// segment that already has a separate del file:
copyFile(dir, "_0_1.del", "_0_2.del");
// Create a bogus separate del file for a
// segment that does not yet have a separate del file:
copyFile(dir, "_0_1.del", "_1_1.del");
// Create a bogus separate del file for a
// non-existent segment:
copyFile(dir, "_0_1.del", "_188_1.del");
// Create a bogus segment file:
copyFile(dir, "_0.cfs", "_188.cfs");
// Create a bogus fnm file when the CFS already exists:
copyFile(dir, "_0.cfs", "_0.fnm");
// Create a deletable file:
copyFile(dir, "_0.cfs", "deletable");
// Create some old segments file:
copyFile(dir, "segments_2", "segments");
copyFile(dir, "segments_2", "segments_1");
// Create a bogus cfs file shadowing a non-cfs segment:
assertTrue(dir.fileExists("_3.fdt"));
assertTrue(!dir.fileExists("_3.cfs"));
copyFile(dir, "_1.cfs", "_3.cfs");
String[] filesPre = dir.listAll();
// Open & close a writer: it should delete the above 4
// files and nothing more:
writer = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.APPEND));
writer.close();
String[] files2 = dir.listAll();
dir.close();
Arrays.sort(files);
Arrays.sort(files2);
Set<String> dif = difFiles(files, files2);
if (!Arrays.equals(files, files2)) {
fail("IndexFileDeleter failed to delete unreferenced extra files: should have deleted " + (filesPre.length-files.length) + " files but only deleted " + (filesPre.length - files2.length) + "; expected files:\n " + asString(files) + "\n actual files:\n " + asString(files2)+"\ndif: "+dif);
}
}
private static Set<String> difFiles(String[] files1, String[] files2) {
Set<String> set1 = new HashSet<String>();
Set<String> set2 = new HashSet<String>();
Set<String> extra = new HashSet<String>();
for (int x=0; x < files1.length; x++) {
set1.add(files1[x]);
}
for (int x=0; x < files2.length; x++) {
set2.add(files2[x]);
}
Iterator<String> i1 = set1.iterator();
while (i1.hasNext()) {
String o = i1.next();
if (!set2.contains(o)) {
extra.add(o);
}
}
Iterator<String> i2 = set2.iterator();
while (i2.hasNext()) {
String o = i2.next();
if (!set1.contains(o)) {
extra.add(o);
}
}
return extra;
}
private String asString(String[] l) {
String s = "";
for(int i=0;i<l.length;i++) {
if (i > 0) {
s += "\n ";
}
s += l[i];
}
return s;
}
public void copyFile(Directory dir, String src, String dest) throws IOException {
IndexInput in = dir.openInput(src);
IndexOutput out = dir.createOutput(dest);
byte[] b = new byte[1024];
long remainder = in.length();
while(remainder > 0) {
int len = (int) Math.min(b.length, remainder);
in.readBytes(b, 0, len);
out.writeBytes(b, len);
remainder -= len;
}
in.close();
out.close();
}
private void addDoc(IndexWriter writer, int id) throws IOException
{
Document doc = new Document();
doc.add(newField("content", "aaa", Field.Store.NO, Field.Index.ANALYZED));
doc.add(newField("id", Integer.toString(id), Field.Store.YES, Field.Index.NOT_ANALYZED));
writer.addDocument(doc);
}
}
| {
"content_hash": "327cb3f0af369d8b603d728a7e52320b",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 300,
"avg_line_length": 32.76651982378855,
"alnum_prop": 0.6398225329389621,
"repo_name": "fnp/pylucene",
"id": "20640203e287d4c7c8f1f586e0a2c4d190ac2283",
"size": "8240",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "lucene-java-3.5.0/lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "22004"
},
{
"name": "C++",
"bytes": "400999"
},
{
"name": "Java",
"bytes": "17659185"
},
{
"name": "JavaScript",
"bytes": "43988"
},
{
"name": "Perl",
"bytes": "63743"
},
{
"name": "Python",
"bytes": "384342"
}
],
"symlink_target": ""
} |
class PageTable
{
private:
uint32_t pages[1024];
public:
PageTable();
~PageTable();
uint32_t & pageDescriptor(uint32_t pageIndex)
{
return this->pages[pageIndex];
}
};
static_assert(sizeof(PageTable) == 4096, "PageDirectory must be 4096 bytes large"); | {
"content_hash": "296edfe630cbf4a9f1dc793d10a1c4e5",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 83,
"avg_line_length": 17.466666666666665,
"alnum_prop": 0.7099236641221374,
"repo_name": "MasterQ32/DasOS",
"id": "e7c4fc8e51e947f5767f75e2bc154fb8f9b464ba",
"size": "276",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "kernel/include/pagetable.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "5264"
},
{
"name": "C",
"bytes": "505373"
},
{
"name": "C++",
"bytes": "239426"
},
{
"name": "Makefile",
"bytes": "9806"
}
],
"symlink_target": ""
} |
/*** Translation ***/
LanguageDirectory="fr-FR";
function getTxt(s)
{
switch(s)
{
case "Save":return "Enregistrer";
case "Preview":return "Aperçu";
case "Full Screen":return "Afficher en plein \u00E9cran";
case "Search":return "Rechercher et remplacer";
case "Check Spelling":return "V\u00E9rification d´orthographe";
case "Text Formatting":return "Cr\u00E9er un style seulement pour ce document";
case "List Formatting":return "S\u00E9lectionner un format de puces et num\u00E9ros";
case "Paragraph Formatting":return "Mise en forme du paragraphe courant";
case "Styles":return "Selectionner un style";
case "Custom CSS":return "Feuille de styles CSS personnalis\u00E9e";
case "Styles & Formatting":return "Styles CSS et mise en forme";
case "Style Selection":return "Selectionner un style";
case "Paragraph":return "Paragraphe";
case "Font Name":return "Nom de Police";
case "Font Size":return "Taille de Police";
case "Cut":return "Couper";
case "Copy":return "Copier";
case "Paste":return "Coller";
case "Undo":return "Annuler l’action";
case "Redo":return "R\u00E9tablir l’action annul\u00E9e";
case "Bold":return "Gras";
case "Italic":return "Italique";
case "Underline":return "Soulign\u00E9";
case "Strikethrough":return "Barr\u00E9";
case "Superscript":return "Placer en Exposant";
case "Subscript":return "Placer en Indice";
case "Justify Left":return "Aligner à gauche";
case "Justify Center":return "Aligner au centre";
case "Justify Right":return "Aligner à droite";
case "Justify Full":return "Justifier";
case "Numbering":return "Num\u00E9ros";
case "Bullets":return "Puces";
case "Indent":return "Augmenter le retrait";
case "Outdent":return "Diminuer le retrait";
case "Left To Right":return "De gauche á droite";
case "Right To Left":return "De droite á gauche";
case "Foreground Color":return "Couleur des caractères";
case "Background Color":return "couleur de l’arrière plan";
case "Hyperlink":return "Ins\u00E9rer un lien hypertexte";
case "Bookmark":return "Ins\u00E9rer un signet";
case "Special Characters":return "Caractères sp\u00E9ciaux";
case "Image":return "Image";
case "Flash":return "Flash";
case "Media":return "Media";
case "Content Block":return "Bloc HTML du Contenu";
case "Internal Link":return "Lien Interne";
case "Internal Image":return "Internal Image";
case "Object":return "Objet";
case "Insert Table":return "Ins\u00E9rer un Tableau";
case "Table Size":return "Taille";
case "Edit Table":return "Modifier le Tableau s\u00E9lectionn\u00E9";
case "Edit Cell":return "Modifier la Cellule s\u00E9lectionn\u00E9e";
case "Table":return "Tableau";
case "AutoTable":return "Tableau Format Auto";
case "Border & Shading":return "Bordures et Ombrage";
case "Show/Hide Guidelines":return "Afficher/Masquer les bordures du tableau";
case "Absolute":return "Ins\u00E9rer la s\u00E9lection dans un cadre de texte";
case "Paste from Word":return "Coller un document Word";
case "Line":return "Ins\u00E9rer une Ligne";
case "Form Editor":return "Editeur de formulaire";
case "Form":return "Formulaire";
case "Text Field":return "Champ texte";
case "List":return "Liste";
case "Checkbox":return "Case à cocher";
case "Radio Button":return "Radio Bouton";
case "Hidden Field":return "Champ cach\u00E9";
case "File Field":return "Champ de fichier";
case "Button":return "Bouton";
case "Clean":return "Supprimer l´enrichissement des caractères";
case "View/Edit Source":return "Afficher/Modifier le code HTML";
case "Tag Selector":return "Selecteur de balise";
case "Clear All":return "Effacer tout le contenu";
case "Tags":return "Signatures";
case "Heading 1":return "Titre 1";
case "Heading 2":return "Titre 2";
case "Heading 3":return "Titre 3";
case "Heading 4":return "Titre 4";
case "Heading 5":return "Titre 5";
case "Heading 6":return "Titre 6";
case "Preformatted":return "Pr\u00E9format\u00E9";
case "Normal (P)":return "Normal (P)";
case "Normal (DIV)":return "Normal (DIV)";
case "Size 1":return "Taille 1";
case "Size 2":return "Taille 2";
case "Size 3":return "Taille 3";
case "Size 4":return "Taille 4";
case "Size 5":return "Taille 5";
case "Size 6":return "Taille 6";
case "Size 7":return "Taille 7";
case "Are you sure you wish to delete all contents?":
return "Etes vous sur(e) de vouloir supprimer tout le contenu ?";
case "Remove Tag":return "Supprimer la balise";
case "Custom Colors":return "Couleurs personnalis\u00E9es";
case "More Colors...":return "Autres Couleurs...";
case "Box Formatting":return "Mise en forme du bloc...";
case "Advanced Table Insert":return "Am\u00E9nagement des tableaux...";//
case "Edit Table/Cell":return "Edition Tableau/Cellule";
case "Print":return "Imprimer";
case "Paste Text":return "Coller au format texte";
case "CSS Builder":return "Constructeur de CSS";
case "Remove Formatting":return "Supprimer la mise en forme";
case "Table Dimension Text": return "Dimension Texte";
case "Table Advance Link": return "Advanc\u00E9";
case "Fonts": return "Polices";
case "Text": return "Texte";
case "Link": return "Lien";
case "YoutubeVideo": return "Vid\u00E9o Youtube";
case "Search & Replace": return "Cherche & Remplace";
case "HTML Editor": return "Editeur HTML";
case "Emoticons": return "Emoticones";
case "PasteWarning": return "Coller en utilisant le clavier (CTRL-V)."; /*Your browser security settings don't permit this operation.*/
case "Quote": return "Citation";
default:return "";
}
} | {
"content_hash": "00b234190ee1d6cb3b98b6e75f251f67",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 139,
"avg_line_length": 47.26190476190476,
"alnum_prop": 0.6801007556675063,
"repo_name": "zs425/accommfzf2",
"id": "6d2d2b2bb33d094b8dcdae7ef86c5b1a373d6d4c",
"size": "5955",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/bootstrap-editor/scripts/language/fr-FR/alt/editor_lang.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "47912"
},
{
"name": "ActionScript",
"bytes": "15982"
},
{
"name": "CSS",
"bytes": "641938"
},
{
"name": "JavaScript",
"bytes": "3192659"
},
{
"name": "PHP",
"bytes": "1812385"
}
],
"symlink_target": ""
} |
<style>
h4.block {
}
.note h2 {
text-align: center;
font-weight: bold;
}
</style>
<div ng-controller="SupportController" class="margin-top-10" data-ng-init="init()">
<div class="row">
<div class="col-md-3 " id="supportOverviewPortlet" style="position:fixed; height: 450px !important; width:20%;">
<div class="portlet light">
<div class="portlet-title">
<div class="caption caption-md">
<span class="caption-subject font-green-haze bold uppercase">Support</span>
</div>
</div>
<div class="portlet-body">
<b>
<a href="#/support-tickets.html">
<span class="title">Support Tickets</span>
</a><br>
<a href="#/on-hold-tickets.html">
<span class="title">On Hold Tickets</span>
</a><br>
</b>
</div>
</div>
</div>
<div class="col-md-offset-3" style="margin-left: 21%; margin-right:3%;" >
<div class="row">
<form name="submitForm" class="row well" novalidate ng-submit="rangeTickets()">
<div class="col-md-5 col-sm-12">
<div class="form-group">
<label class="control-label"> Date Range Search</label>
<span>
<input type="checkbox" ng-model="dateSwitch">
</span>
<div class="input-group" >
<input class="form-control" type="daterange" ng-model="session.datesrange" ranges="ranges" ng-disabled="!dateSwitch || daysAgoSwitch">
<span class="input-group-btn">
<button class="btn default" type="button" disabled><i class="fa fa-calendar"></i></button>
</span>
</div>
</div>
</div>
<div class="col-md-5 col-sm-12">
<div class="form-group">
<label class="control-label"> Days ago Search</label>
<span>
<input type="checkbox" ng-model="daysAgoSwitch" >
</span>
<div class="input-group" >
<input class="form-control" ng-model="session.daysAgo" ng-disabled="!daysAgoSwitch || dateSwitch" type="text">
<span class="input-group-btn">
<button class="btn default cancelClass" type="button" ng-click="session.daysAgo = ''" ng-disabled="!daysAgoSwitch"><i class="fa fa-times"></i></button>
</span>
</div>
</div>
</div>
<div class="col-md-2 col-sm-12">
<div class="form-group">
<div class="input-group" style="margin-top: 18%;">
<input class="btn btn-danger" type="submit" value="Overview of Range" ng-disabled="!dateSwitch" ng-if="dateSwitch">
<input class="btn btn-danger" type="submit" value="Overview of Days" ng-disabled="!daysAgoSwitch" ng-if="daysAgoSwitch">
</div>
</div>
</div>
</form>
</div>
<div class="caption" ng-if="response.data">
<span class="caption-subject bold uppercase font-green-haze"> Overview of Support Tickets</span>
</div>
<table class="table table-bordered table-striped" ng-if="response.data" style="font-weight: bold;text-align: center; font-size: 14px;">
<thead >
<tr>
<td class="active">
No. of Tickets
</td>
<td class="success">
Client Replies
</td>
<td class="warning">
Staff Replies
</td>
<td class="info">
Tickets Without Replies
</td>
<td class="danger">
Average First Response
</td>
</tr>
</thead>
<tbody>
<tr>
<td class="active">{{response.data.newTicketsCount.count}}</td>
<td class="success">{{response.data.clientRepliesCount.count}}</td>
<td class="warning">{{response.data.adminRepliesCount.count}}</td>
<td class="info">{{response.data.noRepliesCount.count}}</td>
<td class="danger">{{response.data.avgFirstResponseTime.totalRespTime / 3600| number:2 }} hrs</td>
</tr>
</tbody>
</table>
<!-- <div class="row" ng-if="response.data">
<div class="col-md-6 col-sm-12">
<div class="portlet light tasks-widget">
<div class="portlet-title">
<div class="caption">
<i class="icon-bar-chart font-green-haze"></i>
<span class="caption-subject bold uppercase font-green-haze"> Average first reply time</span>
</div>
<div class="tools">
<a title="" data-original-title="" href="javascript:;" class="collapse">
</a>
</div>
</div>
<div class="portlet-body">
<center>
<div id="canvas-holder">
<center>
<canvas class="classUnk" tc-chartjs-doughnut chart-options="baroption" chart-data="bardata" chart-legend="doughnutChart1" width="100" height="100">
</canvas>
</center>
</div>
</center>
</div>
</div>
</div>
<div class="col-md-6 col-sm-12">
<div class="portlet light">
<div class="portlet-title">
<div class="caption">
<i class="icon-bar-chart font-green-haze"></i>
<span class="caption-subject bold uppercase font-green-haze">tickets submitted by hour</span>
</div>
<div class="tools">
<a title="" data-original-title="" href="javascript:;" class="collapse">
</a>
</div>
</div>
<div class="portlet-body">
<center>
<div id="canvas-holder">
<canvas tc-chartjs-bar chart-options="opt" chart-data="dat" chart-legend="barChart1"></canvas>
</div>
</center>
</div>
</div>
</div>
</div>-->
</div>
</div>
</div>
<!-- END MAIN CONTENT -->
<!-- BEGIN MAIN JS & CSS -->
<script>
$("#supportOverviewPortlet").mCustomScrollbar({theme: "minimal"});
</script>
| {
"content_hash": "82f5576556e193494332d9891f9bec23",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 233,
"avg_line_length": 47.13636363636363,
"alnum_prop": 0.38753616200578594,
"repo_name": "syedarshad-js/sales-predictor",
"id": "4511686ed931e566ba7a95c36dd4663db5b2dd33",
"size": "8296",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/admin/views/support/support-overview.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "919523"
},
{
"name": "CoffeeScript",
"bytes": "6349"
},
{
"name": "HTML",
"bytes": "1607937"
},
{
"name": "JavaScript",
"bytes": "3571429"
},
{
"name": "PHP",
"bytes": "443"
},
{
"name": "Shell",
"bytes": "1646"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
<version>3.19.0-SNAPSHOT</version>
</parent>
<artifactId>camel-bindy</artifactId>
<packaging>jar</packaging>
<name>Camel :: Bindy</name>
<description>Camel Bindy data format support</description>
<properties>
<camel.surefire.fork.vmargs>-XX:+ExitOnOutOfMemoryError -Duser.language=en -Duser.region=GB</camel.surefire.fork.vmargs>
<camel.surefire.parallel>true</camel.surefire.parallel>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-support</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>${icu4j-version}</version>
</dependency>
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
| {
"content_hash": "7057edf02c48c433d2d9ebad4adfdec4",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 201,
"avg_line_length": 36.92857142857143,
"alnum_prop": 0.6533849129593811,
"repo_name": "cunningt/camel",
"id": "614c717af00fd4419ddb865b37eee360b50981d6",
"size": "2585",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/camel-bindy/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6695"
},
{
"name": "Batchfile",
"bytes": "2353"
},
{
"name": "CSS",
"bytes": "5472"
},
{
"name": "Dockerfile",
"bytes": "5676"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "8015"
},
{
"name": "Groovy",
"bytes": "396363"
},
{
"name": "HTML",
"bytes": "212954"
},
{
"name": "Java",
"bytes": "113234282"
},
{
"name": "JavaScript",
"bytes": "103655"
},
{
"name": "Jsonnet",
"bytes": "1734"
},
{
"name": "Kotlin",
"bytes": "41869"
},
{
"name": "Mustache",
"bytes": "525"
},
{
"name": "RobotFramework",
"bytes": "8461"
},
{
"name": "Ruby",
"bytes": "88"
},
{
"name": "Shell",
"bytes": "15221"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "699"
},
{
"name": "XSLT",
"bytes": "276597"
}
],
"symlink_target": ""
} |
RSpec.describe Cassie::Queries::Statement do
let(:klass) do
Class.new(Cassie::Query) do
end
end
let(:object) { klass.new }
describe ".select" do
let(:table_name){ :some_table }
let(:klass) do
Class.new(Cassie::Query) do
select :some_table
end
end
it "sets the table name" do
expect(klass.table).to eq(table_name)
end
end
end | {
"content_hash": "57a4b48362f7de304c7e9da493dd6db2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 44,
"avg_line_length": 20.473684210526315,
"alnum_prop": 0.6118251928020566,
"repo_name": "eprothro/cassie-queries",
"id": "f7844934796c11830714214bf7c26776462fb274",
"size": "389",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/lib/cassie/queries/statement_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "49310"
}
],
"symlink_target": ""
} |
package com.vaadin.tests.components;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.parallel.Browser;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class SaneErrorsTest extends MultiBrowserTest {
/*
* (non-Javadoc)
*
* @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest()
*/
@Override
public List<DesiredCapabilities> getBrowsersToTest() {
return getBrowserCapabilities(Browser.FIREFOX);
}
@Test
public void test() {
openTestURL();
List<WebElement> elements = getDriver()
.findElements(By.xpath("//*[text() = 'Show me my NPE!']"));
for (WebElement webElement : elements) {
webElement.click();
}
getDriver().findElement(By.xpath("//*[text() = 'Collect exceptions']"))
.click();
List<WebElement> errorMessages = getDriver()
.findElements(By.className("v-label"));
for (WebElement webElement : errorMessages) {
String text = webElement.getText();
Assert.assertEquals("java.lang.NullPointerException", text);
}
}
}
| {
"content_hash": "c6f5afe4933e84fb54d59491d83612b2",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 79,
"avg_line_length": 28.06382978723404,
"alnum_prop": 0.643669446550417,
"repo_name": "kironapublic/vaadin",
"id": "34bf03aecdac076e426feb2d8d08cd6b424f259b",
"size": "1914",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "uitest/src/test/java/com/vaadin/tests/components/SaneErrorsTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "740138"
},
{
"name": "HTML",
"bytes": "102292"
},
{
"name": "Java",
"bytes": "23876126"
},
{
"name": "JavaScript",
"bytes": "128039"
},
{
"name": "Python",
"bytes": "34992"
},
{
"name": "Shell",
"bytes": "14720"
},
{
"name": "Smarty",
"bytes": "175"
}
],
"symlink_target": ""
} |
package vars
import (
"src.elv.sh/pkg/eval/errs"
)
type readOnly struct {
value any
}
// NewReadOnly creates a variable that is read-only and always returns an error
// on Set.
func NewReadOnly(v any) Var {
return readOnly{v}
}
func (rv readOnly) Set(val any) error {
return errs.SetReadOnlyVar{}
}
func (rv readOnly) Get() any {
return rv.value
}
// IsReadOnly returns whether v is a read-only variable.
func IsReadOnly(v Var) bool {
switch v.(type) {
case readOnly:
return true
case roCallback:
return true
default:
return false
}
}
| {
"content_hash": "f18c4675ca6451d4977ac58d08046f99",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 79,
"avg_line_length": 15.914285714285715,
"alnum_prop": 0.7073608617594255,
"repo_name": "elves/elvish",
"id": "19aec7da3c66a122d9760e8a2ff14639ed3913fa",
"size": "557",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pkg/eval/vars/read_only.go",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "12245"
},
{
"name": "Dockerfile",
"bytes": "365"
},
{
"name": "Elvish",
"bytes": "154044"
},
{
"name": "Go",
"bytes": "1704527"
},
{
"name": "HTML",
"bytes": "21886"
},
{
"name": "JavaScript",
"bytes": "5695"
},
{
"name": "Makefile",
"bytes": "3187"
},
{
"name": "Python",
"bytes": "3045"
},
{
"name": "Shell",
"bytes": "6505"
}
],
"symlink_target": ""
} |
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vipsnacks</groupId>
<artifactId>snacks</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>snacks_service</artifactId>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>snacks_common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<finalName>snacks_service</finalName>
</build>
</project>
| {
"content_hash": "636aeaf1a4c026f729c1d8cf343b5bc1",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 149,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.6578282828282829,
"repo_name": "handexing/vipsnacks",
"id": "ea715ff616ab4c422d7ba3dddf6fcbe0bd78135f",
"size": "792",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "snacks_service/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "267854"
},
{
"name": "HTML",
"bytes": "4818"
},
{
"name": "Java",
"bytes": "90611"
},
{
"name": "JavaScript",
"bytes": "135861"
}
],
"symlink_target": ""
} |
layout: base
title: 'Dependencies'
generated: 'true'
permalink: sr/dep/all.html
---
# Dependencies
{% include sr-dep-table.html %}
----------
{% assign sorted = site.sr-dep | sort: 'title' %}{% for p in sorted %}
<a id="al-sr-dep/{{ p.title }}" class="al-dest"/>
<h2><code>{{ p.title }}</code>: {{ p.shortdef }}</h2>
{% if p.content contains "<!--details-->" %}
{{ p.content | split:"<!--details-->" | first }}
<a href="{{ p.title }}" class="al-doc">See details</a>
{% else %}
{{ p.content }}
{% endif %}
<a href="{{ site.git_edit }}/{% if p.collection %}{{ p.relative_path }}{% else %}{{ p.path }}{% endif %}" target="#">edit {{ p.title }}</a>
{% endfor %}
| {
"content_hash": "73df93b524a719d668bdd1f9bb09d225",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 139,
"avg_line_length": 29,
"alnum_prop": 0.5517241379310345,
"repo_name": "PhyloStar/UDTelugu",
"id": "bfa5be2fa05289e62c905890e7944cd8bc2f3fb0",
"size": "671",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_sr-overview/dep-all.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "62487"
},
{
"name": "HTML",
"bytes": "800587"
},
{
"name": "JavaScript",
"bytes": "181266"
},
{
"name": "Perl 6",
"bytes": "3953"
},
{
"name": "Python",
"bytes": "53707"
},
{
"name": "Ruby",
"bytes": "578"
},
{
"name": "Shell",
"bytes": "9597"
}
],
"symlink_target": ""
} |
<template name="feature">
<div class="ui stackable grid">
{{#unless imageOnTheLeft}}
<div class="eight wide column">
{{> yield 'image'}}
</div>
{{/unless}}
<div class="eight wide column">
{{> yield}}
</div>
{{#if imageOnTheLeft}}
<div class="eight wide column">
{{> yield 'image'}}
</div>
{{/if}}
</div>
</template>
| {
"content_hash": "58b601c31ebef8458c72d6b83f62b232",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 35,
"avg_line_length": 22.235294117647058,
"alnum_prop": 0.5291005291005291,
"repo_name": "anticoders/blog",
"id": "e17387491cd638d4ed520b94fc800483302ed5ca",
"size": "378",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/components/presentation/feature.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "13815"
},
{
"name": "HTML",
"bytes": "22093"
},
{
"name": "JavaScript",
"bytes": "62959"
},
{
"name": "Shell",
"bytes": "586"
}
],
"symlink_target": ""
} |
package com.speedment.common.codegen.internal.model;
import com.speedment.common.codegen.model.Class;
import com.speedment.common.codegen.model.Field;
import com.speedment.common.codegen.model.Javadoc;
import com.speedment.common.codegen.model.Value;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.NoSuchElementException;
import static org.junit.jupiter.api.Assertions.*;
final class FieldImplTest extends AbstractTest<Field> {
private final static String NAME = "A";
public FieldImplTest() {
super(() -> new FieldImpl(NAME, int.class),
a -> a.setParent(Class.of("A")),
a -> a.setName("Z"),
a -> a.set(Long.class),
a -> a.set(Value.ofNumber(1)),
a -> a.javadoc(Javadoc.of("A")),
a -> a.imports(List.class),
a -> a.annotate(Integer.class),
Field::public_
);
}
@Test
void setParent() {
instance().setParent(Class.of(NAME));
assertTrue(instance().getParent().isPresent());
}
@Test
void getParent() {
assertFalse(instance().getParent().isPresent());
}
@Test
void getImports() {
assertTrue(instance().getImports().isEmpty());
}
@Test
void getName() {
assertEquals(NAME, instance().getName());
}
@Test
void setName() {
instance().setName("Z");
assertNotEquals(NAME, instance().getName());
}
@Test
void getType() {
assertEquals(int.class, instance().getType());
}
@Test
void set() {
instance().set(long.class);
assertEquals(long.class, instance().getType());
}
@Test
void getModifiers() {
assertTrue(instance().getModifiers().isEmpty());
}
@Test
void testSet() {
instance().set(Javadoc.of("A"));
assertTrue(instance().getJavadoc().isPresent());
}
@Test
void getJavadoc() {
assertFalse(instance().getJavadoc().isPresent());
}
@Test
void testSet1() {
final Value<?> v = Value.ofNumber(1);
instance().set(v);
assertEquals(v, instance().getValue().orElseThrow(NoSuchElementException::new));
}
@Test
void getValue() {
assertFalse(instance().getJavadoc().isPresent());
}
@Test
void getAnnotations() {
assertTrue(instance().getAnnotations().isEmpty());
}
} | {
"content_hash": "958f7f5329d35bbe5675c3e6e0ca6cbe",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 88,
"avg_line_length": 24.058823529411764,
"alnum_prop": 0.5802770986145069,
"repo_name": "speedment/speedment",
"id": "4161a3e80b72a3fc3c6aa5659f01c5c14369642d",
"size": "3083",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "common-parent/codegen/src/test/java/com/speedment/common/codegen/internal/model/FieldImplTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "17142"
},
{
"name": "Java",
"bytes": "13137551"
},
{
"name": "Shell",
"bytes": "7494"
}
],
"symlink_target": ""
} |
function Floor(width, height, type) {
// Layout-related functions
function setLayoutType(type) {
switch(type) {
default:
for(var x = 0; x < that.width; x++) {
for(var y = 0; y < that.height; y++) {
if(x === 0 || x === (that.layout.length-1) || y === 0 || y === (that.layout[x].length-1))
that.layout[x][y] = new Cell(x, y, Cell.BLOCKED);
else that.layout[x][y] = new Cell(x, y, Cell.EMPTY);
}
}
break;
}
};
// Generation functions
function generate() {
var density = DENSITY; // optimal values are in the range of [2, 5]
var minrsize = MIN_ROOM_SIZE;
var maxrsize = turnOdd(Math.round(Math.max(that.width-2, that.height-2)/density));
if(maxrsize < minrsize)
maxrsize = minrsize;
// place rooms
generateRooms(minrsize, maxrsize);
// place doors
generateDoors(minrsize, maxrsize);
// connect rooms
generateCorridors();
// place dead ends
generateDeadEnds();
// place entrance and exit
generateStairs();
};
function generateRooms(minrsize, maxrsize) {
var xmin = 3;
var xmax = that.layout.length-minrsize;
var ymin = 3;
var ymax = that.layout[0].length-minrsize;
var nrooms = Math.round(((that.width-2)*(that.height-2))/Math.pow(maxrsize, 2));
while(that.rooms.length === 0) {
for(var i = 0; i < nrooms; i++) {
var inix = turnOdd(rnd.nextRange(xmin, xmax+1));
var iniy = turnOdd(rnd.nextRange(ymin, ymax+1));
var rwidth = turnOdd(rnd.nextRange(minrsize, maxrsize+1));
var rheight = turnOdd(rnd.nextRange(minrsize, maxrsize+1));
if(rwidth < minrsize) rwidth = minrsize;
if(rheight < minrsize) rheight = minrsize;
if((inix+rwidth) > xmax) rwidth = (xmax-inix);
if((iniy+rheight) > ymax) rheight = (ymax-iniy);
if((rwidth < minrsize) || (rheight < minrsize)) continue;
if(room4room(inix, iniy, rwidth, rheight)) {
var room = new Room(that.rooms.length, inix, iniy, rwidth, rheight);
insertRoom(room);
that.rooms.push(room);
}
}
}
};
function insertRoom(room) {
for(var x = (room.inix-1), lx = (room.inix+room.width+1); x < lx; x++) {
for(var y = (room.iniy-1), ly = (room.iniy+room.height+1); y < ly; y++) {
if (x === (room.inix-1) || x === (room.inix+room.width) ||
y === (room.iniy-1) || y === (room.iniy+room.height)) {
if(that.layout[x][y].type !== Cell.BLOCKED) that.layout[x][y].type = Cell.PERIMETER;
}
else {
that.layout[x][y].type = Cell.ROOM;
that.layout[x][y].room = room;
}
}
}
};
function generateDoors(minrsize, maxrsize) {
for(var i = 0, l = that.rooms.length; i < l; i++) {
var room = that.rooms[i];
var maxdoors = Math.round((room.width*room.height)/Math.pow(minrsize, 2));
var ndoors = rnd.nextRange(1, maxdoors);
insertDoors(room, ndoors);
}
};
function insertDoors(room, ndoors) {
while(ndoors > 0) {
var x, y, nx, ny, lx, ly, rx, ry;
var orientation = rnd.nextRange(0, 4);
switch(orientation) {
case Cartography.NORTH:
x = turnOdd(rnd.nextRange(room.inix, room.inix+room.width-1));
y = room.iniy-1;
nx = x; ny = y-1;
lx = x-1; ly = y;
rx = x+1; ry = y;
break;
case Cartography.EAST:
x = room.inix+room.width;
y = turnOdd(rnd.nextRange(room.iniy, room.iniy+room.height-1));
nx = x+1; ny = y;
lx = x; ly = y-1;
rx = x; ry = y+1;
break;
case Cartography.SOUTH:
x = turnOdd(rnd.nextRange(room.inix, room.inix+room.width-1));
y = room.iniy+room.height;
nx = x; ny = y+1;
lx = x-1; ly = y;
rx = x+1; ry = y;
break;
case Cartography.WEST:
x = room.inix-1;
y = turnOdd(rnd.nextRange(room.iniy, room.iniy+room.height-1));
nx = x-1; ny = y;
lx = x; ly = y-1;
rx = x; ry = y+1;
break;
}
if ((that.layout[x][y].type === Cell.PERIMETER) && (that.layout[nx][ny].type !== Cell.BLOCKED) &&
(that.layout[lx][ly].type === Cell.PERIMETER) && (that.layout[rx][ry].type === Cell.PERIMETER)) {
var interior = false;
if(that.layout[nx][ny].type !== Cell.ROOM) ndoors--;
else interior = true;
room.doors.push(new Door(x, y, orientation, interior));
that.layout[x][y].type = Cell.DOOR;
}
}
};
function generateCorridors() {
// There is a scenario where a room can't be connected to others because something (other rooms, perimeters, etc)
// is blocking all the possible paths. Because of this we can't rely on the expandCorridorsFrom function solely,
// so i use allRoomsConnected to ensure all the rooms are connected (although probably some are unreachable).
while(!allRoomsConnected()) {
var room = that.rooms[rnd.nextRange(0, that.rooms.length)];
expandCorridorsFrom(room);
}
};
function expandCorridorsFrom(room) {
if(that.layout[room.inix][room.iniy].connected) {
return;
} else {
for(var x = room.inix, lx = room.inix+room.width; x < lx; x++) {
for(var y = room.iniy, ly = room.iniy+room.height; y < ly; y++) {
that.layout[x][y].connected = true;
}
}
}
for(var i = 0, l = room.doors.length; i < l; i++) {
var fromDoor = room.doors[i];
var dir = Cartography.direction(fromDoor.orientation);
that.layout[fromDoor.x][fromDoor.y].connected = true;
if(fromDoor.interior) {
var otherRoom = that.layout[fromDoor.x+dir.dx][fromDoor.y+dir.dy].room;
if(!that.layout[otherRoom.inix][otherRoom.iniy].connected)
expandCorridorsFrom(otherRoom);
} else {
if(that.rooms.length <= 1) {
var deadend = getDeadEnd();
that.layout[deadend.x][deadend.y].connected = connectDoors(fromDoor, deadend, dir);
} else {
var otherRoom = getUnconnectedRoom();
if(!otherRoom) {
var sameRoom = true;
while(sameRoom) {
otherRoom = that.rooms[rnd.nextRange(0, that.rooms.length)];
sameRoom = (otherRoom === room);
}
}
var toDoor = otherRoom.doors[rnd.nextRange(0, otherRoom.doors.length)];
while(toDoor.interior)
toDoor = otherRoom.doors[rnd.nextRange(0, otherRoom.doors.length)];
if(connectDoors(fromDoor, toDoor, dir)) {
that.layout[toDoor.x][toDoor.y].connected = true;
expandCorridorsFrom(otherRoom);
}
}
}
}
};
function connectDoors(start, goal, dir) {
start = that.layout[start.x+dir.dx][start.y+dir.dy];
if(start.type === Cell.EMPTY) {
start.type = Cell.CORRIDOR;
start.connected = true;
}
var connected = aStar.searchPath(that.layout, start, goal, 2);
takeWalk(aStar.buildPath());
return connected;
};
function generateDeadEnds() {
var nDeadEnds = rnd.nextRange(0, that.rooms.length);
for(var i = 0; i < nDeadEnds; i++) {
var corridorCell = getCorridorCell();
var deadEnd = getDeadEnd();
if(!corridorCell || !deadEnd) {
return;
} else {
if(aStar.searchPath(that.layout, corridorCell, deadEnd, 2)){
takeWalk(aStar.buildPath());
that.layout[deadEnd.x][deadEnd.y].type = Cell.DEADEND;
that.layout[deadEnd.x][deadEnd.y].connected = true;
that.deadEnds.push(deadEnd);
}
}
}
};
function getCorridorCell() {
var inix = turnOdd(rnd.nextRange(0, that.width));
var iniy = turnOdd(rnd.nextRange(0, that.height));
for(var x = 0; x < that.width; x+=2) {
for(var y = 0; y < that.height; y+=2){
var startx = (inix+x)%(that.width-1);
var starty = (iniy+y)%(that.height-1);
if(that.layout[startx][starty].type === Cell.CORRIDOR && that.layout[startx][starty].connected)
return that.layout[startx][starty];
}
}
return false;
};
function getDeadEnd() {
var inix = turnOdd(rnd.nextRange(0, that.width));
var iniy = turnOdd(rnd.nextRange(0, that.height));
for(var x = 0; x < that.width; x+=2) {
for(var y = 0; y < that.height; y+=2){
var deadx = (inix+x)%(that.width-1);
var deady = (iniy+y)%(that.height-1);
if(that.layout[deadx][deady].type === Cell.EMPTY && isolatedCell(deadx, deady))
return that.layout[deadx][deady];
}
}
return false;
};
function generateStairs() {
insertStairs(false);
insertStairs(true);
};
function insertStairs(up) {
var inserted = false;
while(!inserted) {
var index = rnd.nextRange(0, that.deadEnds.length+that.rooms.length);
if(index < that.deadEnds.length) {
inserted = insertStairsInDeadEnd(that.deadEnds[index], up);
} else {
index = index-that.deadEnds.length;
inserted = insertStairsInRoom(that.rooms[index], up);
}
}
};
function insertStairsInDeadEnd(deadEnd, up) {
if(deadEnd.type === Cell.STAIRS)
return false;
deadEnd.type = Cell.STAIRS;
var stairs = new Stairs(deadEnd.x, deadEnd.y, up);
that.stairs.push(stairs);
return true;
};
function insertStairsInRoom(room, up) {
if(roomContainsStairs(room))
return false;
var index = rnd.nextRange(0, (room.width)*(room.height));
var x = room.inix+index%room.width;
var y = room.iniy+Math.floor(index/room.width)
var cell = that.layout[x][y];
if(cell.type === Cell.STAIRS)
return false;
for(var i = 0; i < 4; i++) {
var dir = Cartography.direction(i);
var neighborCell = that.layout[x+dir.dx][y+dir.dy];
if(neighborCell.type === Cell.DOOR)
return false;
}
cell.type = Cell.STAIRS;
var stairs = new Stairs(x, y, up);
that.stairs.push(stairs);
return true;
};
function isolatedCell(x, y) {
for(var i = 0; i < 4; i++) {
var dir = Cartography.direction(i);
var cell = that.layout[x+dir.dx][y+dir.dy];
if(cell.type !== Cell.EMPTY && cell.type !== Cell.BLOCKED)
return false;
}
return true;
};
function allRoomsConnected() {
for(var i = 0, l = that.rooms.length; i < l; i++) {
var room = that.rooms[i];
if(!that.layout[room.inix][room.iniy].connected)
return false;
}
return true;
};
function getUnconnectedRoom() {
for(var i = 0, l = that.rooms.length; i < l; i++) {
var room = that.rooms[i];
if(!that.layout[room.inix][room.iniy].connected)
return room;
}
return false;
};
function room4room(inix, iniy, w, h) {
for(var x = inix, lx = (inix+w); x < lx; x++) {
for(var y = iniy, ly = (iniy+h); y < ly; y++) {
if(that.layout[x][y].type != Cell.EMPTY) return false;
}
}
return true;
};
function roomContainsStairs(room) {
for(var x = room.inix, lx = room.inix+room.width; x < lx; x++) {
for(var y = room.iniy, ly = room.iniy+room.height; y < ly; y++) {
var cell = that.layout[x][y];
if(cell.type === Cell.STAIRS)
return true;
}
}
return false;
};
function takeSteps(x, y, dir) {
var firstStep = that.layout[x+dir.dx][y+dir.dy];
var secondStep = that.layout[x+2*dir.dx][y+2*dir.dy];
if(!firstStep.connected) {
firstStep.type = Cell.CORRIDOR;
firstStep.connected = true;
}
if(!secondStep.connected) {
secondStep.type = Cell.CORRIDOR;
secondStep.connected = true;
} else {
if(secondStep.type === Cell.DEADEND) {
for(var i = 0, l = that.deadEnds.length; i < l; i++) {
var deadEnd = that.deadEnds[i];
if(deadEnd.x === secondStep.x && deadEnd.y === secondStep.y) {
that.deadEnds.splice(i, 1);
break;
}
}
secondStep.type = Cell.CORRIDOR;
}
}
};
function takeWalk(steps) {
for(var i = steps.length-1; i > 0; i--) {
var node = steps[i];
var dir = steps[i-1].dir;
takeSteps(node.x, node.y, dir);
}
};
function turnOdd(n) {
return Math.abs((n%2===0)?(n-1):n);
};
var MIN_FLOOR_WIDTH = 9;
var MIN_FLOOR_HEIGHT = 9;
var MIN_ROOM_SIZE = 3;
var DENSITY = 4;
var rnd = new RNG(Date.now());
this.width = (width < MIN_FLOOR_WIDTH) ? MIN_FLOOR_WIDTH : turnOdd(width);
this.height = (height < MIN_FLOOR_HEIGHT) ? MIN_FLOOR_HEIGHT : turnOdd(height);
this.type = type;
this.rooms = [];
this.deadEnds = [];
this.stairs = [];
this.layout = new Array(this.width);
for(var x = 0; x < this.width; x++)
this.layout[x] = new Array(this.height);
var stepCondition = function(x, y) {
var type = that.layout[x][y].type;
return((type === Cell.EMPTY) || (type === Cell.CORRIDOR) || (type === Cell.DOOR) || (type === Cell.DEADEND));
};
var goalCondition = function(x, y, gx, gy) {
if(gx === x && gy === y) // dead end check
return true;
for(var i = 0; i < 4; i++) { // doors check
var dir = Cartography.direction(i);
if(gx === x+dir.dx && gy === y+dir.dy)
return true;
}
return false;
};
var aStar = new AStar(stepCondition, goalCondition);
var that = this;
setLayoutType(type);
generate();
};
| {
"content_hash": "870069dd5998d6ce00638feb302fd749",
"timestamp": "",
"source": "github",
"line_count": 491,
"max_line_length": 116,
"avg_line_length": 25.596741344195518,
"alnum_prop": 0.6092457033736474,
"repo_name": "jorgeprodriguez/random-dungeon-generator",
"id": "1e38b0c3c8c2b21f1d7cc06975da0248a929ece7",
"size": "12568",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/generator/Floor.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "41402"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MathML
{
[AttributeUsage(AttributeTargets.Class)]
public class MathMLElementName : Attribute
{
public string ElementName { get; private set; }
public MathMLElementName(string elementName)
{
ElementName = elementName;
}
}
} | {
"content_hash": "43fbb6cbeb79065a52367d4be28e2c93",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 55,
"avg_line_length": 21.63157894736842,
"alnum_prop": 0.681265206812652,
"repo_name": "BenjaminTMilnes/MathML",
"id": "66018abecdf1ef9f0b52eeabf762290317876268",
"size": "413",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MathML/MathMLElementName.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "79164"
}
],
"symlink_target": ""
} |
package ch.qos.logback.core.joran.conditional;
import ch.qos.logback.core.spi.PropertyContainer;
import ch.qos.logback.core.util.OptionHelper;
public class PropertyWrapperForScripts {
PropertyContainer local;
PropertyContainer context;
// this method is invoked by reflection in PropertyEvalScriptBuilder
public void setPropertyContainers(PropertyContainer local, PropertyContainer context) {
this.local = local;
this.context = context;
}
public boolean isNull(String k) {
String val = OptionHelper.propertyLookup(k, local, context);
return (val == null);
}
public boolean isDefined(String k) {
String val = OptionHelper.propertyLookup(k, local, context);
return (val != null);
}
public String p(String k) {
return property(k);
}
public String property(String k) {
String val = OptionHelper.propertyLookup(k, local, context);
if(val != null)
return val;
else
return "";
}
}
| {
"content_hash": "13ecd354d5a190b166e72d81e6832752",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 89,
"avg_line_length": 25.692307692307693,
"alnum_prop": 0.6816367265469062,
"repo_name": "cscfa/bartleby",
"id": "606f5e1abe5aacb979ee09b62ee5368d23f03129",
"size": "1486",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "library/logBack/logback-1.1.3/logback-core/src/main/java/ch/qos/logback/core/joran/conditional/PropertyWrapperForScripts.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "487"
},
{
"name": "Batchfile",
"bytes": "478"
},
{
"name": "Common Lisp",
"bytes": "100"
},
{
"name": "Groff",
"bytes": "405"
},
{
"name": "Java",
"bytes": "4069200"
},
{
"name": "PLSQL",
"bytes": "4133"
},
{
"name": "PLpgSQL",
"bytes": "4948"
},
{
"name": "Scala",
"bytes": "39629"
},
{
"name": "Shell",
"bytes": "5050"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace BPMNET.Core
{
public interface IInstanceTask<TKey>
where TKey : IEquatable<TKey>
{
Task ClaimTask(IUser user);
Task CompleteTask(IDictionary<string, object> variables);
Task AssignTask(IUser user);
Task AssignTask(IUser user, IDictionary<string, object> variables);
}
}
| {
"content_hash": "89670e1c685fa2c796d92290db3042ae",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 75,
"avg_line_length": 27.466666666666665,
"alnum_prop": 0.6966019417475728,
"repo_name": "Diaskhan/jetbpm",
"id": "8e7c9c2185f74f5ddb5e08ff641d2858b7097950",
"size": "414",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BpmNet-master/BPMNET.Core/Runtime/IInstanceTask.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "9704"
},
{
"name": "C#",
"bytes": "1531197"
},
{
"name": "CSS",
"bytes": "9403"
},
{
"name": "Groovy",
"bytes": "1594"
},
{
"name": "HTML",
"bytes": "59975"
},
{
"name": "Java",
"bytes": "27495382"
},
{
"name": "JavaScript",
"bytes": "77"
},
{
"name": "PLpgSQL",
"bytes": "26834"
},
{
"name": "Python",
"bytes": "187"
},
{
"name": "Ruby",
"bytes": "60"
},
{
"name": "Shell",
"bytes": "10937"
}
],
"symlink_target": ""
} |
find_library(PROTOBUF_LIBRARY_DIR NAMES protobuf)
find_program(PROTOBUF_BINARY_DIR NAMES protoc)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(protobuf REQUIRED_VARS PROTOBUF_LIBRARY_DIR PROTOBUF_BINARY_DIR)
if(PROTOBUF_FOUND)
message(STATUS "Found Protobuf binary - ${PROTOBUF_BINARY_DIR}, Protobuf library dir - ${PROTOBUF_LIBRARY_DIR}")
else()
message(WARNING "Protobuf not found")
endif()
| {
"content_hash": "fbfb08fdfe756e95b92fa3e1ba4278d4",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 116,
"avg_line_length": 42.9,
"alnum_prop": 0.7925407925407926,
"repo_name": "Dudi119/SearchYA",
"id": "f5f5698b9bf9c986f4c49f3a0e3b495a26da946d",
"size": "429",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cmake/FindProtoBuf.cmake",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "225"
},
{
"name": "C++",
"bytes": "132995"
},
{
"name": "CMake",
"bytes": "15237"
},
{
"name": "Shell",
"bytes": "3305"
}
],
"symlink_target": ""
} |
<?php
namespace Stampi\AdminBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class ItemType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('playset')
->add('rarity')
;
}
/**
* @param OptionsResolverInterface $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Stampi\AdminBundle\Entity\Item'
));
}
/**
* @return string
*/
public function getName()
{
return 'stampi_adminbundle_item';
}
}
| {
"content_hash": "96bfc1b497e731d59d74e20bc2aaf217",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 76,
"avg_line_length": 22.25,
"alnum_prop": 0.6269662921348315,
"repo_name": "fgavilan/Stampi",
"id": "06b34793052f94c49aaea3830ce7ab71a5b7bf21",
"size": "890",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Stampi/AdminBundle/Form/ItemType.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "CSS",
"bytes": "186353"
},
{
"name": "HTML",
"bytes": "49507"
},
{
"name": "JavaScript",
"bytes": "503938"
},
{
"name": "PHP",
"bytes": "139055"
}
],
"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.
#include "chrome/browser/policy/messaging_layer/public/report_client.h"
#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/singleton.h"
#include "base/path_service.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/bind_post_task.h"
#include "base/task/thread_pool.h"
#include "base/threading/sequence_bound.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/policy/messaging_layer/upload/upload_provider.h"
#include "chrome/browser/policy/messaging_layer/util/dm_token_retriever_provider.h"
#include "chrome/common/chrome_paths.h"
#include "components/policy/core/common/cloud/cloud_policy_client_registration_helper.h"
#include "components/policy/core/common/cloud/cloud_policy_manager.h"
#include "components/policy/core/common/cloud/device_management_service.h"
#include "components/policy/core/common/cloud/machine_level_user_cloud_policy_manager.h"
#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#include "components/reporting/client/dm_token_retriever.h"
#include "components/reporting/client/report_queue_configuration.h"
#include "components/reporting/client/report_queue_impl.h"
#include "components/reporting/encryption/encryption_module.h"
#include "components/reporting/encryption/verification.h"
#include "components/reporting/proto/synced/record.pb.h"
#include "components/reporting/resources/resource_interface.h"
#include "components/reporting/storage/storage_configuration.h"
#include "components/reporting/storage/storage_module.h"
#include "components/reporting/storage/storage_module_interface.h"
#include "components/reporting/storage/storage_uploader_interface.h"
#include "components/reporting/storage_selector/storage_selector.h"
#include "components/reporting/util/status.h"
#include "components/reporting/util/status_macros.h"
#include "components/reporting/util/statusor.h"
#include "components/signin/public/identity_manager/identity_manager.h"
namespace reporting {
namespace {
const base::FilePath::CharType kReportingDirectory[] =
FILE_PATH_LITERAL("reporting");
} // namespace
// static
void ReportingClient::CreateLocalStorageModule(
const base::FilePath& local_reporting_path,
base::StringPiece verification_key,
CompressionInformation::CompressionAlgorithm compression_algorithm,
UploaderInterface::AsyncStartUploaderCb async_start_upload_cb,
base::OnceCallback<void(StatusOr<scoped_refptr<StorageModuleInterface>>)>
cb) {
LOG(WARNING) << "Store reporting data locally";
DCHECK(!StorageSelector::is_use_missive())
<< "Can only be used in local mode";
StorageModule::Create(
StorageOptions()
.set_directory(local_reporting_path)
.set_signature_verification_public_key(verification_key),
std::move(async_start_upload_cb), EncryptionModule::Create(),
CompressionModule::Create(512, compression_algorithm), std::move(cb));
}
// static
StorageModule* ReportingClient::GetLocalStorageModule() {
DCHECK(!StorageSelector::is_use_missive())
<< "Can only be used in local mode";
return static_cast<StorageModule*>(GetInstance()->storage().get());
}
// Uploader is passed to Storage in order to upload messages using the
// UploadClient.
class ReportingClient::Uploader : public UploaderInterface {
public:
using UploadCallback = base::OnceCallback<
Status(bool, std::vector<EncryptedRecord>, ScopedReservation)>;
static std::unique_ptr<Uploader> Create(bool need_encryption_key,
UploadCallback upload_callback) {
return base::WrapUnique(
new Uploader(need_encryption_key, std::move(upload_callback)));
}
~Uploader() override = default;
Uploader(const Uploader& other) = delete;
Uploader& operator=(const Uploader& other) = delete;
void ProcessRecord(EncryptedRecord data,
ScopedReservation scoped_reservation,
base::OnceCallback<void(bool)> processed_cb) override {
helper_.AsyncCall(&Helper::ProcessRecord)
.WithArgs(std::move(data), std::move(scoped_reservation),
std::move(processed_cb));
}
void ProcessGap(SequenceInformation start,
uint64_t count,
base::OnceCallback<void(bool)> processed_cb) override {
helper_.AsyncCall(&Helper::ProcessGap)
.WithArgs(std::move(start), count, std::move(processed_cb));
}
void Completed(Status final_status) override {
helper_.AsyncCall(&Helper::Completed).WithArgs(final_status);
}
private:
// Helper class that performs actions, wrapped in SequenceBound by |Uploader|.
class Helper {
public:
Helper(bool need_encryption_key, UploadCallback upload_callback);
Helper(const Helper& other) = delete;
Helper& operator=(const Helper& other) = delete;
void ProcessRecord(EncryptedRecord data,
ScopedReservation scoped_reservation,
base::OnceCallback<void(bool)> processed_cb);
void ProcessGap(SequenceInformation start,
uint64_t count,
base::OnceCallback<void(bool)> processed_cb);
void Completed(Status final_status);
private:
bool completed_ GUARDED_BY_CONTEXT(sequence_checker_){false};
const bool need_encryption_key_;
std::vector<EncryptedRecord> encrypted_records_;
ScopedReservation encrypted_records_reservation_;
SEQUENCE_CHECKER(sequence_checker_);
UploadCallback upload_callback_;
};
Uploader(bool need_encryption_key, UploadCallback upload_callback)
: helper_(base::ThreadPool::CreateSequencedTaskRunner({}),
need_encryption_key,
std::move(upload_callback)) {}
base::SequenceBound<Helper> helper_;
};
ReportingClient::Uploader::Helper::Helper(
bool need_encryption_key,
ReportingClient::Uploader::UploadCallback upload_callback)
: need_encryption_key_(need_encryption_key),
upload_callback_(std::move(upload_callback)) {
// Constructor is called on the task assigned by |SequenceBound|.
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
void ReportingClient::Uploader::Helper::ProcessRecord(
EncryptedRecord data,
ScopedReservation scoped_reservation,
base::OnceCallback<void(bool)> processed_cb) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (completed_) {
std::move(processed_cb).Run(false);
return;
}
encrypted_records_.emplace_back(std::move(data));
encrypted_records_reservation_.HandOver(scoped_reservation);
std::move(processed_cb).Run(true);
}
void ReportingClient::Uploader::Helper::ProcessGap(
SequenceInformation start,
uint64_t count,
base::OnceCallback<void(bool)> processed_cb) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (completed_) {
std::move(processed_cb).Run(false);
return;
}
for (uint64_t i = 0; i < count; ++i) {
encrypted_records_.emplace_back();
*encrypted_records_.rbegin()->mutable_sequence_information() = start;
start.set_sequencing_id(start.sequencing_id() + 1);
}
std::move(processed_cb).Run(true);
}
void ReportingClient::Uploader::Helper::Completed(Status final_status) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (!final_status.ok()) {
// No work to do - something went wrong with storage and it no longer
// wants to upload the records. Let the records die with |this|.
return;
}
if (completed_) {
// Upload has already been invoked. Return.
return;
}
completed_ = true;
if (encrypted_records_.empty() && !need_encryption_key_) {
return;
}
DCHECK(upload_callback_);
Status upload_status =
std::move(upload_callback_)
.Run(need_encryption_key_, std::move(encrypted_records_),
std::move(encrypted_records_reservation_));
if (!upload_status.ok()) {
LOG(ERROR) << "Unable to upload records: " << upload_status;
}
}
ReportingClient::ReportingClient()
: ReportQueueProvider(base::BindRepeating(
[](base::OnceCallback<void(
StatusOr<scoped_refptr<StorageModuleInterface>>)>
storage_created_cb) {
#if BUILDFLAG(IS_CHROMEOS)
if (StorageSelector::is_use_missive()) {
StorageSelector::CreateMissiveStorageModule(
std::move(storage_created_cb));
return;
}
#endif // BUILDFLAG(IS_CHROMEOS)
// Storage location in the local file system (if local storage is
// enabled).
base::FilePath reporting_path;
const auto res =
base::PathService::Get(chrome::DIR_USER_DATA, &reporting_path);
DCHECK(res) << "Could not retrieve base path";
#if BUILDFLAG(IS_CHROMEOS_ASH)
reporting_path = reporting_path.Append("user");
#endif
reporting_path = reporting_path.Append(kReportingDirectory);
CreateLocalStorageModule(
reporting_path, SignatureVerifier::VerificationKey(),
CompressionInformation::COMPRESSION_SNAPPY,
base::BindRepeating(&ReportingClient::AsyncStartUploader),
std::move(storage_created_cb));
})) {
}
ReportingClient::~ReportingClient() = default;
// static
ReportingClient* ReportingClient::GetInstance() {
return base::Singleton<ReportingClient>::get();
}
// static
ReportQueueProvider* ReportQueueProvider::GetInstance() {
// Forward to ReportingClient::GetInstance, because
// base::Singleton<ReportingClient>::get() cannot be called
// outside ReportingClient class.
return ReportingClient::GetInstance();
}
void ReportingClient::ConfigureReportQueue(
std::unique_ptr<ReportQueueConfiguration> configuration,
ReportQueueProvider::ReportQueueConfiguredCallback completion_cb) {
// If DM token has already been set (only likely for testing purposes or until
// pre-existing events are migrated over to use event types instead), we do
// nothing and trigger completion callback with report queue config.
if (!configuration->dm_token().empty()) {
std::move(completion_cb).Run(std::move(configuration));
return;
}
auto dm_token_retriever_provider =
std::make_unique<DMTokenRetrieverProvider>();
auto dm_token_retriever =
std::move(dm_token_retriever_provider)
->GetDMTokenRetrieverForEventType(configuration->event_type());
// Trigger completion callback with an internal error if no DM token retriever
// found
if (!dm_token_retriever) {
std::move(completion_cb)
.Run(Status(error::INTERNAL,
base::StrCat({"No DM token retriever found for event type=",
base::NumberToString(static_cast<int>(
configuration->event_type()))})));
return;
}
std::move(dm_token_retriever)
->RetrieveDMToken(base::BindOnce(
[](std::unique_ptr<ReportQueueConfiguration> configuration,
ReportQueueProvider::ReportQueueConfiguredCallback completion_cb,
StatusOr<std::string> dm_token_result) {
// Trigger completion callback with error if there was an error
// retrieving DM token.
if (!dm_token_result.ok()) {
std::move(completion_cb).Run(dm_token_result.status());
return;
}
// Set DM token in config and trigger completion callback with the
// corresponding result.
auto config_result =
configuration->SetDMToken(dm_token_result.ValueOrDie());
// Fail on error
if (!config_result.ok()) {
std::move(completion_cb).Run(config_result);
return;
}
// Success, run completion callback with updated config
std::move(completion_cb).Run(std::move(configuration));
},
std::move(configuration), std::move(completion_cb)));
}
// static
void ReportingClient::AsyncStartUploader(
UploaderInterface::UploadReason reason,
UploaderInterface::UploaderInterfaceResultCb start_uploader_cb) {
ReportingClient::GetInstance()->DeliverAsyncStartUploader(
reason, std::move(start_uploader_cb));
}
void ReportingClient::DeliverAsyncStartUploader(
UploaderInterface::UploadReason reason,
UploaderInterface::UploaderInterfaceResultCb start_uploader_cb) {
sequenced_task_runner()->PostTask(
FROM_HERE,
base::BindOnce(
[](UploaderInterface::UploadReason reason,
UploaderInterface::UploaderInterfaceResultCb start_uploader_cb,
ReportingClient* instance) {
if (!instance->upload_provider_) {
// If non-missived uploading is enabled, it will need upload
// provider. In case of missived Uploader will be provided by
// EncryptedReportingServiceProvider so it does not need to be
// enabled here.
if (!StorageSelector::is_uploader_required() ||
StorageSelector::is_use_missive()) {
std::move(start_uploader_cb)
.Run(Status(error::UNAVAILABLE, "Uploader not available"));
return;
}
instance->upload_provider_ =
instance->CreateLocalUploadProvider();
}
auto uploader = Uploader::Create(
/*need_encryption_key=*/(
EncryptionModuleInterface::is_enabled() &&
reason == UploaderInterface::UploadReason::KEY_DELIVERY),
base::BindOnce(
[](EncryptedReportingUploadProvider* upload_provider,
bool need_encryption_key,
std::vector<EncryptedRecord> records,
ScopedReservation scoped_reservation) {
upload_provider->RequestUploadEncryptedRecords(
need_encryption_key, std::move(records),
std::move(scoped_reservation), base::DoNothing());
return Status::StatusOK();
},
base::Unretained(instance->upload_provider_.get())));
std::move(start_uploader_cb).Run(std::move(uploader));
},
reason, std::move(start_uploader_cb), base::Unretained(this)));
}
// static
std::unique_ptr<EncryptedReportingUploadProvider>
ReportingClient::CreateLocalUploadProvider() {
// Note: access local storage inside the callbacks, because it may be not yet
// stored in the client at the moment EncryptedReportingUploadProvider
// is instantiated.
return std::make_unique<EncryptedReportingUploadProvider>(
base::BindPostTask(
sequenced_task_runner(),
base::BindRepeating(
[](SequenceInformation sequence_information, bool force) {
GetLocalStorageModule()->ReportSuccess(
std::move(sequence_information), force);
})),
base::BindPostTask(
sequenced_task_runner(),
base::BindRepeating([](SignedEncryptionInfo signed_encryption_key) {
GetLocalStorageModule()->UpdateEncryptionKey(
std::move(signed_encryption_key));
})));
}
} // namespace reporting
| {
"content_hash": "6bdb39d3d19715d46e21d63d11415943",
"timestamp": "",
"source": "github",
"line_count": 392,
"max_line_length": 88,
"avg_line_length": 40.00765306122449,
"alnum_prop": 0.6696422878275841,
"repo_name": "nwjs/chromium.src",
"id": "e13713dd137edd6ae6a78b38a93928650bf805b6",
"size": "15683",
"binary": false,
"copies": "1",
"ref": "refs/heads/nw70",
"path": "chrome/browser/policy/messaging_layer/public/report_client.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
(function (angular, jcs) {
'use strict';
//var apiServer = "http://expense-manager-backend.azurewebsites.net";
var apiServer = "http://localhost:59184";
var baseApiPath = "/api/v1";
var apiPath = apiServer + baseApiPath;
jcs.modules.core = {
name: "jcs-core",
apiServer : apiServer,
apiPath : apiPath,
baseApiPath : baseApiPath,
services: {
eventbus: "eventbus",
tripsSelection : "tripsSelection"
},
events : {
tripChanged : "tripChanged"
},
api: {
expenses: apiPath + "/crewexpenses/"
}
};
angular.module(jcs.modules.core.name, []);
}(angular, jcs)); | {
"content_hash": "640cdca25123d1118666b1658d9c5b6c",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 73,
"avg_line_length": 25.535714285714285,
"alnum_prop": 0.544055944055944,
"repo_name": "Zaknafeyn/expense-manager",
"id": "2e80cec5df85f073444e2631efc838828f4c09bb",
"size": "715",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/modules/core/module.core.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2783"
},
{
"name": "HTML",
"bytes": "16765"
},
{
"name": "JavaScript",
"bytes": "55926"
}
],
"symlink_target": ""
} |
//
// ZMessageSendView.h
// ZMessageKit
//
// Created by zhuayi on 9/15/15.
// Copyright (c) 2015 zhuayi. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ZMessageDelegate.h"
@interface ZMessageSendView : UIView<UITextViewDelegate>
/**
* 代理方法
*/
@property (nonatomic, weak) id<ZMessageSendDelete> delegate;
/**
* 文本框
*/
@property (nonatomic, strong) UITextView *textField;
@end
| {
"content_hash": "9c8b61cd5bdff468eb6a1092e2914b60",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 60,
"avg_line_length": 16.08,
"alnum_prop": 0.6890547263681592,
"repo_name": "zhuayi/ZMessageKit",
"id": "ddc53de1e0f256f04cce8b93153a5582245d4fe4",
"size": "416",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Pod/Classes/ZMessageSendView.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "40102"
},
{
"name": "Ruby",
"bytes": "1814"
}
],
"symlink_target": ""
} |
class AuthorsController < ApplicationController
before_action :set_author, only: [:show]
# GET /authors
def index
@authors = Author.all
end
# GET /authors/1
def show
end
private
# Use callbacks to share common setup or constraints between actions.
def set_author
@author = Author.find(params[:id])
end
end
| {
"content_hash": "0fab52bff139a7a501caa4b9e6bf4f92",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 71,
"avg_line_length": 17.894736842105264,
"alnum_prop": 0.6941176470588235,
"repo_name": "neilang/implicit_page_titles",
"id": "a24c6946c8845dd46eeaf9ff203e944a9a44fb38",
"size": "340",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/dummy_app/app/controllers/authors_controller.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "686"
},
{
"name": "HTML",
"bytes": "7105"
},
{
"name": "JavaScript",
"bytes": "596"
},
{
"name": "Ruby",
"bytes": "31417"
}
],
"symlink_target": ""
} |
directory File.dirname(node['mysql-backup']['backup_file']) do
mode 0755
action :create
end
template '/etc/cron.d/mysql-backup' do
source 'cron.d.erb'
variables(
:schedule => node['mysql-backup']['schedule'],
:backup_file => node['mysql-backup']['backup_file'],
:mysql_user => node['mysql-backup']['mysql_user'],
:mysql_password => node['mysql-backup']['mysql_password'],
:log_file => '/var/log/mysql-backup.log'
)
owner 'root'
group 'root'
mode 0600
end
template '/etc/init/mysql-backup.conf' do
source 'upstart.conf.erb'
variables(
:backup_file => node['mysql-backup']['backup_file'],
:mysql_user => node['mysql-backup']['mysql_user'],
:mysql_password => node['mysql-backup']['mysql_password'],
:log_file => '/var/log/mysql-backup.log'
)
owner 'root'
group 'root'
mode 0600
end
| {
"content_hash": "af4aaa8e5f3aadb640b753d8a168cc4b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 62,
"avg_line_length": 27.29032258064516,
"alnum_prop": 0.6430260047281324,
"repo_name": "kwaaioak/devops",
"id": "7a0132e0b18cd507c096c89536fe787d39ad7f16",
"size": "982",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chef-repo/cookbooks/mysql-backup/recipes/default.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "44974"
},
{
"name": "Ruby",
"bytes": "40304"
},
{
"name": "Shell",
"bytes": "4782"
}
],
"symlink_target": ""
} |
<!DOCTYPE html><html><head>
<title>A canvas quadraticCurveTo example</title>
<meta name="DC.creator" content="Kamiel Martinet, http://www.martinet.nl/">
<meta name="DC.publisher" content="Mozilla Developer Center, http://developer.mozilla.org">
<!--[if lt IE 9]><script type="text/javascript" src="../../../../../../bin/flashcanvas.js"></script><![endif]-->
<script>
function canvasReady() {
drawShape(document.getElementById('canvas'));
}
function drawShape(canvas){
// get the canvas element using the DOM
// Make sure we don't execute when canvas isn't supported
if (canvas.getContext){
// use getContext to use the canvas for drawing
var ctx = canvas.getContext('2d');
// Draw shapes
ctx.beginPath();
ctx.moveTo(75,25);
ctx.quadraticCurveTo(25,25,25,62.5);
ctx.quadraticCurveTo(25,100,50,100);
ctx.quadraticCurveTo(50,120,30,125);
ctx.quadraticCurveTo(60,120,65,100);
ctx.quadraticCurveTo(125,100,125,62.5);
ctx.quadraticCurveTo(125,25,75,25);
ctx.stroke();
} else {
alert('You need Safari or Firefox 1.5+ to see this demo.');
}
}
</script>
<style type="text/css">
body { margin: 20px; font-family: arial,verdana,helvetica; background: #fff;}
h1 { font-size: 140%; font-weight:normal; color: #036; border-bottom: 1px solid #ccc; }
canvas { border: 2px solid #000; float: left; margin-right: 20px; margin-bottom: 20px; }
pre { float:left; display:block; background: rgb(238,238,238); border: 1px dashed #666; padding: 15px 20px; margin: 0 0 10px 0; }
</style>
</head>
<body onload="canvasReady();">
<h1>A canvas <code>quadraticCurveTo</code> example</h1>
<div>
<canvas id="canvas" width="150" height="150"></canvas>
<pre>
function canvasReady() {
drawShape(document.getElementById('canvas'));
}
function drawShape(canvas){
// get the canvas element using the DOM
// Make sure we don't execute when canvas isn't supported
if (canvas.getContext){
// use getContext to use the canvas for drawing
var ctx = canvas.getContext('2d');
// Draw shapes
ctx.beginPath();
ctx.moveTo(75,25);
ctx.quadraticCurveTo(25,25,25,62.5);
ctx.quadraticCurveTo(25,100,50,100);
ctx.quadraticCurveTo(50,120,30,125);
ctx.quadraticCurveTo(60,120,65,100);
ctx.quadraticCurveTo(125,100,125,62.5);
ctx.quadraticCurveTo(125,25,75,25);
ctx.stroke();
} else {
alert('You need Safari or Firefox 1.5+ to see this demo.');
}
}
</pre>
</div>
</body>
</html>
| {
"content_hash": "e20b81fdecb80f674627fcfe471bfad5",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 135,
"avg_line_length": 32.42168674698795,
"alnum_prop": 0.6198439241917503,
"repo_name": "feklee/realitybuilder",
"id": "d39f1ec7a4244731a6b46139fb25b3b25f71c896",
"size": "2691",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "deployed/separate/FlashCanvasPro/examples/uupaa-js-spinoff.googlecode.com/svn/trunk/uuCanvas.js/demo/2_5_canvas_quadraticcurveto.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "15414"
},
{
"name": "HTML",
"bytes": "496231"
},
{
"name": "JavaScript",
"bytes": "936284"
},
{
"name": "PHP",
"bytes": "4337"
},
{
"name": "Python",
"bytes": "90080"
}
],
"symlink_target": ""
} |
/*!
* AngularJS Material Design
* https://github.com/angular/material
* @license MIT
* v1.1.9-master-41c9d00
*/md-content{display:block;position:relative;overflow:auto;-webkit-overflow-scrolling:touch}md-content[md-scroll-y]{overflow-y:auto;overflow-x:hidden}md-content[md-scroll-x]{overflow-x:auto;overflow-y:hidden}@media print{md-content{overflow:visible!important}} | {
"content_hash": "2f27d2a849a90de43f4fa61a5294b958",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 261,
"avg_line_length": 62.333333333333336,
"alnum_prop": 0.7780748663101604,
"repo_name": "slickqa/slickqaweb",
"id": "87deff9ce97e8272241d744459dd4bae31588ece",
"size": "374",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "slickqaweb/static/components/angular-material/modules/js/content/content.min.css",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4471266"
},
{
"name": "Dockerfile",
"bytes": "4478"
},
{
"name": "HTML",
"bytes": "523433"
},
{
"name": "JavaScript",
"bytes": "2937024"
},
{
"name": "Python",
"bytes": "222075"
},
{
"name": "Ruby",
"bytes": "36812"
},
{
"name": "Shell",
"bytes": "3211"
}
],
"symlink_target": ""
} |

Automate back up or restore of APK's, Android applications to your Android phone.
## Table of contents:
0x0: Support Information<br>
0x1: How to run the software<br>
0x2: Use cases <br>
0x3: Command Line Arguments<br>
## 0x0: Support Information
Support for the software is provided through the dedicated XDA developers forum post [here](http://forum.xda-developers.com/showthread.php?t=1310742)
## 0x1 How to run the software
You will need to have python 3 installed plus two python dependencies py3-progressbar and pycrypto. You can do that by opening a terminal and typing one of the following commands
pip install -r requirements.txt
pipenv install
Also you can you download precompiled binaries for Windows, Linux, MacOS from [here](https://github.com/binary-signal/mass-apk-installer/releases)
## 0x2: Use cases
# back up to folder created automaticaly
$python3 mass-apk-installer.py backup
# back up to a zip file created automaticaly
$python3 mass-apk-installer.py backup -a
# back up to encrypted zip file created automaticaly
$python3 mass-apk-installer.py backup -a -e
#restore from folder
$python3 mass-apk-installer.py restore 2018-02-12_04-47-25
#restore from zip file
$python3 mass-apk-installer.py restore 2018-02-12_04-47-25.zip
#restore from encrypted zip file
$python3 mass-apk-installer.py restore 2018-02-12_04-47-25.aes
## 0x3: Command Line Arguments
backup [-a] [-e] | make back up
-a, --archive | Create zip archive after back up, used with -b flag
-e, --encrypt | Encrypt zip archive after backup used with -b -a flags
restore [path] | restore back up to device, path can be a folder, zip file or encrypted archive
| {
"content_hash": "e6c3495643fc7c9e0ea07d6b4d781ba7",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 178,
"avg_line_length": 30.67241379310345,
"alnum_prop": 0.732433951658235,
"repo_name": "binary-signal/mass-apk-installer",
"id": "22dbf09da640f99c3222f2e34ef37e68f40447f0",
"size": "1801",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "19181"
}
],
"symlink_target": ""
} |
var boot_state={
create:function(){
game.physics.startSystem(Phaser.Physics.ARCADE);
game.state.start('load',load_state);
}
}; | {
"content_hash": "ab5472586e5e5e6f12a7fa68f1092437",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 56,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.573170731707317,
"repo_name": "deliacazamir/Fun-Web",
"id": "67db1419371a358554420b96907690397d650440",
"size": "164",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "project/js/boot_state.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "129"
},
{
"name": "CSS",
"bytes": "3258"
},
{
"name": "HTML",
"bytes": "15138"
},
{
"name": "JavaScript",
"bytes": "9808575"
}
],
"symlink_target": ""
} |
<?php
namespace NottsDigital\Adapter;
use Goutte\Client;
use NottsDigital\Adapter\AdapterInterface;
use Symfony\Component\DomCrawler\Crawler;
class TitoAdapter implements AdapterInterface
{
/**
* @var Client
*/
protected $client;
/**
* @var array
*/
protected $config;
/**
* @var string
*/
protected $baseUrl;
/**
* @var \Symfony\Component\DomCrawler\Crawler
*/
protected $event;
/**
* @var string
*/
protected $group;
public function __construct(Client $client, $baseUrl, $config)
{
$this->client = $client;
$this->baseUrl = $baseUrl;
$this->config = $config;
}
/**
* @param string $group
* @return \Symfony\Component\DomCrawler\Crawler
*/
public function fetch($group)
{
$this->group = $group;
try {
$crawler = $this->client->request('GET', $this->baseUrl . '/' . $this->config[$group]['url'] );
$this->event = $crawler->filter('.events .future > a')->eq(0);
} catch (\InvalidArgumentException $e) {
$this->event = new Crawler();
}
}
/**
* @return string
*/
public function getBaseUrl()
{
return $this->baseUrl;
}
/**
* @return \DateTime
*/
public function getDate()
{
$dateStr = '';
try {
$dateStr = $this->event->text();
} catch (\InvalidArgumentException $e) {}
preg_match("/(\w+)(\s{1})(\d{1,2})([a-zA-z]{2}),\s{1}(\d{4})/", $dateStr, $date);
if (!is_array($date) || empty($date)) {
throw new \InvalidArgumentException('Date does not exist or format unknown.');
}
/** @var \DateTime $date */
$date = \DateTime::createFromFormat('F jS\, Y', $date[0]);
return $date;
}
/**
* @return string
*/
public function getUrl()
{
$url = '';
try {
$url = $this->getBaseUrl() . $this->event->attr('href');
} catch (\Exception $e) {}
return $url;
}
/**
* @return string
*/
public function getGroupName()
{
return $this->group;
}
/**
* @return string
*/
public function getTitle()
{
return '';
}
/**
* @return string
*/
public function getLocation()
{
return '';
}
/**
* @return array
*/
public function getGroupInfo()
{
return [];
}
/**
* @return string
*/
public function getGroupDescription()
{
// TODO: Implement getGroupDescription() method.
}
/**
* @return string
*/
public function getGroupPhoto()
{
// TODO: Implement getGroupPhoto() method.
}
/**
* @return array
*/
public function getEventEntityCollection()
{
// TODO: Implement getEventEntityCollection() method.
}
} | {
"content_hash": "637d31f56271d863464db938733c4a6c",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 107,
"avg_line_length": 19.006369426751593,
"alnum_prop": 0.5010053619302949,
"repo_name": "pavlakis/notts-digital",
"id": "72ea1cf053c8042ff67b70f4e40864e003204143",
"size": "3229",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/Adapter/TitoAdapter.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "77130"
}
],
"symlink_target": ""
} |
package xyz.isunxu.imooc_practice_android.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import xyz.isunxu.imooc_practice_android.R;
public class WeixinFragment extends Fragment implements View.OnTouchListener {
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.tab01, container, false);
}
@Override public boolean onTouch(View v, MotionEvent event) {
return true;
}
}
| {
"content_hash": "f7bde969d3b73aa2882372c3e5dd500b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 113,
"avg_line_length": 28.2,
"alnum_prop": 0.7659574468085106,
"repo_name": "sunxu3074/imooc-practice-android",
"id": "5aa8b97cf36648d0f8650e94e428c43bd64687a0",
"size": "705",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app_tab/src/main/java/xyz/isunxu/imooc_practice_android/fragment/WeixinFragment.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "58253"
}
],
"symlink_target": ""
} |
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace EFCoreExtend.Test
{
/// <summary>
/// 策略扩展测试
/// </summary>
public class TestPolicyExtend
{
//static DbContext db = new MSSqlDBContext();
static DbContext db = new SqlieteDBContext();
//static DbContext db = new MysqlDBContext();
//static DbContext db = new PostgreSqlDBContext();
PersonPolicyExtendBLL p = new PersonPolicyExtendBLL(db);
static TestPolicyExtend()
{
//添加扩展的策略执行器
var exc = new InsertIntoPolicyExecutor();
EFHelper.Services.SqlConfigMgr.PolicyMgr.SetInitPolicyExecutor(() => exc);
//添加扩展的策略类型
EFHelper.Services.SqlConfigMgr.PolicyMgr.SetPolicyType<InsertIntoPolicy>();
EFHelper.Services.SqlConfigMgr.Config.LoadDirectory(Directory.GetCurrentDirectory() + "/Datas/PolicyExtend");
}
[Fact]
public void Test()
{
Assert.True(p.AddPersonPolicyEx() > 0);
Assert.True(p.DeletePersonPolicyEx() > 0);
}
}
}
| {
"content_hash": "2c5447a80b6e098d9b4e9a34002ca52e",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 121,
"avg_line_length": 30.48780487804878,
"alnum_prop": 0.6168,
"repo_name": "skigs/EFCoreExtend",
"id": "4cd954e329d0464a45e8be995f797380b48e8f13",
"size": "1302",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/EFCoreExtend.Test/Test/PolicyExtend/TestPolicyExtend.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "881298"
},
{
"name": "Lua",
"bytes": "35320"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<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">
<parent>
<artifactId>siddhi</artifactId>
<groupId>io.siddhi</groupId>
<version>5.1.4-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<artifactId>siddhi-query-compiler</artifactId>
<name>Siddhi Query Compiler</name>
<dependencies>
<dependency>
<groupId>io.siddhi</groupId>
<artifactId>siddhi-query-api</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
<configuration>
<!--<sourceDirectory>${antlr.dir}</sourceDirectory>-->
<listener>false</listener>
<visitor>true</visitor>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Export-Package>
io.siddhi.query.compiler;version="${project.version}",
io.siddhi.query.compiler.*;version="${project.version}"
</Export-Package>
<Import-Package>
*;resolution:=optional
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${jacoco.agent.argLine}</argLine>
<environmentVariables>
<testEnvironmentVariable>EnvironmentVariable</testEnvironmentVariable>
</environmentVariables>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${basedir}/target/jacoco.exec</destFile>
<propertyName>jacoco.agent.argLine</propertyName>
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<excludes>
<exclude>**/SiddhiQLBaseVisitor.class</exclude>
<exclude>**/SiddhiQLParser*</exclude>
<exclude>**/SiddhiQLLexer*</exclude>
</excludes>
<dataFile>${basedir}/target/jacoco.exec</dataFile>
<outputDirectory>${basedir}/target/coverage-reports/site</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
</properties>
</project>
| {
"content_hash": "baa6eb736cb3fd64694bc0a7a65e51b6",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 204,
"avg_line_length": 41.49342105263158,
"alnum_prop": 0.49690819724116064,
"repo_name": "tishan89/siddhi",
"id": "5f7f8574ee6ae9f6b91b886819f7600b8ffeeabb",
"size": "6307",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/siddhi-query-compiler/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "20260"
},
{
"name": "FreeMarker",
"bytes": "11849"
},
{
"name": "Java",
"bytes": "8258155"
},
{
"name": "Shell",
"bytes": "455"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="generator" content="ApiGen 2.8.0" />
<meta name="robots" content="noindex" />
<title>File Component/Document/Component/IParameterInterface.php | Mark V</title>
<script type="text/javascript" src="resources/combined.js?2054962197"></script>
<script type="text/javascript" src="elementlist.js?2814603222"></script>
<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3639401462" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,300italic|Open+Sans:300' rel='stylesheet'
type='text/css' />
</head>
<body>
<div id="TopBar">
<ul>
<li><a href="http://derdu.github.io/MOC-Framework-Mark-V" title="DerDu"
onclick="window.open(this.href); return false;">Documentation</a></li>
<li><a href="https://github.com/DerDu/MOC-Framework-Mark-V" title="DerDu"
onclick="window.open(this.href); return false;">GitHub</a></li>
<li><a href="https://github.com/DerDu" title="DerDu" onclick="window.open(this.href); return false;">DerDu</a>
</li>
</ul>
</div>
<div id="Header">
<h1>MOC Framework</h1>
<p>Mark V</p>
</div>
<div id="Navigation">
<ul>
<li>
<a>Documentation</a>
</li>
</ul>
</div>
<div class="Channel">
<h1>Api Documentation</h1>
<div id="ChannelRelease">
<div id="left">
<div id="menu">
<a href="index.html" title="Overview"><span>Overview</span></a>
<div id="groups">
<h3>Namespaces</h3>
<ul>
<li class="active main"><a href="namespace-MOC.html">MOC<span></span></a>
<ul>
<li class="active main"><a href="namespace-MOC.V.html">V<span></span></a>
<ul>
<li class="active main"><a href="namespace-MOC.V.Component.html">Component<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Database.html">Database<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Database.Component.html">Component<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Database.Component.Bridge.html">Bridge<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Database.Component.Bridge.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Database.Component.Exception.html">Exception<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Database.Component.Exception.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Database.Component.Parameter.html">Parameter<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Database.Component.Parameter.Repository.html">Repository</a>
</li>
</ul></li></ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Database.Exception.html">Exception</a>
</li>
<li class="main"><a href="namespace-MOC.V.Component.Database.Vendor.html">Vendor</a>
</li>
</ul></li>
<li class="active main"><a href="namespace-MOC.V.Component.Document.html">Document<span></span></a>
<ul>
<li class="active main"><a href="namespace-MOC.V.Component.Document.Component.html">Component<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Document.Component.Bridge.html">Bridge<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Document.Component.Bridge.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Document.Component.Exception.html">Exception<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Document.Component.Exception.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Document.Component.Parameter.html">Parameter<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Document.Component.Parameter.Repository.html">Repository</a>
</li>
</ul></li></ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Document.Exception.html">Exception</a>
</li>
<li class="main"><a href="namespace-MOC.V.Component.Document.Vendor.html">Vendor</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Documentation.html">Documentation<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Documentation.Component.html">Component<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Documentation.Component.Bridge.html">Bridge<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Documentation.Component.Bridge.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Documentation.Component.Exception.html">Exception<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Documentation.Component.Exception.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Documentation.Component.Parameter.html">Parameter<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Documentation.Component.Parameter.Repository.html">Repository</a>
</li>
</ul></li></ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Documentation.Exception.html">Exception</a>
</li>
<li class="main"><a href="namespace-MOC.V.Component.Documentation.Vendor.html">Vendor</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Router.html">Router<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Router.Component.html">Component<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Router.Component.Bridge.html">Bridge<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Router.Component.Bridge.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Router.Component.Exception.html">Exception<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Router.Component.Exception.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Router.Component.Parameter.html">Parameter<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Router.Component.Parameter.Repository.html">Repository</a>
</li>
</ul></li></ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Router.Exception.html">Exception</a>
</li>
<li class="main"><a href="namespace-MOC.V.Component.Router.Vendor.html">Vendor</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Template.html">Template<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Template.Component.html">Component<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Template.Component.Bridge.html">Bridge<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Template.Component.Bridge.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Template.Component.Exception.html">Exception<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Template.Component.Exception.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Template.Component.Parameter.html">Parameter<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Component.Template.Component.Parameter.Repository.html">Repository</a>
</li>
</ul></li></ul></li>
<li class="main"><a href="namespace-MOC.V.Component.Template.Exception.html">Exception</a>
</li>
<li class="main"><a href="namespace-MOC.V.Component.Template.Vendor.html">Vendor</a>
</li>
</ul></li></ul></li>
<li class="main"><a href="namespace-MOC.V.Core.html">Core<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.html">AutoLoader<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Component.html">Component<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Component.Bridge.html">Bridge<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Component.Bridge.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Component.Exception.html">Exception<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Component.Exception.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Component.Parameter.html">Parameter<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Component.Parameter.Repository.html">Repository</a>
</li>
</ul></li></ul></li>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Exception.html">Exception</a>
</li>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Vendor.html">Vendor<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Vendor.Multiton.html">Multiton</a>
</li>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Vendor.Universal.html">Universal<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.AutoLoader.Vendor.Universal.NamespaceLoader.html">NamespaceLoader</a>
</li>
</ul></li></ul></li></ul></li>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.html">FileSystem<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.Component.html">Component<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.Component.Bridge.html">Bridge<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.Component.Bridge.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.Component.Exception.html">Exception<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.Component.Exception.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.Component.Parameter.html">Parameter<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.Component.Parameter.Repository.html">Repository</a>
</li>
</ul></li></ul></li>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.Exception.html">Exception</a>
</li>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.Vendor.html">Vendor<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.FileSystem.Vendor.Universal.html">Universal</a>
</li>
</ul></li></ul></li>
<li class="main"><a href="namespace-MOC.V.Core.HttpKernel.html">HttpKernel<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.HttpKernel.Component.html">Component<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.HttpKernel.Component.Bridge.html">Bridge<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.HttpKernel.Component.Bridge.Repository.html">Repository</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Core.HttpKernel.Component.Exception.html">Exception</a>
</li>
<li class="main"><a href="namespace-MOC.V.Core.HttpKernel.Component.Parameter.html">Parameter</a>
</li>
</ul></li>
<li class="main"><a href="namespace-MOC.V.Core.HttpKernel.Exception.html">Exception</a>
</li>
<li class="main"><a href="namespace-MOC.V.Core.HttpKernel.Vendor.html">Vendor<span></span></a>
<ul>
<li class="main"><a href="namespace-MOC.V.Core.HttpKernel.Vendor.Universal.html">Universal</a>
</li>
</ul></li></ul></li></ul></li></ul></li></ul></li>
<li><a href="namespace-PHP.html">PHP</a>
</li>
</ul>
</div>
<hr />
<div id="elements">
<h3>Interfaces</h3>
<ul>
<li><a href="class-MOC.V.Component.Document.Component.IBridgeInterface.html">IBridgeInterface</a></li>
<li class="active"><a href="class-MOC.V.Component.Document.Component.IParameterInterface.html">IParameterInterface</a></li>
<li><a href="class-MOC.V.Component.Document.Component.IVendorInterface.html">IVendorInterface</a></li>
</ul>
</div>
</div>
</div>
<div id="splitter"></div>
<div id="right">
<div id="rightInner">
<form id="search">
<input type="hidden" name="cx" value="" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" class="text" />
<input type="submit" value="Search" class="Button" />
</form>
<div id="navigation">
<ul>
<li>
<a href="index.html" title="Overview"><span>Overview</span></a>
</li>
<li>
<a href="namespace-MOC.V.Component.Document.Component.html" title="Summary of MOC\V\Component\Document\Component"><span>Namespace</span></a>
</li>
<li>
<a href="class-MOC.V.Component.Document.Component.IParameterInterface.html" title="Summary of MOC\V\Component\Document\Component\IParameterInterface"><span>Class</span></a>
</li>
</ul>
<ul>
<li>
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
</li>
<li>
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
</li>
<li>
<a href="todo.html" title="Todo list"><span>Todo</span></a>
</li>
</ul>
<ul>
<li>
<a href="mark-v-api-documentation.zip" title="Download documentation as ZIP archive"><span>Download</span></a>
</li>
</ul>
</div>
<pre><code><span id="1" class="l"><a class="l" href="#1"> 1: </a><span class="xlang"><?php</span>
</span><span id="2" class="l"><a class="l" href="#2"> 2: </a><span class="php-keyword1">namespace</span> MOC\V\Component\Document\Component;
</span><span id="3" class="l"><a class="l" href="#3"> 3: </a>
</span><span id="4" class="l"><a class="l" href="#4"> 4: </a><span class="php-comment">/**
</span></span><span id="5" class="l"><a class="l" href="#5"> 5: </a><span class="php-comment"> * Interface IParameterInterface
</span></span><span id="6" class="l"><a class="l" href="#6"> 6: </a><span class="php-comment"> *
</span></span><span id="7" class="l"><a class="l" href="#7"> 7: </a><span class="php-comment"> * @package MOC\V\Component\Document\Component
</span></span><span id="8" class="l"><a class="l" href="#8"> 8: </a><span class="php-comment"> */</span>
</span><span id="9" class="l"><a class="l" href="#9"> 9: </a><span class="php-keyword1">interface</span> <a id="IParameterInterface" href="#IParameterInterface">IParameterInterface</a>
</span><span id="10" class="l"><a class="l" href="#10">10: </a>{
</span><span id="11" class="l"><a class="l" href="#11">11: </a>
</span><span id="12" class="l"><a class="l" href="#12">12: </a>}
</span><span id="13" class="l"><a class="l" href="#13">13: </a></span></code></pre>
<div id="footer">
Mark V API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a>
</div>
</div>
</div>
<div style="clear: both;"></div>
</div>
</div>
<div id="BottomBar">
<ul>
<li>Powered by <a href="http://github.com"
style="background: transparent url('resources/GitHub-Mark-Light-32px.png') no-repeat left center; padding-left: 42px; margin-left: 5px;">GitHub</a>
</li>
<li>
Mark V API documentation generated by <a href="http://apigen.org">ApiGen 2.8.0</a>
</li>
</ul>
</div>
</body>
</html>
| {
"content_hash": "e2dd351817c893d256b581b56445e209",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 184,
"avg_line_length": 44.586301369863016,
"alnum_prop": 0.6407152513211257,
"repo_name": "TheTypoMaster/SPHERE-Framework",
"id": "3926f2b393613847a6d967a7eea7e02739c2a727",
"size": "16274",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Library/MOC-V/Documentation/source-class-MOC.V.Component.Document.Component.IParameterInterface.html",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "2630"
},
{
"name": "Batchfile",
"bytes": "7341"
},
{
"name": "CSS",
"bytes": "1047983"
},
{
"name": "HTML",
"bytes": "6258719"
},
{
"name": "JavaScript",
"bytes": "15888113"
},
{
"name": "Makefile",
"bytes": "6774"
},
{
"name": "PHP",
"bytes": "9320934"
},
{
"name": "PowerShell",
"bytes": "149"
},
{
"name": "Python",
"bytes": "22027"
},
{
"name": "Ruby",
"bytes": "2399"
},
{
"name": "Shell",
"bytes": "6738"
},
{
"name": "Smarty",
"bytes": "65319"
}
],
"symlink_target": ""
} |
package de.kaiserpfalzedv.commons.ejb.jndi.test;
import de.kaiserpfalzedv.commons.ejb.jndi.JndiWalker;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import static org.junit.Assert.assertEquals;
/**
* @author klenkes {@literal <rlichti@kaiserpfalz-edv.de>}
* @version 1.0.0
* @since 2016-09-29
*/
public class JndiWalkerTest {
private static final Logger LOG = LoggerFactory.getLogger(JndiWalkerTest.class);
private InitialContext ctx;
private JndiWalker service;
@Test
public void checkStringLookup() throws NamingException {
String result = (String) ctx.lookup("java:comp/env/test");
assertEquals("Teststring", result);
}
@Test
public void checkJndiWalk() throws NamingException {
String result = service.walk(ctx, "java:comp/env");
LOG.debug("Result: {}", result);
assertEquals("JNDI tree for 'java:comp/env': \n" +
"test (java.lang.String, not-supported, relative)\n" +
"dir1 (org.osjava.sj.jndi.MemoryContext, not-supported, relative)\n" +
" entry (java.lang.String, not-supported, relative)\n" +
" dirC (org.osjava.sj.jndi.MemoryContext, not-supported, relative)\n" +
" entry (java.lang.String, not-supported, relative)\n" +
" entry2 (java.lang.String, not-supported, relative)\n" +
" dirB (org.osjava.sj.jndi.MemoryContext, not-supported, relative)\n" +
" entry (java.lang.String, not-supported, relative)", result);
}
@Before
public void setupService() throws NamingException {
service = new JndiWalker();
ctx = new InitialContext();
}
}
| {
"content_hash": "e88568c8cece25195d8237c2726ad0f5",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 103,
"avg_line_length": 34.40350877192982,
"alnum_prop": 0.609382967873534,
"repo_name": "KaiserpfalzEDV/kp-office",
"id": "aad3a21ee3d247d7e9cb0c75855726098a8fd4f6",
"size": "2585",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "kp-commons-root/kp-commons-ejb/src/test/java/de/kaiserpfalzedv/commons/ejb/jndi/test/JndiWalkerTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "33923"
},
{
"name": "HTML",
"bytes": "842"
},
{
"name": "Java",
"bytes": "952023"
}
],
"symlink_target": ""
} |
package com.google.cloud.monitoring.v3;
import com.google.api.core.BetaApi;
import com.google.monitoring.v3.CreateUptimeCheckConfigRequest;
import com.google.monitoring.v3.DeleteUptimeCheckConfigRequest;
import com.google.monitoring.v3.GetUptimeCheckConfigRequest;
import com.google.monitoring.v3.ListUptimeCheckConfigsRequest;
import com.google.monitoring.v3.ListUptimeCheckConfigsResponse;
import com.google.monitoring.v3.ListUptimeCheckIpsRequest;
import com.google.monitoring.v3.ListUptimeCheckIpsResponse;
import com.google.monitoring.v3.UpdateUptimeCheckConfigRequest;
import com.google.monitoring.v3.UptimeCheckConfig;
import com.google.monitoring.v3.UptimeCheckServiceGrpc.UptimeCheckServiceImplBase;
import com.google.protobuf.Empty;
import com.google.protobuf.GeneratedMessageV3;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
@javax.annotation.Generated("by GAPIC")
@BetaApi
public class MockUptimeCheckServiceImpl extends UptimeCheckServiceImplBase {
private ArrayList<GeneratedMessageV3> requests;
private Queue<Object> responses;
public MockUptimeCheckServiceImpl() {
requests = new ArrayList<>();
responses = new LinkedList<>();
}
public List<GeneratedMessageV3> getRequests() {
return requests;
}
public void addResponse(GeneratedMessageV3 response) {
responses.add(response);
}
public void setResponses(List<GeneratedMessageV3> responses) {
this.responses = new LinkedList<Object>(responses);
}
public void addException(Exception exception) {
responses.add(exception);
}
public void reset() {
requests = new ArrayList<>();
responses = new LinkedList<>();
}
@Override
public void listUptimeCheckConfigs(
ListUptimeCheckConfigsRequest request,
StreamObserver<ListUptimeCheckConfigsResponse> responseObserver) {
Object response = responses.remove();
if (response instanceof ListUptimeCheckConfigsResponse) {
requests.add(request);
responseObserver.onNext((ListUptimeCheckConfigsResponse) response);
responseObserver.onCompleted();
} else if (response instanceof Exception) {
responseObserver.onError((Exception) response);
} else {
responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
}
}
@Override
public void getUptimeCheckConfig(
GetUptimeCheckConfigRequest request, StreamObserver<UptimeCheckConfig> responseObserver) {
Object response = responses.remove();
if (response instanceof UptimeCheckConfig) {
requests.add(request);
responseObserver.onNext((UptimeCheckConfig) response);
responseObserver.onCompleted();
} else if (response instanceof Exception) {
responseObserver.onError((Exception) response);
} else {
responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
}
}
@Override
public void createUptimeCheckConfig(
CreateUptimeCheckConfigRequest request, StreamObserver<UptimeCheckConfig> responseObserver) {
Object response = responses.remove();
if (response instanceof UptimeCheckConfig) {
requests.add(request);
responseObserver.onNext((UptimeCheckConfig) response);
responseObserver.onCompleted();
} else if (response instanceof Exception) {
responseObserver.onError((Exception) response);
} else {
responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
}
}
@Override
public void updateUptimeCheckConfig(
UpdateUptimeCheckConfigRequest request, StreamObserver<UptimeCheckConfig> responseObserver) {
Object response = responses.remove();
if (response instanceof UptimeCheckConfig) {
requests.add(request);
responseObserver.onNext((UptimeCheckConfig) response);
responseObserver.onCompleted();
} else if (response instanceof Exception) {
responseObserver.onError((Exception) response);
} else {
responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
}
}
@Override
public void deleteUptimeCheckConfig(
DeleteUptimeCheckConfigRequest request, StreamObserver<Empty> responseObserver) {
Object response = responses.remove();
if (response instanceof Empty) {
requests.add(request);
responseObserver.onNext((Empty) response);
responseObserver.onCompleted();
} else if (response instanceof Exception) {
responseObserver.onError((Exception) response);
} else {
responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
}
}
@Override
public void listUptimeCheckIps(
ListUptimeCheckIpsRequest request,
StreamObserver<ListUptimeCheckIpsResponse> responseObserver) {
Object response = responses.remove();
if (response instanceof ListUptimeCheckIpsResponse) {
requests.add(request);
responseObserver.onNext((ListUptimeCheckIpsResponse) response);
responseObserver.onCompleted();
} else if (response instanceof Exception) {
responseObserver.onError((Exception) response);
} else {
responseObserver.onError(new IllegalArgumentException("Unrecognized response type"));
}
}
}
| {
"content_hash": "bf4024485105c913c073b53c3e0f7452",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 99,
"avg_line_length": 36.23287671232877,
"alnum_prop": 0.7572778827977316,
"repo_name": "pongad/api-client-staging",
"id": "1d4feb22930edeb559babeb77b7372d38ee1fe44",
"size": "5884",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "generated/java/gapic-google-cloud-monitoring-v3/src/test/java/com/google/cloud/monitoring/v3/MockUptimeCheckServiceImpl.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "10561078"
},
{
"name": "JavaScript",
"bytes": "890945"
},
{
"name": "PHP",
"bytes": "9761909"
},
{
"name": "Python",
"bytes": "1395608"
},
{
"name": "Shell",
"bytes": "592"
}
],
"symlink_target": ""
} |
/**
* Generated with Acceleo
*/
package org.wso2.developerstudio.eclipse.gmf.esb.components;
// Start of user code for imports
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.Diagnostician;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.eef.runtime.api.notify.EStructuralFeatureNotificationFilter;
import org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent;
import org.eclipse.emf.eef.runtime.api.notify.NotificationFilter;
import org.eclipse.emf.eef.runtime.context.PropertiesEditingContext;
import org.eclipse.emf.eef.runtime.impl.components.SinglePartPropertiesEditingComponent;
import org.eclipse.emf.eef.runtime.impl.notify.PropertiesEditionEvent;
import org.eclipse.emf.eef.runtime.impl.utils.EEFConverterUtil;
import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.wso2.developerstudio.eclipse.gmf.esb.MergeNode;
import org.wso2.developerstudio.eclipse.gmf.esb.parts.EsbViewsRepository;
import org.wso2.developerstudio.eclipse.gmf.esb.parts.MergeNodePropertiesEditionPart;
// End of user code
/**
*
*
*/
public class MergeNodePropertiesEditionComponent extends SinglePartPropertiesEditingComponent {
public static String BASE_PART = "Base"; //$NON-NLS-1$
/**
* Default constructor
*
*/
public MergeNodePropertiesEditionComponent(PropertiesEditingContext editingContext, EObject mergeNode, String editing_mode) {
super(editingContext, mergeNode, editing_mode);
parts = new String[] { BASE_PART };
repositoryKey = EsbViewsRepository.class;
partKey = EsbViewsRepository.MergeNode.class;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final MergeNode mergeNode = (MergeNode)elt;
final MergeNodePropertiesEditionPart basePart = (MergeNodePropertiesEditionPart)editingPart;
// init values
if (isAccessible(EsbViewsRepository.MergeNode.Properties.description))
basePart.setDescription(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, mergeNode.getDescription()));
if (isAccessible(EsbViewsRepository.MergeNode.Properties.commentsList))
basePart.setCommentsList(mergeNode.getCommentsList());
if (isAccessible(EsbViewsRepository.MergeNode.Properties.reverse)) {
basePart.setReverse(mergeNode.isReverse());
}
// init filters
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
/**
* {@inheritDoc}
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#associatedFeature(java.lang.Object)
*/
public EStructuralFeature associatedFeature(Object editorKey) {
if (editorKey == EsbViewsRepository.MergeNode.Properties.description) {
return EsbPackage.eINSTANCE.getEsbElement_Description();
}
if (editorKey == EsbViewsRepository.MergeNode.Properties.commentsList) {
return EsbPackage.eINSTANCE.getEsbElement_CommentsList();
}
if (editorKey == EsbViewsRepository.MergeNode.Properties.reverse) {
return EsbPackage.eINSTANCE.getMediator_Reverse();
}
return super.associatedFeature(editorKey);
}
/**
* {@inheritDoc}
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
*
*/
public void updateSemanticModel(final IPropertiesEditionEvent event) {
MergeNode mergeNode = (MergeNode)semanticObject;
if (EsbViewsRepository.MergeNode.Properties.description == event.getAffectedEditor()) {
mergeNode.setDescription((java.lang.String)EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String)event.getNewValue()));
}
if (EsbViewsRepository.MergeNode.Properties.commentsList == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
mergeNode.getCommentsList().clear();
mergeNode.getCommentsList().addAll(((EList) event.getNewValue()));
}
}
if (EsbViewsRepository.MergeNode.Properties.reverse == event.getAffectedEditor()) {
mergeNode.setReverse((Boolean)event.getNewValue());
}
}
/**
* {@inheritDoc}
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
*/
public void updatePart(Notification msg) {
super.updatePart(msg);
if (editingPart.isVisible()) {
MergeNodePropertiesEditionPart basePart = (MergeNodePropertiesEditionPart)editingPart;
if (EsbPackage.eINSTANCE.getEsbElement_Description().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(EsbViewsRepository.MergeNode.Properties.description)) {
if (msg.getNewValue() != null) {
basePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue()));
} else {
basePart.setDescription("");
}
}
if (EsbPackage.eINSTANCE.getEsbElement_CommentsList().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(EsbViewsRepository.MergeNode.Properties.commentsList)) {
if (msg.getNewValue() instanceof EList<?>) {
basePart.setCommentsList((EList<?>)msg.getNewValue());
} else if (msg.getNewValue() == null) {
basePart.setCommentsList(new BasicEList<Object>());
} else {
BasicEList<Object> newValueAsList = new BasicEList<Object>();
newValueAsList.add(msg.getNewValue());
basePart.setCommentsList(newValueAsList);
}
}
if (EsbPackage.eINSTANCE.getMediator_Reverse().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(EsbViewsRepository.MergeNode.Properties.reverse))
basePart.setReverse((Boolean)msg.getNewValue());
}
}
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#getNotificationFilters()
*/
@Override
protected NotificationFilter[] getNotificationFilters() {
NotificationFilter filter = new EStructuralFeatureNotificationFilter(
EsbPackage.eINSTANCE.getEsbElement_Description(),
EsbPackage.eINSTANCE.getEsbElement_CommentsList(),
EsbPackage.eINSTANCE.getMediator_Reverse() );
return new NotificationFilter[] {filter,};
}
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
*
*/
public Diagnostic validateValue(IPropertiesEditionEvent event) {
Diagnostic ret = Diagnostic.OK_INSTANCE;
if (event.getNewValue() != null) {
try {
if (EsbViewsRepository.MergeNode.Properties.description == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(EsbPackage.eINSTANCE.getEsbElement_Description().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(EsbPackage.eINSTANCE.getEsbElement_Description().getEAttributeType(), newValue);
}
if (EsbViewsRepository.MergeNode.Properties.commentsList == event.getAffectedEditor()) {
BasicDiagnostic chain = new BasicDiagnostic();
for (Iterator iterator = ((List)event.getNewValue()).iterator(); iterator.hasNext();) {
chain.add(Diagnostician.INSTANCE.validate(EsbPackage.eINSTANCE.getEsbElement_CommentsList().getEAttributeType(), iterator.next()));
}
ret = chain;
}
if (EsbViewsRepository.MergeNode.Properties.reverse == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(EsbPackage.eINSTANCE.getMediator_Reverse().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(EsbPackage.eINSTANCE.getMediator_Reverse().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
}
| {
"content_hash": "477e09e3924cf6ba2fcbfbc9128e95e6",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 218,
"avg_line_length": 36.991769547325106,
"alnum_prop": 0.7589275781510736,
"repo_name": "prabushi/devstudio-tooling-esb",
"id": "a8fe8bc370f55ea6f280ca7403ca5f5c04d3f1a5",
"size": "8989",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src-gen/org/wso2/developerstudio/eclipse/gmf/esb/components/MergeNodePropertiesEditionComponent.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "41098"
},
{
"name": "HTML",
"bytes": "731356"
},
{
"name": "Java",
"bytes": "77332976"
},
{
"name": "JavaScript",
"bytes": "475592"
},
{
"name": "Shell",
"bytes": "7727"
}
],
"symlink_target": ""
} |
using System;
using System.Web.Mvc;
namespace Alloy
{
public class EPiServerApplication : EPiServer.Global
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
//Tip: Want to call the EPiServer API on startup? Add an initialization module instead (Add -> New Item.. -> EPiServer -> Initialization Module)
}
}
} | {
"content_hash": "a2048be9ac0adbf8ab6f28529442bfaf",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 156,
"avg_line_length": 26.4,
"alnum_prop": 0.648989898989899,
"repo_name": "episerver/EPiTranslateFlowDemo",
"id": "80e42daaf61b997411daad98615806c69f54826a",
"size": "398",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Alloy/Global.asax.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "101"
},
{
"name": "C#",
"bytes": "175710"
},
{
"name": "CSS",
"bytes": "14581"
},
{
"name": "HTML",
"bytes": "402"
},
{
"name": "JavaScript",
"bytes": "7953"
},
{
"name": "PLSQL",
"bytes": "53305"
},
{
"name": "PLpgSQL",
"bytes": "35508"
},
{
"name": "PowerShell",
"bytes": "492664"
}
],
"symlink_target": ""
} |
namespace BunnyCraft.Models
{
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
public class AirCraft
{
private ICollection<Bunny> bunnies;
public AirCraft()
{
this.bunnies = new HashSet<Bunny>();
}
public int Id { get; set; }
[Required]
[MinLength(3)]
[MaxLength(10)]
public string Model { get; set; }
public virtual ICollection<Bunny> Bunnies
{
get { return this.bunnies; }
set { this.bunnies = value; }
}
}
}
| {
"content_hash": "ac4bf94810f040ec1d06bf6e14c3a333",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 49,
"avg_line_length": 21.392857142857142,
"alnum_prop": 0.5459098497495827,
"repo_name": "kaizer04/Telerik-Academy-2013-2014",
"id": "2a000a1c5bb87aeb05333bbbc9d64f0722307794",
"size": "601",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "Web Services/BunnyCraft/BunnyCraft.Models/AirCraft.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "120044"
},
{
"name": "Batchfile",
"bytes": "4176"
},
{
"name": "C#",
"bytes": "4193228"
},
{
"name": "CSS",
"bytes": "238134"
},
{
"name": "CoffeeScript",
"bytes": "11643"
},
{
"name": "HTML",
"bytes": "371739"
},
{
"name": "Harbour",
"bytes": "724"
},
{
"name": "JavaScript",
"bytes": "2993743"
},
{
"name": "Smalltalk",
"bytes": "2556"
},
{
"name": "Visual Basic",
"bytes": "9387"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="SHORTCUT ICON" href="../../../../../img/clover.ico" />
<link rel="stylesheet" href="../../../../../aui/css/aui.min.css" media="all"/>
<link rel="stylesheet" href="../../../../../aui/css/aui-experimental.min.css" media="all"/>
<!--[if IE 9]><link rel="stylesheet" href="../../../../../aui/css/aui-ie9.min.css" media="all"/><![endif]-->
<style type="text/css" media="all">
@import url('../../../../../style.css');
@import url('../../../../../tree.css');
</style>
<script src="../../../../../jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-experimental.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-soy.min.js" type="text/javascript"></script>
<script src="../../../../../package-nodes-tree.js" type="text/javascript"></script>
<script src="../../../../../clover-tree.js" type="text/javascript"></script>
<script src="../../../../../clover.js" type="text/javascript"></script>
<script src="../../../../../clover-descriptions.js" type="text/javascript"></script>
<script src="../../../../../cloud.js" type="text/javascript"></script>
<title>ABA Route Transit Number Validator 1.0.1-SNAPSHOT</title>
</head>
<body>
<div id="page">
<header id="header" role="banner">
<nav class="aui-header aui-dropdown2-trigger-group" role="navigation">
<div class="aui-header-inner">
<div class="aui-header-primary">
<h1 id="logo" class="aui-header-logo aui-header-logo-clover">
<a href="http://openclover.org" title="Visit OpenClover home page"><span class="aui-header-logo-device">OpenClover</span></a>
</h1>
</div>
<div class="aui-header-secondary">
<ul class="aui-nav">
<li id="system-help-menu">
<a class="aui-nav-link" title="Open online documentation" target="_blank"
href="http://openclover.org/documentation">
<span class="aui-icon aui-icon-small aui-iconfont-help"> Help</span>
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="aui-page-panel">
<div class="aui-page-panel-inner">
<div class="aui-page-panel-nav aui-page-panel-nav-clover">
<div class="aui-page-header-inner" style="margin-bottom: 20px;">
<div class="aui-page-header-image">
<a href="http://cardatechnologies.com" target="_top">
<div class="aui-avatar aui-avatar-large aui-avatar-project">
<div class="aui-avatar-inner">
<img src="../../../../../img/clover_logo_large.png" alt="Clover icon"/>
</div>
</div>
</a>
</div>
<div class="aui-page-header-main" >
<h1>
<a href="http://cardatechnologies.com" target="_top">
ABA Route Transit Number Validator 1.0.1-SNAPSHOT
</a>
</h1>
</div>
</div>
<nav class="aui-navgroup aui-navgroup-vertical">
<div class="aui-navgroup-inner">
<ul class="aui-nav">
<li class="">
<a href="../../../../../dashboard.html">Project overview</a>
</li>
</ul>
<div class="aui-nav-heading packages-nav-heading">
<strong>Packages</strong>
</div>
<div class="aui-nav project-packages">
<form method="get" action="#" class="aui package-filter-container">
<input type="text" autocomplete="off" class="package-filter text"
placeholder="Type to filter packages..." name="package-filter" id="package-filter"
title="Start typing package name (or part of the name) to search through the tree. Use arrow keys and the Enter key to navigate."/>
</form>
<p class="package-filter-no-results-message hidden">
<small>No results found.</small>
</p>
<div class="packages-tree-wrapper" data-root-relative="../../../../../" data-package-name="com.cardatechnologies.utils.validators.abaroutevalidator">
<div class="packages-tree-container"></div>
<div class="clover-packages-lozenges"></div>
</div>
</div>
</div>
</nav> </div>
<section class="aui-page-panel-content">
<div class="aui-page-panel-content-clover">
<div class="aui-page-header-main"><ol class="aui-nav aui-nav-breadcrumbs">
<li><a href="../../../../../dashboard.html"> Project Clover database Sat Aug 7 2021 12:29:33 MDT</a></li>
<li><a href="test-pkg-summary.html">Package com.cardatechnologies.utils.validators.abaroutevalidator</a></li>
<li><a href="test-Test_AbaRouteValidator_11.html">Class Test_AbaRouteValidator_11</a></li>
</ol></div>
<h1 class="aui-h2-clover">
Test testAbaNumberCheck_22879_good
</h1>
<table class="aui">
<thead>
<tr>
<th>Test</th>
<th><label title="The test result. Either a Pass, Fail or Error.">Status</label></th>
<th><label title="When the test execution was started">Start time</label></th>
<th><label title="The total time in seconds taken to run this test.">Time (seconds)</label></th>
<th><label title="A failure or error message if the test is not successful.">Message</label></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_11.html?line=10360#src-10360" >testAbaNumberCheck_22879_good</a>
</td>
<td>
<span class="sortValue">1</span><span class="aui-lozenge aui-lozenge-success">PASS</span>
</td>
<td>
7 Aug 12:40:10
</td>
<td>
0.0 </td>
<td>
<div></div>
<div class="errorMessage"></div>
</td>
</tr>
</tbody>
</table>
<div> </div>
<table class="aui aui-table-sortable">
<thead>
<tr>
<th style="white-space:nowrap;"><label title="A class that was directly hit by this test.">Target Class</label></th>
<th colspan="4"><label title="The percentage of coverage contributed by each single test.">Coverage contributed by</label> testAbaNumberCheck_22879_good</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</span>
  <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/AbaRouteValidator.html?id=34765#AbaRouteValidator" title="AbaRouteValidator" name="sl-47">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</a>
</td>
<td>
<span class="sortValue">0.7352941</span>73.5%
</td>
<td class="align-middle" style="width: 100%" colspan="3">
<div>
<div title="73.5% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:73.5%"></div></div></div> </td>
</tr>
</tbody>
</table>
</div> <!-- class="aui-page-panel-content-clover" -->
<footer id="footer" role="contentinfo">
<section class="footer-body">
<ul>
<li>
Report generated by <a target="_new" href="http://openclover.org">OpenClover</a> v 4.4.1
on Sat Aug 7 2021 12:49:26 MDT using coverage data from Sat Aug 7 2021 12:47:23 MDT.
</li>
</ul>
<ul>
<li>OpenClover is free and open-source software. </li>
</ul>
</section>
</footer> </section> <!-- class="aui-page-panel-content" -->
</div> <!-- class="aui-page-panel-inner" -->
</div> <!-- class="aui-page-panel" -->
</div> <!-- id="page" -->
</body>
</html> | {
"content_hash": "f9f17ee42ecde7c84bacbfa1a097bc7b",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 297,
"avg_line_length": 43.92822966507177,
"alnum_prop": 0.5097483934211959,
"repo_name": "dcarda/aba.route.validator",
"id": "4a4558f1b882c7b97e9446364cab763cc748004a",
"size": "9181",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "target13/site/clover/com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_11_testAbaNumberCheck_22879_good_qtp.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "18715254"
}
],
"symlink_target": ""
} |
package com.github.plusvic.yara;
/**
* Yara match
*/
public interface YaraMatch {
/**
* Value that was matched
*
* @return
*/
String getValue();
/**
* Offset where match was found
*
* @return
*/
long getOffset();
}
| {
"content_hash": "08aa658e2e7b3dacfca0b34c0967f5f7",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 35,
"avg_line_length": 13.75,
"alnum_prop": 0.5163636363636364,
"repo_name": "papostolescu/yara-java",
"id": "fe0836b5fd117c57305e8db5ef875bdec375e34b",
"size": "275",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/com/github/plusvic/yara/YaraMatch.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "3317"
},
{
"name": "Java",
"bytes": "55639"
},
{
"name": "M4",
"bytes": "352"
}
],
"symlink_target": ""
} |
try:
import multiprocessing
except ImportError:
pass
from io import open
from setuptools import setup, find_packages
setup(
name='sphinx-js',
version='2.7',
description='Support for using Sphinx on JSDoc-documented JS code',
long_description=open('README.rst', 'r', encoding='utf8').read(),
author='Erik Rose',
author_email='erikrose@grinchcentral.com',
license='MIT',
packages=find_packages(exclude=['ez_setup']),
tests_require=['nose',
'recommonmark==0.4.0',
# Sphinx's plain-text renderer changes behavior slightly
# with regard to how it emits class names and em dashes from
# time to time:
'Sphinx==1.7.2'],
test_suite='nose.collector',
url='https://github.com/erikrose/sphinx-js',
include_package_data=True,
install_requires=['docutils', 'Jinja2>2.0,<3.0', 'parsimonious>=0.7.0,<0.8.0', 'six>=1.9.0,<2.0', 'Sphinx<2.0'],
classifiers=[
'Intended Audience :: Developers',
'Natural Language :: English',
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Documentation :: Sphinx',
'Topic :: Software Development :: Documentation'
],
keywords=['sphinx', 'documentation', 'docs', 'javascript', 'js', 'jsdoc', 'restructured'],
)
| {
"content_hash": "f55115b51e946437482e374240965a51",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 116,
"avg_line_length": 37.609756097560975,
"alnum_prop": 0.6005188067444877,
"repo_name": "erikrose/sphinx-js",
"id": "0c7694e3f46da1df2de279ad78820b5d41674e91",
"size": "1675",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "setup.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "4081"
},
{
"name": "Python",
"bytes": "68445"
},
{
"name": "TypeScript",
"bytes": "4654"
}
],
"symlink_target": ""
} |
#include "val_greentea.h"
#include "val_interfaces.h"
#include "val_internal_trusted_storage.h"
#include "val_protected_storage.h"
#include "val_attestation.h"
/*VAL APIs to be used by test */
const val_api_t val_api = {
.print = mbed_val_print,
.set_status = mbed_val_set_status,
.get_status = mbed_val_get_status,
.test_init = mbed_val_test_init,
.test_exit = mbed_val_test_exit,
.err_check_set = NULL,
.target_get_config = NULL,
.execute_non_secure_tests = mbed_val_execute_non_secure_tests,
.switch_to_secure_client = NULL,
.execute_secure_test_func = mbed_val_execute_secure_test_func,
.get_secure_test_result = mbed_val_get_secure_test_result,
.ipc_connect = mbed_val_ipc_connect,
.ipc_call = mbed_val_ipc_call,
.ipc_close = mbed_val_ipc_close,
.nvmem_read = NULL,
.nvmem_write = NULL,
.wd_timer_init = NULL,
.wd_timer_enable = NULL,
.wd_timer_disable = NULL,
.wd_reprogram_timer = mbed_val_wd_reprogram_timer,
.set_boot_flag = NULL,
.get_boot_flag = NULL,
.its_function = val_its_function,
.ps_function = val_ps_function,
.attestation_function = val_attestation_function,
};
const psa_api_t psa_api = {
.framework_version = pal_ipc_framework_version,
.version = pal_ipc_version,
.connect = pal_ipc_connect,
.call = pal_ipc_call,
.close = pal_ipc_close,
};
| {
"content_hash": "ca96163c16e53354cb5ea0fba176615a",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 67,
"avg_line_length": 38.48888888888889,
"alnum_prop": 0.5236720554272517,
"repo_name": "mbedmicro/mbed",
"id": "b6bf08546291685e50340783af080c218ab0fd6b",
"size": "2420",
"binary": false,
"copies": "20",
"ref": "refs/heads/master",
"path": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/test_abstraction_layers/val/val_interfaces.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "5511149"
},
{
"name": "C",
"bytes": "152405192"
},
{
"name": "C++",
"bytes": "7777242"
},
{
"name": "CMake",
"bytes": "27635"
},
{
"name": "HTML",
"bytes": "1531100"
},
{
"name": "Makefile",
"bytes": "131050"
},
{
"name": "Objective-C",
"bytes": "169382"
},
{
"name": "Python",
"bytes": "7913"
},
{
"name": "Shell",
"bytes": "24790"
},
{
"name": "XSLT",
"bytes": "11192"
}
],
"symlink_target": ""
} |
name: cljs.core/ex-cause
see also:
---
## Summary
## Details
## Examples
| {
"content_hash": "72bce56412fc685d1eebaad84b51e635",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 24,
"avg_line_length": 8.444444444444445,
"alnum_prop": 0.631578947368421,
"repo_name": "cljs/api",
"id": "5734a3f24ec2a92b5c52eeff2ef455fe01b82090",
"size": "80",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docfiles/cljs.core/ex-cause.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Clojure",
"bytes": "164565"
},
{
"name": "JavaScript",
"bytes": "400169"
}
],
"symlink_target": ""
} |
function J = computeCost(X, y, theta)
%COMPUTECOST Compute cost for linear regression
% J = COMPUTECOST(X, y, theta) computes the cost of using theta as the
% parameter for linear regression to fit the data points in X and y
% Initialize some useful values
m = length(y); % number of training examples
% ====================== YOUR CODE HERE ======================
% Instructions: Compute the cost of a particular choice of theta
% You should set J to the cost.
J = sum((X * theta - y) .^ 2) / (2 * m);
% =========================================================================
end
| {
"content_hash": "256666f6c6e0bb259eef26cbc81328f5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 75,
"avg_line_length": 37.8125,
"alnum_prop": 0.5504132231404959,
"repo_name": "huangcd/ml-class",
"id": "6ddcaad86c9938afd79feec3681d61e35168e70e",
"size": "605",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mlclass-ex1-006/mlclass-ex1/computeCost.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "M",
"bytes": "780"
},
{
"name": "Matlab",
"bytes": "101288"
}
],
"symlink_target": ""
} |
<HTML>
<BODY>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->
<B><A HREF="STRTOUL.html">STRTOUL(3)</A></B> FreeBSD Library Functions Manual <B><A HREF="STRTOUL.html">STRTOUL(3)</A></B>
</PRE>
<H2>NAME</H2><PRE>
<B>strtoul,</B> <B>strtouq</B> - convert a string to an unsigned long or uquad_t
</PRE>
<H2>SYNOPSIS</H2><PRE>
<B>#include</B> <B><stdlib.h></B>
<B>#include</B> <B><limits.h></B>
<I>unsigned</I> <I>long</I>
<B>strtoul</B>(<I>const</I> <I>char</I> <I>*nptr</I>, <I>char</I> <I>**endptr</I>, <I>int</I> <I>base</I>)
<B>#include</B> <B><sys/types.h></B>
<B>#include</B> <B><stdlib.h></B>
<B>#include</B> <B><limits.h></B>
<I>u</I><B>_</B><I>quad</I><B>_</B><I>t</I>
<B>strtouq</B>(<I>const</I> <I>char</I> <I>*nptr</I>, <I>char</I> <I>**endptr</I>, <I>int</I> <I>base</I>)
</PRE>
<H2>DESCRIPTION</H2><PRE>
The <B>strtoul</B>() function converts the string in <I>nptr</I> to an <I>unsigned</I> <I>long</I>
value. The <B>strtouq</B>() function converts the string in <I>nptr</I> to a <I>u</I><B>_</B><I>quad</I><B>_</B><I>t</I>
value. The conversion is done according to the given <I>base</I>, which must be
between 2 and 36 inclusive, or be the special value 0.
The string may begin with an arbitrary amount of white space (as deter-
mined by <B><A HREF="isspace.html">isspace(3)</A></B>) followed by a single optional `+' or `-' sign. If
<I>base</I> is zero or 16, the string may then include a `0x' prefix, and the
number will be read in base 16; otherwise, a zero <I>base</I> is taken as 10
(decimal) unless the next character is `0', in which case it is taken as
8 (octal).
The remainder of the string is converted to an <I>unsigned</I> <I>long</I> value in the
obvious manner, stopping at the end of the string or at the first charac-
ter that does not produce a valid digit in the given base. (In bases
above 10, the letter `A' in either upper or lower case represents 10, `B'
represents 11, and so forth, with `Z' representing 35.)
If <I>endptr</I> is non nil, <B>strtoul</B>() stores the address of the first invalid
character in <I>*endptr</I>. If there were no digits at all, however, <B>strtoul</B>()
stores the original value of <I>nptr</I> in <I>*endptr</I>. (Thus, if <I>*nptr</I> is not `\0'
but <I>**endptr</I> is `\0' on return, the entire string was valid.)
</PRE>
<H2>RETURN VALUES</H2><PRE>
The <B>strtoul</B>() function returns either the result of the conversion or, if
there was a leading minus sign, the negation of the result of the conver-
sion, unless the original (non-negated) value would overflow; in the lat-
ter case, <B>strtoul</B>() returns ULONG_MAX and sets the global variable <I>errno</I>
to ERANGE.
</PRE>
<H2>ERRORS</H2><PRE>
[ERANGE] The given string was out of range; the value converted has been
clamped.
</PRE>
<H2>SEE ALSO</H2><PRE>
<B><A HREF="strtol.html">strtol(3)</A></B>
</PRE>
<H2>STANDARDS</H2><PRE>
The <B>strtoul</B>() function conforms to ISO 9899: 1990 (``ISO C'').
</PRE>
<H2>BUGS</H2><PRE>
Ignores the current locale.
BSD June 4, 1993 1
</PRE>
<HR>
<ADDRESS>
Man(1) output converted with
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</ADDRESS>
</BODY>
</HTML>
| {
"content_hash": "a7ca539c5dea88f072150a6e79a2578a",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 134,
"avg_line_length": 36.956989247311824,
"alnum_prop": 0.6136165260401513,
"repo_name": "loongson-community/EFI-MIPS",
"id": "5f82eddd42c06fec2589f9b8699eec4e58168ff0",
"size": "3437",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ToolKit/doc/man/html/strtoul.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "271282"
},
{
"name": "Batchfile",
"bytes": "318"
},
{
"name": "C",
"bytes": "32642014"
},
{
"name": "C++",
"bytes": "1058125"
},
{
"name": "CSS",
"bytes": "2547"
},
{
"name": "GAP",
"bytes": "111381"
},
{
"name": "Groff",
"bytes": "1245691"
},
{
"name": "HTML",
"bytes": "1328432"
},
{
"name": "Lex",
"bytes": "14559"
},
{
"name": "M",
"bytes": "748"
},
{
"name": "Makefile",
"bytes": "468567"
},
{
"name": "Mask",
"bytes": "3420"
},
{
"name": "NSIS",
"bytes": "8743"
},
{
"name": "Objective-C",
"bytes": "3415447"
},
{
"name": "Pascal",
"bytes": "3368"
},
{
"name": "Python",
"bytes": "7763565"
},
{
"name": "R",
"bytes": "546"
},
{
"name": "Shell",
"bytes": "10084"
},
{
"name": "Yacc",
"bytes": "30661"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types=1);
namespace Krizalys\Onedrive\Definition;
/**
* An interface defining the contract for an operation definition.
*
* @since 2.5.0
*/
interface OperationDefinitionInterface
{
/**
* Gets the body parameter definitions.
*
* @return \Krizalys\Onedrive\Parameter\ParameterDefinitionCollectionInterface
* The body parameter definitions.
*
* @since 2.5.0
*/
public function getBodyParameterDefinitions();
/**
* Gets the header parameter definitions.
*
* @return \Krizalys\Onedrive\Parameter\ParameterDefinitionCollectionInterface
* The header parameter definitions.
*
* @since 2.5.0
*/
public function getHeaderParameterDefinitions();
/**
* Gets the query string parameter definitions.
*
* @return \Krizalys\Onedrive\Parameter\ParameterDefinitionCollectionInterface
* The query string parameter definitions.
*
* @since 2.5.0
*/
public function getQueryStringParameterDefinitions();
}
| {
"content_hash": "53cf0e9a9840a5ec15a811307cd9d356",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 82,
"avg_line_length": 23.755555555555556,
"alnum_prop": 0.6651075771749299,
"repo_name": "krizalys/onedrive-php-sdk",
"id": "ed09de44c1db7a378931983db2b4efa1d3eb05fa",
"size": "1502",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Definition/OperationDefinitionInterface.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "563539"
}
],
"symlink_target": ""
} |
module Eligibility
extend ActiveSupport::Concern
def display_eligibility(name, ineligible)
"#{name}#{'*' if ineligible}"
end
end
| {
"content_hash": "4a8c02569a4fe08058b13d0b2286fe1b",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 43,
"avg_line_length": 20,
"alnum_prop": 0.7142857142857143,
"repo_name": "scotthue/unicycling-registration",
"id": "71b0c7a1f675fa50769d957d249f2f69a54e2a31",
"size": "140",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/models/concerns/eligibility.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "94289"
},
{
"name": "CoffeeScript",
"bytes": "14440"
},
{
"name": "HTML",
"bytes": "322127"
},
{
"name": "JavaScript",
"bytes": "15064"
},
{
"name": "Ruby",
"bytes": "1533567"
}
],
"symlink_target": ""
} |
<div class="commune_descr limited">
<p>
Saint-Martin-sur-la-Chambre est
un village
géographiquement positionné dans le département de Savoie en Rhône-Alpes. On dénombrait 448 habitants en 2008.</p>
<p>Si vous pensez demenager à Saint-Martin-sur-la-Chambre, vous pourrez aisément trouver une maison à vendre. </p>
<p>Le parc de logements, à Saint-Martin-sur-la-Chambre, se décomposait en 2011 en sept appartements et 284 maisons soit
un marché plutôt équilibré.</p>
<p>À coté de Saint-Martin-sur-la-Chambre sont localisées les communes de
<a href="{{VLROOT}}/immobilier/montaimont_73163/">Montaimont</a> située à 2 km, 151 habitants,
<a href="{{VLROOT}}/immobilier/montgellafrey_73167/">Montgellafrey</a> située à 2 km, 68 habitants,
<a href="{{VLROOT}}/immobilier/chambre_73067/">La Chambre</a> localisée à 1 km, 1 163 habitants,
<a href="{{VLROOT}}/immobilier/saint-remy-de-maurienne_73278/">Saint-Rémy-de-Maurienne</a> localisée à 4 km, 1 170 habitants,
<a href="{{VLROOT}}/immobilier/saint-avre_73224/">Saint-Avre</a> à 1 km, 740 habitants,
<a href="{{VLROOT}}/immobilier/chavannes-en-maurienne_73083/">Les Chavannes-en-Maurienne</a> à 3 km, 213 habitants,
entre autres. De plus, Saint-Martin-sur-la-Chambre est située à seulement dix km de <a href="{{VLROOT}}/immobilier/saint-jean-de-maurienne_73248/">Saint-Jean-de-Maurienne</a>.</p>
</div>
| {
"content_hash": "706a297cf8678f7abd439bbe85218208",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 185,
"avg_line_length": 83.52941176470588,
"alnum_prop": 0.7436619718309859,
"repo_name": "donaldinou/frontend",
"id": "24aaa319ee5d38342b560a46c1922d73a1394fc0",
"size": "1450",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Viteloge/CoreBundle/Resources/descriptions/73259.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "CSS",
"bytes": "111338"
},
{
"name": "HTML",
"bytes": "58634405"
},
{
"name": "JavaScript",
"bytes": "88564"
},
{
"name": "PHP",
"bytes": "841919"
}
],
"symlink_target": ""
} |
package nuclearcontrol;
import forge.ITextureProvider;
import ic2.api.ElectricItem;
import net.minecraft.server.EntityHuman;
import net.minecraft.server.Item;
import net.minecraft.server.ItemStack;
import net.minecraft.server.TileEntity;
import net.minecraft.server.World;
import net.minecraft.server.mod_IC2NuclearControl;
public class ItemToolThermometer extends Item implements ITextureProvider
{
public ThermometerVersion thermometerVersion;
public ItemToolThermometer(int var1, int var2, ThermometerVersion var3)
{
super(var1);
this.d(var2);
this.setMaxDurability(102);
this.e(1);
this.thermometerVersion = var3;
}
public boolean canTakeDamage(ItemStack var1, int var2)
{
return true;
}
public String getTextureFile()
{
return "/img/texture_thermo.png";
}
public boolean onItemUseFirst(ItemStack var1, EntityHuman var2, World var3, int var4, int var5, int var6, int var7)
{
if (!this.canTakeDamage(var1, 2))
{
return false;
}
else
{
TileEntity var8 = NuclearHelper.getReactorAt(var3, var4, var5, var6);
if (var8 == null)
{
TileEntity var9 = NuclearHelper.getReactorChamberAt(var3, var4, var5, var6);
if (var9 != null)
{
var8 = NuclearHelper.getReactorAroundCoord(var3, var4, var5, var6);
}
}
if (var8 != null)
{
if (!var3.isStatic)
{
this.messagePlayer(var2, var8);
this.damage(var1, 1, var2);
}
return true;
}
else
{
return false;
}
}
}
public void messagePlayer(EntityHuman var1, TileEntity var2)
{
int var3 = NuclearHelper.getReactorHeat(var2);
switch (thermometerVersion)
{
case ANALOG:
mod_IC2NuclearControl.chatMessage(var1, "Hull heat: " + var3);
break;
case DIGITAL:
int var4 = NuclearHelper.getMaxHeat(var2);
mod_IC2NuclearControl.chatMessage(var1, "Hull heat: " + var3 + " (Water evaporate: " + var4 * 50 / 100 + " / melting: " + var4 * 85 / 100 + ")");
}
}
public void damage(ItemStack var1, int var2, EntityHuman var3)
{
switch (thermometerVersion)
{
case ANALOG:
var1.damage(10, var3);
break;
case DIGITAL:
ElectricItem.use(var1, 50 * var2, var3);
}
}
}
| {
"content_hash": "82e6fd8549045d3da7a6254f70477350",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 161,
"avg_line_length": 27.2,
"alnum_prop": 0.5488970588235295,
"repo_name": "mushroomhostage/ic2-nuclear-control",
"id": "193df5b9fc5bf78da0310ecf5dc4f92c58bfe432",
"size": "2720",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "1.1.6bukkit/ItemToolThermometer.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "1092517"
},
{
"name": "Shell",
"bytes": "828"
}
],
"symlink_target": ""
} |
import { assert } from '@ember/debug';
import { get } from '@ember/object';
import { entries } from '../utils/helper-functions';
import { typeOf } from '@ember/utils';
import { getOwner } from '@ember/application';
import { camelize } from '@ember/string';
/**
Base class for converting the base fixture that factory guy creates to
the payload expected by ember data adapter.
While it's converting the format, it transforms the attribute and relationship keys.
Don't want to transform keys when building payload for a FactoryGuy#make/makeList operation,
but only for build/buildList.
serializerMode (true) means => produce json as if ember data was serializing the payload
to go back to the server.
So, what does serializerMode ( false ) mean? produce json that can immediately be consumed
by ember data .. but it is such a long story .. that I will have to explain another time
If there are associations in the base fixture, they will be added to the
new fixture as 'side loaded' elements, even if they are another json payload
built with the build/buildList methods.
@param {DS.Store} store
@param {Object} options
transformKeys transform keys and values in fixture if true
serializeMode act like serialization is for a return to server if true
@constructor
*/
export default class FixtureConverter {
constructor(store, {transformKeys = true, serializeMode = false} = {}) {
this.transformKeys = transformKeys;
this.serializeMode = serializeMode;
this.store = store;
this.listType = false;
this.noTransformFn = (x) => x;
this.defaultValueTransformFn = this.noTransformFn;
}
/**
Convert an initial fixture into a final payload.
This raw fixture can contain other json in relationships that were
built by FactoryGuy ( build, buildList ) methods
@param modelName
@param fixture
@returns {*} converted fixture
*/
convert(modelName, fixture) {
let data;
if (typeOf(fixture) === 'array') {
this.listType = true;
data = fixture.map((single) => {
return this.convertSingle(modelName, single);
});
} else {
data = this.convertSingle(modelName, fixture);
}
let payload = this.createPayload(modelName, data);
this.addIncludedArray(payload);
return payload;
}
/**
Empty response is a special case, so use this method for generating it.
@param _
@param {Object} options useValue to override the null value that is passed
@returns {Array|null}
*/
emptyResponse(_, options = {}) {
return options.useValue || null;
}
/**
* Use the primaryKey from the serializer if it is declared
*
* @param modelName
* @param data
* @param fixture
*/
addPrimaryKey(modelName, data, fixture) {
let primaryKey = this.store.serializerFor(modelName).get('primaryKey'),
primaryKeyValue = fixture[primaryKey] || fixture.id;
// model fragments will have no primaryKey and don't want them to have id
if (primaryKeyValue) {
// need to set the id for all as a baseline
data.id = primaryKeyValue;
// if the id is NOT the primary key, need to make sure that the primaryKey
// has the primaryKey value
data[primaryKey] = primaryKeyValue;
}
}
transformRelationshipKey(relationship) {
let {parentModelName, parentType} = relationship,
type = parentModelName || parentType && parentType.modelName || relationship.type,
transformFn = this.getTransformKeyFunction(type, 'Relationship');
return transformFn(relationship.key, relationship.kind);
}
getRelationshipType(relationship, fixture) {
let isPolymorphic = relationship.options.polymorphic;
return isPolymorphic ? this.polymorphicTypeTransformFn(fixture.type) : relationship.type;
}
attributeIncluded(attribute, modelName) {
if (!this.serializeMode) {
return true;
}
let serializer = this.store.serializerFor(modelName),
attrOptions = this.attrsOption(serializer, attribute);
if (attrOptions && attrOptions.serialize === false) {
return false;
}
return true;
}
getTransformKeyFunction(modelName, type) {
if (!this.transformKeys) {
return this.noTransformFn;
}
let serializer = this.store.serializerFor(modelName),
keyFn = serializer['keyFor' + type] || this.defaultKeyTransformFn;
return ((attribute, method) => {
// if there is an attrs override in serializer, return that first
let attrOptions = this.attrsOption(serializer, attribute),
attrName;
if (attrOptions) {
if (attrOptions.key) {
attrName = attrOptions.key;
}
if (typeOf(attrOptions) === "string") {
attrName = attrOptions;
}
}
return attrName || keyFn.apply(serializer, [attribute, method, 'serialize']);
});
}
getTransformValueFunction(type) {
if (!this.transformKeys || (type && type.match('-mf'))) {
return this.noTransformFn;
}
if (!type) {
return this.defaultValueTransformFn;
}
let container = getOwner(this.store),
transform = container.lookup('transform:' + type);
assert(`[ember-data-factory-guy] could not find
the [ ${type} ] transform. If you are in a unit test, be sure
to include it in the list of needs as [ transform:${type} ], Or set your
unit test to be [ integration: true ] and include everything.`,
transform
);
let transformer = container.lookup('transform:' + type);
return transformer.serialize.bind(transformer);
}
extractAttributes(modelName, fixture) {
let attributes = {},
transformKeyFunction = this.getTransformKeyFunction(modelName, 'Attribute');
this.store.modelFor(modelName).eachAttribute((attribute, meta) => {
if (this.attributeIncluded(attribute, modelName)) {
let attributeKey = transformKeyFunction(attribute),
transformValueFunction = this.getTransformValueFunction(meta.type);
if (fixture.hasOwnProperty(attribute)) {
attributes[attributeKey] = transformValueFunction(fixture[attribute], meta.options);
} else if (fixture.hasOwnProperty(attributeKey)) {
attributes[attributeKey] = transformValueFunction(fixture[attributeKey], meta.options);
}
}
});
return attributes;
}
/**
Extract relationships and descend into those looking for others
@param {String} modelName
@param {Object} fixture
@returns {{}}
*/
extractRelationships(modelName, fixture) {
let relationships = {};
this.store.modelFor(modelName).eachRelationship((key, relationship) => {
if (fixture.hasOwnProperty(key)) {
if (relationship.kind === 'belongsTo') {
this.extractBelongsTo(fixture, relationship, modelName, relationships);
} else if (relationship.kind === 'hasMany') {
this.extractHasMany(fixture, relationship, modelName, relationships);
}
}
});
return relationships;
}
/**
Extract belongTo relationships
@param fixture
@param relationship
@param relationships
*/
extractBelongsTo(fixture, relationship, parentModelName, relationships) {
let belongsToRecord = fixture[relationship.key],
isEmbedded = this.isEmbeddedRelationship(parentModelName, relationship.key),
relationshipKey = isEmbedded ? relationship.key : this.transformRelationshipKey(relationship);
let data = this.extractSingleRecord(belongsToRecord, relationship, isEmbedded);
relationships[relationshipKey] = this.assignRelationship(data);
}
// Borrowed from ember data
// checks config for attrs option to embedded (always)
isEmbeddedRelationship(modelName, attr) {
let serializer = this.store.serializerFor(modelName),
option = this.attrsOption(serializer, attr);
return option && (option.embedded === 'always' || option.deserialize === 'records');
}
attrsOption(serializer, attr) {
let attrs = serializer.get('attrs'),
option = attrs && (attrs[camelize(attr)] || attrs[attr]);
return option;
}
extractHasMany(fixture, relationship, parentModelName, relationships) {
let hasManyRecords = fixture[relationship.key],
relationshipKey = this.transformRelationshipKey(relationship),
isEmbedded = this.isEmbeddedRelationship(parentModelName, relationship.key);
if (hasManyRecords && hasManyRecords.isProxy) {
return this.addListProxyData(hasManyRecords, relationship, relationships, isEmbedded);
}
if (typeOf(hasManyRecords) !== 'array') {
return;
}
let records = hasManyRecords.map((hasManyRecord) => {
return this.extractSingleRecord(hasManyRecord, relationship, isEmbedded);
});
relationships[relationshipKey] = this.assignRelationship(records);
}
extractSingleRecord(record, relationship, isEmbedded) {
let data;
switch (typeOf(record)) {
case 'object':
if (record.isProxy) {
data = this.addProxyData(record, relationship, isEmbedded);
} else {
data = this.addData(record, relationship, isEmbedded);
}
break;
case 'instance':
data = this.normalizeAssociation(record, relationship);
break;
case 'number':
case 'string':
assert(
`Polymorphic relationships cannot be specified by id you
need to supply an object with id and type`, !relationship.options.polymorphic
);
record = {id: record, type: relationship.type};
data = this.normalizeAssociation(record, relationship);
}
return data;
}
assignRelationship(object) {
return object;
}
/**
* Technically don't have to verify the links because hey would not even be assigned,
* but the user might want to know why
*
* @param modelName
* @param links
*/
verifyLinks(modelName, links={}) {
const modelClass = this.store.modelFor(modelName),
relationships = get(modelClass, 'relationshipsByName');
for (let [relationshipKey, link] of entries(links)) {
assert(`You defined a link url ${link} for the [${relationshipKey}] relationship
on model [${modelName}] but that relationship does not exist`,
relationships.get(relationshipKey));
}
}
addData(embeddedFixture, relationship, isEmbedded) {
let relationshipType = this.getRelationshipType(relationship, embeddedFixture),
// find possibly more embedded fixtures
data = this.convertSingle(relationshipType, embeddedFixture);
if (isEmbedded) {
return data;
}
this.addToIncluded(data, relationshipType);
return this.normalizeAssociation(data, relationship);
}
// proxy data is data that was build with FactoryGuy.build method
addProxyData(jsonProxy, relationship, isEmbedded) {
let data = jsonProxy.getModelPayload(),
relationshipType = this.getRelationshipType(relationship, data);
if (isEmbedded) {
this.addToIncludedFromProxy(jsonProxy);
return data;
}
this.addToIncluded(data, relationshipType);
this.addToIncludedFromProxy(jsonProxy);
return this.normalizeAssociation(data, relationship);
}
// listProxy data is data that was build with FactoryGuy.buildList method
addListProxyData(jsonProxy, relationship, relationships, isEmbedded) {
let relationshipKey = this.transformRelationshipKey(relationship);
let records = jsonProxy.getModelPayload().map((data) => {
if (isEmbedded) {
return data;
}
let relationshipType = this.getRelationshipType(relationship, data);
this.addToIncluded(data, relationshipType);
return this.normalizeAssociation(data, relationship);
});
this.addToIncludedFromProxy(jsonProxy);
relationships[relationshipKey] = this.assignRelationship(records);
}
}
| {
"content_hash": "fe48e9d67cd9480eb002331778652746",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 102,
"avg_line_length": 33.64225352112676,
"alnum_prop": 0.6810684082726283,
"repo_name": "crossroads/ember-data-factory-guy",
"id": "ad51af46aa3c47aa2d2255383b1ac65af1e9ac2e",
"size": "11943",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "addon/converter/fixture-converter.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "31"
},
{
"name": "HTML",
"bytes": "4905"
},
{
"name": "JavaScript",
"bytes": "425604"
}
],
"symlink_target": ""
} |
<?php
/*
Element Description: VC mail signup form
*/
// Element Class
class vc_mailSignUp extends WPBakeryShortCode {
// Element Init
function __construct() {
add_action( 'init', array( $this, 'vc_mailSignUp_mapping' ) );
add_shortcode( 'vc_mailSignUp', array( $this, 'vc_render_mailSignUp' ) );
}
// Element Mapping
public function vc_mailSignUp_mapping() {
// Stop all if VC is not enabled
if ( !defined( 'WPB_VC_VERSION' ) ) {
return;
}
// Map the block with vc_map()
vc_map(
array(
'name' => __('WHOTHAT mail SignUp-form', 'mailSignUp'),
'base' => 'vc_mailSignUp',
'description' => __('Custom imagebox, for displaying an image along with a title & subtext', 'mailSignUp'),
'category' => __('WHOTHAT elements', 'mailSignUp'),
'icon' => get_template_directory_uri().'/assets/icons/ic_vc-element_imagebox.png',
'params' => array(
array(
'type' => 'textfield',
'heading' => __( 'Extra class name', 'mailSignUp' ),
'param_name' => 'el_class',
'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'mailSignUp' ),
),
array(
'type' => 'css_editor',
'heading' => __( 'Css', 'mailSignUp' ),
'param_name' => 'css',
'group' => __( 'Design options', 'mailSignUp' ),
),
),
)
);
}
// Element HTML
public function vc_render_mailSignUp( $atts ) {
// Params extraction
extract(
shortcode_atts(
array(
'css' => '',
'el_class' => '',
),
$atts
)
);
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, vc_shortcode_custom_css_class( $css, ' ' ), $this->settings['base'], $atts );
// Fill $html var with data
$html = '
<div class="vc_mailSignUp_wrap ' . $el_class. '">
<div class="mailSignUpForm ' .esc_attr( $css_class ). '">
<h3>TILMELD NYHEDSBREV</h3>
<p>få nyheder og tilbud direkte ind<br>i indbakken.</p>
<form action="" method="post">
<input id="signName" type="text" placeholder="Dit navn" value="" maxlength="" autocomplete="on" onmousedown="" onblur="" />
<input id="signCompany" type="text" placeholder="Evt. firmanavn" value="" maxlength="" autocomplete="on" onmousedown="" onblur="" />
<input id="signEmail" type="text" placeholder="Din e-mail adressse" value="" maxlength="" autocomplete="on" onmousedown="" onblur="" />
<button id="signUpBtn" type="submit" value=""/><span><a>Tilmeld dig nyhedsbrevet</a></span>
</form>
</div>
</div>
';
return $html;
}
} // End Element Class
// Element Class Init
new vc_mailSignUp();
?> | {
"content_hash": "34f22ba678fbb899702afdbc6c9ffc92",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 160,
"avg_line_length": 30.846153846153847,
"alnum_prop": 0.5653722835767724,
"repo_name": "whothat-dk/Slagelse-Lift",
"id": "9793cc885c61487f0976d2e9086a62c1abab927e",
"size": "2808",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "wp-content/themes/whothat/composer/mailSignUp.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "896"
},
{
"name": "CSS",
"bytes": "2174755"
},
{
"name": "HTML",
"bytes": "34805"
},
{
"name": "JavaScript",
"bytes": "2613550"
},
{
"name": "PHP",
"bytes": "12854207"
}
],
"symlink_target": ""
} |
package ws.moor.gletscher.catalog;
import com.google.common.util.concurrent.Futures;
import com.google.protobuf.InvalidProtocolBufferException;
import ws.moor.gletscher.blocks.BlockStore;
import ws.moor.gletscher.blocks.PersistedBlock;
import ws.moor.gletscher.proto.Gletscher;
import ws.moor.gletscher.util.ByteSize;
import java.io.PrintStream;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
public class CatalogAnalyzer {
private final BlockStore blockStore;
public CatalogAnalyzer(BlockStore blockStore) {
this.blockStore = blockStore;
}
public void analyze(Catalog catalog, PrintStream out) {
out.printf("Analyzing catalog %s...\n", catalog.getAddress());
Stack<Gletscher.Directory> stack = new Stack<>();
for (PersistedBlock root : catalog.getRoots().values()) {
stack.push(fetchDirectory(root));
}
int directories = 0;
int files = 0;
int symlinks = 0;
int totalBlocks = 0;
long totalBlockSize = 0;
long metaSize = 0;
Set<PersistedBlock> uniqueBlocks = new HashSet<>();
Map<String, AtomicLong> bytesByExtension = new HashMap<>();
while (!stack.isEmpty()) {
directories++;
Gletscher.Directory dir = stack.pop();
metaSize += dir.getSerializedSize();
for (Gletscher.DirectoryEntry entry : dir.getEntryList()) {
switch (entry.getTypeCase()) {
case FILE:
files++;
long fileSize = 0;
for (Gletscher.PersistedBlock block : entry.getFile().getBlockList()) {
uniqueBlocks.add(PersistedBlock.fromProto(block));
totalBlocks++;
fileSize += block.getOriginalSize();
}
totalBlockSize += fileSize;
trackBytesByExtension(entry.getFile().getName(), fileSize, bytesByExtension);
break;
case DIRECTORY:
stack.push(fetchDirectory(PersistedBlock.fromProto(entry.getDirectory().getBlock())));
break;
case SYMLINK:
symlinks++;
break;
default:
throw new IllegalStateException(entry.toString());
}
}
}
long uniqueSize =
uniqueBlocks.stream().collect(Collectors.summingLong(PersistedBlock::getOriginalLength));
out.println(" roots: " + catalog.getRoots().size());
out.println(" directories: " + directories);
out.println(" files: " + files);
out.println(" symlinks: " + symlinks);
out.println(" meta size: " + ByteSize.ofBytes(metaSize));
out.println(" total blocks: " + totalBlocks);
out.println(" total block size: " + ByteSize.ofBytes(totalBlockSize));
out.println(" unique blocks: " + uniqueBlocks.size());
out.println("unique block size: " + ByteSize.ofBytes(uniqueSize));
out.println();
if (!bytesByExtension.isEmpty()) {
out.println("size by extension:");
long remainingSize = totalBlockSize;
List<Map.Entry<String, AtomicLong>> sortedEntries =
bytesByExtension.entrySet().stream()
.sorted(
Map.Entry.<String, AtomicLong>comparingByValue(
Comparator.comparing(AtomicLong::get))
.reversed())
.collect(Collectors.toList());
for (int i = 0; i < 10 && i < sortedEntries.size(); i++) {
out.printf(
"%17s: %s\n",
sortedEntries.get(i).getKey(), ByteSize.ofBytes(sortedEntries.get(i).getValue().get()));
remainingSize -= sortedEntries.get(i).getValue().get();
}
if (remainingSize > 0) {
out.printf(" others: %s\n", ByteSize.ofBytes(remainingSize));
}
out.println();
}
// Set<PersistedBlock> allBlocksThere = blockStore.listAllBlocks();
// System.out.println("all blocks in storage: " + allBlocksThere.size());
// long totalSize = 0;
// for (PersistedBlock block : allBlocksThere) {
// totalSize += block.getOriginalLength();
// }
// System.out.println("all blocks in storage size: " + totalSize);
//
// allBlocksThere.removeAll(uniqueBlocks);
// System.out.println("excess blocks: " + allBlocksThere.size());
// totalSize = 0;
// for (PersistedBlock block : allBlocksThere) {
// totalSize += block.getOriginalLength();
// }
// System.out.println("excess blocks size: " + totalSize);
}
private static void trackBytesByExtension(String fileName, long fileSize, Map<String, AtomicLong> bytesByExtension) {
int idx = fileName.lastIndexOf('.');
if (idx >= 1 && idx < fileName.length() - 1 && idx >= fileName.length() - 6) {
// Require at least one character before the last dot, and only consider extensions between 1 and 5 characters.
String extension = fileName.substring(idx + 1).toLowerCase();
bytesByExtension.computeIfAbsent(extension, unused -> new AtomicLong()).addAndGet(fileSize);
}
}
private Gletscher.Directory fetchDirectory(PersistedBlock root) {
try {
return Gletscher.Directory.parseFrom(Futures.getUnchecked(blockStore.retrieve(root)));
} catch (InvalidProtocolBufferException e) {
throw new IllegalStateException(e);
}
}
}
| {
"content_hash": "0f1f91c8db2f76c0927f65911408427b",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 119,
"avg_line_length": 37.49315068493151,
"alnum_prop": 0.6346364632809646,
"repo_name": "pmoor/gletscher",
"id": "9745132beb910198833557c8684cfd16cc5201e7",
"size": "6085",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/ws/moor/gletscher/catalog/CatalogAnalyzer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "284201"
}
],
"symlink_target": ""
} |
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 5.7.9 - MySQL Community Server (GPL)
-- Server OS: Win64
-- HeidiSQL Version: 9.3.0.4984
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping structure for table aaiischo_ais1.room
CREATE TABLE IF NOT EXISTS `room` (room
`id` int(10) NOT NULL AUTO_INCREMENT,
`floor_id` int(10) NOT NULL,
`room_number` varchar(30) NOT NULL,
`status` int(1) NOT NULL DEFAULT '1',
`branch_id` int(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='this table store room information';
-- Dumping data for table aaiischo_ais1.room: ~0 rows (approximately)
DELETE FROM `room`;
/*!40000 ALTER TABLE `room` DISABLE KEYS */;
/*!40000 ALTER TABLE `room` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| {
"content_hash": "fa3bea7baa3a3009654a1635612a2f5f",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 99,
"avg_line_length": 46.758620689655174,
"alnum_prop": 0.5951327433628318,
"repo_name": "vuthysin5284/school",
"id": "a2074c84c1638a037b63797f8573d8e66908c345",
"size": "1356",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/Eng/room.sql",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3156032"
},
{
"name": "HTML",
"bytes": "385961"
},
{
"name": "Hack",
"bytes": "286076"
},
{
"name": "JavaScript",
"bytes": "3548461"
},
{
"name": "PHP",
"bytes": "2972320"
},
{
"name": "TSQL",
"bytes": "24607041"
}
],
"symlink_target": ""
} |
package tzhai.euler;
import java.util.ArrayList;
/**
* Problem 23 Non-abundant sums
*
* A perfect number is a number for which the sum of its proper divisors is
* exactly equal to the number. For example, the sum of the proper divisors of
* 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
*
* A number n is called deficient if the sum of its proper divisors is less than
* n and it is called abundant if this sum exceeds n.
*
* As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest
* number that can be written as the sum of two abundant numbers is 24. By
* mathematical analysis, it can be shown that all integers greater than 28123
* can be written as the sum of two abundant numbers. However, this upper limit
* cannot be reduced any further by analysis even though it is known that the
* greatest number that cannot be expressed as the sum of two abundant numbers
* is less than this limit.
*
* Find the sum of all the positive integers which cannot be written as the sum
* of two abundant numbers.
*
* @author Zhai Tengfei
*
*/
public class Problem23 {
private static ArrayList<Integer> sumProperDivisors = new ArrayList<Integer>();
private static int nonAbundantSums() {
int sum = 0;
for (int i = 12; i <= 28123; i++) {
int temp = 0;
for (int j = 1; j < i / 2 + 1; j++) {
if (i % j == 0) {
temp += j;
}
}
if (temp > i) {
sumProperDivisors.add(i);
}
}
for (int i = 1; i <= 28123; i++) {
boolean flag = false;
for (int j = 0; j < sumProperDivisors.size(); j++) {
int sumTemp = sumProperDivisors.get(j);
if (i <= sumTemp) {
break;
} else if (sumProperDivisors.contains(i - sumTemp)) {
flag = true;
break;
}
}
if (!flag) {
sum += i;
}
}
return sum;
}
public static void main(String[] args) {
System.out.println(Problem23.nonAbundantSums());
}
}
| {
"content_hash": "80cbe2ebe662fe20fd6db9390cb5fda9",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 80,
"avg_line_length": 28.441176470588236,
"alnum_prop": 0.6463288521199586,
"repo_name": "zhaitengfei/ProjetEuler",
"id": "2f31d69a25eab380eb4ba29d218f9536df7d2e63",
"size": "1934",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/tzhai/euler/Problem23.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "55173"
}
],
"symlink_target": ""
} |
package org.apache.ivory.resource;
import org.apache.ivory.IvoryWebException;
import org.apache.ivory.monitors.Dimension;
import org.apache.ivory.monitors.Monitored;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
@Path("entities")
public class SchedulableEntityManager extends AbstractSchedulableEntityManager {
@GET
@Path("status/{type}/{entity}")
@Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN })
@Monitored(event = "status")
@Override
public APIResult getStatus(@Dimension("entityType") @PathParam("type") String type,
@Dimension("entityName") @PathParam("entity") String entity,
@Dimension("colo") @QueryParam("colo") final String colo)
throws IvoryWebException {
return super.getStatus(type, entity, colo);
}
@GET
@Path("dependencies/{type}/{entity}")
@Produces(MediaType.TEXT_XML)
@Monitored(event = "dependencies")
@Override
public EntityList getDependencies(@Dimension("entityType") @PathParam("type") String type,
@Dimension("entityName") @PathParam("entity") String entity) {
return super.getDependencies(type, entity);
}
@GET
@Path("list/{type}")
@Produces(MediaType.TEXT_XML)
@Monitored(event = "dependencies")
@Override
public EntityList getDependencies(@Dimension("type") @PathParam("type") String type) {
return super.getDependencies(type);
}
@GET
@Path("definition/{type}/{entity}")
@Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN })
@Monitored(event = "definition")
@Override
public String getEntityDefinition(@Dimension("type") @PathParam("type") String type,
@Dimension("entity") @PathParam("entity") String entityName) {
return super.getEntityDefinition(type, entityName);
}
@POST
@Path("schedule/{type}/{entity}")
@Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN })
@Monitored(event = "schedule")
@Override
public APIResult schedule(@Context HttpServletRequest request,
@Dimension("entityType") @PathParam("type") String type,
@Dimension("entityName") @PathParam("entity") String entity,
@Dimension("colo") @QueryParam("colo") String colo) {
return super.schedule(request, type, entity, colo);
}
@POST
@Path("suspend/{type}/{entity}")
@Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN })
@Monitored(event = "suspend")
@Override
public APIResult suspend(@Context HttpServletRequest request,
@Dimension("entityType") @PathParam("type") String type,
@Dimension("entityName") @PathParam("entity") String entity,
@Dimension("colo") @QueryParam("colo") String colo) {
return super.suspend(request, type, entity, colo);
}
@POST
@Path("resume/{type}/{entity}")
@Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN })
@Monitored(event = "resume")
@Override
public APIResult resume(@Context HttpServletRequest request,
@Dimension("entityType") @PathParam("type") String type,
@Dimension("entityName") @PathParam("entity") String entity,
@Dimension("colo") @QueryParam("colo") String colo) {
return super.resume(request, type, entity, colo);
}
}
| {
"content_hash": "016219cae883b8e33a976f17d2fcb5cc",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 100,
"avg_line_length": 39.89010989010989,
"alnum_prop": 0.6201101928374656,
"repo_name": "InMobi/ivory",
"id": "6e631c5cc8cda35eccfc63c1a0e8790d7ddc8102",
"size": "3630",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "webapp/src/main/java/org/apache/ivory/resource/SchedulableEntityManager.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "976385"
},
{
"name": "Perl",
"bytes": "19647"
},
{
"name": "Shell",
"bytes": "1552"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_second"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.just.businesinfo.SecondActivity"
tools:showIn="@layout/app_bar_second">
<TextView
android:id="@+id/nominal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:textColor="@color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/Scale"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="2dip"
android:textColor="@color/colorAccent" />
<TextView
android:id="@+id/Rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#5d5d5d"
android:textStyle="bold" />
</RelativeLayout>
| {
"content_hash": "f4d1124bbfd01585637f18b0f1e9991f",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 74,
"avg_line_length": 38.125,
"alnum_prop": 0.681311475409836,
"repo_name": "Garasjuk/EPAMtraning2016",
"id": "bc51da2c66d5a4842b1d54001df443199f301165",
"size": "1525",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BusinesInfo/app/src/main/res/layout/content_second.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "2547"
},
{
"name": "Java",
"bytes": "202261"
}
],
"symlink_target": ""
} |
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>AnnotationPage | manifesto</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">manifesto</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="../modules/_annotationpage_.html">"AnnotationPage"</a>
</li>
<li>
<a href="_annotationpage_.annotationpage.html">AnnotationPage</a>
</li>
</ul>
<h1>Class AnnotationPage</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<a href="_manifestresource_.manifestresource.html" class="tsd-signature-type">ManifestResource</a>
<ul class="tsd-hierarchy">
<li>
<span class="target">AnnotationPage</span>
</li>
</ul>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="_annotationpage_.annotationpage.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section tsd-is-inherited">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#__jsonld" class="tsd-kind-icon">__jsonld</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#context" class="tsd-kind-icon">context</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#externalresource" class="tsd-kind-icon">external<wbr>Resource</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#id" class="tsd-kind-icon">id</a></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#options" class="tsd-kind-icon">options</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#getdefaultlabel" class="tsd-kind-icon">get<wbr>Default<wbr>Label</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#getiiifresourcetype" class="tsd-kind-icon">getIIIFResource<wbr>Type</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="_annotationpage_.annotationpage.html#getitems" class="tsd-kind-icon">get<wbr>Items</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#getlabel" class="tsd-kind-icon">get<wbr>Label</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#getmetadata" class="tsd-kind-icon">get<wbr>Metadata</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#getproperty" class="tsd-kind-icon">get<wbr>Property</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#getrendering" class="tsd-kind-icon">get<wbr>Rendering</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#getrenderings" class="tsd-kind-icon">get<wbr>Renderings</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#getservice" class="tsd-kind-icon">get<wbr>Service</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#getservices" class="tsd-kind-icon">get<wbr>Services</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#getthumbnail" class="tsd-kind-icon">get<wbr>Thumbnail</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#isannotation" class="tsd-kind-icon">is<wbr>Annotation</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#iscanvas" class="tsd-kind-icon">is<wbr>Canvas</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#iscollection" class="tsd-kind-icon">is<wbr>Collection</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#ismanifest" class="tsd-kind-icon">is<wbr>Manifest</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#isrange" class="tsd-kind-icon">is<wbr>Range</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><a href="_annotationpage_.annotationpage.html#issequence" class="tsd-kind-icon">is<wbr>Sequence</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite">
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite">
<li class="tsd-signature tsd-kind-icon">new <wbr>Annotation<wbr>Page<span class="tsd-signature-symbol">(</span>jsonld<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, options<span class="tsd-signature-symbol">: </span><a href="../interfaces/_imanifestooptions_.imanifestooptions.html" class="tsd-signature-type">IManifestoOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_annotationpage_.annotationpage.html" class="tsd-signature-type">AnnotationPage</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Overrides <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#constructor">constructor</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/AnnotationPage.ts#L5">AnnotationPage.ts:5</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>jsonld: <span class="tsd-signature-type">any</span></h5>
</li>
<li>
<h5>options: <a href="../interfaces/_imanifestooptions_.imanifestooptions.html" class="tsd-signature-type">IManifestoOptions</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="_annotationpage_.annotationpage.html" class="tsd-signature-type">AnnotationPage</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-inherited">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
<a name="__jsonld" class="tsd-anchor"></a>
<h3>__jsonld</h3>
<div class="tsd-signature tsd-kind-icon">__jsonld<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
<p>Inherited from <a href="_jsonldresource_.jsonldresource.html">JSONLDResource</a>.<a href="_jsonldresource_.jsonldresource.html#__jsonld">__jsonld</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/JSONLDResource.ts#L4">JSONLDResource.ts:4</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
<a name="context" class="tsd-anchor"></a>
<h3>context</h3>
<div class="tsd-signature tsd-kind-icon">context<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<p>Inherited from <a href="_jsonldresource_.jsonldresource.html">JSONLDResource</a>.<a href="_jsonldresource_.jsonldresource.html#context">context</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/JSONLDResource.ts#L2">JSONLDResource.ts:2</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
<a name="externalresource" class="tsd-anchor"></a>
<h3>external<wbr>Resource</h3>
<div class="tsd-signature tsd-kind-icon">external<wbr>Resource<span class="tsd-signature-symbol">:</span> <a href="../interfaces/_iexternalresource_.iexternalresource.html" class="tsd-signature-type">IExternalResource</a></div>
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#externalresource">externalResource</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L4">ManifestResource.ts:4</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
<a name="id" class="tsd-anchor"></a>
<h3>id</h3>
<div class="tsd-signature tsd-kind-icon">id<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<p>Inherited from <a href="_jsonldresource_.jsonldresource.html">JSONLDResource</a>.<a href="_jsonldresource_.jsonldresource.html#id">id</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/JSONLDResource.ts#L3">JSONLDResource.ts:3</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
<a name="options" class="tsd-anchor"></a>
<h3>options</h3>
<div class="tsd-signature tsd-kind-icon">options<span class="tsd-signature-symbol">:</span> <a href="../interfaces/_imanifestooptions_.imanifestooptions.html" class="tsd-signature-type">IManifestoOptions</a></div>
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#options">options</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L5">ManifestResource.ts:5</a></li>
</ul>
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="getdefaultlabel" class="tsd-anchor"></a>
<h3>get<wbr>Default<wbr>Label</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">get<wbr>Default<wbr>Label<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#getdefaultlabel">getDefaultLabel</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L26">ManifestResource.ts:26</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span>
<span class="tsd-signature-symbol"> | </span>
<span class="tsd-signature-type">null</span>
</h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="getiiifresourcetype" class="tsd-anchor"></a>
<h3>getIIIFResource<wbr>Type</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">getIIIFResource<wbr>Type<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">IIIFResourceType</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#getiiifresourcetype">getIIIFResourceType</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L12">ManifestResource.ts:12</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">IIIFResourceType</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getitems" class="tsd-anchor"></a>
<h3>get<wbr>Items</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>Items<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_annotation_.annotation.html" class="tsd-signature-type">Annotation</a><span class="tsd-signature-symbol">[]</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/AnnotationPage.ts#L11">AnnotationPage.ts:11</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <a href="_annotation_.annotation.html" class="tsd-signature-type">Annotation</a><span class="tsd-signature-symbol">[]</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="getlabel" class="tsd-anchor"></a>
<h3>get<wbr>Label</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">get<wbr>Label<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_languagemap_.languagemap.html" class="tsd-signature-type">LanguageMap</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#getlabel">getLabel</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L16">ManifestResource.ts:16</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <a href="_languagemap_.languagemap.html" class="tsd-signature-type">LanguageMap</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="getmetadata" class="tsd-anchor"></a>
<h3>get<wbr>Metadata</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">get<wbr>Metadata<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_labelvaluepair_.labelvaluepair.html" class="tsd-signature-type">LabelValuePair</a><span class="tsd-signature-symbol">[]</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#getmetadata">getMetadata</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L30">ManifestResource.ts:30</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <a href="_labelvaluepair_.labelvaluepair.html" class="tsd-signature-type">LabelValuePair</a><span class="tsd-signature-symbol">[]</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="getproperty" class="tsd-anchor"></a>
<h3>get<wbr>Property</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">get<wbr>Property<span class="tsd-signature-symbol">(</span>name<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_jsonldresource_.jsonldresource.html">JSONLDResource</a>.<a href="_jsonldresource_.jsonldresource.html#getproperty">getProperty</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/JSONLDResource.ts#L12">JSONLDResource.ts:12</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>name: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="getrendering" class="tsd-anchor"></a>
<h3>get<wbr>Rendering</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">get<wbr>Rendering<span class="tsd-signature-symbol">(</span>format<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RenderingFormat</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_rendering_.rendering.html" class="tsd-signature-type">Rendering</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#getrendering">getRendering</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L47">ManifestResource.ts:47</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>format: <span class="tsd-signature-type">RenderingFormat</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="_rendering_.rendering.html" class="tsd-signature-type">Rendering</a>
<span class="tsd-signature-symbol"> | </span>
<span class="tsd-signature-type">null</span>
</h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="getrenderings" class="tsd-anchor"></a>
<h3>get<wbr>Renderings</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">get<wbr>Renderings<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_rendering_.rendering.html" class="tsd-signature-type">Rendering</a><span class="tsd-signature-symbol">[]</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#getrenderings">getRenderings</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L61">ManifestResource.ts:61</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <a href="_rendering_.rendering.html" class="tsd-signature-type">Rendering</a><span class="tsd-signature-symbol">[]</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="getservice" class="tsd-anchor"></a>
<h3>get<wbr>Service</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">get<wbr>Service<span class="tsd-signature-symbol">(</span>profile<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ServiceProfile</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_service_.service.html" class="tsd-signature-type">Service</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#getservice">getService</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L88">ManifestResource.ts:88</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>profile: <span class="tsd-signature-type">ServiceProfile</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="_service_.service.html" class="tsd-signature-type">Service</a>
<span class="tsd-signature-symbol"> | </span>
<span class="tsd-signature-type">null</span>
</h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="getservices" class="tsd-anchor"></a>
<h3>get<wbr>Services</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">get<wbr>Services<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_service_.service.html" class="tsd-signature-type">Service</a><span class="tsd-signature-symbol">[]</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#getservices">getServices</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L92">ManifestResource.ts:92</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <a href="_service_.service.html" class="tsd-signature-type">Service</a><span class="tsd-signature-symbol">[]</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="getthumbnail" class="tsd-anchor"></a>
<h3>get<wbr>Thumbnail</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">get<wbr>Thumbnail<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="_thumbnail_.thumbnail.html" class="tsd-signature-type">Thumbnail</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#getthumbnail">getThumbnail</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L96">ManifestResource.ts:96</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <a href="_thumbnail_.thumbnail.html" class="tsd-signature-type">Thumbnail</a>
<span class="tsd-signature-symbol"> | </span>
<span class="tsd-signature-type">null</span>
</h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="isannotation" class="tsd-anchor"></a>
<h3>is<wbr>Annotation</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">is<wbr>Annotation<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#isannotation">isAnnotation</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L110">ManifestResource.ts:110</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="iscanvas" class="tsd-anchor"></a>
<h3>is<wbr>Canvas</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">is<wbr>Canvas<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#iscanvas">isCanvas</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L114">ManifestResource.ts:114</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="iscollection" class="tsd-anchor"></a>
<h3>is<wbr>Collection</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">is<wbr>Collection<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#iscollection">isCollection</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L118">ManifestResource.ts:118</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="ismanifest" class="tsd-anchor"></a>
<h3>is<wbr>Manifest</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">is<wbr>Manifest<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#ismanifest">isManifest</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L122">ManifestResource.ts:122</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="isrange" class="tsd-anchor"></a>
<h3>is<wbr>Range</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">is<wbr>Range<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#isrange">isRange</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L126">ManifestResource.ts:126</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a name="issequence" class="tsd-anchor"></a>
<h3>is<wbr>Sequence</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<li class="tsd-signature tsd-kind-icon">is<wbr>Sequence<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<p>Inherited from <a href="_manifestresource_.manifestresource.html">ManifestResource</a>.<a href="_manifestresource_.manifestresource.html#issequence">isSequence</a></p>
<ul>
<li>Defined in <a href="https://github.com/edsilv/manifesto/blob/b83b754/src/ManifestResource.ts#L130">ManifestResource.ts:130</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
<li class="current tsd-kind-external-module">
<a href="../modules/_annotationpage_.html">"<wbr>Annotation<wbr>Page"</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-class tsd-parent-kind-external-module">
<a href="_annotationpage_.annotationpage.html" class="tsd-kind-icon">Annotation<wbr>Page</a>
<ul>
<li class=" tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite">
<a href="_annotationpage_.annotationpage.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#__jsonld" class="tsd-kind-icon">__jsonld</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#context" class="tsd-kind-icon">context</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#externalresource" class="tsd-kind-icon">external<wbr>Resource</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#id" class="tsd-kind-icon">id</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#options" class="tsd-kind-icon">options</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#getdefaultlabel" class="tsd-kind-icon">get<wbr>Default<wbr>Label</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#getiiifresourcetype" class="tsd-kind-icon">getIIIFResource<wbr>Type</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="_annotationpage_.annotationpage.html#getitems" class="tsd-kind-icon">get<wbr>Items</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#getlabel" class="tsd-kind-icon">get<wbr>Label</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#getmetadata" class="tsd-kind-icon">get<wbr>Metadata</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#getproperty" class="tsd-kind-icon">get<wbr>Property</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#getrendering" class="tsd-kind-icon">get<wbr>Rendering</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#getrenderings" class="tsd-kind-icon">get<wbr>Renderings</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#getservice" class="tsd-kind-icon">get<wbr>Service</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#getservices" class="tsd-kind-icon">get<wbr>Services</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#getthumbnail" class="tsd-kind-icon">get<wbr>Thumbnail</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#isannotation" class="tsd-kind-icon">is<wbr>Annotation</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#iscanvas" class="tsd-kind-icon">is<wbr>Canvas</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#iscollection" class="tsd-kind-icon">is<wbr>Collection</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#ismanifest" class="tsd-kind-icon">is<wbr>Manifest</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#isrange" class="tsd-kind-icon">is<wbr>Range</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-inherited">
<a href="_annotationpage_.annotationpage.html#issequence" class="tsd-kind-icon">is<wbr>Sequence</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="http://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html> | {
"content_hash": "da9ca0cece4b61c6a74dcd2a28edf8a4",
"timestamp": "",
"source": "github",
"line_count": 719,
"max_line_length": 562,
"avg_line_length": 62.98470097357441,
"alnum_prop": 0.6692576072075255,
"repo_name": "viewdir/manifesto",
"id": "bc3da94753f48aa8d9af63fe2126b8a04c30a6a2",
"size": "45286",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/classes/_annotationpage_.annotationpage.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "52073"
},
{
"name": "TypeScript",
"bytes": "135185"
}
],
"symlink_target": ""
} |
using std::max;
using std::min;
namespace ash {
namespace internal {
gfx::Rect ImageGrid::TestAPI::GetTransformedLayerBounds(
const ui::Layer& layer) {
gfx::Rect bounds = layer.bounds();
layer.transform().TransformRect(&bounds);
return bounds;
}
ImageGrid::ImageGrid()
: layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)),
top_image_height_(0),
bottom_image_height_(0),
left_image_width_(0),
right_image_width_(0),
base_top_row_height_(0),
base_bottom_row_height_(0),
base_left_column_width_(0),
base_right_column_width_(0) {
}
ImageGrid::~ImageGrid() {
}
void ImageGrid::SetImages(const gfx::Image* top_left_image,
const gfx::Image* top_image,
const gfx::Image* top_right_image,
const gfx::Image* left_image,
const gfx::Image* center_image,
const gfx::Image* right_image,
const gfx::Image* bottom_left_image,
const gfx::Image* bottom_image,
const gfx::Image* bottom_right_image) {
SetImage(top_left_image, &top_left_layer_, &top_left_painter_);
SetImage(top_image, &top_layer_, &top_painter_);
SetImage(top_right_image, &top_right_layer_, &top_right_painter_);
SetImage(left_image, &left_layer_, &left_painter_);
SetImage(center_image, ¢er_layer_, ¢er_painter_);
SetImage(right_image, &right_layer_, &right_painter_);
SetImage(bottom_left_image, &bottom_left_layer_, &bottom_left_painter_);
SetImage(bottom_image, &bottom_layer_, &bottom_painter_);
SetImage(bottom_right_image, &bottom_right_layer_, &bottom_right_painter_);
top_image_height_ = GetImageSize(top_image).height();
bottom_image_height_ = GetImageSize(bottom_image).height();
left_image_width_ = GetImageSize(left_image).width();
right_image_width_ = GetImageSize(right_image).width();
base_top_row_height_ = max(GetImageSize(top_left_image).height(),
max(GetImageSize(top_image).height(),
GetImageSize(top_right_image).height()));
base_bottom_row_height_ = max(GetImageSize(bottom_left_image).height(),
max(GetImageSize(bottom_image).height(),
GetImageSize(bottom_right_image).height()));
base_left_column_width_ = max(GetImageSize(top_left_image).width(),
max(GetImageSize(left_image).width(),
GetImageSize(bottom_left_image).width()));
base_right_column_width_ = max(GetImageSize(top_right_image).width(),
max(GetImageSize(right_image).width(),
GetImageSize(bottom_right_image).width()));
// Invalidate previous |size_| so calls to SetSize() will recompute it.
size_.SetSize(0, 0);
}
void ImageGrid::SetSize(const gfx::Size& size) {
if (size_ == size)
return;
size_ = size;
gfx::Rect updated_bounds = layer_->bounds();
updated_bounds.set_size(size);
layer_->SetBounds(updated_bounds);
// Calculate the available amount of space for corner images on all sides of
// the grid. If the images don't fit, we need to clip them.
const int left = min(base_left_column_width_, size_.width() / 2);
const int right = min(base_right_column_width_, size_.width() - left);
const int top = min(base_top_row_height_, size_.height() / 2);
const int bottom = min(base_bottom_row_height_, size_.height() - top);
// The remaining space goes to the center image.
int center_width = std::max(size.width() - left - right, 0);
int center_height = std::max(size.height() - top - bottom, 0);
if (top_layer_.get()) {
if (center_width > 0) {
ui::Transform transform;
transform.SetScaleX(
static_cast<float>(center_width) / top_layer_->bounds().width());
transform.ConcatTranslate(left, 0);
top_layer_->SetTransform(transform);
}
top_layer_->SetVisible(center_width > 0);
}
if (bottom_layer_.get()) {
if (center_width > 0) {
ui::Transform transform;
transform.SetScaleX(
static_cast<float>(center_width) / bottom_layer_->bounds().width());
transform.ConcatTranslate(
left, size.height() - bottom_layer_->bounds().height());
bottom_layer_->SetTransform(transform);
}
bottom_layer_->SetVisible(center_width > 0);
}
if (left_layer_.get()) {
if (center_height > 0) {
ui::Transform transform;
transform.SetScaleY(
(static_cast<float>(center_height) / left_layer_->bounds().height()));
transform.ConcatTranslate(0, top);
left_layer_->SetTransform(transform);
}
left_layer_->SetVisible(center_height > 0);
}
if (right_layer_.get()) {
if (center_height > 0) {
ui::Transform transform;
transform.SetScaleY(
static_cast<float>(center_height) / right_layer_->bounds().height());
transform.ConcatTranslate(
size.width() - right_layer_->bounds().width(), top);
right_layer_->SetTransform(transform);
}
right_layer_->SetVisible(center_height > 0);
}
if (top_left_layer_.get()) {
// No transformation needed; it should be at (0, 0) and unscaled.
top_left_painter_->SetClipRect(
LayerExceedsSize(top_left_layer_.get(), gfx::Size(left, top)) ?
gfx::Rect(gfx::Rect(0, 0, left, top)) :
gfx::Rect(),
top_left_layer_.get());
}
if (top_right_layer_.get()) {
ui::Transform transform;
transform.SetTranslateX(size.width() - top_right_layer_->bounds().width());
top_right_layer_->SetTransform(transform);
top_right_painter_->SetClipRect(
LayerExceedsSize(top_right_layer_.get(), gfx::Size(right, top)) ?
gfx::Rect(top_right_layer_->bounds().width() - right, 0,
right, top) :
gfx::Rect(),
top_right_layer_.get());
}
if (bottom_left_layer_.get()) {
ui::Transform transform;
transform.SetTranslateY(
size.height() - bottom_left_layer_->bounds().height());
bottom_left_layer_->SetTransform(transform);
bottom_left_painter_->SetClipRect(
LayerExceedsSize(bottom_left_layer_.get(), gfx::Size(left, bottom)) ?
gfx::Rect(0, bottom_left_layer_->bounds().height() - bottom,
left, bottom) :
gfx::Rect(),
bottom_left_layer_.get());
}
if (bottom_right_layer_.get()) {
ui::Transform transform;
transform.SetTranslate(
size.width() - bottom_right_layer_->bounds().width(),
size.height() - bottom_right_layer_->bounds().height());
bottom_right_layer_->SetTransform(transform);
bottom_right_painter_->SetClipRect(
LayerExceedsSize(bottom_right_layer_.get(), gfx::Size(right, bottom)) ?
gfx::Rect(bottom_right_layer_->bounds().width() - right,
bottom_right_layer_->bounds().height() - bottom,
right, bottom) :
gfx::Rect(),
bottom_right_layer_.get());
}
if (center_layer_.get()) {
if (center_width > 0 && center_height > 0) {
ui::Transform transform;
transform.SetScale(center_width / center_layer_->bounds().width(),
center_height / center_layer_->bounds().height());
transform.ConcatTranslate(left, top);
center_layer_->SetTransform(transform);
}
center_layer_->SetVisible(center_width > 0 && center_height > 0);
}
}
void ImageGrid::SetContentBounds(const gfx::Rect& content_bounds) {
SetSize(gfx::Size(
content_bounds.width() + left_image_width_ + right_image_width_,
content_bounds.height() + top_image_height_ +
bottom_image_height_));
layer_->SetBounds(
gfx::Rect(content_bounds.x() - left_image_width_,
content_bounds.y() - top_image_height_,
layer_->bounds().width(),
layer_->bounds().height()));
}
void ImageGrid::ImagePainter::SetClipRect(const gfx::Rect& clip_rect,
ui::Layer* layer) {
if (clip_rect != clip_rect_) {
clip_rect_ = clip_rect;
layer->SchedulePaint(layer->bounds());
}
}
void ImageGrid::ImagePainter::OnPaintLayer(gfx::Canvas* canvas) {
if (!clip_rect_.IsEmpty())
canvas->ClipRect(clip_rect_);
canvas->DrawBitmapInt(*(image_->ToSkBitmap()), 0, 0);
}
// static
gfx::Size ImageGrid::GetImageSize(const gfx::Image* image) {
return image ?
gfx::Size(image->ToSkBitmap()->width(), image->ToSkBitmap()->height()) :
gfx::Size();
}
// static
bool ImageGrid::LayerExceedsSize(const ui::Layer* layer,
const gfx::Size& size) {
return layer->bounds().width() > size.width() ||
layer->bounds().height() > size.height();
}
void ImageGrid::SetImage(const gfx::Image* image,
scoped_ptr<ui::Layer>* layer_ptr,
scoped_ptr<ImagePainter>* painter_ptr) {
// Clean out old layers and painters.
if (layer_ptr->get())
layer_->Remove(layer_ptr->get());
layer_ptr->reset();
painter_ptr->reset();
// If we're not using an image, we're done.
if (!image)
return;
// Set up the new layer and painter.
layer_ptr->reset(new ui::Layer(ui::LAYER_TEXTURED));
const gfx::Size size = GetImageSize(image);
layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height()));
painter_ptr->reset(new ImagePainter(image));
layer_ptr->get()->set_delegate(painter_ptr->get());
layer_ptr->get()->SetFillsBoundsOpaquely(false);
layer_ptr->get()->SetVisible(true);
layer_->Add(layer_ptr->get());
}
} // namespace internal
} // namespace ash
| {
"content_hash": "d057652eaf79c332ce406297735547f4",
"timestamp": "",
"source": "github",
"line_count": 259,
"max_line_length": 80,
"avg_line_length": 37.71042471042471,
"alnum_prop": 0.5989556670420805,
"repo_name": "robclark/chromium",
"id": "c9c982fae9bcaa8fe1513ab36fffa5d1eeeebf39",
"size": "10211",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ash/wm/image_grid.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "1178292"
},
{
"name": "C",
"bytes": "74631766"
},
{
"name": "C++",
"bytes": "120828826"
},
{
"name": "F#",
"bytes": "381"
},
{
"name": "Go",
"bytes": "18556"
},
{
"name": "Java",
"bytes": "120805"
},
{
"name": "JavaScript",
"bytes": "16170722"
},
{
"name": "Objective-C",
"bytes": "5449644"
},
{
"name": "PHP",
"bytes": "97796"
},
{
"name": "Perl",
"bytes": "918516"
},
{
"name": "Python",
"bytes": "5989396"
},
{
"name": "R",
"bytes": "524"
},
{
"name": "Shell",
"bytes": "4169796"
},
{
"name": "Tcl",
"bytes": "277077"
}
],
"symlink_target": ""
} |
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
| {
"content_hash": "d0baf7ddf39c918df6cbf17abbd2f9af",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 281,
"avg_line_length": 53.23529411764706,
"alnum_prop": 0.7850828729281768,
"repo_name": "JohnWong/iOS-file-manager",
"id": "033763a8417524618da2fd8dc0a552cfb69e2b20",
"size": "1973",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "iOSFileManager/AppDelegate.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3421"
},
{
"name": "HTML",
"bytes": "3498"
},
{
"name": "JavaScript",
"bytes": "20291"
},
{
"name": "Objective-C",
"bytes": "20387"
},
{
"name": "Ruby",
"bytes": "66"
},
{
"name": "Shell",
"bytes": "848"
}
],
"symlink_target": ""
} |
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>validacion2</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" href="/favicon.ico">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<!-- endbower -->
<!-- endbuild -->
<!-- build:css(.tmp) styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
</head>
<body>
<form id="formulario" novalidate action="accion.php" method="post">
<div>
<label for="nombre">Nombre:
<span class="important">*</span>
</label>
<input type="text" id="nombre" name="nombre" />
</div>
<div>
<label for="email">E-mail:
<span class="important">*</span>
</label>
<input type="email" id="email" name="email" />
</div>
<div>
<label for="url">Url:</label>
<input type="url" id="url" name="url" />
</div>
<div>
<label for="comentarios">Comentarios:</label>
<textarea id="comentarios" name="comentarios"></textarea>
</div>
<div>
<input type="submit" value="Enviar" />
</div>
</form>
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/jquery-validate/dist/jquery.validate.js"></script>
<!-- endbower -->
<!-- endbuild -->
<!-- build:js({app,.tmp}) scripts/main2.js -->
<script src="scripts/ejercicio2.js"></script>
<script src="scripts/localization.js"></script>
<!-- endbuild -->
</body>
</html>
| {
"content_hash": "bce9789cfa5e34a87bed014b2ef54c8f",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 84,
"avg_line_length": 30.442622950819672,
"alnum_prop": 0.5293484114162628,
"repo_name": "juanda99/validacion2",
"id": "03d1a1edcd3af89e635cbcb6a64a77a8c13b30d2",
"size": "1857",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/ejercicio2.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "223"
},
{
"name": "JavaScript",
"bytes": "18594"
},
{
"name": "PHP",
"bytes": "581"
}
],
"symlink_target": ""
} |
package com.javafx.experiments.dataapp.model.transit;
import com.javafx.experiments.dataapp.model.Product;
import com.javafx.experiments.dataapp.model.ProductType;
import com.javafx.experiments.dataapp.model.Region;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
@XmlRootElement
public class ProductTypeTransitCumulativeSales extends TransitCumulativeSales implements Serializable {
private static final long serialVersionUID = 1L;
private ProductType productType;
public ProductType getProductType() {
return productType;
}
public void setProductType(ProductType productType){
this.productType = productType;
}
}
| {
"content_hash": "69f4dd409fcf626499da59f50fc4163f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 103,
"avg_line_length": 29.727272727272727,
"alnum_prop": 0.7930682976554536,
"repo_name": "jalian-systems/marathonv5",
"id": "0eafee500fdd21e87f16c1acf68b7a3c6518e8d7",
"size": "2684",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "marathon-projects/javafx-samples-2.2.80/src/DataApp/DataAppLibrary/src/com/javafx/experiments/dataapp/model/transit/ProductTypeTransitCumulativeSales.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AppleScript",
"bytes": "1764"
},
{
"name": "Batchfile",
"bytes": "6982"
},
{
"name": "CSS",
"bytes": "1787119"
},
{
"name": "HTML",
"bytes": "54026"
},
{
"name": "Java",
"bytes": "9276296"
},
{
"name": "JavaScript",
"bytes": "44347"
},
{
"name": "Ruby",
"bytes": "877513"
},
{
"name": "Shell",
"bytes": "580"
},
{
"name": "XSLT",
"bytes": "12141"
}
],
"symlink_target": ""
} |
package org.cfeclipse.cfml.parser.cfscript;
/* JJT: 0.2.2 */
public class ASTSubtractNode extends SimpleNode {
ASTSubtractNode(int id) {
super(id);
}
public void interpret()
{
jjtGetChild(0).interpret();
jjtGetChild(1).interpret();
stack[--top] = new Integer(((Integer)stack[top]).intValue() -
((Integer)stack[top + 1]).intValue());
}
}
| {
"content_hash": "35e3e92b44945cb7b38247949ff91824",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 70,
"avg_line_length": 17.36,
"alnum_prop": 0.5506912442396313,
"repo_name": "cybersonic/org.cfeclipse.cfml",
"id": "a1a701b147186b5b8b432aaa1a0422bda232c68b",
"size": "1916",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/org/cfeclipse/cfml/parser/cfscript/ASTSubtractNode.java",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
module Hashrocket
class Wireframe < Struct.new(:path)
class_attribute :excludes
def self.files
Dir.glob('app/views/ui/*.html.haml')
end
def self.all
files.sort.map(&instantize).extend(Filter)
end
def self.instantize(*args)
method(:new)
end
def self.cleaned
all.filter(excludes)
end
def name
File.basename(path,'.html.haml')
end
module Excludes
def excludes
Wireframe.excludes ||= []
end
def exclude(*args)
excludes.push(*args)
end
end
module Filter
def pass?(rule, filename)
if rule.respond_to? :call
!rule[filename]
else
filename != rule
end
end
def filter(rules)
select do |wireframe|
rules.all? do |rule|
pass?(rule, wireframe.name)
end
end
end
end
end
end
| {
"content_hash": "83f5822a560d4dcfb3bfba1f6590880c",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 48,
"avg_line_length": 17.339622641509433,
"alnum_prop": 0.5462459194776932,
"repo_name": "hashrocket/hashrocket-rails",
"id": "ceee21d81ba14a5f3d35f35a0ba7028f7a43d100",
"size": "919",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/hashrocket/wireframe.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "4331"
}
],
"symlink_target": ""
} |
package aux;
import java.awt.*;
public class ImageCanvas extends Canvas {
private Image image;
public ImageCanvas(Image image) {
this.image = image;
}
public void paint(Graphics graphics) {
graphics.drawImage(image, 0, 0, this);
}
public void update(Graphics graphics) {
paint(graphics);
}
public Dimension minimumSize() {
int w = image.getWidth(null);
int h = image.getHeight(null);
if (w == -1 || h == -1)
return new Dimension(0,0);
return new Dimension(w, h);
}
public Dimension preferredSize() {
return minimumSize();
}
}
| {
"content_hash": "89ad5207239d1a724035fe28c2d519f1",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 43,
"avg_line_length": 18.060606060606062,
"alnum_prop": 0.6375838926174496,
"repo_name": "BartMassey/java-aux",
"id": "011a5a038881f3b1157a96aa97d21303e2d898b7",
"size": "814",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ImageCanvas.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "33618"
}
],
"symlink_target": ""
} |
using System;
namespace iOS4Unity
{
public class NSObject : IDisposable
{
private static readonly IntPtr _classHandle;
static NSObject()
{
_classHandle = ObjC.GetClass("NSObject");
}
public virtual IntPtr ClassHandle
{
get { return _classHandle; }
}
~NSObject()
{
Dispose();
}
public IntPtr Handle;
private readonly bool _shouldRelease;
public NSObject(IntPtr handle)
{
Handle = handle;
Runtime.RegisterNSObject(this);
}
public NSObject()
{
Handle = ObjC.MessageSendIntPtr(ClassHandle, "alloc");
Runtime.RegisterNSObject(this);
_shouldRelease = true;
}
public string Description
{
get { return ObjC.MessageSendString(Handle, "description"); }
}
public override string ToString()
{
return Description;
}
public virtual void Dispose()
{
GC.SuppressFinalize(this);
if (Handle != IntPtr.Zero)
{
Runtime.UnregisterNSObject(Handle);
Callbacks.UnsubscribeAll(this);
if (_shouldRelease)
{
ObjC.MessageSend(Handle, "release");
}
}
}
}
} | {
"content_hash": "b2de416610efab51c4c1528f9a77df90",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 73,
"avg_line_length": 22.06153846153846,
"alnum_prop": 0.4902370990237099,
"repo_name": "Hitcents/iOS4Unity",
"id": "2dfdad69433384df609ba1a1758cd873ba5087de",
"size": "1434",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/iOS4Unity/NSObject.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "1410660"
},
{
"name": "F#",
"bytes": "2588"
},
{
"name": "Shell",
"bytes": "146"
}
],
"symlink_target": ""
} |
namespace Google.Cloud.Firestore.Admin.V1.Snippets
{
// [START firestore_v1_generated_FirestoreAdmin_GetIndex_sync_flattened]
using Google.Cloud.Firestore.Admin.V1;
public sealed partial class GeneratedFirestoreAdminClientSnippets
{
/// <summary>Snippet for GetIndex</summary>
/// <remarks>
/// This snippet has been automatically generated for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </remarks>
public void GetIndex()
{
// Create client
FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/databases/[DATABASE]/collectionGroups/[COLLECTION]/indexes/[INDEX]";
// Make the request
Index response = firestoreAdminClient.GetIndex(name);
}
}
// [END firestore_v1_generated_FirestoreAdmin_GetIndex_sync_flattened]
}
| {
"content_hash": "1d3362bf4312fa259b5ccf3b102a832a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 114,
"avg_line_length": 42.333333333333336,
"alnum_prop": 0.6663385826771654,
"repo_name": "jskeet/google-cloud-dotnet",
"id": "7a669944bb4f74a0b7f441aa15db238e6d423f2a",
"size": "1638",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "apis/Google.Cloud.Firestore.Admin.V1/Google.Cloud.Firestore.Admin.V1.GeneratedSnippets/FirestoreAdminClient.GetIndexSnippet.g.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "767"
},
{
"name": "C#",
"bytes": "268415427"
},
{
"name": "CSS",
"bytes": "1346"
},
{
"name": "Dockerfile",
"bytes": "3173"
},
{
"name": "HTML",
"bytes": "3823"
},
{
"name": "JavaScript",
"bytes": "226"
},
{
"name": "PowerShell",
"bytes": "3303"
},
{
"name": "Python",
"bytes": "2744"
},
{
"name": "Shell",
"bytes": "65260"
},
{
"name": "sed",
"bytes": "1030"
}
],
"symlink_target": ""
} |
title: Can I apply as an individual, not as an organization?
published: True
tags: [small_grants_fund]
categories: [faqs]
layout: post
---
<div class="content">
<p>No. Unfortunately, only organizations are eligible to apply.</p>
</div> | {
"content_hash": "577c0a9f16514f0ba903021846bc0da6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 68,
"avg_line_length": 26.22222222222222,
"alnum_prop": 0.7330508474576272,
"repo_name": "Vizzuality/gfw-howto",
"id": "ee86dac722b70536ea12a5f1765c8bf57262df3c",
"size": "240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/01-01-01-faq-sgf-can-i-apply-as-an-individual-not-as-an-organization.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "96914"
},
{
"name": "HTML",
"bytes": "73918"
},
{
"name": "JavaScript",
"bytes": "84091"
},
{
"name": "Ruby",
"bytes": "5903"
}
],
"symlink_target": ""
} |
namespace blink {
CSSAtRuleID CssAtRuleID(StringView name) {
if (EqualIgnoringASCIICase(name, "charset"))
return kCSSAtRuleCharset;
if (EqualIgnoringASCIICase(name, "font-face"))
return kCSSAtRuleFontFace;
if (EqualIgnoringASCIICase(name, "import"))
return kCSSAtRuleImport;
if (EqualIgnoringASCIICase(name, "keyframes"))
return kCSSAtRuleKeyframes;
if (EqualIgnoringASCIICase(name, "layer")) {
if (RuntimeEnabledFeatures::CSSCascadeLayersEnabled())
return kCSSAtRuleLayer;
return kCSSAtRuleInvalid;
}
if (EqualIgnoringASCIICase(name, "media"))
return kCSSAtRuleMedia;
if (EqualIgnoringASCIICase(name, "namespace"))
return kCSSAtRuleNamespace;
if (EqualIgnoringASCIICase(name, "page"))
return kCSSAtRulePage;
if (EqualIgnoringASCIICase(name, "property"))
return kCSSAtRuleProperty;
if (EqualIgnoringASCIICase(name, "container")) {
if (RuntimeEnabledFeatures::CSSContainerQueriesEnabled())
return kCSSAtRuleContainer;
return kCSSAtRuleInvalid;
}
if (EqualIgnoringASCIICase(name, "counter-style"))
return kCSSAtRuleCounterStyle;
if (EqualIgnoringASCIICase(name, "scroll-timeline")) {
if (RuntimeEnabledFeatures::CSSScrollTimelineEnabled())
return kCSSAtRuleScrollTimeline;
return kCSSAtRuleInvalid;
}
if (EqualIgnoringASCIICase(name, "supports"))
return kCSSAtRuleSupports;
if (EqualIgnoringASCIICase(name, "viewport"))
return kCSSAtRuleViewport;
if (EqualIgnoringASCIICase(name, "-webkit-keyframes"))
return kCSSAtRuleWebkitKeyframes;
return kCSSAtRuleInvalid;
}
void CountAtRule(const CSSParserContext* context, CSSAtRuleID rule_id) {
WebFeature feature;
switch (rule_id) {
case kCSSAtRuleCharset:
feature = WebFeature::kCSSAtRuleCharset;
break;
case kCSSAtRuleFontFace:
feature = WebFeature::kCSSAtRuleFontFace;
break;
case kCSSAtRuleImport:
feature = WebFeature::kCSSAtRuleImport;
break;
case kCSSAtRuleKeyframes:
feature = WebFeature::kCSSAtRuleKeyframes;
break;
case kCSSAtRuleLayer:
feature = WebFeature::kCSSCascadeLayers;
break;
case kCSSAtRuleMedia:
feature = WebFeature::kCSSAtRuleMedia;
break;
case kCSSAtRuleNamespace:
feature = WebFeature::kCSSAtRuleNamespace;
break;
case kCSSAtRulePage:
feature = WebFeature::kCSSAtRulePage;
break;
case kCSSAtRuleProperty:
feature = WebFeature::kCSSAtRuleProperty;
break;
case kCSSAtRuleContainer:
// TODO(crbug.com/1145970): Add use-counter.
return;
case kCSSAtRuleCounterStyle:
feature = WebFeature::kCSSAtRuleCounterStyle;
break;
case kCSSAtRuleScrollTimeline:
feature = WebFeature::kCSSAtRuleScrollTimeline;
break;
case kCSSAtRuleSupports:
feature = WebFeature::kCSSAtRuleSupports;
break;
case kCSSAtRuleViewport:
feature = WebFeature::kCSSAtRuleViewport;
break;
case kCSSAtRuleWebkitKeyframes:
feature = WebFeature::kCSSAtRuleWebkitKeyframes;
break;
case kCSSAtRuleInvalid:
// fallthrough
default:
NOTREACHED();
return;
}
context->Count(feature);
}
} // namespace blink
| {
"content_hash": "7c9a2158a1e67bf595a797f4ffe243be",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 72,
"avg_line_length": 30.471698113207548,
"alnum_prop": 0.7185758513931888,
"repo_name": "ric2b/Vivaldi-browser",
"id": "d58b26111d42647c0599fc1daedf718723986d93",
"size": "3684",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chromium/third_party/blink/renderer/core/css/parser/css_at_rule_id.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"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_75) on Sat May 16 22:22:27 CEST 2015 -->
<title>Cassandra.AsyncProcessor.execute_prepared_cql_query</title>
<meta name="date" content="2015-05-16">
<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="Cassandra.AsyncProcessor.execute_prepared_cql_query";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_cql3_query.html" title="class in org.apache.cassandra.thrift"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql3_query.html" title="class in org.apache.cassandra.thrift"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html" target="_top">Frames</a></li>
<li><a href="Cassandra.AsyncProcessor.execute_prepared_cql_query.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.cassandra.thrift</div>
<h2 title="Class Cassandra.AsyncProcessor.execute_prepared_cql_query" class="title">Class Cassandra.AsyncProcessor.execute_prepared_cql_query<I extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>></h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.thrift.AsyncProcessFunction<I,<a href="../../../../org/apache/cassandra/thrift/Cassandra.execute_prepared_cql_query_args.html" title="class in org.apache.cassandra.thrift">Cassandra.execute_prepared_cql_query_args</a>,<a href="../../../../org/apache/cassandra/thrift/CqlResult.html" title="class in org.apache.cassandra.thrift">CqlResult</a>></li>
<li>
<ul class="inheritance">
<li>org.apache.cassandra.thrift.Cassandra.AsyncProcessor.execute_prepared_cql_query<I></li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Enclosing class:</dt>
<dd><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.html" title="class in org.apache.cassandra.thrift">Cassandra.AsyncProcessor</a><<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.html" title="type parameter in Cassandra.AsyncProcessor">I</a> extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>></dd>
</dl>
<hr>
<br>
<pre>public static class <span class="strong">Cassandra.AsyncProcessor.execute_prepared_cql_query<I extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>></span>
extends org.apache.thrift.AsyncProcessFunction<I,<a href="../../../../org/apache/cassandra/thrift/Cassandra.execute_prepared_cql_query_args.html" title="class in org.apache.cassandra.thrift">Cassandra.execute_prepared_cql_query_args</a>,<a href="../../../../org/apache/cassandra/thrift/CqlResult.html" title="class in org.apache.cassandra.thrift">CqlResult</a>></pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html#Cassandra.AsyncProcessor.execute_prepared_cql_query()">Cassandra.AsyncProcessor.execute_prepared_cql_query</a></strong>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../org/apache/cassandra/thrift/Cassandra.execute_prepared_cql_query_args.html" title="class in org.apache.cassandra.thrift">Cassandra.execute_prepared_cql_query_args</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html#getEmptyArgsInstance()">getEmptyArgsInstance</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>org.apache.thrift.async.AsyncMethodCallback<<a href="../../../../org/apache/cassandra/thrift/CqlResult.html" title="class in org.apache.cassandra.thrift">CqlResult</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html#getResultHandler(org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer,%20int)">getResultHandler</a></strong>(org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb,
int seqid)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html#isOneway()">isOneway</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html#start(I,%20org.apache.cassandra.thrift.Cassandra.execute_prepared_cql_query_args,%20org.apache.thrift.async.AsyncMethodCallback)">start</a></strong>(<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html" title="type parameter in Cassandra.AsyncProcessor.execute_prepared_cql_query">I</a> iface,
<a href="../../../../org/apache/cassandra/thrift/Cassandra.execute_prepared_cql_query_args.html" title="class in org.apache.cassandra.thrift">Cassandra.execute_prepared_cql_query_args</a> args,
org.apache.thrift.async.AsyncMethodCallback<<a href="../../../../org/apache/cassandra/thrift/CqlResult.html" title="class in org.apache.cassandra.thrift">CqlResult</a>> resultHandler)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.thrift.AsyncProcessFunction">
<!-- -->
</a>
<h3>Methods inherited from class org.apache.thrift.AsyncProcessFunction</h3>
<code>getMethodName, sendResponse</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="Cassandra.AsyncProcessor.execute_prepared_cql_query()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Cassandra.AsyncProcessor.execute_prepared_cql_query</h4>
<pre>public Cassandra.AsyncProcessor.execute_prepared_cql_query()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getEmptyArgsInstance()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEmptyArgsInstance</h4>
<pre>public <a href="../../../../org/apache/cassandra/thrift/Cassandra.execute_prepared_cql_query_args.html" title="class in org.apache.cassandra.thrift">Cassandra.execute_prepared_cql_query_args</a> getEmptyArgsInstance()</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code>getEmptyArgsInstance</code> in class <code>org.apache.thrift.AsyncProcessFunction<<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html" title="type parameter in Cassandra.AsyncProcessor.execute_prepared_cql_query">I</a> extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>,<a href="../../../../org/apache/cassandra/thrift/Cassandra.execute_prepared_cql_query_args.html" title="class in org.apache.cassandra.thrift">Cassandra.execute_prepared_cql_query_args</a>,<a href="../../../../org/apache/cassandra/thrift/CqlResult.html" title="class in org.apache.cassandra.thrift">CqlResult</a>></code></dd>
</dl>
</li>
</ul>
<a name="getResultHandler(org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getResultHandler</h4>
<pre>public org.apache.thrift.async.AsyncMethodCallback<<a href="../../../../org/apache/cassandra/thrift/CqlResult.html" title="class in org.apache.cassandra.thrift">CqlResult</a>> getResultHandler(org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb,
int seqid)</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code>getResultHandler</code> in class <code>org.apache.thrift.AsyncProcessFunction<<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html" title="type parameter in Cassandra.AsyncProcessor.execute_prepared_cql_query">I</a> extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>,<a href="../../../../org/apache/cassandra/thrift/Cassandra.execute_prepared_cql_query_args.html" title="class in org.apache.cassandra.thrift">Cassandra.execute_prepared_cql_query_args</a>,<a href="../../../../org/apache/cassandra/thrift/CqlResult.html" title="class in org.apache.cassandra.thrift">CqlResult</a>></code></dd>
</dl>
</li>
</ul>
<a name="isOneway()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isOneway</h4>
<pre>protected boolean isOneway()</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code>isOneway</code> in class <code>org.apache.thrift.AsyncProcessFunction<<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html" title="type parameter in Cassandra.AsyncProcessor.execute_prepared_cql_query">I</a> extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>,<a href="../../../../org/apache/cassandra/thrift/Cassandra.execute_prepared_cql_query_args.html" title="class in org.apache.cassandra.thrift">Cassandra.execute_prepared_cql_query_args</a>,<a href="../../../../org/apache/cassandra/thrift/CqlResult.html" title="class in org.apache.cassandra.thrift">CqlResult</a>></code></dd>
</dl>
</li>
</ul>
<a name="start(org.apache.cassandra.thrift.Cassandra.AsyncIface,org.apache.cassandra.thrift.Cassandra.execute_prepared_cql_query_args,org.apache.thrift.async.AsyncMethodCallback)">
<!-- -->
</a><a name="start(I, org.apache.cassandra.thrift.Cassandra.execute_prepared_cql_query_args, org.apache.thrift.async.AsyncMethodCallback)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>start</h4>
<pre>public void start(<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html" title="type parameter in Cassandra.AsyncProcessor.execute_prepared_cql_query">I</a> iface,
<a href="../../../../org/apache/cassandra/thrift/Cassandra.execute_prepared_cql_query_args.html" title="class in org.apache.cassandra.thrift">Cassandra.execute_prepared_cql_query_args</a> args,
org.apache.thrift.async.AsyncMethodCallback<<a href="../../../../org/apache/cassandra/thrift/CqlResult.html" title="class in org.apache.cassandra.thrift">CqlResult</a>> resultHandler)
throws org.apache.thrift.TException</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code>start</code> in class <code>org.apache.thrift.AsyncProcessFunction<<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html" title="type parameter in Cassandra.AsyncProcessor.execute_prepared_cql_query">I</a> extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>,<a href="../../../../org/apache/cassandra/thrift/Cassandra.execute_prepared_cql_query_args.html" title="class in org.apache.cassandra.thrift">Cassandra.execute_prepared_cql_query_args</a>,<a href="../../../../org/apache/cassandra/thrift/CqlResult.html" title="class in org.apache.cassandra.thrift">CqlResult</a>></code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>org.apache.thrift.TException</code></dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_cql3_query.html" title="class in org.apache.cassandra.thrift"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql3_query.html" title="class in org.apache.cassandra.thrift"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html" target="_top">Frames</a></li>
<li><a href="Cassandra.AsyncProcessor.execute_prepared_cql_query.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "2b0f17187c76a54aef4f6b689de5295a",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 781,
"avg_line_length": 55.01194029850746,
"alnum_prop": 0.6924412610559444,
"repo_name": "sayanh/ViewMaintenanceCassandra",
"id": "7ee04374294a91bed675ee674d1e2ea88855c56c",
"size": "18429",
"binary": false,
"copies": "1",
"ref": "refs/heads/trunk",
"path": "doc/org/apache/cassandra/thrift/Cassandra.AsyncProcessor.execute_prepared_cql_query.html",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "801"
},
{
"name": "Batchfile",
"bytes": "21834"
},
{
"name": "GAP",
"bytes": "62279"
},
{
"name": "Java",
"bytes": "10347352"
},
{
"name": "PowerShell",
"bytes": "39438"
},
{
"name": "Python",
"bytes": "314996"
},
{
"name": "Shell",
"bytes": "50026"
},
{
"name": "Thrift",
"bytes": "40282"
}
],
"symlink_target": ""
} |
<!--<script id="tpl-inftbl" type="text/x-handlebars-template">
<div class="mod mod-playerinfotable skin-playerinfotable-{{playerName}}">
<div class="col l6 push-l1 infos">
<div class="flat-table js-flat-table">
{{#each playerData}}
<div class="info-table-css">{{this}}</div>
{{/each}}
</div>
</div>
</div>
</script>!--> | {
"content_hash": "df51f82a1e675bd6b5e80bcd3e3d11f7",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 74,
"avg_line_length": 29.5,
"alnum_prop": 0.6045197740112994,
"repo_name": "dfernandesnamics/spielerstatistik",
"id": "8496f826e1c349286445c043b314bd046413034b",
"size": "354",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/modules/playerprofile-wrapper/block-template-infotable.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "1503"
},
{
"name": "CSS",
"bytes": "166785"
},
{
"name": "HTML",
"bytes": "24838"
},
{
"name": "JavaScript",
"bytes": "507130"
},
{
"name": "PHP",
"bytes": "737926"
}
],
"symlink_target": ""
} |
#include "../../include/regui/private/REXMLSerializableReader.h"
#if 0
#if defined(__RE_USING_ADITIONAL_TINYXML_LIBRARY__)
#include "../addlibs/tinyxml.h"
using namespace tinyxml2;
#elif defined(__RE_USING_SYSTEM_TINYXML_LIBRARY__)
#include <tinyxml.h>
#else
#define __RE_NO_XML_PARSER_PRIVATE__
#endif
REBOOL REXMLSerializableReader::ParseObject(void * objectElement, REGUIObject * obj, REGUIObject * fromCallBack)
{
#ifndef __RE_NO_XML_PARSER_PRIVATE__
XMLElement * element = (XMLElement *)objectElement;
for (XMLElement * childElem = element->FirstChildElement(); childElem != NULL; childElem = childElem->NextSiblingElement())
{
const char * nodeValue = childElem->Value();
if (nodeValue)
{
if (strcmp(nodeValue, "object") == 0)
{
const char * className = NULL;
const char * key = NULL;
for (const XMLAttribute * attrib = childElem->FirstAttribute(); attrib != NULL; attrib = attrib->Next())
{
const char * name = attrib->Name();
if (name)
{
if (strcmp(name, "class") == 0)
{
className = attrib->Value();
}
else if (strcmp(name, "key") == 0)
{
key = attrib->Value();
}
}
_processedElementsCount++;
}
REGUIObject * newObject = _callBack.CreateNewObject(_controller, className, key);
if (newObject)
{
REBOOL isAccepted = false;
//REGUIObject * xmlSerializable = newObject->GetCasted<IREXMLSerializable>();
//if (xmlSerializable)
//{
newObject->onPrepareGUIObjectForSetuping();
this->ParseObject(childElem, newObject, newObject);
isAccepted = obj->acceptObjectParameter(className, key, newObject);
newObject->onSetupingGUIObjectFinished(isAccepted);
//}
if (!isAccepted)
{
newObject->release();
}
}
else
{
return false;
}
}
else
{
const char * key = NULL;
for (const XMLAttribute * attrib = childElem->FirstAttribute(); attrib != NULL; attrib = attrib->Next())
{
const char * name = attrib->Name();
if (name)
{
if (strcmp(name, "key") == 0)
{
key = attrib->Value();
}
}
_processedElementsCount++;
}
if (key)
{
const char * value = childElem->GetText();
if (value)
{
if (strcmp(nodeValue, "property") == 0)
{
IREObjectProperty * prop = obj->getPropertyForKey(key);
if (prop)
{
int propIdentif = 0;
if (sscanf(value, "%i", &propIdentif) == 1)
{
REXMLSerializableReader::PropertyStruct newStruct;
newStruct.property = prop;
newStruct.editorid = (REInt32)propIdentif;
_properties.add(newStruct);
}
}
}
else if (strcmp(key, "editorid") == 0)
{
int propIdentif = 0;
if (sscanf(value, "%i", &propIdentif) == 1)
{
for (REUInt32 i = 0; i < _properties.count(); i++)
{
if (_properties[i].editorid == (REInt32)propIdentif)
{
IREObjectProperty * prop = _properties[i].property;
prop->setObject(fromCallBack);
_properties.removeAt(i);
break;
}
}
}
}
else
{
obj->acceptStringParameter(key, value);
}
}
}
}
_processedElementsCount++;
}
}
#endif
return true;
}
REUInt32 REXMLSerializableReader::CalculateElements(void * objectElement)
{
REUInt32 count = 0;
#ifndef __RE_NO_XML_PARSER_PRIVATE__
XMLElement * element = (XMLElement *)objectElement;
for (XMLElement * childElem = element->FirstChildElement(); childElem != NULL; childElem = childElem->NextSiblingElement())
{
const char * nodeValue = childElem->Value();
if (nodeValue)
{
for (const XMLAttribute * attrib = childElem->FirstAttribute(); attrib != NULL; attrib = attrib->Next())
{
count++;
}
if (strcmp(nodeValue, "object") == 0)
{
count += this->CalculateElements(childElem);
}
count++;
}
}
#endif
return count;
}
const REFloat32 REXMLSerializableReader::GetProgress() const
{
#ifndef __RE_NO_XML_PARSER_PRIVATE__
if (_totalElementsCount)
{
return ((REFloat32)_processedElementsCount / (REFloat32)_totalElementsCount);
}
#endif
return 0.0f;
}
REBOOL REXMLSerializableReader::Read(const REString & xmlString)
{
#ifndef __RE_NO_XML_PARSER_PRIVATE__
_totalElementsCount = 0;
_processedElementsCount = 0;
_isError = false;
if (_controller && _callBack.CreateNewObject)
{
XMLDocument doc;
doc.Parse(xmlString.UTF8String());
if (doc.Error()) { return false; }
XMLElement * root = doc.RootElement();
if (root == NULL) { return false; }
const char * rootVal = root->Value();
if (rootVal)
{
if (strcmp(rootVal, "viewcontroller") == 0)
{
_totalElementsCount = this->CalculateElements(root);
#if 0
if ( this->ParseObject(root, _controller, _controller) )
{
return true;
}
#endif
_isError = true;
}
}
}
#endif
return false;
}
REXMLSerializableReader::REXMLSerializableReader(REGUIObject * (CreateNewObject)(REViewController *, const char *, const char *), REViewController * controller) :
_controller(NULL),
_totalElementsCount(0),
_processedElementsCount(0),
_isError(false)
{
#ifndef __RE_NO_XML_PARSER_PRIVATE__
_controller = controller;
_callBack.CreateNewObject = CreateNewObject;
#endif
}
REXMLSerializableReader::~REXMLSerializableReader()
{
}
#endif
| {
"content_hash": "d27d548835616f77c2c3b4812e841d0d",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 162,
"avg_line_length": 23.930131004366814,
"alnum_prop": 0.6151459854014598,
"repo_name": "OlehKulykov/re-sdk",
"id": "71daf99b643ff96d3815bca9dba50f9999d9bdc7",
"size": "6102",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/gui/REXMLSerializableReader.cpp",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "24942"
},
{
"name": "C",
"bytes": "32671921"
},
{
"name": "C++",
"bytes": "3014808"
},
{
"name": "CSS",
"bytes": "31514"
},
{
"name": "JavaScript",
"bytes": "864893"
},
{
"name": "Objective-C",
"bytes": "179780"
},
{
"name": "Perl",
"bytes": "9062"
},
{
"name": "Python",
"bytes": "518736"
},
{
"name": "Shell",
"bytes": "927399"
},
{
"name": "Smalltalk",
"bytes": "30276"
}
],
"symlink_target": ""
} |
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
requries: [
'Rally.ui.tree.TreeGrid'
],
items:[
{ xtype: 'container',
itemId: 'header',
layout: 'column',
items: [ {
xtype: 'container',
itemId: 'selectorBox'
},
{
xtype: 'container',
itemId: 'disableBox'
},
{
xtype: 'container',
itemId: 'notBox'
},
{
xtype: 'container',
itemId: 'buttonBox'
}
]
},
{ xtype: 'container',
itemId: 'body'
}
],
storyGrid: null,
fieldName: "c_ActualReleaseNumber",
fieldTitle: "Actual Release Number",
_updateGrid: function(app) {
if ( app.storyGrid !== null) {
app.storyGrid.destroy();
}
app._createGrid(app,
app.down('#fieldSelector').getValue(),
app.down('#releaseSelector').getValue(),
app.down('#stateSelector').getValue()
);
},
_createFilter: function(app) {
//Create a blank filter array and add objects (with properties) according to the checkboxes
var filters = [];
if (Ext.getCmp('releaseFilterDisable').getValue() === false)
{
var releasefilter = Ext.create('Rally.data.wsapi.Filter',{
property: 'Release.ObjectID',
operator: app.down('#releaseNot').getValue() ? '!=' : '=',
value: Rally.util.Ref.getOidFromRef(app.down('#releaseSelector').getValue())
});
filters.push(releasefilter);
}
if (Ext.getCmp('fieldFilterDisable').getValue() === false)
{
var fieldfilter = Ext.create('Rally.data.wsapi.Filter',{
property: app.fieldName,
operator: app.down('#fieldNot').getValue() ? '!=' : '=',
value: app.down('#fieldSelector').getValue()
});
filters.push(fieldfilter);
}
if (Ext.getCmp('stateFilterDisable').getValue() === false)
{
var statefilter = Ext.create('Rally.data.wsapi.Filter',{
property: 'ScheduleState',
operator: app.down('#stateNot').getValue() ? '!=' : '=',
value: app.down('#stateSelector').getValue()
});
filters.push(statefilter);
}
return filters;
},
_createCfg: function(app) {
//Create a blank filter array and add objects (with properties) according to the checkboxes
var colCfgs =
[
{
text: 'ID',
dataIndex: 'FormattedID'
},
{
text: 'Title',
dataIndex: 'Name',
flex: 1
}
];
if (Ext.getCmp('releaseFilterDisable').getValue() === true)
{
var releaseClm = {
text: 'Release',
dataIndex: 'Release.Name'
};
colCfgs.push(releaseClm);
}
if (Ext.getCmp('fieldFilterDisable').getValue() === true)
{
var fieldClm = {
text: app.fieldTitle,
dataIndex: app.fieldName
};
colCfgs.push(fieldClm);
}
if (Ext.getCmp('stateFilterDisable').getValue() === true)
{
var stateClm = {
text: 'Schedule State',
dataIndex: 'ScheduleState'
};
colCfgs.push(stateClm);
}
return colCfgs;
},
_createGrid: function (app, fieldValue, releaseValue, stateValue){
app.storyGrid = Ext.create('Rally.ui.grid.Grid', {
//We will rely on the default 'fetch' settings
autoLoad: false,
models: [ 'User Story', 'Defect'],
storeConfig: {
filters:[]
},
columnCfgs: [
{
text: 'ID',
dataIndex: 'FormattedID'
},
{
text: 'Title',
dataIndex: 'Name'
},
{
text: 'State',
dataIndex: 'ScheduleState'
}
]
});
// Now re-add the filter
var store = app.storyGrid.getStore();
store.clearFilter(true);
store.filter(app._createFilter(app));
// Reset the columnCfgs of the grid
//debugger;
// var colCfgs = app._createCfg(app);
// for (var j = 0; j < colCfgs.length ; j++) {
// app.storyGrid.setColumnCfgs(colCfgs);
// }
//Add listeners to change onto dropdowns. To keep the code simple,
// I am not going to pass the value, but refetch it.
// Ext.getCmp('releaseSelector').on( {
// change: function(thing, value){
// app._updateGrid(app);
// }
// });
//
// Ext.getCmp('fieldSelector').on( {
// change: function(thing, value){
// app._updateGrid(app);
// }
// });
//
// Ext.getCmp('stateSelector').on( {
// change: function(thing, value){
// app._updateGrid(app);
// }
// });
app.down('#body').add(app.storyGrid);
},
launch: function() {
var app = this;
//Cascade the creation of comboboxes so that we keep the code simple
var releaseSelector = Ext.create('Rally.ui.combobox.ReleaseComboBox', {
fieldLabel: 'Rally Release: ',
allowNoEntry: true,
id: 'releaseSelector',
listeners: {
ready: function(thing, value){
app.doFieldSelector(app, value);
}
}
});
var disableSelector = Ext.create('Ext.container.Container', {
items: [
{
xtype: 'fieldcontainer',
fieldLabel: 'Filter Disable',
defaultType: 'checkboxfield',
items: [
{
boxLabel: 'Release',
name: 'all',
inputValue: '1',
id: 'releaseFilterDisable'
},
{
boxLabel: app.fieldTitle,
name: 'field',
inputValue: '2',
id: 'fieldFilterDisable'
},
{
boxLabel: 'State',
name: 'state',
inputValue: '1',
id: 'stateFilterDisable'
}
]
}
]
});
var notSelector = Ext.create('Ext.container.Container', {
items: [
{
xtype: 'fieldcontainer',
fieldLabel: 'Apply Inverse Filter',
defaultType: 'checkboxfield',
items: [
{
boxLabel: 'Release',
name: 'all',
inputValue: '1',
id: 'releaseNot'
},
{
boxLabel: app.fieldTitle,
name: 'field',
inputValue: '2',
id: 'fieldNot'
},
{
boxLabel: 'State',
name: 'state',
inputValue: '1',
id: 'stateNot'
}
]
}
]
});
var goButton = Ext.create('Ext.Button', {
text: 'Run Query',
handler: function() { app._updateGrid(app); }
});
this.down('#selectorBox').add(releaseSelector);
this.down('#disableBox').add(disableSelector);
this.down('#notBox').add(notSelector);
this.down('#buttonBox').add(goButton);
},
doFieldSelector: function(app, releaseValue) {
var fieldSelector = Ext.create('Rally.ui.combobox.FieldValueComboBox', {
fieldLabel: app.fieldTitle + ": ",
allowNoEntry: true,
allowBlank: true,
autoScroll: true,
autoExpand: true,
anyMatch: true,
id: 'fieldSelector',
model: 'UserStory',
field: app.fieldName,
listeners: {
ready: function(thing, fieldValue){
app.doStateSelector(app, fieldValue, releaseValue);
}
}
});
this.down('#selectorBox').add(fieldSelector);
},
doStateSelector: function(app, fieldValue, releaseValue) {
var stateSelector = Ext.create('Rally.ui.combobox.FieldValueComboBox', {
fieldLabel: 'Current State: ',
allowBlank: true,
allowNoEntry: true,
autoScroll: true,
autoExpand: true,
anyMatch: true,
id: 'stateSelector',
model: 'UserStory',
field: 'ScheduleState',
listeners: {
ready: function(thing, stateValue){
app._createGrid(app, fieldValue, releaseValue, stateValue);
}
}
});
this.down('#selectorBox').add(stateSelector);
}
});
| {
"content_hash": "df1bc3926508bd99c21821b076dea4ea",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 99,
"avg_line_length": 32.87683284457478,
"alnum_prop": 0.3773080010703773,
"repo_name": "nikantonelli/StoriesFilteredByActualRelease",
"id": "18107520f16fe41fad6afd319bf889c94444ba43",
"size": "11337",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "App.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "40"
},
{
"name": "JavaScript",
"bytes": "11337"
}
],
"symlink_target": ""
} |
class DropTokenExpirations < ActiveRecord::Migration[5.1]
def change
drop_table :token_expirations do |t|
t.string :sub
t.integer :exp
t.string :jti
t.datetime :created_at, null: false
t.datetime :updated_at, null: false
end
end
end
| {
"content_hash": "01ee7738d35787aa82d8c605954828e5",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 57,
"avg_line_length": 23.416666666666668,
"alnum_prop": 0.6370106761565836,
"repo_name": "FarmBot/Farmbot-Web-API",
"id": "fe87936533f4ef92dacffddb482c698479996efa",
"size": "281",
"binary": false,
"copies": "3",
"ref": "refs/heads/soil_height",
"path": "db/migrate/20180328212540_drop_token_expirations.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "62380"
},
{
"name": "HTML",
"bytes": "28417"
},
{
"name": "JavaScript",
"bytes": "101562"
},
{
"name": "Ruby",
"bytes": "268353"
},
{
"name": "Shell",
"bytes": "610"
},
{
"name": "TypeScript",
"bytes": "604078"
}
],
"symlink_target": ""
} |
//
// ScottCounterEngine.h
// ScottCounter
//
// Created by Scott_Mr on 2017/3/16.
// Copyright © 2017年 Scott. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ScottCounterConst.h"
@interface ScottCounterEngine : NSObject
/**
类方法创建一个实例
*/
+ (instancetype)counterEngine;
/**
在指定时间内从 数字A -> 数字B
@param startNumber 开始数字
@param endNumber 结束数字
@param duration 时长
@param animationOption 动画类型
@param currentNumber 当前数字回调
@param completion 完成后回调
*/
- (void)fromNumber:(CGFloat)startNumber toNumber:(CGFloat)endNumber duration:(CFTimeInterval)duration animationOptions:(ScottCounterAnimationOptions)animationOption currentNumber:(ScottCurrentNumberBlock)currentNumber completion:(ScottCompletionBlock)completion;
@end
| {
"content_hash": "eec36b1c7a1be189d29f801249d0e440",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 262,
"avg_line_length": 22.393939393939394,
"alnum_prop": 0.7753721244925575,
"repo_name": "LZAscott/ScottCounter",
"id": "3385d053ab280c7089620dac3a7ec1501b3f3c3d",
"size": "832",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ScottCounter/ScottCounter/ScottCounterEngine.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "28762"
},
{
"name": "Ruby",
"bytes": "587"
}
],
"symlink_target": ""
} |
export default function() {
let synoAlbum = {
success:true,
data: {
items:[{
id:'id-album0001',
info: {
description:"description of id-album0001",
sharepath:"/",
name:"/",
title:"Accur Photo",
hits:null,
allow_comment:false,
type:"public",
conversion:true,
allow_embed:false
},
additional: {
album_sorting: {
sort_by:"filename",
sort_direction:"asc",
has_preference_sort:false
}
}
}]
}
};
this.passthrough('http://app.accur.cc/**');
this.get('/webapi/2albums', () => {
//return {data: [{type: 'albums', id: 'id-album0001', attributes: {info:'id-a-info0001',additional:'id-a-addinfo0001',somemsg:'somemsg-for-album'}}]};
return {
data: [{
info:{description:'desccccc',title:'tittttle',name:'nnaamme'},
additional:{album_sorting:'desccccc'},
somemsg:'somemsg-for-album'
}]
};
});
this.get('/webapi/albums', () => {
return {albums:synoAlbum.data.items};
});
this.get('/album-info', () => {
return {data: {type: 'album-info', id: 'id-a-info0001', attributes: {album:'id-album0001',description:'desccccc',title:'tittttle',name:'nnaamme'}}};
});
this.get('/album-additional-info', () => {
return {data: {type: 'album-additional-info', id: 'id-a-addinfo0001', attributes: {album:'id-album0001',album_sorting:'desccccc'}}};
});
this.get('/album.php', () => {
return {data: [{somemsg:'somemsg-for-album'},{somemsg:'somemsg-for-album2222'}]};
});
this.passthrough();
}
| {
"content_hash": "2fc394033016d5443c76c24c8f0231fc",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 154,
"avg_line_length": 28.74137931034483,
"alnum_prop": 0.5470905818836233,
"repo_name": "toejiang/synology-dsm-gallery",
"id": "6b96917947b4d1dca773055c523844f06ab798b9",
"size": "1667",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mirage/config.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "14112"
},
{
"name": "HTML",
"bytes": "27831"
},
{
"name": "JavaScript",
"bytes": "128087"
},
{
"name": "PHP",
"bytes": "11269"
}
],
"symlink_target": ""
} |
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require __DIR__ . '/../vendor/autoload.php';
use Dwr\OpenWeather\Configuration;
use Dwr\OpenWeather\OpenWeather;
use Dwr\OpenWeather\Converter\Converter;
$apiKey = getenv('OPEN_WEATHER_API_KEY');
$openWeatherConfig = new Configuration($apiKey);
$city = 'Paris';
$openWeather = new OpenWeather('Weather', $openWeatherConfig);
$weather = $openWeather->getByCityName($city);
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DwrOpenWeather</title>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<link rel="stylesheet" href="css/chartist.min.css">
<link rel="stylesheet" href="css/weather-basic-large.css?v=1.0">
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<section class="ow-container">
<div class="ow-weather">
<header>
<div class="location"><span class="bold"><?php echo $weather->cityName() ?></span></div>
<div>
<div class="cell">
<img class="icon"
src="http://openweathermap.org/img/w/<?php echo $weather->icon() ?>.png"
alt="<?php echo $weather->description() ?>">
</div>
<div class="cell">
<span class="temperature"><?php echo Converter::kelvinToCelsius($weather->temp()) ?>°C</span>
</div>
</div>
</header>
<div class="tables">
<table class="left">
<tbody>
<tr>
<td>Location:</td>
<td><span class="bold"><?php echo $weather->cityName() ?></span>, <?php echo $weather->country() ?></td>
</tr>
<tr>
<td>Description:</td>
<td><?php echo $weather->description() ?></td>
</tr>
<tr>
<td>Temperature:</td>
<td><span class="blue-highlighted"><?php echo Converter::kelvinToCelsius($weather->temp()) ?> °C</span></td>
</tr>
<tr>
<td>Temperature Min:</td>
<td><?php echo Converter::kelvinToCelsius($weather->tempMin()) ?> °C</td>
</tr>
<tr>
<td>Temperature Max:</td>
<td><?php echo Converter::kelvinToCelsius($weather->tempMax()) ?> °C</td>
</tr>
</tbody>
</table>
<table class="right">
<tbody>
<tr>
<td>Pressure:</td>
<td><span class="green-highlighted"><?php echo $weather->pressure() ?> hPa</span></td>
</tr>
<tr>
<td>Wind:</td>
<td><?php echo $weather->windSpeed() ?> m/s</td>
</tr>
<tr>
<td>Humidity:</td>
<td><span class="orange-highlighted"><?php echo $weather->humidity() ?> %</span></td>
</tr>
<tr>
<td>Sunrise:</td>
<td><?php echo Converter::intToDate($weather->sunrise(), 'H:i:s') ?></td>
</tr>
<tr>
<td>Sunset:</td>
<td><?php echo Converter::intToDate($weather->sunset(), 'H:i:s') ?></td>
</tr>
<tr>
<td><span class="xsmall-font">Source datetime:</span></td>
<td><span class="xsmall-font bold"><?php echo Converter::intToDate($weather->dt(), 'd-m-Y (H:i)') ?></span></td>
</tr>
</tbody>
</table>
<div class="clear-both"></div>
</div>
</div>
</section>
</body>
</html>
| {
"content_hash": "a7eda818355eeda83dde5a1e0d312f22",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 132,
"avg_line_length": 37.60550458715596,
"alnum_prop": 0.4545010978287387,
"repo_name": "dariuszwrzesien/DwrOpenWeather",
"id": "2d3d090faec1a60710e00e5dcc12765acb52044b",
"size": "4099",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/weather-basic-large.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "28617"
}
],
"symlink_target": ""
} |
package client
const (
CONTAINER_TYPE = "container"
)
type Container struct {
Resource `yaml:"-"`
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"`
BlkioDeviceOptions map[string]interface{} `json:"blkioDeviceOptions,omitempty" yaml:"blkio_device_options,omitempty"`
BlkioWeight int64 `json:"blkioWeight,omitempty" yaml:"blkio_weight,omitempty"`
CapAdd []string `json:"capAdd,omitempty" yaml:"cap_add,omitempty"`
CapDrop []string `json:"capDrop,omitempty" yaml:"cap_drop,omitempty"`
CgroupParent string `json:"cgroupParent,omitempty" yaml:"cgroup_parent,omitempty"`
ClusterId string `json:"clusterId,omitempty" yaml:"cluster_id,omitempty"`
Command []string `json:"command,omitempty" yaml:"command,omitempty"`
Count int64 `json:"count,omitempty" yaml:"count,omitempty"`
CpuCount int64 `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"`
CpuPercent int64 `json:"cpuPercent,omitempty" yaml:"cpu_percent,omitempty"`
CpuPeriod int64 `json:"cpuPeriod,omitempty" yaml:"cpu_period,omitempty"`
CpuQuota int64 `json:"cpuQuota,omitempty" yaml:"cpu_quota,omitempty"`
CpuSetCpu string `json:"cpuSetCpu,omitempty" yaml:"cpu_set_cpu,omitempty"`
CpuSetMems string `json:"cpuSetMems,omitempty" yaml:"cpu_set_mems,omitempty"`
CpuShares int64 `json:"cpuShares,omitempty" yaml:"cpu_shares,omitempty"`
CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,omitempty"`
CreateOnly bool `json:"createOnly,omitempty" yaml:"create_only,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
DataVolumeMounts map[string]interface{} `json:"dataVolumeMounts,omitempty" yaml:"data_volume_mounts,omitempty"`
DataVolumes []string `json:"dataVolumes,omitempty" yaml:"data_volumes,omitempty"`
DataVolumesFrom []string `json:"dataVolumesFrom,omitempty" yaml:"data_volumes_from,omitempty"`
DependsOn []DependsOn `json:"dependsOn,omitempty" yaml:"depends_on,omitempty"`
DeploymentUnitId string `json:"deploymentUnitId,omitempty" yaml:"deployment_unit_id,omitempty"`
DeploymentUnitUuid string `json:"deploymentUnitUuid,omitempty" yaml:"deployment_unit_uuid,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Desired bool `json:"desired,omitempty" yaml:"desired,omitempty"`
Devices []string `json:"devices,omitempty" yaml:"devices,omitempty"`
DiskQuota int64 `json:"diskQuota,omitempty" yaml:"disk_quota,omitempty"`
Dns []string `json:"dns,omitempty" yaml:"dns,omitempty"`
DnsOpt []string `json:"dnsOpt,omitempty" yaml:"dns_opt,omitempty"`
DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"`
DomainName string `json:"domainName,omitempty" yaml:"domain_name,omitempty"`
EntryPoint []string `json:"entryPoint,omitempty" yaml:"entry_point,omitempty"`
Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"`
ExitCode int64 `json:"exitCode,omitempty" yaml:"exit_code,omitempty"`
Expose []string `json:"expose,omitempty" yaml:"expose,omitempty"`
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
ExtraHosts []string `json:"extraHosts,omitempty" yaml:"extra_hosts,omitempty"`
FirstRunning string `json:"firstRunning,omitempty" yaml:"first_running,omitempty"`
GroupAdd []string `json:"groupAdd,omitempty" yaml:"group_add,omitempty"`
HealthCheck *InstanceHealthCheck `json:"healthCheck,omitempty" yaml:"health_check,omitempty"`
HealthCmd []string `json:"healthCmd,omitempty" yaml:"health_cmd,omitempty"`
HealthInterval int64 `json:"healthInterval,omitempty" yaml:"health_interval,omitempty"`
HealthRetries int64 `json:"healthRetries,omitempty" yaml:"health_retries,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
HealthTimeout int64 `json:"healthTimeout,omitempty" yaml:"health_timeout,omitempty"`
HealthcheckStates []HealthcheckState `json:"healthcheckStates,omitempty" yaml:"healthcheck_states,omitempty"`
HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
Image string `json:"image,omitempty" yaml:"image,omitempty"`
ImageUuid string `json:"imageUuid,omitempty" yaml:"image_uuid,omitempty"`
InstanceLinks []Link `json:"instanceLinks,omitempty" yaml:"instance_links,omitempty"`
InstanceTriggeredStop string `json:"instanceTriggeredStop,omitempty" yaml:"instance_triggered_stop,omitempty"`
IoMaximumBandwidth int64 `json:"ioMaximumBandwidth,omitempty" yaml:"io_maximum_bandwidth,omitempty"`
IoMaximumIOps int64 `json:"ioMaximumIOps,omitempty" yaml:"io_maximum_iops,omitempty"`
Ip string `json:"ip,omitempty" yaml:"ip,omitempty"`
Ip6 string `json:"ip6,omitempty" yaml:"ip6,omitempty"`
IpcContainerId string `json:"ipcContainerId,omitempty" yaml:"ipc_container_id,omitempty"`
IpcMode string `json:"ipcMode,omitempty" yaml:"ipc_mode,omitempty"`
Isolation string `json:"isolation,omitempty" yaml:"isolation,omitempty"`
KernelMemory int64 `json:"kernelMemory,omitempty" yaml:"kernel_memory,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
LaunchConfigName string `json:"launchConfigName,omitempty" yaml:"launch_config_name,omitempty"`
LogConfig *LogConfig `json:"logConfig,omitempty" yaml:"log_config,omitempty"`
LxcConf map[string]string `json:"lxcConf,omitempty" yaml:"lxc_conf,omitempty"`
Memory int64 `json:"memory,omitempty" yaml:"memory,omitempty"`
MemoryReservation int64 `json:"memoryReservation,omitempty" yaml:"memory_reservation,omitempty"`
MemorySwap int64 `json:"memorySwap,omitempty" yaml:"memory_swap,omitempty"`
MemorySwappiness int64 `json:"memorySwappiness,omitempty" yaml:"memory_swappiness,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
MilliCpuReservation int64 `json:"milliCpuReservation,omitempty" yaml:"milli_cpu_reservation,omitempty"`
Mounts []MountEntry `json:"mounts,omitempty" yaml:"mounts,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
NativeContainer bool `json:"nativeContainer,omitempty" yaml:"native_container,omitempty"`
NetAlias []string `json:"netAlias,omitempty" yaml:"net_alias,omitempty"`
NetworkContainerId string `json:"networkContainerId,omitempty" yaml:"network_container_id,omitempty"`
NetworkIds []string `json:"networkIds,omitempty" yaml:"network_ids,omitempty"`
NetworkMode string `json:"networkMode,omitempty" yaml:"network_mode,omitempty"`
OomKillDisable bool `json:"oomKillDisable,omitempty" yaml:"oom_kill_disable,omitempty"`
OomScoreAdj int64 `json:"oomScoreAdj,omitempty" yaml:"oom_score_adj,omitempty"`
PidContainerId string `json:"pidContainerId,omitempty" yaml:"pid_container_id,omitempty"`
PidMode string `json:"pidMode,omitempty" yaml:"pid_mode,omitempty"`
PidsLimit int64 `json:"pidsLimit,omitempty" yaml:"pids_limit,omitempty"`
Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"`
PrePullOnUpgrade string `json:"prePullOnUpgrade,omitempty" yaml:"pre_pull_on_upgrade,omitempty"`
PrimaryIpAddress string `json:"primaryIpAddress,omitempty" yaml:"primary_ip_address,omitempty"`
PrimaryNetworkId string `json:"primaryNetworkId,omitempty" yaml:"primary_network_id,omitempty"`
Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"`
PublicEndpoints []PublicEndpoint `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"`
PublishAllPorts bool `json:"publishAllPorts,omitempty" yaml:"publish_all_ports,omitempty"`
ReadOnly bool `json:"readOnly,omitempty" yaml:"read_only,omitempty"`
RegistryCredentialId string `json:"registryCredentialId,omitempty" yaml:"registry_credential_id,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
RequestedHostId string `json:"requestedHostId,omitempty" yaml:"requested_host_id,omitempty"`
RequestedIpAddress string `json:"requestedIpAddress,omitempty" yaml:"requested_ip_address,omitempty"`
RestartPolicy *RestartPolicy `json:"restartPolicy,omitempty" yaml:"restart_policy,omitempty"`
RetainIp bool `json:"retainIp,omitempty" yaml:"retain_ip,omitempty"`
RevisionId string `json:"revisionId,omitempty" yaml:"revision_id,omitempty"`
Secrets []SecretReference `json:"secrets,omitempty" yaml:"secrets,omitempty"`
SecurityOpt []string `json:"securityOpt,omitempty" yaml:"security_opt,omitempty"`
ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"`
ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"`
ShmSize int64 `json:"shmSize,omitempty" yaml:"shm_size,omitempty"`
ShouldRestart bool `json:"shouldRestart,omitempty" yaml:"should_restart,omitempty"`
SidekickTo string `json:"sidekickTo,omitempty" yaml:"sidekick_to,omitempty"`
StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"`
StartCount int64 `json:"startCount,omitempty" yaml:"start_count,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
StdinOpen bool `json:"stdinOpen,omitempty" yaml:"stdin_open,omitempty"`
StopSignal string `json:"stopSignal,omitempty" yaml:"stop_signal,omitempty"`
StopTimeout int64 `json:"stopTimeout,omitempty" yaml:"stop_timeout,omitempty"`
StorageOpt map[string]string `json:"storageOpt,omitempty" yaml:"storage_opt,omitempty"`
Sysctls map[string]string `json:"sysctls,omitempty" yaml:"sysctls,omitempty"`
Tmpfs map[string]string `json:"tmpfs,omitempty" yaml:"tmpfs,omitempty"`
Token string `json:"token,omitempty" yaml:"token,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"`
Ulimits []Ulimit `json:"ulimits,omitempty" yaml:"ulimits,omitempty"`
User string `json:"user,omitempty" yaml:"user,omitempty"`
UserPorts []string `json:"userPorts,omitempty" yaml:"user_ports,omitempty"`
UsernsMode string `json:"usernsMode,omitempty" yaml:"userns_mode,omitempty"`
Uts string `json:"uts,omitempty" yaml:"uts,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
VolumeDriver string `json:"volumeDriver,omitempty" yaml:"volume_driver,omitempty"`
WorkingDir string `json:"workingDir,omitempty" yaml:"working_dir,omitempty"`
}
type ContainerCollection struct {
Collection
Data []Container `json:"data,omitempty"`
client *ContainerClient
}
type ContainerClient struct {
rancherClient *RancherClient
}
type ContainerOperations interface {
List(opts *ListOpts) (*ContainerCollection, error)
Create(opts *Container) (*Container, error)
Update(existing *Container, updates interface{}) (*Container, error)
ById(id string) (*Container, error)
Delete(container *Container) error
ActionConsole(*Container, *InstanceConsoleInput) (*InstanceConsole, error)
ActionConverttoservice(*Container) (*Service, error)
ActionCreate(*Container) (*Instance, error)
ActionError(*Container) (*Instance, error)
ActionExecute(*Container, *ContainerExec) (*HostAccess, error)
ActionLogs(*Container, *ContainerLogs) (*HostAccess, error)
ActionProxy(*Container, *ContainerProxy) (*HostAccess, error)
ActionRemove(*Container, *InstanceRemove) (*Instance, error)
ActionRestart(*Container) (*Instance, error)
ActionStart(*Container) (*Instance, error)
ActionStop(*Container, *InstanceStop) (*Instance, error)
ActionUpgrade(*Container, *ContainerUpgrade) (*Revision, error)
}
func newContainerClient(rancherClient *RancherClient) *ContainerClient {
return &ContainerClient{
rancherClient: rancherClient,
}
}
func (c *ContainerClient) Create(container *Container) (*Container, error) {
resp := &Container{}
err := c.rancherClient.doCreate(CONTAINER_TYPE, container, resp)
return resp, err
}
func (c *ContainerClient) Update(existing *Container, updates interface{}) (*Container, error) {
resp := &Container{}
err := c.rancherClient.doUpdate(CONTAINER_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *ContainerClient) List(opts *ListOpts) (*ContainerCollection, error) {
resp := &ContainerCollection{}
err := c.rancherClient.doList(CONTAINER_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ContainerCollection) Next() (*ContainerCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ContainerCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ContainerClient) ById(id string) (*Container, error) {
resp := &Container{}
err := c.rancherClient.doById(CONTAINER_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *ContainerClient) Delete(container *Container) error {
return c.rancherClient.doResourceDelete(CONTAINER_TYPE, &container.Resource)
}
func (c *ContainerClient) ActionConsole(resource *Container, input *InstanceConsoleInput) (*InstanceConsole, error) {
resp := &InstanceConsole{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "console", &resource.Resource, input, resp)
return resp, err
}
func (c *ContainerClient) ActionConverttoservice(resource *Container) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "converttoservice", &resource.Resource, nil, resp)
return resp, err
}
func (c *ContainerClient) ActionCreate(resource *Container) (*Instance, error) {
resp := &Instance{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *ContainerClient) ActionError(resource *Container) (*Instance, error) {
resp := &Instance{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "error", &resource.Resource, nil, resp)
return resp, err
}
func (c *ContainerClient) ActionExecute(resource *Container, input *ContainerExec) (*HostAccess, error) {
resp := &HostAccess{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "execute", &resource.Resource, input, resp)
return resp, err
}
func (c *ContainerClient) ActionLogs(resource *Container, input *ContainerLogs) (*HostAccess, error) {
resp := &HostAccess{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "logs", &resource.Resource, input, resp)
return resp, err
}
func (c *ContainerClient) ActionProxy(resource *Container, input *ContainerProxy) (*HostAccess, error) {
resp := &HostAccess{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "proxy", &resource.Resource, input, resp)
return resp, err
}
func (c *ContainerClient) ActionRemove(resource *Container, input *InstanceRemove) (*Instance, error) {
resp := &Instance{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "remove", &resource.Resource, input, resp)
return resp, err
}
func (c *ContainerClient) ActionRestart(resource *Container) (*Instance, error) {
resp := &Instance{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "restart", &resource.Resource, nil, resp)
return resp, err
}
func (c *ContainerClient) ActionStart(resource *Container) (*Instance, error) {
resp := &Instance{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "start", &resource.Resource, nil, resp)
return resp, err
}
func (c *ContainerClient) ActionStop(resource *Container, input *InstanceStop) (*Instance, error) {
resp := &Instance{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "stop", &resource.Resource, input, resp)
return resp, err
}
func (c *ContainerClient) ActionUpgrade(resource *Container, input *ContainerUpgrade) (*Revision, error) {
resp := &Revision{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "upgrade", &resource.Resource, input, resp)
return resp, err
}
| {
"content_hash": "ef4aaf898bda90e478cc22ad3aca7a58",
"timestamp": "",
"source": "github",
"line_count": 471,
"max_line_length": 118,
"avg_line_length": 34.19532908704883,
"alnum_prop": 0.7647460573699243,
"repo_name": "aiwantaozi/logging-k8s-controller",
"id": "597e8cd3b3711b72483dac2f739ad036f1f6a81a",
"size": "16106",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "vendor/github.com/rancher/go-rancher/v3/generated_container.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "54041"
},
{
"name": "Makefile",
"bytes": "421"
},
{
"name": "Shell",
"bytes": "2138"
}
],
"symlink_target": ""
} |
package com.twitter.scrooge.frontend
import com.twitter.scrooge.ast._
import scala.collection.mutable.ArrayBuffer
import scala.util.parsing.input.Positional
class PositionalException(message: String, node: Positional)
extends Exception(s"$message\n${node.pos.longString}")
case class TypeNotFoundException(name: String, node: Positional) extends PositionalException(name, node)
case class UndefinedConstantException(name: String, node: Positional) extends PositionalException(name, node)
case class UndefinedSymbolException(name: String, node: Positional) extends PositionalException(name, node)
case class TypeMismatchException(name: String, node: Positional) extends PositionalException(name, node)
case class QualifierNotFoundException(name: String, node: Positional) extends PositionalException(name, node)
case class ResolvedDocument(document: Document, resolver: TypeResolver)
case class ResolvedDefinition(definition: Definition, resolver: TypeResolver)
case class TypeResolver(
typeMap: Map[String, FieldType] = Map.empty,
constMap: Map[String, ConstDefinition] = Map.empty,
serviceMap: Map[String, Service] = Map.empty,
includeMap: Map[String, ResolvedDocument] = Map.empty) {
def getResolver(qid: QualifiedID) = {
includeMap.get(qid.names.head).getOrElse(throw new QualifierNotFoundException(qid.fullName, qid)).resolver
}
def resolveFieldType(id: Identifier): FieldType = id match {
case SimpleID(name, _) => typeMap.get(name).getOrElse(throw new TypeNotFoundException(name, id))
case qid: QualifiedID => getResolver(qid).resolveFieldType(qid.tail)
}
def resolveService(id: Identifier): Service = id match {
case SimpleID(name, _) => serviceMap.get(name).getOrElse(throw new UndefinedSymbolException(name, id))
case qid: QualifiedID => getResolver(qid).resolveService(qid.tail)
}
def resolveConst(id: Identifier): (FieldType, RHS) = id match {
case SimpleID(name, _) =>
val const = constMap.get(name).getOrElse(throw new UndefinedConstantException(name, id))
(const.fieldType, const.value)
case qid: QualifiedID => getResolver(qid).resolveConst(qid.tail)
}
/**
* Returns a new TypeResolver with the given include mapping added.
*/
def withMapping(inc: Include): TypeResolver = {
val resolver = TypeResolver()
val resolvedDocument = resolver(inc.document, Some(inc.prefix))
copy(includeMap = includeMap + (inc.prefix.name -> resolvedDocument))
}
/**
* Returns a new TypeResolver with the given type mapping added.
*/
def withMapping(name: String, fieldType: FieldType): TypeResolver = {
copy(typeMap = typeMap + (name -> fieldType))
}
/**
* Returns a new TypeResolver with the given constant added.
*/
def withMapping(const: ConstDefinition): TypeResolver = {
copy(constMap = constMap + (const.sid.name -> const))
}
/**
* Returns a new TypeResolver with the given service added.
*/
def withMapping(service: Service): TypeResolver = {
copy(serviceMap = serviceMap + (service.sid.name -> service))
}
/**
* Resolves all types in the given document.
* @param scopePrefix the scope of the document if the document is an include
*/
def apply(doc: Document, scopePrefix: Option[SimpleID] = None): ResolvedDocument = {
var resolver = this
val includes = doc.headers.collect { case i: Include => i }
val defBuf = new ArrayBuffer[Definition](doc.defs.size)
for (i <- includes) {
try {
resolver = resolver.withMapping(i)
} catch {
case ex: Throwable =>
throw new FileParseException(filename = i.filePath, cause = ex)
}
}
for (d <- doc.defs) {
val ResolvedDefinition(d2, r2) = resolver(d, scopePrefix)
resolver = r2
defBuf += d2
}
ResolvedDocument(doc.copy(defs = defBuf.toSeq), resolver)
}
/**
* Resolves types in the given definition according to the current
* typeMap, and then returns an updated TypeResolver with the new
* definition bound, plus the resolved definition.
*/
def apply(definition: Definition, scopePrefix: Option[SimpleID]): ResolvedDefinition = {
definition match {
case d @ Typedef(sid, t, _) =>
val resolved = apply(t)
ResolvedDefinition(
d.copy(fieldType = resolved),
withMapping(sid.name, resolved))
case s @ Struct(sid, _, fs, _, _) =>
val resolved = s.copy(fields = fs.map(apply))
ResolvedDefinition(
resolved,
withMapping(sid.name, StructType(resolved, scopePrefix)))
case u @ Union(sid, _, fs, _, _) =>
val resolved = u.copy(fields = fs.map(apply))
ResolvedDefinition(
resolved,
withMapping(sid.name, StructType(resolved, scopePrefix)))
case e @ Exception_(sid, _, fs, _) =>
val resolved = e.copy(fields = fs.map(apply))
ResolvedDefinition(
resolved,
withMapping(sid.name, StructType(resolved, scopePrefix)))
case c @ ConstDefinition(_, t, v, _) =>
val fieldType = apply(t)
val resolved = c.copy(fieldType = fieldType, value = apply(v, fieldType))
ResolvedDefinition(resolved, withMapping(resolved))
case s @ Service(sid, p, fs, _) =>
val resolved = s.copy(parent = p.map(apply), functions = fs.map(apply))
ResolvedDefinition(resolved, withMapping(resolved))
case e @ Enum(sid, _, _) =>
ResolvedDefinition(e, withMapping(sid.name, EnumType(e, scopePrefix)))
case s @ Senum(sid, _) =>
ResolvedDefinition(s, withMapping(sid.name, TString))
case d: EnumField => ResolvedDefinition(d, this)
case d: FunctionArgs => ResolvedDefinition(d, this)
case d: FunctionResult => ResolvedDefinition(d, this)
}
}
def apply(f: Function): Function = f match {
case Function(_, _, t, as, ts, _) =>
f.copy(funcType = apply(t), args = as.map(apply), throws = ts.map(apply))
}
def apply(f: Field): Field = {
val fieldType = apply(f.fieldType)
f.copy(
fieldType = fieldType,
default = f.default.map { const => apply(const, fieldType) })
}
def apply(t: FunctionType): FunctionType = t match {
case Void => Void
case OnewayVoid => OnewayVoid
case t: FieldType => apply(t)
}
def apply(t: FieldType): FieldType = t match {
case ReferenceType(id) => resolveFieldType(id)
case m @ MapType(k, v, _) => m.copy(keyType = apply(k), valueType = apply(v))
case s @ SetType(e, _) => s.copy(eltType = apply(e))
case l @ ListType(e, _) => l.copy(eltType = apply(e))
case b: BaseType => b
case e: EnumType => e
case s: StructType => s
}
def apply(c: RHS, fieldType: FieldType): RHS = c match {
// list values and map values look the same in Thrift, but different in Java and Scala
// So we need type information in order to generated correct code.
case l @ ListRHS(elems) =>
fieldType match {
case ListType(eltType, _) => l.copy(elems = elems.map(e => apply(e, eltType)))
case SetType(eltType, _) => SetRHS(elems.map(e => apply(e, eltType)).toSet)
case _ => throw new TypeMismatchException("Expecting " + fieldType + ", found " + l, c)
}
case m @ MapRHS(elems) =>
fieldType match {
case MapType(keyType, valType, _) =>
m.copy(elems = elems.map { case (k, v) => (apply(k, keyType), apply(v, valType)) })
case st @ StructType(s, _) =>
val structMap = Map.newBuilder[Field, RHS]
s.fields.foreach { f =>
val filtered = elems.filter {
case (StringLiteral(fieldName), _) => fieldName == f.sid.name
case _ => false
}
if (filtered.size == 1) {
val (k, v) = filtered.head
structMap += f -> apply(v, f.fieldType)
} else if (filtered.size > 1) {
throw new TypeMismatchException(s"Duplicate default values for ${f.sid.name} found for $fieldType", m)
} else if (!f.requiredness.isOptional && f.default.isEmpty) {
throw new TypeMismatchException(s"Value required for ${f.sid.name} in $fieldType", m)
}
}
StructRHS(sid = st.sid, elems = structMap.result())
case _ => throw new TypeMismatchException("Expecting " + fieldType + ", found " + m, m)
}
case i @ IdRHS(id) => {
val (constFieldType, constRHS) = id match {
case sid: SimpleID =>
// When the rhs value is a simpleID, it can only be a constant
// defined in the same file
resolveConst(sid)
case qid @ QualifiedID(names) =>
fieldType match {
case EnumType(enum, _) =>
val resolvedFieldType = resolveFieldType(qid.qualifier)
val value = enum.values.find(_.sid.name == names.last).getOrElse(
throw new UndefinedSymbolException(qid.fullName, qid))
(resolvedFieldType, EnumRHS(enum, value))
case t => resolveConst(qid)
}
}
if (constFieldType != fieldType)
throw new TypeMismatchException(
s"Type mismatch: Expecting $fieldType, found ${id.fullName}: $constFieldType",
id
)
constRHS
}
case _ => c
}
def apply(parent: ServiceParent): ServiceParent = {
val parentID = parent.prefix match {
case Some(p) => parent.sid.addScope(p)
case None => parent.sid
}
parent.copy(service = Some(resolveService(parentID)))
}
}
| {
"content_hash": "c043c3b590efcc1b8dffdf0990ba7ba7",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 116,
"avg_line_length": 39.417355371900825,
"alnum_prop": 0.6408428556452458,
"repo_name": "travisbrown/scrooge",
"id": "c31887e06b8b97039cef975614d167a946e56343",
"size": "10135",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "scrooge-generator/src/main/scala/com/twitter/scrooge/frontend/TypeResolver.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "51537"
},
{
"name": "Java",
"bytes": "66578"
},
{
"name": "Python",
"bytes": "6045"
},
{
"name": "Scala",
"bytes": "500515"
},
{
"name": "Shell",
"bytes": "23953"
},
{
"name": "Thrift",
"bytes": "50732"
}
],
"symlink_target": ""
} |
using System;
using System.Globalization;
namespace RevStack.OrientDb
{
public static class Extensions
{
public static string ToCamelCase(this string value)
{
if (string.IsNullOrEmpty(value))
return value;
if (!char.IsUpper(value[0]))
return value;
string camelCase = char.ToLower(value[0], CultureInfo.InvariantCulture).ToString(CultureInfo.InvariantCulture);
if (value.Length > 1)
camelCase += value.Substring(1);
return camelCase;
}
}
}
| {
"content_hash": "4997daf2056f4a426b5a97adae1f21bf",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 123,
"avg_line_length": 25.608695652173914,
"alnum_prop": 0.5857385398981324,
"repo_name": "RevStack/RevStack.OrientDb",
"id": "c1dbd94a8a0555b74ed4c8275d47c4b329ce797d",
"size": "591",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Extensions.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "74444"
}
],
"symlink_target": ""
} |
<?php
/**
* Created by PhpStorm.
* User: syarif
* Date: 1/12/15
* Time: 2:02 PM
*/
Class StoreController extends VipplazaController
{
public function filters(){
return array(
'accessControl', // perform access control for CRUD operations
);
}
public function accessRules()
{
return array(
array('allow',
'actions' => array('createProductdetail','createcategory','createindex','productdetail'),
'users' => array('@'),
),
array('deny', // deny all users
'users' => array('*'),
),
);
}
//create html
public function dataTest()
{
return $url = file_get_contents("http://line.vipplaza.lc/src/product-detail.html");
}
public function actionProductdetail($id)
{
//$url = file_get_contents('http://dev.testingdulu.com/vipline/index/index/id/37258');
$url = file_get_contents($this->url_line_vipplaza . "vipline/index/index/id/{$id}");
$data = json_decode($url);
$this->renderPartial('detail', array('data' => $data));
}
public function actionAddtocart()
{
$product_id = $_POST['product'];
$product_type = $_POST['product_type'];
if ($product_type == "configurable") {
$attribute_id = $_POST['attribute_id'];
$attribute_value = $_POST['super_attribute'][$attribute_id];
}
$qty = $_POST['qty'];
$model = New Cart;
$model->product_id = $product_id;
$model->product_type = $product_type;
if ($product_type == "configurable") {
$model->attribute_id = $attribute_id;
$model->attribute_value = $attribute_value;
}
$model->qty = $qty;
if ($model->validate()) {
$url = $product_type == 'configurable' ? $this->url_line_vipplaza . "vipline/index/lineAddtoCart/product_id/{$product_id}/attribute_id/{$attribute_id}/attribute_value/{$attribute_value}/qty/{$qty}" : $this->url_line_vipplaza . "vipline/index/lineAddtoCart/product_id/{$product_id}/qty/{$qty}";
exit(json_encode(array(
'success' => true,
'url' => $url . "?utm_source=line&utm_medium=banner&utm_campaign=lineshopping"
)));
} else {
exit(CActiveForm::validate($model));
}
}
//call url : http://line.vipplaza.lc/store/createProductdetail/fileName/{fileName}
public function actionCreateProductdetail($fileName)
{
$file = $this->checkFile($fileName);
$Data = Vipplaza::getFileData($file);
$DataProduct = array();
if (!empty($Data)) {
foreach ($Data as $index => $data) {
if (!empty($Data[$index])) {
$id = $Data[$index][0];
if (!empty($id)) {
$url = file_get_contents($this->url_line_vipplaza . "vipline/index/index/id/{$id}");
$data = json_decode($url);
$slug = $data->entity_id . '-' . Vipplaza::url_title($data->name);
$fileName = $ourFileName = "{$slug}.html";
$fh = fopen($this->file->targetDir . '/' . $fileName, 'w') or die("can't open file");
$stringData = $this->setHtmlProductDetail($data);
$create = fwrite($fh, $stringData);
$close = fclose($fh);
if ($close) {
echo $index . ". Created <a target=\"_blank\" href=\"{$this->baseUrl()}/product-html/{$fileName}\">{$this->baseUrl()}/product-html/{$fileName}</a><br>";
}
}
}
}
exit('Success');
}
}
//sample calling : http://line.vipplaza.lc/store/createindex
public function actionCreateindex()
{
$name = "index";
$data = json_encode(Vipplaza::sampleIndexData());
$data = json_decode($data);
if (!empty($data)) {
$fileName = $ourFileName = "{$name}.html";
$fh = fopen($fileName, 'w') or die("can't open file");
$stringData = $this->setHtmlIndex($data);
$create = fwrite($fh, $stringData);
fclose($fh);
}
exit("success");
}
//sample calling : http://line.vipplaza.lc/store/createcategory/fileName/nike-collection-abc?slug=nike
public function actionCreatecategory($fileName)
{
$file = $this->checkFile($fileName);
$Data = Vipplaza::getFileData($file);
$DataProduct = array();
if (!empty($Data)) {
foreach ($Data as $index => $data) {
if (!empty($Data[$index])) {
$id = $Data[$index][0];
//$url = file_get_contents($this->url_line_vipplaza."vipline/index/index/id/{$id}");
if (!empty($id)) {
$url = file_get_contents($this->url_line_vipplaza . "vipline/index/index/id/{$id}");
//exit(Controller::$url_line_vip."vipline/index/index/id/{$id}");
$DataProduct[] = $url;
}
}
}
}
$data = json_encode($DataProduct);
$data = json_decode($data);
$slug = '';
if (isset($_GET['slug'])) {
$slug = $_GET['slug'];
} else {
throw new CHttpException(404, 'The requested page does not exist.');
}
if (isset($_GET['periode'])) {
$periode = $_GET['periode'];
} else {
throw new CHttpException(404, 'The requested page does not exist.');
}
$fileName = $ourFileName = "{$slug}.html";
$fh = fopen($this->file->rootDir . '/' . $fileName, 'w') or die("can't open file");
$stringData = $this->setHtmlCategory($data, $periode);
$create = fwrite($fh, $stringData);
$close = fclose($fh);
if ($close) {
echo "Created <a target=\"_blank\" href=\"{$this->baseUrl()}/{$fileName}\">{$this->baseUrl()}/{$fileName}</a><br>";
exit("success");
} else {
throw new CHttpException(404, 'The requested page does not exist.');
}
}
protected function setHtmlIndex($data)
{
return $this->renderPartial('_setHtmlIndex', array('data' => $data), true);
}
protected function setHtmlCategory($data, $periode)
{
return $this->renderPartial('_setHtmlCategory', array('data' => $data, 'periode' => $periode), true);
}
protected function setHtmlProductDetail($data)
{
return $this->renderPartial('_setHtmlProductDetail', array('data' => $data), true);
}
public function checkFile($file)
{
if (empty($file))
throw new CHttpException(404, 'The requested page does not exist.');
return $file;
}
} | {
"content_hash": "71883f6d8a15ee7cd5653b241fc39875",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 305,
"avg_line_length": 36.463541666666664,
"alnum_prop": 0.5120697043279532,
"repo_name": "akaidrive2014/bbm-vipplaza",
"id": "9bc66ab60061bae72b1a84af4480e2b3bfa5aecf",
"size": "7001",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "protected/controllers/StoreController.php",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "15"
},
{
"name": "Batchfile",
"bytes": "380"
},
{
"name": "CSS",
"bytes": "31953"
},
{
"name": "HTML",
"bytes": "360481"
},
{
"name": "JavaScript",
"bytes": "14009"
},
{
"name": "PHP",
"bytes": "288008"
}
],
"symlink_target": ""
} |
<?php
namespace Doctrine\ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\NotifyPropertyChanged;
use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService;
use Doctrine\Common\Persistence\ObjectManagerAware;
use Doctrine\Common\PropertyChangedListener;
use Doctrine\DBAL\LockMode;
use Doctrine\ORM\Cache\Persister\CachedPersister;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\ListenersInvoker;
use Doctrine\ORM\Event\OnFlushEventArgs;
use Doctrine\ORM\Event\PostFlushEventArgs;
use Doctrine\ORM\Event\PreFlushEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\ORM\Internal\HydrationCompleteHandler;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter;
use Doctrine\ORM\Persisters\Collection\ManyToManyPersister;
use Doctrine\ORM\Persisters\Collection\OneToManyPersister;
use Doctrine\ORM\Persisters\Entity\BasicEntityPersister;
use Doctrine\ORM\Persisters\Entity\JoinedSubclassPersister;
use Doctrine\ORM\Persisters\Entity\SingleTablePersister;
use Doctrine\ORM\Proxy\Proxy;
use Doctrine\ORM\Utility\IdentifierFlattener;
use Exception;
use InvalidArgumentException;
use UnexpectedValueException;
/**
* The UnitOfWork is responsible for tracking changes to objects during an
* "object-level" transaction and for writing out changes to the database
* in the correct order.
*
* Internal note: This class contains highly performance-sensitive code.
*
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
* @author Rob Caiger <rob@clocal.co.uk>
*/
class UnitOfWork implements PropertyChangedListener
{
/**
* An entity is in MANAGED state when its persistence is managed by an EntityManager.
*/
const STATE_MANAGED = 1;
/**
* An entity is new if it has just been instantiated (i.e. using the "new" operator)
* and is not (yet) managed by an EntityManager.
*/
const STATE_NEW = 2;
/**
* A detached entity is an instance with persistent state and identity that is not
* (or no longer) associated with an EntityManager (and a UnitOfWork).
*/
const STATE_DETACHED = 3;
/**
* A removed entity instance is an instance with a persistent identity,
* associated with an EntityManager, whose persistent state will be deleted
* on commit.
*/
const STATE_REMOVED = 4;
/**
* Hint used to collect all primary keys of associated entities during hydration
* and execute it in a dedicated query afterwards
*
* @see https://doctrine-orm.readthedocs.org/en/latest/reference/dql-doctrine-query-language.html?highlight=eager#temporarily-change-fetch-mode-in-dql
*/
const HINT_DEFEREAGERLOAD = 'deferEagerLoad';
/**
* @var boolean
*/
protected $hasCache = false;
/**
* The identity map that holds references to all managed entities that have
* an identity. The entities are grouped by their class name.
* Since all classes in a hierarchy must share the same identifier set,
* we always take the root class name of the hierarchy.
*
* @var array
*/
private $identityMap = array();
/**
* Map of all identifiers of managed entities.
* Keys are object ids (spl_object_hash).
*
* @var array
*/
private $entityIdentifiers = array();
/**
* Map of the original entity data of managed entities.
* Keys are object ids (spl_object_hash). This is used for calculating changesets
* at commit time.
*
* Internal note: Note that PHPs "copy-on-write" behavior helps a lot with memory usage.
* A value will only really be copied if the value in the entity is modified
* by the user.
*
* @var array
*/
private $originalEntityData = array();
/**
* Map of entity changes. Keys are object ids (spl_object_hash).
* Filled at the beginning of a commit of the UnitOfWork and cleaned at the end.
*
* @var array
*/
private $entityChangeSets = array();
/**
* The (cached) states of any known entities.
* Keys are object ids (spl_object_hash).
*
* @var array
*/
private $entityStates = array();
/**
* Map of entities that are scheduled for dirty checking at commit time.
* This is only used for entities with a change tracking policy of DEFERRED_EXPLICIT.
* Keys are object ids (spl_object_hash).
*
* @var array
*/
private $scheduledForSynchronization = array();
/**
* A list of all pending entity insertions.
*
* @var array
*/
private $entityInsertions = array();
/**
* A list of all pending entity updates.
*
* @var array
*/
private $entityUpdates = array();
/**
* Any pending extra updates that have been scheduled by persisters.
*
* @var array
*/
private $extraUpdates = array();
/**
* A list of all pending entity deletions.
*
* @var array
*/
private $entityDeletions = array();
/**
* All pending collection deletions.
*
* @var array
*/
private $collectionDeletions = array();
/**
* All pending collection updates.
*
* @var array
*/
private $collectionUpdates = array();
/**
* List of collections visited during changeset calculation on a commit-phase of a UnitOfWork.
* At the end of the UnitOfWork all these collections will make new snapshots
* of their data.
*
* @var array
*/
private $visitedCollections = array();
/**
* The EntityManager that "owns" this UnitOfWork instance.
*
* @var EntityManagerInterface
*/
private $em;
/**
* The calculator used to calculate the order in which changes to
* entities need to be written to the database.
*
* @var \Doctrine\ORM\Internal\CommitOrderCalculator
*/
private $commitOrderCalculator;
/**
* The entity persister instances used to persist entity instances.
*
* @var array
*/
private $persisters = array();
/**
* The collection persister instances used to persist collections.
*
* @var array
*/
private $collectionPersisters = array();
/**
* The EventManager used for dispatching events.
*
* @var \Doctrine\Common\EventManager
*/
private $evm;
/**
* The ListenersInvoker used for dispatching events.
*
* @var \Doctrine\ORM\Event\ListenersInvoker
*/
private $listenersInvoker;
/**
* The IdentifierFlattener used for manipulating identifiers
*
* @var \Doctrine\ORM\Utility\IdentifierFlattener
*/
private $identifierFlattener;
/**
* Orphaned entities that are scheduled for removal.
*
* @var array
*/
private $orphanRemovals = array();
/**
* Read-Only objects are never evaluated
*
* @var array
*/
private $readOnlyObjects = array();
/**
* Map of Entity Class-Names and corresponding IDs that should eager loaded when requested.
*
* @var array
*/
private $eagerLoadingEntities = array();
/**
* Helper for handling completion of hydration
*
* @var HydrationCompleteHandler
*/
private $hydrationCompleteHandler;
/**
* @var ReflectionPropertiesGetter
*/
private $reflectionPropertiesGetter;
/**
* Initializes a new UnitOfWork instance, bound to the given EntityManager.
*
* @param EntityManagerInterface $em
*/
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
$this->evm = $em->getEventManager();
$this->listenersInvoker = new ListenersInvoker($em);
$this->hasCache = $em->getConfiguration()->isSecondLevelCacheEnabled();
$this->identifierFlattener = new IdentifierFlattener($this, $em->getMetadataFactory());
$this->hydrationCompleteHandler = new HydrationCompleteHandler($this->listenersInvoker, $em);
$this->reflectionPropertiesGetter = new ReflectionPropertiesGetter(new RuntimeReflectionService());
}
/**
* Commits the UnitOfWork, executing all operations that have been postponed
* up to this point. The state of all managed entities will be synchronized with
* the database.
*
* The operations are executed in the following order:
*
* 1) All entity insertions
* 2) All entity updates
* 3) All collection deletions
* 4) All collection updates
* 5) All entity deletions
*
* @param null|object|array $entity
*
* @return void
*
* @throws \Exception
*/
public function commit($entity = null)
{
// Raise preFlush
if ($this->evm->hasListeners(Events::preFlush)) {
$this->evm->dispatchEvent(Events::preFlush, new PreFlushEventArgs($this->em));
}
// Compute changes done since last commit.
if ($entity === null) {
$this->computeChangeSets();
} elseif (is_object($entity)) {
$this->computeSingleEntityChangeSet($entity);
} elseif (is_array($entity)) {
foreach ($entity as $object) {
$this->computeSingleEntityChangeSet($object);
}
}
if (!( $this->entityInsertions ||
$this->entityDeletions ||
$this->entityUpdates ||
$this->collectionUpdates ||
$this->collectionDeletions ||
$this->orphanRemovals )
) {
$this->dispatchOnFlushEvent();
$this->dispatchPostFlushEvent();
return; // Nothing to do.
}
if ($this->orphanRemovals) {
foreach ($this->orphanRemovals as $orphan) {
$this->remove($orphan);
}
}
$this->dispatchOnFlushEvent();
// Now we need a commit order to maintain referential integrity
$commitOrder = $this->getCommitOrder();
$conn = $this->em->getConnection();
$conn->beginTransaction();
try {
if ($this->entityInsertions) {
foreach ($commitOrder as $class) {
$this->executeInserts($class);
}
}
if ($this->entityUpdates) {
foreach ($commitOrder as $class) {
$this->executeUpdates($class);
}
}
// Extra updates that were requested by persisters.
if ($this->extraUpdates) {
$this->executeExtraUpdates();
}
// Collection deletions (deletions of complete collections)
foreach ($this->collectionDeletions as $collectionToDelete) {
$this->getCollectionPersister($collectionToDelete->getMapping())->delete($collectionToDelete);
}
// Collection updates (deleteRows, updateRows, insertRows)
foreach ($this->collectionUpdates as $collectionToUpdate) {
$this->getCollectionPersister($collectionToUpdate->getMapping())->update($collectionToUpdate);
}
// Entity deletions come last and need to be in reverse commit order
if ($this->entityDeletions) {
for ($count = count($commitOrder), $i = $count - 1; $i >= 0 && $this->entityDeletions; --$i) {
$this->executeDeletions($commitOrder[$i]);
}
}
$conn->commit();
} catch (Exception $e) {
$this->em->close();
$conn->rollback();
$this->afterTransactionRolledBack();
throw $e;
}
$this->afterTransactionComplete();
// Take new snapshots from visited collections
foreach ($this->visitedCollections as $coll) {
$coll->takeSnapshot();
}
$this->dispatchPostFlushEvent();
// Clear up
$this->entityInsertions =
$this->entityUpdates =
$this->entityDeletions =
$this->extraUpdates =
$this->entityChangeSets =
$this->collectionUpdates =
$this->collectionDeletions =
$this->visitedCollections =
$this->scheduledForSynchronization =
$this->orphanRemovals = array();
}
/**
* Computes all the changes that have been done to entities and collections
* since the last commit and stores these changes in the _entityChangeSet map
* temporarily for access by the persisters, until the UoW commit is finished.
*
* @return void
*/
public function computeChangeSets()
{
// Compute changes for INSERTed entities first. This must always happen.
$this->computeScheduleInsertsChangeSets();
// Compute changes for other MANAGED entities. Change tracking policies take effect here.
foreach ($this->identityMap as $className => $entities) {
$class = $this->em->getClassMetadata($className);
// Skip class if instances are read-only
if ($class->isReadOnly) {
continue;
}
// If change tracking is explicit or happens through notification, then only compute
// changes on entities of that type that are explicitly marked for synchronization.
switch (true) {
case ( $class->isChangeTrackingDeferredImplicit() ):
$entitiesToProcess = $entities;
break;
case ( isset( $this->scheduledForSynchronization[$className] ) ):
$entitiesToProcess = $this->scheduledForSynchronization[$className];
break;
default:
$entitiesToProcess = array();
}
foreach ($entitiesToProcess as $entity) {
// Ignore uninitialized proxy objects
if ($entity instanceof Proxy && !$entity->__isInitialized__) {
continue;
}
// Only MANAGED entities that are NOT SCHEDULED FOR INSERTION OR DELETION are processed here.
$oid = spl_object_hash($entity);
if (!isset( $this->entityInsertions[$oid] ) && !isset( $this->entityDeletions[$oid] ) && isset( $this->entityStates[$oid] )) {
$this->computeChangeSet($class, $entity);
}
}
}
}
/**
* Computes the changesets of all entities scheduled for insertion.
*
* @return void
*/
private function computeScheduleInsertsChangeSets()
{
foreach ($this->entityInsertions as $entity) {
$class = $this->em->getClassMetadata(get_class($entity));
$this->computeChangeSet($class, $entity);
}
}
/**
* Computes the changes that happened to a single entity.
*
* Modifies/populates the following properties:
*
* {@link _originalEntityData}
* If the entity is NEW or MANAGED but not yet fully persisted (only has an id)
* then it was not fetched from the database and therefore we have no original
* entity data yet. All of the current entity data is stored as the original entity data.
*
* {@link _entityChangeSets}
* The changes detected on all properties of the entity are stored there.
* A change is a tuple array where the first entry is the old value and the second
* entry is the new value of the property. Changesets are used by persisters
* to INSERT/UPDATE the persistent entity state.
*
* {@link _entityUpdates}
* If the entity is already fully MANAGED (has been fetched from the database before)
* and any changes to its properties are detected, then a reference to the entity is stored
* there to mark it for an update.
*
* {@link _collectionDeletions}
* If a PersistentCollection has been de-referenced in a fully MANAGED entity,
* then this collection is marked for deletion.
*
* @ignore
*
* @internal Don't call from the outside.
*
* @param ClassMetadata $class The class descriptor of the entity.
* @param object $entity The entity for which to compute the changes.
*
* @return void
*/
public function computeChangeSet(ClassMetadata $class, $entity)
{
$oid = spl_object_hash($entity);
if (isset( $this->readOnlyObjects[$oid] )) {
return;
}
if (!$class->isInheritanceTypeNone()) {
$class = $this->em->getClassMetadata(get_class($entity));
}
$invoke = $this->listenersInvoker->getSubscribedSystems($class,
Events::preFlush) & ~ListenersInvoker::INVOKE_MANAGER;
if ($invoke !== ListenersInvoker::INVOKE_NONE) {
$this->listenersInvoker->invoke($class, Events::preFlush, $entity, new PreFlushEventArgs($this->em),
$invoke);
}
$actualData = array();
foreach ($class->reflFields as $name => $refProp) {
$value = $refProp->getValue($entity);
if ($class->isCollectionValuedAssociation($name) && $value !== null) {
if ($value instanceof PersistentCollection) {
if ($value->getOwner() === $entity) {
continue;
}
$value = new ArrayCollection($value->getValues());
}
// If $value is not a Collection then use an ArrayCollection.
if (!$value instanceof Collection) {
$value = new ArrayCollection($value);
}
$assoc = $class->associationMappings[$name];
// Inject PersistentCollection
$value = new PersistentCollection(
$this->em, $this->em->getClassMetadata($assoc['targetEntity']), $value
);
$value->setOwner($entity, $assoc);
$value->setDirty(!$value->isEmpty());
$class->reflFields[$name]->setValue($entity, $value);
$actualData[$name] = $value;
continue;
}
if (( !$class->isIdentifier($name) || !$class->isIdGeneratorIdentity() ) && ( $name !== $class->versionField )) {
$actualData[$name] = $value;
}
}
if (!isset( $this->originalEntityData[$oid] )) {
// Entity is either NEW or MANAGED but not yet fully persisted (only has an id).
// These result in an INSERT.
$this->originalEntityData[$oid] = $actualData;
$changeSet = array();
foreach ($actualData as $propName => $actualValue) {
if (!isset( $class->associationMappings[$propName] )) {
$changeSet[$propName] = array(null, $actualValue);
continue;
}
$assoc = $class->associationMappings[$propName];
if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE) {
$changeSet[$propName] = array(null, $actualValue);
}
}
$this->entityChangeSets[$oid] = $changeSet;
} else {
// Entity is "fully" MANAGED: it was already fully persisted before
// and we have a copy of the original data
$originalData = $this->originalEntityData[$oid];
$isChangeTrackingNotify = $class->isChangeTrackingNotify();
$changeSet = ( $isChangeTrackingNotify && isset( $this->entityChangeSets[$oid] ) )
? $this->entityChangeSets[$oid]
: array();
foreach ($actualData as $propName => $actualValue) {
// skip field, its a partially omitted one!
if (!( isset( $originalData[$propName] ) || array_key_exists($propName, $originalData) )) {
continue;
}
$orgValue = $originalData[$propName];
// skip if value haven't changed
if ($orgValue === $actualValue) {
continue;
}
// if regular field
if (!isset( $class->associationMappings[$propName] )) {
if ($isChangeTrackingNotify) {
continue;
}
$changeSet[$propName] = array($orgValue, $actualValue);
continue;
}
$assoc = $class->associationMappings[$propName];
// Persistent collection was exchanged with the "originally"
// created one. This can only mean it was cloned and replaced
// on another entity.
if ($actualValue instanceof PersistentCollection) {
$owner = $actualValue->getOwner();
if ($owner === null) { // cloned
$actualValue->setOwner($entity, $assoc);
} else {
if ($owner !== $entity) { // no clone, we have to fix
if (!$actualValue->isInitialized()) {
$actualValue->initialize(); // we have to do this otherwise the cols share state
}
$newValue = clone $actualValue;
$newValue->setOwner($entity, $assoc);
$class->reflFields[$propName]->setValue($entity, $newValue);
}
}
}
if ($orgValue instanceof PersistentCollection) {
// A PersistentCollection was de-referenced, so delete it.
$coid = spl_object_hash($orgValue);
if (isset( $this->collectionDeletions[$coid] )) {
continue;
}
$this->collectionDeletions[$coid] = $orgValue;
$changeSet[$propName] = $orgValue; // Signal changeset, to-many assocs will be ignored.
continue;
}
if ($assoc['type'] & ClassMetadata::TO_ONE) {
if ($assoc['isOwningSide']) {
$changeSet[$propName] = array($orgValue, $actualValue);
}
if ($orgValue !== null && $assoc['orphanRemoval']) {
$this->scheduleOrphanRemoval($orgValue);
}
}
}
if ($changeSet) {
$this->entityChangeSets[$oid] = $changeSet;
$this->originalEntityData[$oid] = $actualData;
$this->entityUpdates[$oid] = $entity;
}
}
// Look for changes in associations of the entity
foreach ($class->associationMappings as $field => $assoc) {
if (( $val = $class->reflFields[$field]->getValue($entity) ) === null) {
continue;
}
$this->computeAssociationChanges($assoc, $val);
if (!isset( $this->entityChangeSets[$oid] ) &&
$assoc['isOwningSide'] &&
$assoc['type'] == ClassMetadata::MANY_TO_MANY &&
$val instanceof PersistentCollection &&
$val->isDirty()
) {
$this->entityChangeSets[$oid] = array();
$this->originalEntityData[$oid] = $actualData;
$this->entityUpdates[$oid] = $entity;
}
}
}
/**
* INTERNAL:
* Schedules an orphaned entity for removal. The remove() operation will be
* invoked on that entity at the beginning of the next commit of this
* UnitOfWork.
*
* @ignore
*
* @param object $entity
*
* @return void
*/
public function scheduleOrphanRemoval($entity)
{
$this->orphanRemovals[spl_object_hash($entity)] = $entity;
}
/**
* Computes the changes of an association.
*
* @param array $assoc The association mapping.
* @param mixed $value The value of the association.
*
* @throws ORMInvalidArgumentException
* @throws ORMException
*
* @return void
*/
private function computeAssociationChanges($assoc, $value)
{
if ($value instanceof Proxy && !$value->__isInitialized__) {
return;
}
if ($value instanceof PersistentCollection && $value->isDirty()) {
$coid = spl_object_hash($value);
if ($assoc['isOwningSide']) {
$this->collectionUpdates[$coid] = $value;
}
$this->visitedCollections[$coid] = $value;
}
// Look through the entities, and in any of their associations,
// for transient (new) entities, recursively. ("Persistence by reachability")
// Unwrap. Uninitialized collections will simply be empty.
$unwrappedValue = ( $assoc['type'] & ClassMetadata::TO_ONE ) ? array($value) : $value->unwrap();
$targetClass = $this->em->getClassMetadata($assoc['targetEntity']);
foreach ($unwrappedValue as $key => $entry) {
if (!( $entry instanceof $targetClass->name )) {
throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry);
}
$state = $this->getEntityState($entry, self::STATE_NEW);
if (!( $entry instanceof $assoc['targetEntity'] )) {
throw ORMException::unexpectedAssociationValue($assoc['sourceEntity'], $assoc['fieldName'],
get_class($entry), $assoc['targetEntity']);
}
switch ($state) {
case self::STATE_NEW:
if (!$assoc['isCascadePersist']) {
throw ORMInvalidArgumentException::newEntityFoundThroughRelationship($assoc, $entry);
}
$this->persistNew($targetClass, $entry);
$this->computeChangeSet($targetClass, $entry);
break;
case self::STATE_REMOVED:
// Consume the $value as array (it's either an array or an ArrayAccess)
// and remove the element from Collection.
if ($assoc['type'] & ClassMetadata::TO_MANY) {
unset( $value[$key] );
}
break;
case self::STATE_DETACHED:
// Can actually not happen right now as we assume STATE_NEW,
// so the exception will be raised from the DBAL layer (constraint violation).
throw ORMInvalidArgumentException::detachedEntityFoundThroughRelationship($assoc, $entry);
break;
default:
// MANAGED associated entities are already taken into account
// during changeset calculation anyway, since they are in the identity map.
}
}
}
/**
* Gets the state of an entity with regard to the current unit of work.
*
* @param object $entity
* @param int|null $assume The state to assume if the state is not yet known (not MANAGED or REMOVED).
* This parameter can be set to improve performance of entity state detection
* by potentially avoiding a database lookup if the distinction between NEW and DETACHED
* is either known or does not matter for the caller of the method.
*
* @return int The entity state.
*/
public function getEntityState($entity, $assume = null)
{
$oid = spl_object_hash($entity);
if (isset( $this->entityStates[$oid] )) {
return $this->entityStates[$oid];
}
if ($assume !== null) {
return $assume;
}
// State can only be NEW or DETACHED, because MANAGED/REMOVED states are known.
// Note that you can not remember the NEW or DETACHED state in _entityStates since
// the UoW does not hold references to such objects and the object hash can be reused.
// More generally because the state may "change" between NEW/DETACHED without the UoW being aware of it.
$class = $this->em->getClassMetadata(get_class($entity));
$id = $class->getIdentifierValues($entity);
if (!$id) {
return self::STATE_NEW;
}
if ($class->containsForeignIdentifier) {
$id = $this->identifierFlattener->flattenIdentifier($class, $id);
}
switch (true) {
case ( $class->isIdentifierNatural() ):
// Check for a version field, if available, to avoid a db lookup.
if ($class->isVersioned) {
return ( $class->getFieldValue($entity, $class->versionField) )
? self::STATE_DETACHED
: self::STATE_NEW;
}
// Last try before db lookup: check the identity map.
if ($this->tryGetById($id, $class->rootEntityName)) {
return self::STATE_DETACHED;
}
// db lookup
if ($this->getEntityPersister($class->name)->exists($entity)) {
return self::STATE_DETACHED;
}
return self::STATE_NEW;
case ( !$class->idGenerator->isPostInsertGenerator() ):
// if we have a pre insert generator we can't be sure that having an id
// really means that the entity exists. We have to verify this through
// the last resort: a db lookup
// Last try before db lookup: check the identity map.
if ($this->tryGetById($id, $class->rootEntityName)) {
return self::STATE_DETACHED;
}
// db lookup
if ($this->getEntityPersister($class->name)->exists($entity)) {
return self::STATE_DETACHED;
}
return self::STATE_NEW;
default:
return self::STATE_DETACHED;
}
}
/**
* Tries to find an entity with the given identifier in the identity map of
* this UnitOfWork.
*
* @param mixed $id The entity identifier to look for.
* @param string $rootClassName The name of the root class of the mapped entity hierarchy.
*
* @return object|bool Returns the entity with the specified identifier if it exists in
* this UnitOfWork, FALSE otherwise.
*/
public function tryGetById($id, $rootClassName)
{
$idHash = implode(' ', (array)$id);
if (isset( $this->identityMap[$rootClassName][$idHash] )) {
return $this->identityMap[$rootClassName][$idHash];
}
return false;
}
/**
* Gets the EntityPersister for an Entity.
*
* @param string $entityName The name of the Entity.
*
* @return \Doctrine\ORM\Persisters\Entity\EntityPersister
*/
public function getEntityPersister($entityName)
{
if (isset( $this->persisters[$entityName] )) {
return $this->persisters[$entityName];
}
$class = $this->em->getClassMetadata($entityName);
switch (true) {
case ( $class->isInheritanceTypeNone() ):
$persister = new BasicEntityPersister($this->em, $class);
break;
case ( $class->isInheritanceTypeSingleTable() ):
$persister = new SingleTablePersister($this->em, $class);
break;
case ( $class->isInheritanceTypeJoined() ):
$persister = new JoinedSubclassPersister($this->em, $class);
break;
default:
throw new \RuntimeException('No persister found for entity.');
}
if ($this->hasCache && $class->cache !== null) {
$persister = $this->em->getConfiguration()
->getSecondLevelCacheConfiguration()
->getCacheFactory()
->buildCachedEntityPersister($this->em, $persister, $class);
}
$this->persisters[$entityName] = $persister;
return $this->persisters[$entityName];
}
/**
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
* @param object $entity
*
* @return void
*/
private function persistNew($class, $entity)
{
$oid = spl_object_hash($entity);
$invoke = $this->listenersInvoker->getSubscribedSystems($class, Events::prePersist);
if ($invoke !== ListenersInvoker::INVOKE_NONE) {
$this->listenersInvoker->invoke($class, Events::prePersist, $entity,
new LifecycleEventArgs($entity, $this->em), $invoke);
}
$idGen = $class->idGenerator;
if (!$idGen->isPostInsertGenerator()) {
$idValue = $idGen->generate($this->em, $entity);
if (!$idGen instanceof \Doctrine\ORM\Id\AssignedGenerator) {
$idValue = array($class->identifier[0] => $idValue);
$class->setIdentifierValues($entity, $idValue);
}
$this->entityIdentifiers[$oid] = $idValue;
}
$this->entityStates[$oid] = self::STATE_MANAGED;
$this->scheduleForInsert($entity);
}
/**
* Schedules an entity for insertion into the database.
* If the entity already has an identifier, it will be added to the identity map.
*
* @param object $entity The entity to schedule for insertion.
*
* @return void
*
* @throws ORMInvalidArgumentException
* @throws \InvalidArgumentException
*/
public function scheduleForInsert($entity)
{
$oid = spl_object_hash($entity);
if (isset( $this->entityUpdates[$oid] )) {
throw new InvalidArgumentException("Dirty entity can not be scheduled for insertion.");
}
if (isset( $this->entityDeletions[$oid] )) {
throw ORMInvalidArgumentException::scheduleInsertForRemovedEntity($entity);
}
if (isset( $this->originalEntityData[$oid] ) && !isset( $this->entityInsertions[$oid] )) {
throw ORMInvalidArgumentException::scheduleInsertForManagedEntity($entity);
}
if (isset( $this->entityInsertions[$oid] )) {
throw ORMInvalidArgumentException::scheduleInsertTwice($entity);
}
$this->entityInsertions[$oid] = $entity;
if (isset( $this->entityIdentifiers[$oid] )) {
$this->addToIdentityMap($entity);
}
if ($entity instanceof NotifyPropertyChanged) {
$entity->addPropertyChangedListener($this);
}
}
/**
* INTERNAL:
* Registers an entity in the identity map.
* Note that entities in a hierarchy are registered with the class name of
* the root entity.
*
* @ignore
*
* @param object $entity The entity to register.
*
* @return boolean TRUE if the registration was successful, FALSE if the identity of
* the entity in question is already managed.
*
* @throws ORMInvalidArgumentException
*/
public function addToIdentityMap($entity)
{
$classMetadata = $this->em->getClassMetadata(get_class($entity));
$idHash = implode(' ', $this->entityIdentifiers[spl_object_hash($entity)]);
if ($idHash === '') {
throw ORMInvalidArgumentException::entityWithoutIdentity($classMetadata->name, $entity);
}
$className = $classMetadata->rootEntityName;
if (isset( $this->identityMap[$className][$idHash] )) {
return false;
}
$this->identityMap[$className][$idHash] = $entity;
return true;
}
/**
* Only flushes the given entity according to a ruleset that keeps the UoW consistent.
*
* 1. All entities scheduled for insertion, (orphan) removals and changes in collections are processed as well!
* 2. Read Only entities are skipped.
* 3. Proxies are skipped.
* 4. Only if entity is properly managed.
*
* @param object $entity
*
* @return void
*
* @throws \InvalidArgumentException
*/
private function computeSingleEntityChangeSet($entity)
{
$state = $this->getEntityState($entity);
if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity));
}
$class = $this->em->getClassMetadata(get_class($entity));
if ($state === self::STATE_MANAGED && $class->isChangeTrackingDeferredImplicit()) {
$this->persist($entity);
}
// Compute changes for INSERTed entities first. This must always happen even in this case.
$this->computeScheduleInsertsChangeSets();
if ($class->isReadOnly) {
return;
}
// Ignore uninitialized proxy objects
if ($entity instanceof Proxy && !$entity->__isInitialized__) {
return;
}
// Only MANAGED entities that are NOT SCHEDULED FOR INSERTION OR DELETION are processed here.
$oid = spl_object_hash($entity);
if (!isset( $this->entityInsertions[$oid] ) && !isset( $this->entityDeletions[$oid] ) && isset( $this->entityStates[$oid] )) {
$this->computeChangeSet($class, $entity);
}
}
/**
* Helper method to show an object as string.
*
* @param object $obj
*
* @return string
*/
private static function objToStr($obj)
{
return method_exists($obj, '__toString') ? (string)$obj : get_class($obj).'@'.spl_object_hash($obj);
}
/**
* Persists an entity as part of the current unit of work.
*
* @param object $entity The entity to persist.
*
* @return void
*/
public function persist($entity)
{
$visited = array();
$this->doPersist($entity, $visited);
}
/**
* Persists an entity as part of the current unit of work.
*
* This method is internally called during persist() cascades as it tracks
* the already visited entities to prevent infinite recursions.
*
* @param object $entity The entity to persist.
* @param array $visited The already visited entities.
*
* @return void
*
* @throws ORMInvalidArgumentException
* @throws UnexpectedValueException
*/
private function doPersist($entity, array &$visited)
{
$oid = spl_object_hash($entity);
if (isset( $visited[$oid] )) {
return; // Prevent infinite recursion
}
$visited[$oid] = $entity; // Mark visited
$class = $this->em->getClassMetadata(get_class($entity));
// We assume NEW, so DETACHED entities result in an exception on flush (constraint violation).
// If we would detect DETACHED here we would throw an exception anyway with the same
// consequences (not recoverable/programming error), so just assuming NEW here
// lets us avoid some database lookups for entities with natural identifiers.
$entityState = $this->getEntityState($entity, self::STATE_NEW);
switch ($entityState) {
case self::STATE_MANAGED:
// Nothing to do, except if policy is "deferred explicit"
if ($class->isChangeTrackingDeferredExplicit()) {
$this->scheduleForDirtyCheck($entity);
}
break;
case self::STATE_NEW:
$this->persistNew($class, $entity);
break;
case self::STATE_REMOVED:
// Entity becomes managed again
unset( $this->entityDeletions[$oid] );
$this->addToIdentityMap($entity);
$this->entityStates[$oid] = self::STATE_MANAGED;
break;
case self::STATE_DETACHED:
// Can actually not happen right now since we assume STATE_NEW.
throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted");
default:
throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
}
$this->cascadePersist($entity, $visited);
}
/**
* Schedules an entity for dirty-checking at commit-time.
*
* @param object $entity The entity to schedule for dirty-checking.
*
* @return void
*
* @todo Rename: scheduleForSynchronization
*/
public function scheduleForDirtyCheck($entity)
{
$rootClassName = $this->em->getClassMetadata(get_class($entity))->rootEntityName;
$this->scheduledForSynchronization[$rootClassName][spl_object_hash($entity)] = $entity;
}
/**
* Cascades the save operation to associated entities.
*
* @param object $entity
* @param array $visited
*
* @return void
*/
private function cascadePersist($entity, array &$visited)
{
$class = $this->em->getClassMetadata(get_class($entity));
$associationMappings = array_filter(
$class->associationMappings,
function ($assoc) {
return $assoc['isCascadePersist'];
}
);
foreach ($associationMappings as $assoc) {
$relatedEntities = $class->reflFields[$assoc['fieldName']]->getValue($entity);
switch (true) {
case ( $relatedEntities instanceof PersistentCollection ):
// Unwrap so that foreach() does not initialize
$relatedEntities = $relatedEntities->unwrap();
// break; is commented intentionally!
case ( $relatedEntities instanceof Collection ):
case ( is_array($relatedEntities) ):
if (( $assoc['type'] & ClassMetadata::TO_MANY ) <= 0) {
throw ORMInvalidArgumentException::invalidAssociation(
$this->em->getClassMetadata($assoc['targetEntity']),
$assoc,
$relatedEntities
);
}
foreach ($relatedEntities as $relatedEntity) {
$this->doPersist($relatedEntity, $visited);
}
break;
case ( $relatedEntities !== null ):
if (!$relatedEntities instanceof $assoc['targetEntity']) {
throw ORMInvalidArgumentException::invalidAssociation(
$this->em->getClassMetadata($assoc['targetEntity']),
$assoc,
$relatedEntities
);
}
$this->doPersist($relatedEntities, $visited);
break;
default:
// Do nothing
}
}
}
private function dispatchOnFlushEvent()
{
if ($this->evm->hasListeners(Events::onFlush)) {
$this->evm->dispatchEvent(Events::onFlush, new OnFlushEventArgs($this->em));
}
}
private function dispatchPostFlushEvent()
{
if ($this->evm->hasListeners(Events::postFlush)) {
$this->evm->dispatchEvent(Events::postFlush, new PostFlushEventArgs($this->em));
}
}
/**
* Deletes an entity as part of the current unit of work.
*
* @param object $entity The entity to remove.
*
* @return void
*/
public function remove($entity)
{
$visited = array();
$this->doRemove($entity, $visited);
}
/**
* Deletes an entity as part of the current unit of work.
*
* This method is internally called during delete() cascades as it tracks
* the already visited entities to prevent infinite recursions.
*
* @param object $entity The entity to delete.
* @param array $visited The map of the already visited entities.
*
* @return void
*
* @throws ORMInvalidArgumentException If the instance is a detached entity.
* @throws UnexpectedValueException
*/
private function doRemove($entity, array &$visited)
{
$oid = spl_object_hash($entity);
if (isset( $visited[$oid] )) {
return; // Prevent infinite recursion
}
$visited[$oid] = $entity; // mark visited
// Cascade first, because scheduleForDelete() removes the entity from the identity map, which
// can cause problems when a lazy proxy has to be initialized for the cascade operation.
$this->cascadeRemove($entity, $visited);
$class = $this->em->getClassMetadata(get_class($entity));
$entityState = $this->getEntityState($entity);
switch ($entityState) {
case self::STATE_NEW:
case self::STATE_REMOVED:
// nothing to do
break;
case self::STATE_MANAGED:
$invoke = $this->listenersInvoker->getSubscribedSystems($class, Events::preRemove);
if ($invoke !== ListenersInvoker::INVOKE_NONE) {
$this->listenersInvoker->invoke($class, Events::preRemove, $entity,
new LifecycleEventArgs($entity, $this->em), $invoke);
}
$this->scheduleForDelete($entity);
break;
case self::STATE_DETACHED:
throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed");
default:
throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity));
}
}
/**
* Cascades the delete operation to associated entities.
*
* @param object $entity
* @param array $visited
*
* @return void
*/
private function cascadeRemove($entity, array &$visited)
{
$class = $this->em->getClassMetadata(get_class($entity));
$associationMappings = array_filter(
$class->associationMappings,
function ($assoc) {
return $assoc['isCascadeRemove'];
}
);
$entitiesToCascade = array();
foreach ($associationMappings as $assoc) {
if ($entity instanceof Proxy && !$entity->__isInitialized__) {
$entity->__load();
}
$relatedEntities = $class->reflFields[$assoc['fieldName']]->getValue($entity);
switch (true) {
case ( $relatedEntities instanceof Collection ):
case ( is_array($relatedEntities) ):
// If its a PersistentCollection initialization is intended! No unwrap!
foreach ($relatedEntities as $relatedEntity) {
$entitiesToCascade[] = $relatedEntity;
}
break;
case ( $relatedEntities !== null ):
$entitiesToCascade[] = $relatedEntities;
break;
default:
// Do nothing
}
}
foreach ($entitiesToCascade as $relatedEntity) {
$this->doRemove($relatedEntity, $visited);
}
}
/**
* INTERNAL:
* Schedules an entity for deletion.
*
* @param object $entity
*
* @return void
*/
public function scheduleForDelete($entity)
{
$oid = spl_object_hash($entity);
if (isset( $this->entityInsertions[$oid] )) {
if ($this->isInIdentityMap($entity)) {
$this->removeFromIdentityMap($entity);
}
unset( $this->entityInsertions[$oid], $this->entityStates[$oid] );
return; // entity has not been persisted yet, so nothing more to do.
}
if (!$this->isInIdentityMap($entity)) {
return;
}
$this->removeFromIdentityMap($entity);
if (isset( $this->entityUpdates[$oid] )) {
unset( $this->entityUpdates[$oid] );
}
if (!isset( $this->entityDeletions[$oid] )) {
$this->entityDeletions[$oid] = $entity;
$this->entityStates[$oid] = self::STATE_REMOVED;
}
}
/**
* Checks whether an entity is registered in the identity map of this UnitOfWork.
*
* @param object $entity
*
* @return boolean
*/
public function isInIdentityMap($entity)
{
$oid = spl_object_hash($entity);
if (!isset( $this->entityIdentifiers[$oid] )) {
return false;
}
$classMetadata = $this->em->getClassMetadata(get_class($entity));
$idHash = implode(' ', $this->entityIdentifiers[$oid]);
if ($idHash === '') {
return false;
}
return isset( $this->identityMap[$classMetadata->rootEntityName][$idHash] );
}
/**
* INTERNAL:
* Removes an entity from the identity map. This effectively detaches the
* entity from the persistence management of Doctrine.
*
* @ignore
*
* @param object $entity
*
* @return boolean
*
* @throws ORMInvalidArgumentException
*/
public function removeFromIdentityMap($entity)
{
$oid = spl_object_hash($entity);
$classMetadata = $this->em->getClassMetadata(get_class($entity));
$idHash = implode(' ', $this->entityIdentifiers[$oid]);
if ($idHash === '') {
throw ORMInvalidArgumentException::entityHasNoIdentity($entity, "remove from identity map");
}
$className = $classMetadata->rootEntityName;
if (isset( $this->identityMap[$className][$idHash] )) {
unset( $this->identityMap[$className][$idHash] );
unset( $this->readOnlyObjects[$oid] );
//$this->entityStates[$oid] = self::STATE_DETACHED;
return true;
}
return false;
}
/**
* Gets the commit order.
*
* @param array|null $entityChangeSet
*
* @return array
*/
private function getCommitOrder(array $entityChangeSet = null)
{
if ($entityChangeSet === null) {
$entityChangeSet = array_merge($this->entityInsertions, $this->entityUpdates, $this->entityDeletions);
}
$calc = $this->getCommitOrderCalculator();
// See if there are any new classes in the changeset, that are not in the
// commit order graph yet (don't have a node).
// We have to inspect changeSet to be able to correctly build dependencies.
// It is not possible to use IdentityMap here because post inserted ids
// are not yet available.
$newNodes = array();
foreach ($entityChangeSet as $entity) {
$class = $this->em->getClassMetadata(get_class($entity));
if ($calc->hasClass($class->name)) {
continue;
}
$calc->addClass($class);
$newNodes[] = $class;
}
// Calculate dependencies for new nodes
while ($class = array_pop($newNodes)) {
foreach ($class->associationMappings as $assoc) {
if (!( $assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE )) {
continue;
}
$targetClass = $this->em->getClassMetadata($assoc['targetEntity']);
if (!$calc->hasClass($targetClass->name)) {
$calc->addClass($targetClass);
$newNodes[] = $targetClass;
}
$calc->addDependency($targetClass, $class);
// If the target class has mapped subclasses, these share the same dependency.
if (!$targetClass->subClasses) {
continue;
}
foreach ($targetClass->subClasses as $subClassName) {
$targetSubClass = $this->em->getClassMetadata($subClassName);
if (!$calc->hasClass($subClassName)) {
$calc->addClass($targetSubClass);
$newNodes[] = $targetSubClass;
}
$calc->addDependency($targetSubClass, $class);
}
}
}
return $calc->getCommitOrder();
}
/**
* Gets the CommitOrderCalculator used by the UnitOfWork to order commits.
*
* @return \Doctrine\ORM\Internal\CommitOrderCalculator
*/
public function getCommitOrderCalculator()
{
if ($this->commitOrderCalculator === null) {
$this->commitOrderCalculator = new Internal\CommitOrderCalculator;
}
return $this->commitOrderCalculator;
}
/**
* Executes all entity insertions for entities of the specified type.
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
*
* @return void
*/
private function executeInserts($class)
{
$entities = array();
$className = $class->name;
$persister = $this->getEntityPersister($className);
$invoke = $this->listenersInvoker->getSubscribedSystems($class, Events::postPersist);
foreach ($this->entityInsertions as $oid => $entity) {
if ($this->em->getClassMetadata(get_class($entity))->name !== $className) {
continue;
}
$persister->addInsert($entity);
unset( $this->entityInsertions[$oid] );
if ($invoke !== ListenersInvoker::INVOKE_NONE) {
$entities[] = $entity;
}
}
$postInsertIds = $persister->executeInserts();
if ($postInsertIds) {
// Persister returned post-insert IDs
foreach ($postInsertIds as $postInsertId) {
$id = $postInsertId['generatedId'];
$entity = $postInsertId['entity'];
$oid = spl_object_hash($entity);
$idField = $class->identifier[0];
$class->reflFields[$idField]->setValue($entity, $id);
$this->entityIdentifiers[$oid] = array($idField => $id);
$this->entityStates[$oid] = self::STATE_MANAGED;
$this->originalEntityData[$oid][$idField] = $id;
$this->addToIdentityMap($entity);
}
}
foreach ($entities as $entity) {
$this->listenersInvoker->invoke($class, Events::postPersist, $entity,
new LifecycleEventArgs($entity, $this->em), $invoke);
}
}
/**
* Executes all entity updates for entities of the specified type.
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
*
* @return void
*/
private function executeUpdates($class)
{
$className = $class->name;
$persister = $this->getEntityPersister($className);
$preUpdateInvoke = $this->listenersInvoker->getSubscribedSystems($class, Events::preUpdate);
$postUpdateInvoke = $this->listenersInvoker->getSubscribedSystems($class, Events::postUpdate);
foreach ($this->entityUpdates as $oid => $entity) {
if ($this->em->getClassMetadata(get_class($entity))->name !== $className) {
continue;
}
if ($preUpdateInvoke != ListenersInvoker::INVOKE_NONE) {
$this->listenersInvoker->invoke($class, Events::preUpdate, $entity,
new PreUpdateEventArgs($entity, $this->em, $this->entityChangeSets[$oid]), $preUpdateInvoke);
$this->recomputeSingleEntityChangeSet($class, $entity);
}
if (!empty( $this->entityChangeSets[$oid] )) {
$persister->update($entity);
}
unset( $this->entityUpdates[$oid] );
if ($postUpdateInvoke != ListenersInvoker::INVOKE_NONE) {
$this->listenersInvoker->invoke($class, Events::postUpdate, $entity,
new LifecycleEventArgs($entity, $this->em), $postUpdateInvoke);
}
}
}
/**
* INTERNAL:
* Computes the changeset of an individual entity, independently of the
* computeChangeSets() routine that is used at the beginning of a UnitOfWork#commit().
*
* The passed entity must be a managed entity. If the entity already has a change set
* because this method is invoked during a commit cycle then the change sets are added.
* whereby changes detected in this method prevail.
*
* @ignore
*
* @param ClassMetadata $class The class descriptor of the entity.
* @param object $entity The entity for which to (re)calculate the change set.
*
* @return void
*
* @throws ORMInvalidArgumentException If the passed entity is not MANAGED.
*/
public function recomputeSingleEntityChangeSet(ClassMetadata $class, $entity)
{
$oid = spl_object_hash($entity);
if (!isset( $this->entityStates[$oid] ) || $this->entityStates[$oid] != self::STATE_MANAGED) {
throw ORMInvalidArgumentException::entityNotManaged($entity);
}
// skip if change tracking is "NOTIFY"
if ($class->isChangeTrackingNotify()) {
return;
}
if (!$class->isInheritanceTypeNone()) {
$class = $this->em->getClassMetadata(get_class($entity));
}
$actualData = array();
foreach ($class->reflFields as $name => $refProp) {
if (( !$class->isIdentifier($name) || !$class->isIdGeneratorIdentity() )
&& ( $name !== $class->versionField )
&& !$class->isCollectionValuedAssociation($name)
) {
$actualData[$name] = $refProp->getValue($entity);
}
}
if (!isset( $this->originalEntityData[$oid] )) {
throw new \RuntimeException('Cannot call recomputeSingleEntityChangeSet before computeChangeSet on an entity.');
}
$originalData = $this->originalEntityData[$oid];
$changeSet = array();
foreach ($actualData as $propName => $actualValue) {
$orgValue = isset( $originalData[$propName] ) ? $originalData[$propName] : null;
if ($orgValue !== $actualValue) {
$changeSet[$propName] = array($orgValue, $actualValue);
}
}
if ($changeSet) {
if (isset( $this->entityChangeSets[$oid] )) {
$this->entityChangeSets[$oid] = array_merge($this->entityChangeSets[$oid], $changeSet);
} else {
if (!isset( $this->entityInsertions[$oid] )) {
$this->entityChangeSets[$oid] = $changeSet;
$this->entityUpdates[$oid] = $entity;
}
}
$this->originalEntityData[$oid] = $actualData;
}
}
/**
* Executes any extra updates that have been scheduled.
*/
private function executeExtraUpdates()
{
foreach ($this->extraUpdates as $oid => $update) {
list ( $entity, $changeset ) = $update;
$this->entityChangeSets[$oid] = $changeset;
$this->getEntityPersister(get_class($entity))->update($entity);
}
$this->extraUpdates = array();
}
/**
* Gets a collection persister for a collection-valued association.
*
* @param array $association
*
* @return \Doctrine\ORM\Persisters\Collection\CollectionPersister
*/
public function getCollectionPersister(array $association)
{
$role = isset( $association['cache'] )
? $association['sourceEntity'].'::'.$association['fieldName']
: $association['type'];
if (isset( $this->collectionPersisters[$role] )) {
return $this->collectionPersisters[$role];
}
$persister = ClassMetadata::ONE_TO_MANY === $association['type']
? new OneToManyPersister($this->em)
: new ManyToManyPersister($this->em);
if ($this->hasCache && isset( $association['cache'] )) {
$persister = $this->em->getConfiguration()
->getSecondLevelCacheConfiguration()
->getCacheFactory()
->buildCachedCollectionPersister($this->em, $persister, $association);
}
$this->collectionPersisters[$role] = $persister;
return $this->collectionPersisters[$role];
}
/**
* Executes all entity deletions for entities of the specified type.
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $class
*
* @return void
*/
private function executeDeletions($class)
{
$className = $class->name;
$persister = $this->getEntityPersister($className);
$invoke = $this->listenersInvoker->getSubscribedSystems($class, Events::postRemove);
foreach ($this->entityDeletions as $oid => $entity) {
if ($this->em->getClassMetadata(get_class($entity))->name !== $className) {
continue;
}
$persister->delete($entity);
unset(
$this->entityDeletions[$oid],
$this->entityIdentifiers[$oid],
$this->originalEntityData[$oid],
$this->entityStates[$oid]
);
// Entity with this $oid after deletion treated as NEW, even if the $oid
// is obtained by a new entity because the old one went out of scope.
//$this->entityStates[$oid] = self::STATE_NEW;
if (!$class->isIdentifierNatural()) {
$class->reflFields[$class->identifier[0]]->setValue($entity, null);
}
if ($invoke !== ListenersInvoker::INVOKE_NONE) {
$this->listenersInvoker->invoke($class, Events::postRemove, $entity,
new LifecycleEventArgs($entity, $this->em), $invoke);
}
}
}
/**
* Perform whatever processing is encapsulated here after completion of the rolled-back.
*/
private function afterTransactionRolledBack()
{
if (!$this->hasCache) {
return;
}
foreach ($this->persisters as $persister) {
if ($persister instanceof CachedPersister) {
$persister->afterTransactionRolledBack();
}
}
foreach ($this->collectionPersisters as $persister) {
if ($persister instanceof CachedPersister) {
$persister->afterTransactionRolledBack();
}
}
}
/**
* Perform whatever processing is encapsulated here after completion of the transaction.
*/
private function afterTransactionComplete()
{
if (!$this->hasCache) {
return;
}
foreach ($this->persisters as $persister) {
if ($persister instanceof CachedPersister) {
$persister->afterTransactionComplete();
}
}
foreach ($this->collectionPersisters as $persister) {
if ($persister instanceof CachedPersister) {
$persister->afterTransactionComplete();
}
}
}
/**
* Gets the changeset for an entity.
*
* @param object $entity
*
* @return array
*/
public function getEntityChangeSet($entity)
{
$oid = spl_object_hash($entity);
if (isset( $this->entityChangeSets[$oid] )) {
return $this->entityChangeSets[$oid];
}
return array();
}
/**
* Checks whether an entity is scheduled for insertion.
*
* @param object $entity
*
* @return boolean
*/
public function isScheduledForInsert($entity)
{
return isset( $this->entityInsertions[spl_object_hash($entity)] );
}
/**
* Schedules an entity for being updated.
*
* @param object $entity The entity to schedule for being updated.
*
* @return void
*
* @throws ORMInvalidArgumentException
*/
public function scheduleForUpdate($entity)
{
$oid = spl_object_hash($entity);
if (!isset( $this->entityIdentifiers[$oid] )) {
throw ORMInvalidArgumentException::entityHasNoIdentity($entity, "scheduling for update");
}
if (isset( $this->entityDeletions[$oid] )) {
throw ORMInvalidArgumentException::entityIsRemoved($entity, "schedule for update");
}
if (!isset( $this->entityUpdates[$oid] ) && !isset( $this->entityInsertions[$oid] )) {
$this->entityUpdates[$oid] = $entity;
}
}
/**
* INTERNAL:
* Schedules an extra update that will be executed immediately after the
* regular entity updates within the currently running commit cycle.
*
* Extra updates for entities are stored as (entity, changeset) tuples.
*
* @ignore
*
* @param object $entity The entity for which to schedule an extra update.
* @param array $changeset The changeset of the entity (what to update).
*
* @return void
*/
public function scheduleExtraUpdate($entity, array $changeset)
{
$oid = spl_object_hash($entity);
$extraUpdate = array($entity, $changeset);
if (isset( $this->extraUpdates[$oid] )) {
list( $ignored, $changeset2 ) = $this->extraUpdates[$oid];
$extraUpdate = array($entity, $changeset + $changeset2);
}
$this->extraUpdates[$oid] = $extraUpdate;
}
/**
* Checks whether an entity is registered as dirty in the unit of work.
* Note: Is not very useful currently as dirty entities are only registered
* at commit time.
*
* @param object $entity
*
* @return boolean
*/
public function isScheduledForUpdate($entity)
{
return isset( $this->entityUpdates[spl_object_hash($entity)] );
}
/**
* Checks whether an entity is registered to be checked in the unit of work.
*
* @param object $entity
*
* @return boolean
*/
public function isScheduledForDirtyCheck($entity)
{
$rootEntityName = $this->em->getClassMetadata(get_class($entity))->rootEntityName;
return isset( $this->scheduledForSynchronization[$rootEntityName][spl_object_hash($entity)] );
}
/**
* Checks whether an entity is registered as removed/deleted with the unit
* of work.
*
* @param object $entity
*
* @return boolean
*/
public function isScheduledForDelete($entity)
{
return isset( $this->entityDeletions[spl_object_hash($entity)] );
}
/**
* Checks whether an entity is scheduled for insertion, update or deletion.
*
* @param object $entity
*
* @return boolean
*/
public function isEntityScheduled($entity)
{
$oid = spl_object_hash($entity);
return isset( $this->entityInsertions[$oid] )
|| isset( $this->entityUpdates[$oid] )
|| isset( $this->entityDeletions[$oid] );
}
/**
* INTERNAL:
* Gets an entity in the identity map by its identifier hash.
*
* @ignore
*
* @param string $idHash
* @param string $rootClassName
*
* @return object
*/
public function getByIdHash($idHash, $rootClassName)
{
return $this->identityMap[$rootClassName][$idHash];
}
/**
* INTERNAL:
* Tries to get an entity by its identifier hash. If no entity is found for
* the given hash, FALSE is returned.
*
* @ignore
*
* @param mixed $idHash (must be possible to cast it to string)
* @param string $rootClassName
*
* @return object|bool The found entity or FALSE.
*/
public function tryGetByIdHash($idHash, $rootClassName)
{
$stringIdHash = (string)$idHash;
if (isset( $this->identityMap[$rootClassName][$stringIdHash] )) {
return $this->identityMap[$rootClassName][$stringIdHash];
}
return false;
}
/**
* INTERNAL:
* Checks whether an identifier hash exists in the identity map.
*
* @ignore
*
* @param string $idHash
* @param string $rootClassName
*
* @return boolean
*/
public function containsIdHash($idHash, $rootClassName)
{
return isset( $this->identityMap[$rootClassName][$idHash] );
}
/**
* Merges the state of the given detached entity into this UnitOfWork.
*
* @param object $entity
*
* @return object The managed copy of the entity.
*
* @throws OptimisticLockException If the entity uses optimistic locking through a version
* attribute and the version check against the managed copy fails.
*
* @todo Require active transaction!? OptimisticLockException may result in undefined state!?
*/
public function merge($entity)
{
$visited = array();
return $this->doMerge($entity, $visited);
}
/**
* Executes a merge operation on an entity.
*
* @param object $entity
* @param array $visited
* @param object|null $prevManagedCopy
* @param array|null $assoc
*
* @return object The managed copy of the entity.
*
* @throws OptimisticLockException If the entity uses optimistic locking through a version
* attribute and the version check against the managed copy fails.
* @throws ORMInvalidArgumentException If the entity instance is NEW.
* @throws EntityNotFoundException
*/
private function doMerge($entity, array &$visited, $prevManagedCopy = null, $assoc = null)
{
$oid = spl_object_hash($entity);
if (isset( $visited[$oid] )) {
$managedCopy = $visited[$oid];
if ($prevManagedCopy !== null) {
$this->updateAssociationWithMergedEntity($entity, $assoc, $prevManagedCopy, $managedCopy);
}
return $managedCopy;
}
$class = $this->em->getClassMetadata(get_class($entity));
// First we assume DETACHED, although it can still be NEW but we can avoid
// an extra db-roundtrip this way. If it is not MANAGED but has an identity,
// we need to fetch it from the db anyway in order to merge.
// MANAGED entities are ignored by the merge operation.
$managedCopy = $entity;
if ($this->getEntityState($entity, self::STATE_DETACHED) !== self::STATE_MANAGED) {
// Try to look the entity up in the identity map.
$id = $class->getIdentifierValues($entity);
// If there is no ID, it is actually NEW.
if (!$id) {
$managedCopy = $this->newInstance($class);
$this->persistNew($class, $managedCopy);
} else {
$flatId = ( $class->containsForeignIdentifier )
? $this->identifierFlattener->flattenIdentifier($class, $id)
: $id;
$managedCopy = $this->tryGetById($flatId, $class->rootEntityName);
if ($managedCopy) {
// We have the entity in-memory already, just make sure its not removed.
if ($this->getEntityState($managedCopy) == self::STATE_REMOVED) {
throw ORMInvalidArgumentException::entityIsRemoved($managedCopy, "merge");
}
} else {
// We need to fetch the managed copy in order to merge.
$managedCopy = $this->em->find($class->name, $flatId);
}
if ($managedCopy === null) {
// If the identifier is ASSIGNED, it is NEW, otherwise an error
// since the managed entity was not found.
if (!$class->isIdentifierNatural()) {
throw EntityNotFoundException::fromClassNameAndIdentifier(
$class->getName(),
$this->identifierFlattener->flattenIdentifier($class, $id)
);
}
$managedCopy = $this->newInstance($class);
$class->setIdentifierValues($managedCopy, $id);
$this->persistNew($class, $managedCopy);
}
}
if ($class->isVersioned) {
$reflField = $class->reflFields[$class->versionField];
$managedCopyVersion = $reflField->getValue($managedCopy);
$entityVersion = $reflField->getValue($entity);
// Throw exception if versions don't match.
if ($managedCopyVersion != $entityVersion) {
throw OptimisticLockException::lockFailedVersionMismatch($entity, $entityVersion,
$managedCopyVersion);
}
}
$visited[$oid] = $managedCopy; // mark visited
if (!( $entity instanceof Proxy && !$entity->__isInitialized() )) {
if ($managedCopy instanceof Proxy && !$managedCopy->__isInitialized()) {
$managedCopy->__load();
}
$this->mergeEntityStateIntoManagedCopy($entity, $managedCopy);
}
if ($class->isChangeTrackingDeferredExplicit()) {
$this->scheduleForDirtyCheck($entity);
}
}
if ($prevManagedCopy !== null) {
$this->updateAssociationWithMergedEntity($entity, $assoc, $prevManagedCopy, $managedCopy);
}
// Mark the managed copy visited as well
$visited[spl_object_hash($managedCopy)] = $managedCopy;
$this->cascadeMerge($entity, $managedCopy, $visited);
return $managedCopy;
}
/**
* Sets/adds associated managed copies into the previous entity's association field
*
* @param object $entity
* @param array $association
* @param object $previousManagedCopy
* @param object $managedCopy
*
* @return void
*/
private function updateAssociationWithMergedEntity($entity, array $association, $previousManagedCopy, $managedCopy)
{
$assocField = $association['fieldName'];
$prevClass = $this->em->getClassMetadata(get_class($previousManagedCopy));
if ($association['type'] & ClassMetadata::TO_ONE) {
$prevClass->reflFields[$assocField]->setValue($previousManagedCopy, $managedCopy);
return;
}
$value = $prevClass->reflFields[$assocField]->getValue($previousManagedCopy);
$value[] = $managedCopy;
if ($association['type'] == ClassMetadata::ONE_TO_MANY) {
$class = $this->em->getClassMetadata(get_class($entity));
$class->reflFields[$association['mappedBy']]->setValue($managedCopy, $previousManagedCopy);
}
}
/**
* @param ClassMetadata $class
*
* @return \Doctrine\Common\Persistence\ObjectManagerAware|object
*/
private function newInstance($class)
{
$entity = $class->newInstance();
if ($entity instanceof \Doctrine\Common\Persistence\ObjectManagerAware) {
$entity->injectObjectManager($this->em, $class);
}
return $entity;
}
/**
* @param object $entity
* @param object $managedCopy
*
* @throws ORMException
* @throws OptimisticLockException
* @throws TransactionRequiredException
*/
private function mergeEntityStateIntoManagedCopy($entity, $managedCopy)
{
$class = $this->em->getClassMetadata(get_class($entity));
foreach ($this->reflectionPropertiesGetter->getProperties($class->name) as $prop) {
$name = $prop->name;
$prop->setAccessible(true);
if (!isset( $class->associationMappings[$name] )) {
if (!$class->isIdentifier($name)) {
$prop->setValue($managedCopy, $prop->getValue($entity));
}
} else {
$assoc2 = $class->associationMappings[$name];
if ($assoc2['type'] & ClassMetadata::TO_ONE) {
$other = $prop->getValue($entity);
if ($other === null) {
$prop->setValue($managedCopy, null);
} else {
if ($other instanceof Proxy && !$other->__isInitialized()) {
// do not merge fields marked lazy that have not been fetched.
return;
}
if (!$assoc2['isCascadeMerge']) {
if ($this->getEntityState($other) === self::STATE_DETACHED) {
$targetClass = $this->em->getClassMetadata($assoc2['targetEntity']);
$relatedId = $targetClass->getIdentifierValues($other);
if ($targetClass->subClasses) {
$other = $this->em->find($targetClass->name, $relatedId);
} else {
$other = $this->em->getProxyFactory()->getProxy(
$assoc2['targetEntity'],
$relatedId
);
$this->registerManaged($other, $relatedId, array());
}
}
$prop->setValue($managedCopy, $other);
}
}
} else {
$mergeCol = $prop->getValue($entity);
if ($mergeCol instanceof PersistentCollection && !$mergeCol->isInitialized()) {
// do not merge fields marked lazy that have not been fetched.
// keep the lazy persistent collection of the managed copy.
return;
}
$managedCol = $prop->getValue($managedCopy);
if (!$managedCol) {
$managedCol = new PersistentCollection(
$this->em,
$this->em->getClassMetadata($assoc2['targetEntity']),
new ArrayCollection
);
$managedCol->setOwner($managedCopy, $assoc2);
$prop->setValue($managedCopy, $managedCol);
$this->originalEntityData[spl_object_hash($entity)][$name] = $managedCol;
}
if ($assoc2['isCascadeMerge']) {
$managedCol->initialize();
// clear and set dirty a managed collection if its not also the same collection to merge from.
if (!$managedCol->isEmpty() && $managedCol !== $mergeCol) {
$managedCol->unwrap()->clear();
$managedCol->setDirty(true);
if ($assoc2['isOwningSide']
&& $assoc2['type'] == ClassMetadata::MANY_TO_MANY
&& $class->isChangeTrackingNotify()
) {
$this->scheduleForDirtyCheck($managedCopy);
}
}
}
}
}
if ($class->isChangeTrackingNotify()) {
// Just treat all properties as changed, there is no other choice.
$this->propertyChanged($managedCopy, $name, null, $prop->getValue($managedCopy));
}
}
}
/**
* INTERNAL:
* Registers an entity as managed.
*
* @param object $entity The entity.
* @param array $id The identifier values.
* @param array $data The original entity data.
*
* @return void
*/
public function registerManaged($entity, array $id, array $data)
{
$oid = spl_object_hash($entity);
$this->entityIdentifiers[$oid] = $id;
$this->entityStates[$oid] = self::STATE_MANAGED;
$this->originalEntityData[$oid] = $data;
$this->addToIdentityMap($entity);
if ($entity instanceof NotifyPropertyChanged && ( !$entity instanceof Proxy || $entity->__isInitialized() )) {
$entity->addPropertyChangedListener($this);
}
}
/**
* Notifies this UnitOfWork of a property change in an entity.
*
* @param object $entity The entity that owns the property.
* @param string $propertyName The name of the property that changed.
* @param mixed $oldValue The old value of the property.
* @param mixed $newValue The new value of the property.
*
* @return void
*/
public function propertyChanged($entity, $propertyName, $oldValue, $newValue)
{
$oid = spl_object_hash($entity);
$class = $this->em->getClassMetadata(get_class($entity));
$isAssocField = isset( $class->associationMappings[$propertyName] );
if (!$isAssocField && !isset( $class->fieldMappings[$propertyName] )) {
return; // ignore non-persistent fields
}
// Update changeset and mark entity for synchronization
$this->entityChangeSets[$oid][$propertyName] = array($oldValue, $newValue);
if (!isset( $this->scheduledForSynchronization[$class->rootEntityName][$oid] )) {
$this->scheduleForDirtyCheck($entity);
}
}
/**
* Cascades a merge operation to associated entities.
*
* @param object $entity
* @param object $managedCopy
* @param array $visited
*
* @return void
*/
private function cascadeMerge($entity, $managedCopy, array &$visited)
{
$class = $this->em->getClassMetadata(get_class($entity));
$associationMappings = array_filter(
$class->associationMappings,
function ($assoc) {
return $assoc['isCascadeMerge'];
}
);
foreach ($associationMappings as $assoc) {
$relatedEntities = $class->reflFields[$assoc['fieldName']]->getValue($entity);
if ($relatedEntities instanceof Collection) {
if ($relatedEntities === $class->reflFields[$assoc['fieldName']]->getValue($managedCopy)) {
continue;
}
if ($relatedEntities instanceof PersistentCollection) {
// Unwrap so that foreach() does not initialize
$relatedEntities = $relatedEntities->unwrap();
}
foreach ($relatedEntities as $relatedEntity) {
$this->doMerge($relatedEntity, $visited, $managedCopy, $assoc);
}
} else {
if ($relatedEntities !== null) {
$this->doMerge($relatedEntities, $visited, $managedCopy, $assoc);
}
}
}
}
/**
* Detaches an entity from the persistence management. It's persistence will
* no longer be managed by Doctrine.
*
* @param object $entity The entity to detach.
*
* @return void
*/
public function detach($entity)
{
$visited = array();
$this->doDetach($entity, $visited);
}
/**
* Executes a detach operation on the given entity.
*
* @param object $entity
* @param array $visited
* @param boolean $noCascade if true, don't cascade detach operation.
*
* @return void
*/
private function doDetach($entity, array &$visited, $noCascade = false)
{
$oid = spl_object_hash($entity);
if (isset( $visited[$oid] )) {
return; // Prevent infinite recursion
}
$visited[$oid] = $entity; // mark visited
switch ($this->getEntityState($entity, self::STATE_DETACHED)) {
case self::STATE_MANAGED:
if ($this->isInIdentityMap($entity)) {
$this->removeFromIdentityMap($entity);
}
unset(
$this->entityInsertions[$oid],
$this->entityUpdates[$oid],
$this->entityDeletions[$oid],
$this->entityIdentifiers[$oid],
$this->entityStates[$oid],
$this->originalEntityData[$oid]
);
break;
case self::STATE_NEW:
case self::STATE_DETACHED:
return;
}
if (!$noCascade) {
$this->cascadeDetach($entity, $visited);
}
}
/**
* Cascades a detach operation to associated entities.
*
* @param object $entity
* @param array $visited
*
* @return void
*/
private function cascadeDetach($entity, array &$visited)
{
$class = $this->em->getClassMetadata(get_class($entity));
$associationMappings = array_filter(
$class->associationMappings,
function ($assoc) {
return $assoc['isCascadeDetach'];
}
);
foreach ($associationMappings as $assoc) {
$relatedEntities = $class->reflFields[$assoc['fieldName']]->getValue($entity);
switch (true) {
case ( $relatedEntities instanceof PersistentCollection ):
// Unwrap so that foreach() does not initialize
$relatedEntities = $relatedEntities->unwrap();
// break; is commented intentionally!
case ( $relatedEntities instanceof Collection ):
case ( is_array($relatedEntities) ):
foreach ($relatedEntities as $relatedEntity) {
$this->doDetach($relatedEntity, $visited);
}
break;
case ( $relatedEntities !== null ):
$this->doDetach($relatedEntities, $visited);
break;
default:
// Do nothing
}
}
}
/**
* Refreshes the state of the given entity from the database, overwriting
* any local, unpersisted changes.
*
* @param object $entity The entity to refresh.
*
* @return void
*
* @throws InvalidArgumentException If the entity is not MANAGED.
*/
public function refresh($entity)
{
$visited = array();
$this->doRefresh($entity, $visited);
}
/**
* Executes a refresh operation on an entity.
*
* @param object $entity The entity to refresh.
* @param array $visited The already visited entities during cascades.
*
* @return void
*
* @throws ORMInvalidArgumentException If the entity is not MANAGED.
*/
private function doRefresh($entity, array &$visited)
{
$oid = spl_object_hash($entity);
if (isset( $visited[$oid] )) {
return; // Prevent infinite recursion
}
$visited[$oid] = $entity; // mark visited
$class = $this->em->getClassMetadata(get_class($entity));
if ($this->getEntityState($entity) !== self::STATE_MANAGED) {
throw ORMInvalidArgumentException::entityNotManaged($entity);
}
$this->getEntityPersister($class->name)->refresh(
array_combine($class->getIdentifierFieldNames(), $this->entityIdentifiers[$oid]),
$entity
);
$this->cascadeRefresh($entity, $visited);
}
/**
* Cascades a refresh operation to associated entities.
*
* @param object $entity
* @param array $visited
*
* @return void
*/
private function cascadeRefresh($entity, array &$visited)
{
$class = $this->em->getClassMetadata(get_class($entity));
$associationMappings = array_filter(
$class->associationMappings,
function ($assoc) {
return $assoc['isCascadeRefresh'];
}
);
foreach ($associationMappings as $assoc) {
$relatedEntities = $class->reflFields[$assoc['fieldName']]->getValue($entity);
switch (true) {
case ( $relatedEntities instanceof PersistentCollection ):
// Unwrap so that foreach() does not initialize
$relatedEntities = $relatedEntities->unwrap();
// break; is commented intentionally!
case ( $relatedEntities instanceof Collection ):
case ( is_array($relatedEntities) ):
foreach ($relatedEntities as $relatedEntity) {
$this->doRefresh($relatedEntity, $visited);
}
break;
case ( $relatedEntities !== null ):
$this->doRefresh($relatedEntities, $visited);
break;
default:
// Do nothing
}
}
}
/**
* Acquire a lock on the given entity.
*
* @param object $entity
* @param int $lockMode
* @param int $lockVersion
*
* @return void
*
* @throws ORMInvalidArgumentException
* @throws TransactionRequiredException
* @throws OptimisticLockException
*/
public function lock($entity, $lockMode, $lockVersion = null)
{
if ($entity === null) {
throw new \InvalidArgumentException("No entity passed to UnitOfWork#lock().");
}
if ($this->getEntityState($entity, self::STATE_DETACHED) != self::STATE_MANAGED) {
throw ORMInvalidArgumentException::entityNotManaged($entity);
}
$class = $this->em->getClassMetadata(get_class($entity));
switch (true) {
case LockMode::OPTIMISTIC === $lockMode:
if (!$class->isVersioned) {
throw OptimisticLockException::notVersioned($class->name);
}
if ($lockVersion === null) {
return;
}
if ($entity instanceof Proxy && !$entity->__isInitialized__) {
$entity->__load();
}
$entityVersion = $class->reflFields[$class->versionField]->getValue($entity);
if ($entityVersion != $lockVersion) {
throw OptimisticLockException::lockFailedVersionMismatch($entity, $lockVersion, $entityVersion);
}
break;
case LockMode::NONE === $lockMode:
case LockMode::PESSIMISTIC_READ === $lockMode:
case LockMode::PESSIMISTIC_WRITE === $lockMode:
if (!$this->em->getConnection()->isTransactionActive()) {
throw TransactionRequiredException::transactionRequired();
}
$oid = spl_object_hash($entity);
$this->getEntityPersister($class->name)->lock(
array_combine($class->getIdentifierFieldNames(), $this->entityIdentifiers[$oid]),
$lockMode
);
break;
default:
// Do nothing
}
}
/**
* Clears the UnitOfWork.
*
* @param string|null $entityName if given, only entities of this type will get detached.
*
* @return void
*/
public function clear($entityName = null)
{
if ($entityName === null) {
$this->identityMap =
$this->entityIdentifiers =
$this->originalEntityData =
$this->entityChangeSets =
$this->entityStates =
$this->scheduledForSynchronization =
$this->entityInsertions =
$this->entityUpdates =
$this->entityDeletions =
$this->collectionDeletions =
$this->collectionUpdates =
$this->extraUpdates =
$this->readOnlyObjects =
$this->visitedCollections =
$this->orphanRemovals = array();
if ($this->commitOrderCalculator !== null) {
$this->commitOrderCalculator->clear();
}
} else {
$visited = array();
foreach ($this->identityMap as $className => $entities) {
if ($className !== $entityName) {
continue;
}
foreach ($entities as $entity) {
$this->doDetach($entity, $visited, false);
}
}
}
if ($this->evm->hasListeners(Events::onClear)) {
$this->evm->dispatchEvent(Events::onClear, new Event\OnClearEventArgs($this->em, $entityName));
}
}
/**
* INTERNAL:
* Schedules a complete collection for removal when this UnitOfWork commits.
*
* @param PersistentCollection $coll
*
* @return void
*/
public function scheduleCollectionDeletion(PersistentCollection $coll)
{
$coid = spl_object_hash($coll);
// TODO: if $coll is already scheduled for recreation ... what to do?
// Just remove $coll from the scheduled recreations?
if (isset( $this->collectionUpdates[$coid] )) {
unset( $this->collectionUpdates[$coid] );
}
$this->collectionDeletions[$coid] = $coll;
}
/**
* @param PersistentCollection $coll
*
* @return bool
*/
public function isCollectionScheduledForDeletion(PersistentCollection $coll)
{
return isset( $this->collectionDeletions[spl_object_hash($coll)] );
}
/**
* INTERNAL:
* Creates an entity. Used for reconstitution of persistent entities.
*
* Internal note: Highly performance-sensitive method.
*
* @ignore
*
* @param string $className The name of the entity class.
* @param array $data The data for the entity.
* @param array $hints Any hints to account for during reconstitution/lookup of the entity.
*
* @return object The managed entity instance.
*
* @todo Rename: getOrCreateEntity
*/
public function createEntity($className, array $data, &$hints = array())
{
$class = $this->em->getClassMetadata($className);
//$isReadOnly = isset($hints[Query::HINT_READ_ONLY]);
$id = $this->identifierFlattener->flattenIdentifier($class, $data);
$idHash = implode(' ', $id);
if (isset( $this->identityMap[$class->rootEntityName][$idHash] )) {
$entity = $this->identityMap[$class->rootEntityName][$idHash];
$oid = spl_object_hash($entity);
if (
isset( $hints[Query::HINT_REFRESH] )
&& isset( $hints[Query::HINT_REFRESH_ENTITY] )
&& ( $unmanagedProxy = $hints[Query::HINT_REFRESH_ENTITY] ) !== $entity
&& $unmanagedProxy instanceof Proxy
&& $this->isIdentifierEquals($unmanagedProxy, $entity)
) {
// DDC-1238 - we have a managed instance, but it isn't the provided one.
// Therefore we clear its identifier. Also, we must re-fetch metadata since the
// refreshed object may be anything
foreach ($class->identifier as $fieldName) {
$class->reflFields[$fieldName]->setValue($unmanagedProxy, null);
}
return $unmanagedProxy;
}
if ($entity instanceof Proxy && !$entity->__isInitialized()) {
$entity->__setInitialized(true);
$overrideLocalValues = true;
if ($entity instanceof NotifyPropertyChanged) {
$entity->addPropertyChangedListener($this);
}
} else {
$overrideLocalValues = isset( $hints[Query::HINT_REFRESH] );
// If only a specific entity is set to refresh, check that it's the one
if (isset( $hints[Query::HINT_REFRESH_ENTITY] )) {
$overrideLocalValues = $hints[Query::HINT_REFRESH_ENTITY] === $entity;
}
}
if ($overrideLocalValues) {
// inject ObjectManager upon refresh.
if ($entity instanceof ObjectManagerAware) {
$entity->injectObjectManager($this->em, $class);
}
$this->originalEntityData[$oid] = $data;
}
} else {
$entity = $this->newInstance($class);
$oid = spl_object_hash($entity);
$this->entityIdentifiers[$oid] = $id;
$this->entityStates[$oid] = self::STATE_MANAGED;
$this->originalEntityData[$oid] = $data;
$this->identityMap[$class->rootEntityName][$idHash] = $entity;
if ($entity instanceof NotifyPropertyChanged) {
$entity->addPropertyChangedListener($this);
}
$overrideLocalValues = true;
}
if (!$overrideLocalValues) {
return $entity;
}
foreach ($data as $field => $value) {
if (isset( $class->fieldMappings[$field] )) {
$class->reflFields[$field]->setValue($entity, $value);
}
}
// Loading the entity right here, if its in the eager loading map get rid of it there.
unset( $this->eagerLoadingEntities[$class->rootEntityName][$idHash] );
if (isset( $this->eagerLoadingEntities[$class->rootEntityName] ) && !$this->eagerLoadingEntities[$class->rootEntityName]) {
unset( $this->eagerLoadingEntities[$class->rootEntityName] );
}
// Properly initialize any unfetched associations, if partial objects are not allowed.
if (isset( $hints[Query::HINT_FORCE_PARTIAL_LOAD] )) {
return $entity;
}
foreach ($class->associationMappings as $field => $assoc) {
// Check if the association is not among the fetch-joined associations already.
if (isset( $hints['fetchAlias'] ) && isset( $hints['fetched'][$hints['fetchAlias']][$field] )) {
continue;
}
$targetClass = $this->em->getClassMetadata($assoc['targetEntity']);
switch (true) {
case ( $assoc['type'] & ClassMetadata::TO_ONE ):
if (!$assoc['isOwningSide']) {
// use the given entity association
if (isset( $data[$field] ) && is_object($data[$field]) && isset( $this->entityStates[spl_object_hash($data[$field])] )) {
$this->originalEntityData[$oid][$field] = $data[$field];
$class->reflFields[$field]->setValue($entity, $data[$field]);
$targetClass->reflFields[$assoc['mappedBy']]->setValue($data[$field], $entity);
continue 2;
}
// Inverse side of x-to-one can never be lazy
$class->reflFields[$field]->setValue($entity,
$this->getEntityPersister($assoc['targetEntity'])->loadOneToOneEntity($assoc, $entity));
continue 2;
}
// use the entity association
if (isset( $data[$field] ) && is_object($data[$field]) && isset( $this->entityStates[spl_object_hash($data[$field])] )) {
$class->reflFields[$field]->setValue($entity, $data[$field]);
$this->originalEntityData[$oid][$field] = $data[$field];
continue;
}
$associatedId = array();
// TODO: Is this even computed right in all cases of composite keys?
foreach ($assoc['targetToSourceKeyColumns'] as $targetColumn => $srcColumn) {
$joinColumnValue = isset( $data[$srcColumn] ) ? $data[$srcColumn] : null;
if ($joinColumnValue !== null) {
if ($targetClass->containsForeignIdentifier) {
$associatedId[$targetClass->getFieldForColumn($targetColumn)] = $joinColumnValue;
} else {
$associatedId[$targetClass->fieldNames[$targetColumn]] = $joinColumnValue;
}
} elseif ($targetClass->containsForeignIdentifier
&& in_array($targetClass->getFieldForColumn($targetColumn), $targetClass->identifier, true)
) {
// the missing key is part of target's entity primary key
$associatedId = array();
break;
}
}
if (!$associatedId) {
// Foreign key is NULL
$class->reflFields[$field]->setValue($entity, null);
$this->originalEntityData[$oid][$field] = null;
continue;
}
if (!isset( $hints['fetchMode'][$class->name][$field] )) {
$hints['fetchMode'][$class->name][$field] = $assoc['fetch'];
}
// Foreign key is set
// Check identity map first
// FIXME: Can break easily with composite keys if join column values are in
// wrong order. The correct order is the one in ClassMetadata#identifier.
$relatedIdHash = implode(' ', $associatedId);
switch (true) {
case ( isset( $this->identityMap[$targetClass->rootEntityName][$relatedIdHash] ) ):
$newValue = $this->identityMap[$targetClass->rootEntityName][$relatedIdHash];
// If this is an uninitialized proxy, we are deferring eager loads,
// this association is marked as eager fetch, and its an uninitialized proxy (wtf!)
// then we can append this entity for eager loading!
if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER &&
isset( $hints[self::HINT_DEFEREAGERLOAD] ) &&
!$targetClass->isIdentifierComposite &&
$newValue instanceof Proxy &&
$newValue->__isInitialized__ === false
) {
$this->eagerLoadingEntities[$targetClass->rootEntityName][$relatedIdHash] = current($associatedId);
}
break;
case ( $targetClass->subClasses ):
// If it might be a subtype, it can not be lazy. There isn't even
// a way to solve this with deferred eager loading, which means putting
// an entity with subclasses at a *-to-one location is really bad! (performance-wise)
$newValue = $this->getEntityPersister($assoc['targetEntity'])->loadOneToOneEntity($assoc,
$entity, $associatedId);
break;
default:
switch (true) {
// We are negating the condition here. Other cases will assume it is valid!
case ( $hints['fetchMode'][$class->name][$field] !== ClassMetadata::FETCH_EAGER ):
$newValue = $this->em->getProxyFactory()->getProxy($assoc['targetEntity'],
$associatedId);
break;
// Deferred eager load only works for single identifier classes
case ( isset( $hints[self::HINT_DEFEREAGERLOAD] ) && !$targetClass->isIdentifierComposite ):
// TODO: Is there a faster approach?
$this->eagerLoadingEntities[$targetClass->rootEntityName][$relatedIdHash] = current($associatedId);
$newValue = $this->em->getProxyFactory()->getProxy($assoc['targetEntity'],
$associatedId);
break;
default:
// TODO: This is very imperformant, ignore it?
$newValue = $this->em->find($assoc['targetEntity'], $associatedId);
break;
}
// PERF: Inlined & optimized code from UnitOfWork#registerManaged()
$newValueOid = spl_object_hash($newValue);
$this->entityIdentifiers[$newValueOid] = $associatedId;
$this->identityMap[$targetClass->rootEntityName][$relatedIdHash] = $newValue;
if (
$newValue instanceof NotifyPropertyChanged &&
( !$newValue instanceof Proxy || $newValue->__isInitialized() )
) {
$newValue->addPropertyChangedListener($this);
}
$this->entityStates[$newValueOid] = self::STATE_MANAGED;
// make sure that when an proxy is then finally loaded, $this->originalEntityData is set also!
break;
}
$this->originalEntityData[$oid][$field] = $newValue;
$class->reflFields[$field]->setValue($entity, $newValue);
if ($assoc['inversedBy'] && $assoc['type'] & ClassMetadata::ONE_TO_ONE) {
$inverseAssoc = $targetClass->associationMappings[$assoc['inversedBy']];
$targetClass->reflFields[$inverseAssoc['fieldName']]->setValue($newValue, $entity);
}
break;
default:
// Ignore if its a cached collection
if (isset( $hints[Query::HINT_CACHE_ENABLED] ) && $class->getFieldValue($entity,
$field) instanceof PersistentCollection
) {
break;
}
// use the given collection
if (isset( $data[$field] ) && $data[$field] instanceof PersistentCollection) {
$data[$field]->setOwner($entity, $assoc);
$class->reflFields[$field]->setValue($entity, $data[$field]);
$this->originalEntityData[$oid][$field] = $data[$field];
break;
}
// Inject collection
$pColl = new PersistentCollection($this->em, $targetClass, new ArrayCollection);
$pColl->setOwner($entity, $assoc);
$pColl->setInitialized(false);
$reflField = $class->reflFields[$field];
$reflField->setValue($entity, $pColl);
if ($assoc['fetch'] == ClassMetadata::FETCH_EAGER) {
$this->loadCollection($pColl);
$pColl->takeSnapshot();
}
$this->originalEntityData[$oid][$field] = $pColl;
break;
}
}
if ($overrideLocalValues) {
// defer invoking of postLoad event to hydration complete step
$this->hydrationCompleteHandler->deferPostLoadInvoking($class, $entity);
}
return $entity;
}
/**
* Verifies if two given entities actually are the same based on identifier comparison
*
* @param object $entity1
* @param object $entity2
*
* @return bool
*/
private function isIdentifierEquals($entity1, $entity2)
{
if ($entity1 === $entity2) {
return true;
}
$class = $this->em->getClassMetadata(get_class($entity1));
if ($class !== $this->em->getClassMetadata(get_class($entity2))) {
return false;
}
$oid1 = spl_object_hash($entity1);
$oid2 = spl_object_hash($entity2);
$id1 = isset( $this->entityIdentifiers[$oid1] )
? $this->entityIdentifiers[$oid1]
: $this->identifierFlattener->flattenIdentifier($class, $class->getIdentifierValues($entity1));
$id2 = isset( $this->entityIdentifiers[$oid2] )
? $this->entityIdentifiers[$oid2]
: $this->identifierFlattener->flattenIdentifier($class, $class->getIdentifierValues($entity2));
return $id1 === $id2 || implode(' ', $id1) === implode(' ', $id2);
}
/**
* Initializes (loads) an uninitialized persistent collection of an entity.
*
* @param \Doctrine\ORM\PersistentCollection $collection The collection to initialize.
*
* @return void
*
* @todo Maybe later move to EntityManager#initialize($proxyOrCollection). See DDC-733.
*/
public function loadCollection(PersistentCollection $collection)
{
$assoc = $collection->getMapping();
$persister = $this->getEntityPersister($assoc['targetEntity']);
switch ($assoc['type']) {
case ClassMetadata::ONE_TO_MANY:
$persister->loadOneToManyCollection($assoc, $collection->getOwner(), $collection);
break;
case ClassMetadata::MANY_TO_MANY:
$persister->loadManyToManyCollection($assoc, $collection->getOwner(), $collection);
break;
}
$collection->setInitialized(true);
}
/**
* @return void
*/
public function triggerEagerLoads()
{
if (!$this->eagerLoadingEntities) {
return;
}
// avoid infinite recursion
$eagerLoadingEntities = $this->eagerLoadingEntities;
$this->eagerLoadingEntities = array();
foreach ($eagerLoadingEntities as $entityName => $ids) {
if (!$ids) {
continue;
}
$class = $this->em->getClassMetadata($entityName);
$this->getEntityPersister($entityName)->loadAll(
array_combine($class->identifier, array(array_values($ids)))
);
}
}
/**
* Gets the identity map of the UnitOfWork.
*
* @return array
*/
public function getIdentityMap()
{
return $this->identityMap;
}
/* PropertyChangedListener implementation */
/**
* Gets the original data of an entity. The original data is the data that was
* present at the time the entity was reconstituted from the database.
*
* @param object $entity
*
* @return array
*/
public function getOriginalEntityData($entity)
{
$oid = spl_object_hash($entity);
if (isset( $this->originalEntityData[$oid] )) {
return $this->originalEntityData[$oid];
}
return array();
}
/**
* @ignore
*
* @param object $entity
* @param array $data
*
* @return void
*/
public function setOriginalEntityData($entity, array $data)
{
$this->originalEntityData[spl_object_hash($entity)] = $data;
}
/**
* INTERNAL:
* Sets a property value of the original data array of an entity.
*
* @ignore
*
* @param string $oid
* @param string $property
* @param mixed $value
*
* @return void
*/
public function setOriginalEntityProperty($oid, $property, $value)
{
$this->originalEntityData[$oid][$property] = $value;
}
/**
* Processes an entity instance to extract their identifier values.
*
* @param object $entity The entity instance.
*
* @return mixed A scalar value.
*
* @throws \Doctrine\ORM\ORMInvalidArgumentException
*/
public function getSingleIdentifierValue($entity)
{
$class = $this->em->getClassMetadata(get_class($entity));
if ($class->isIdentifierComposite) {
throw ORMInvalidArgumentException::invalidCompositeIdentifier();
}
$values = $this->isInIdentityMap($entity)
? $this->getEntityIdentifier($entity)
: $class->getIdentifierValues($entity);
return isset( $values[$class->identifier[0]] ) ? $values[$class->identifier[0]] : null;
}
/**
* Gets the identifier of an entity.
* The returned value is always an array of identifier values. If the entity
* has a composite identifier then the identifier values are in the same
* order as the identifier field names as returned by ClassMetadata#getIdentifierFieldNames().
*
* @param object $entity
*
* @return array The identifier values.
*/
public function getEntityIdentifier($entity)
{
return $this->entityIdentifiers[spl_object_hash($entity)];
}
/**
* Checks whether the UnitOfWork has any pending insertions.
*
* @return boolean TRUE if this UnitOfWork has pending insertions, FALSE otherwise.
*/
public function hasPendingInsertions()
{
return !empty( $this->entityInsertions );
}
/**
* Calculates the size of the UnitOfWork. The size of the UnitOfWork is the
* number of entities in the identity map.
*
* @return integer
*/
public function size()
{
$countArray = array_map(function ($item) {
return count($item);
}, $this->identityMap);
return array_sum($countArray);
}
/**
* INTERNAL:
* Clears the property changeset of the entity with the given OID.
*
* @param string $oid The entity's OID.
*
* @return void
*/
public function clearEntityChangeSet($oid)
{
$this->entityChangeSets[$oid] = array();
}
/**
* Gets the currently scheduled entity insertions in this UnitOfWork.
*
* @return array
*/
public function getScheduledEntityInsertions()
{
return $this->entityInsertions;
}
/**
* Gets the currently scheduled entity updates in this UnitOfWork.
*
* @return array
*/
public function getScheduledEntityUpdates()
{
return $this->entityUpdates;
}
/**
* Gets the currently scheduled entity deletions in this UnitOfWork.
*
* @return array
*/
public function getScheduledEntityDeletions()
{
return $this->entityDeletions;
}
/**
* Gets the currently scheduled complete collection deletions
*
* @return array
*/
public function getScheduledCollectionDeletions()
{
return $this->collectionDeletions;
}
/**
* Gets the currently scheduled collection inserts, updates and deletes.
*
* @return array
*/
public function getScheduledCollectionUpdates()
{
return $this->collectionUpdates;
}
/**
* Helper method to initialize a lazy loading proxy or persistent collection.
*
* @param object $obj
*
* @return void
*/
public function initializeObject($obj)
{
if ($obj instanceof Proxy) {
$obj->__load();
return;
}
if ($obj instanceof PersistentCollection) {
$obj->initialize();
}
}
/**
* Marks an entity as read-only so that it will not be considered for updates during UnitOfWork#commit().
*
* This operation cannot be undone as some parts of the UnitOfWork now keep gathering information
* on this object that might be necessary to perform a correct update.
*
* @param object $object
*
* @return void
*
* @throws ORMInvalidArgumentException
*/
public function markReadOnly($object)
{
if (!is_object($object) || !$this->isInIdentityMap($object)) {
throw ORMInvalidArgumentException::readOnlyRequiresManagedEntity($object);
}
$this->readOnlyObjects[spl_object_hash($object)] = true;
}
/**
* Is this entity read only?
*
* @param object $object
*
* @return bool
*
* @throws ORMInvalidArgumentException
*/
public function isReadOnly($object)
{
if (!is_object($object)) {
throw ORMInvalidArgumentException::readOnlyRequiresManagedEntity($object);
}
return isset( $this->readOnlyObjects[spl_object_hash($object)] );
}
/**
* This method called by hydrators, and indicates that hydrator totally completed current hydration cycle.
* Unit of work able to fire deferred events, related to loading events here.
*
* @internal should be called internally from object hydrators
*/
public function hydrationComplete()
{
$this->hydrationCompleteHandler->hydrationComplete();
}
}
| {
"content_hash": "58b2d35443cf73e47a15fa602bff12cf",
"timestamp": "",
"source": "github",
"line_count": 3551,
"max_line_length": 154,
"avg_line_length": 33.46493945367502,
"alnum_prop": 0.5481091270175202,
"repo_name": "DerDu/MOC-Framework-Mark-V",
"id": "e43582ca98d165f07f21ee284fba6c2c5eeda28e",
"size": "119815",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Component/Database/Vendor/Doctrine2ORM/2.5.0/lib/Doctrine/ORM/UnitOfWork.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "110"
},
{
"name": "HTML",
"bytes": "252"
},
{
"name": "PHP",
"bytes": "299247"
},
{
"name": "Smarty",
"bytes": "252"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite hostname="ncherkasov" name="selenium_training.LoginTest" tests="2" failures="0" timestamp="23 Jul 2015 18:03:45 GMT" time="4.472" errors="0">
<testcase name="testLoginOK" time="2.730" classname="selenium_training.LoginTest"/>
<testcase name="testLoginFailed" time="1.742" classname="selenium_training.LoginTest"/>
</testsuite> <!-- selenium_training.LoginTest -->
| {
"content_hash": "fb64fb1b73059bdbaa6c09b41b9d341d",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 152,
"avg_line_length": 80.16666666666667,
"alnum_prop": 0.7338877338877339,
"repo_name": "DARTKolian/Selenium-Java-Training-Cherkasov",
"id": "aeeb3e1cebb68d3137a03cae24117345d427efe4",
"size": "481",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Homework 5_1/test-output/junitreports/TEST-selenium_training.LoginTest.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "53370"
},
{
"name": "HTML",
"bytes": "391995"
},
{
"name": "Java",
"bytes": "145221"
},
{
"name": "JavaScript",
"bytes": "35550"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia at 2014-11-25
| Rendered using Apache Maven Fluido Skin 1.3.0
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="Date-Revision-yyyymmdd" content="20141125" />
<meta http-equiv="Content-Language" content="en" />
<title>Trap HTTP Test for Servlet Transport - Continuous Integration</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.3.0.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido-1.3.0.min.js"></script>
</head>
<body class="topBarDisabled">
<div class="container-fluid">
<div id="banner">
<div class="pull-left">
<div id="bannerLeft">
<h2>Trap HTTP Test for Servlet Transport</h2>
</div>
</div>
<div class="pull-right"> </div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li id="publishDate">Last Published: 2014-11-25</li>
<li class="divider">|</li> <li id="projectVersion">Version: 1.3</li>
<li class="divider">|</li> <li class="">
<a href="../../../index.html" title="Trap">
Trap</a>
</li>
<li class="divider ">/</li>
<li class="">
<a href="../../" title="TrAP Packaging Parent">
TrAP Packaging Parent</a>
</li>
<li class="divider ">/</li>
<li class="">
<a href="../" title="TrAP Tests Arquillian Parent">
TrAP Tests Arquillian Parent</a>
</li>
<li class="divider ">/</li>
<li class="">
<a href="./" title="Trap HTTP Test for Servlet Transport">
Trap HTTP Test for Servlet Transport</a>
</li>
<li class="divider ">/</li>
<li class="">Continuous Integration</li>
</ul>
</div>
<div class="row-fluid">
<div id="leftColumn" class="span3">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Trap 1.3</li>
<li>
<a href="../../../index.html" title="Introduction">
<i class="none"></i>
Introduction</a>
</li>
<li>
<a href="../../../trap-api/quickstart.html" title="Java Quickstart">
<i class="none"></i>
Java Quickstart</a>
</li>
<li>
<a href="../../../trap-js/index.html" title="JavaScript Quickstart">
<i class="none"></i>
JavaScript Quickstart</a>
</li>
<li>
<a href="../../../channels.html" title="Channels">
<i class="none"></i>
Channels</a>
</li>
<li>
<a href="../../../configuration.html" title="Configuration">
<i class="none"></i>
Configuration</a>
</li>
<li class="nav-header">Language Specific Documentation</li>
<li>
<a href="../../../trap-api/index.html" title="Java">
<i class="none"></i>
Java</a>
</li>
<li>
<a href="../../../trap-js/index.html" title="JavaScript">
<i class="none"></i>
JavaScript</a>
</li>
<li class="nav-header">Project Documentation</li>
<li>
<a href="project-info.html" title="Project Information">
<i class="icon-chevron-down"></i>
Project Information</a>
<ul class="nav nav-list">
<li>
<a href="index.html" title="About">
<i class="none"></i>
About</a>
</li>
<li>
<a href="plugin-management.html" title="Plugin Management">
<i class="none"></i>
Plugin Management</a>
</li>
<li>
<a href="distribution-management.html" title="Distribution Management">
<i class="none"></i>
Distribution Management</a>
</li>
<li>
<a href="dependency-info.html" title="Dependency Information">
<i class="none"></i>
Dependency Information</a>
</li>
<li>
<a href="dependency-convergence.html" title="Dependency Convergence">
<i class="none"></i>
Dependency Convergence</a>
</li>
<li>
<a href="source-repository.html" title="Source Repository">
<i class="none"></i>
Source Repository</a>
</li>
<li>
<a href="mail-lists.html" title="Mailing Lists">
<i class="none"></i>
Mailing Lists</a>
</li>
<li>
<a href="issue-tracking.html" title="Issue Tracking">
<i class="none"></i>
Issue Tracking</a>
</li>
<li class="active">
<a href="#"><i class="none"></i>Continuous Integration</a>
</li>
<li>
<a href="plugins.html" title="Project Plugins">
<i class="none"></i>
Project Plugins</a>
</li>
<li>
<a href="license.html" title="Project License">
<i class="none"></i>
Project License</a>
</li>
<li>
<a href="dependency-management.html" title="Dependency Management">
<i class="none"></i>
Dependency Management</a>
</li>
<li>
<a href="team-list.html" title="Project Team">
<i class="none"></i>
Project Team</a>
</li>
<li>
<a href="project-summary.html" title="Project Summary">
<i class="none"></i>
Project Summary</a>
</li>
<li>
<a href="dependencies.html" title="Dependencies">
<i class="none"></i>
Dependencies</a>
</li>
</ul>
</li>
<li>
<a href="project-reports.html" title="Project Reports">
<i class="icon-chevron-right"></i>
Project Reports</a>
</li>
</ul>
<form id="search-form" action="http://www.google.com/search" method="get" >
<input value="ericssonresearch.github.io/trap/trap-tests-parent/trap-tests-arquillian-parent/http-tests-servlet/" name="sitesearch" type="hidden"/>
<input class="search-query" name="q" id="query" type="text" />
</form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=search-form"></script>
<hr class="divider" />
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
</div>
<div id="bodyColumn" class="span9" >
<div class="section">
<h2>Continuous Integration<a name="Continuous_Integration"></a></h2><a name="Continuous_Integration"></a>
<p>No continuous integration management system is defined. Please check back at a later date.</p></div>
</div>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row span12">Copyright © 2014
<a href="https://www.ericsson.com">Ericsson AB</a>.
All Rights Reserved.
</div>
</div>
</footer>
</body>
</html> | {
"content_hash": "729ba34a6a6547eae928de672035cc91",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 344,
"avg_line_length": 33.08724832214765,
"alnum_prop": 0.3977687626774848,
"repo_name": "princeofdarkness76/trap",
"id": "6196eaae608095d0edb7b84ee86a01d041843e71",
"size": "9860",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "trap-tests-parent/trap-tests-arquillian-parent/http-tests-servlet/integration.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "203809"
},
{
"name": "HTML",
"bytes": "40284461"
},
{
"name": "Java",
"bytes": "2358762"
},
{
"name": "JavaScript",
"bytes": "390348"
},
{
"name": "Shell",
"bytes": "7473"
}
],
"symlink_target": ""
} |
<?php
/* partials/sidebar.html.twig */
class __TwigTemplate_e6fc7443f33ffb47f00d3370bf2b580a258b08858e81fd546634fc26fe9466eb extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
echo "<div class=\"sidebar-content\">
\t<h4>Random Article</h4>
\t<a class=\"button\" href=\"";
// line 3
echo (isset($context["base_url_relative"]) ? $context["base_url_relative"] : null);
echo "/random\"><i class=\"fa fa-retweet\"></i> I'm Feeling Lucky!</a>
</div>
<div class=\"sidebar-content\">
\t<h4>Some Text Widget</h4>
\t<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.</p>
</div>
<div class=\"sidebar-content\">
<h4>Popular Tags</h4>
";
// line 11
$this->env->loadTemplate("taxonomylist.html.twig")->display(array_merge($context, array("taxonomy" => "tag")));
// line 12
echo "</div>
<div class=\"sidebar-content\">
<h4>Archives</h4>
\t";
// line 15
$this->env->loadTemplate("partials/archives.html.twig")->display($context);
// line 16
echo "</div>
<div class=\"sidebar-content syndicate\">
<h4>Syndicate</h4>
<a class=\"button\" href=\"";
// line 19
echo (isset($context["feed_url"]) ? $context["feed_url"] : null);
echo ".atom\"><i class=\"fa fa-rss-square\"></i> Atom 1.0</a>
<a class=\"button\" href=\"";
// line 20
echo (isset($context["feed_url"]) ? $context["feed_url"] : null);
echo ".rss\"><i class=\"fa fa-rss-square\"></i> RSS</a>
</div>
";
}
public function getTemplateName()
{
return "partials/sidebar.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 52 => 20, 48 => 19, 43 => 16, 41 => 15, 36 => 12, 34 => 11, 23 => 3, 19 => 1,);
}
}
| {
"content_hash": "55a1a2c14d3bb30bf4c0e4c4fc3ab447",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 126,
"avg_line_length": 30.01388888888889,
"alnum_prop": 0.5705691809347524,
"repo_name": "alexandrebgallant/blog.singularnetwork.ca",
"id": "c7c14f7bda50eeea82e7c903081441165488d899",
"size": "2161",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cache/twig/e6/fc/7443f33ffb47f00d3370bf2b580a258b08858e81fd546634fc26fe9466eb.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "107160"
},
{
"name": "HTML",
"bytes": "1164"
},
{
"name": "JavaScript",
"bytes": "737"
},
{
"name": "Nginx",
"bytes": "1551"
},
{
"name": "PHP",
"bytes": "465502"
},
{
"name": "Shell",
"bytes": "41"
}
],
"symlink_target": ""
} |
package com.gravity.goose
import network.{HtmlFetcher, AbstractHtmlFetcher}
import org.jsoup.nodes.Element
import java.util.Date
import scala.beans.BeanProperty
import com.gravity.goose.extractors.{StandardContentExtractor, ContentExtractor, AdditionalDataExtractor, PublishDateExtractor}
/**
* Created by Jim Plush
* User: jim
* Date: 8/16/11
*/
class Configuration {
/**
* this is the local storage path used to place images to inspect them, should be writable
*/
@BeanProperty
var localStoragePath: String = "/tmp/goose"
/**
* What's the minimum bytes for an image we'd accept is, alot of times we want to filter out the author's little images
* in the beginning of the article
*/
@BeanProperty
var minBytesForImages: Int = 4500
/**
* set this guy to false if you don't care about getting images, otherwise you can either use the default
* image extractor to implement the ImageExtractor interface to build your own
*/
@BeanProperty
var enableImageFetching: Boolean = true
/**
* path to your imagemagick convert executable, on the mac using mac ports this is the default listed
*/
@BeanProperty
var imagemagickConvertPath: String = "/opt/local/bin/convert"
/**
* path to your imagemagick identify executable
*/
@BeanProperty
var imagemagickIdentifyPath: String = "/opt/local/bin/identify"
@BeanProperty
var connectionTimeout: Int = 10000
@BeanProperty
var socketTimeout: Int = 10000
/**
* used as the user agent that is sent with your web requests to extract an article
*/
@BeanProperty
var browserUserAgent: String = "Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.8) Gecko/20100723 Ubuntu/10.04 (lucid) Firefox/3.6.8"
var contentExtractor: ContentExtractor = StandardContentExtractor
var publishDateExtractor: PublishDateExtractor = new PublishDateExtractor {
def extract(rootElement: Element): Date = {
null
}
}
var additionalDataExtractor: AdditionalDataExtractor = new AdditionalDataExtractor
def getPublishDateExtractor: PublishDateExtractor = {
publishDateExtractor
}
def setContentExtractor(extractor: ContentExtractor) {
if (extractor == null) throw new IllegalArgumentException("extractor must not be null!")
contentExtractor = extractor
}
/**
* Pass in to extract article publish dates.
* @param extractor a concrete instance of {@link PublishDateExtractor}
* @throws IllegalArgumentException if the instance passed in is <code>null</code>
*/
def setPublishDateExtractor(extractor: PublishDateExtractor) {
if (extractor == null) throw new IllegalArgumentException("extractor must not be null!")
this.publishDateExtractor = extractor
}
def getAdditionalDataExtractor: AdditionalDataExtractor = {
additionalDataExtractor
}
/**
* Pass in to extract any additional data not defined within {@link Article}
* @param extractor a concrete instance of {@link AdditionalDataExtractor}
* @throws IllegalArgumentException if the instance passed in is <code>null</code>
*/
def setAdditionalDataExtractor(extractor: AdditionalDataExtractor) {
this.additionalDataExtractor = extractor
}
var htmlFetcher: AbstractHtmlFetcher = HtmlFetcher
def setHtmlFetcher(fetcher: AbstractHtmlFetcher) {
require(fetcher != null, "fetcher MUST NOT be null!")
this.htmlFetcher = fetcher
}
def getHtmlFetcher: AbstractHtmlFetcher = htmlFetcher
} | {
"content_hash": "7f35a09644f02b6b9a84dcbb7ca18e2e",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 135,
"avg_line_length": 30.91891891891892,
"alnum_prop": 0.7467948717948718,
"repo_name": "jtsay362/goose",
"id": "fdf3499d0eb2c83f1901257c8354b46fb02063bb",
"size": "4217",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/scala/com/gravity/goose/Configuration.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Scala",
"bytes": "216590"
}
],
"symlink_target": ""
} |
#include <aws/monitoring/model/ListMetricStreamsRequest.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
using namespace Aws::CloudWatch::Model;
using namespace Aws::Utils;
ListMetricStreamsRequest::ListMetricStreamsRequest() :
m_nextTokenHasBeenSet(false),
m_maxResults(0),
m_maxResultsHasBeenSet(false)
{
}
Aws::String ListMetricStreamsRequest::SerializePayload() const
{
Aws::StringStream ss;
ss << "Action=ListMetricStreams&";
if(m_nextTokenHasBeenSet)
{
ss << "NextToken=" << StringUtils::URLEncode(m_nextToken.c_str()) << "&";
}
if(m_maxResultsHasBeenSet)
{
ss << "MaxResults=" << m_maxResults << "&";
}
ss << "Version=2010-08-01";
return ss.str();
}
void ListMetricStreamsRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const
{
uri.SetQueryString(SerializePayload());
}
| {
"content_hash": "dc9d67ab6116209bb636fc2f80d54668",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 77,
"avg_line_length": 22.487179487179485,
"alnum_prop": 0.7058152793614595,
"repo_name": "aws/aws-sdk-cpp",
"id": "775147bab22bd3d3e97d29366eb64536c747cea1",
"size": "996",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "aws-cpp-sdk-monitoring/source/model/ListMetricStreamsRequest.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "309797"
},
{
"name": "C++",
"bytes": "476866144"
},
{
"name": "CMake",
"bytes": "1245180"
},
{
"name": "Dockerfile",
"bytes": "11688"
},
{
"name": "HTML",
"bytes": "8056"
},
{
"name": "Java",
"bytes": "413602"
},
{
"name": "Python",
"bytes": "79245"
},
{
"name": "Shell",
"bytes": "9246"
}
],
"symlink_target": ""
} |
package Package;
public class Class {
//** Static variables.
//** Static initializer.
//** Instance variables.
//** Instance initializer.
//** Inner classes.
//** Constructors.
//** Static methods.
//** Instance methods.
}
| {
"content_hash": "6326122388972aef70a0f94152d7930f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 27,
"avg_line_length": 11.476190476190476,
"alnum_prop": 0.6224066390041494,
"repo_name": "SummitStreet/launchpad",
"id": "f13478e56b64f4027967344987e6ca54a7dd1ba2",
"size": "241",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/java/Class.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "8341"
},
{
"name": "JavaScript",
"bytes": "10370"
},
{
"name": "Makefile",
"bytes": "4168"
},
{
"name": "Python",
"bytes": "6926"
}
],
"symlink_target": ""
} |
<?php
function tweet($statusMessage)
{
$consumerKey = '';
$consumerSecret = '';
$oAuthToken = '';
$oAuthSecret = '';
if(file_exists('twitterpassword.php'))
require_once('twitterpassword.php');
require_once('twitteroauth.php');
// twitteroauth.php points to OAuth.php
// all files are in the same dir
// create a new instance
$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);
$tweet->post('statuses/update', array('status' => $statusMessage));
}
?> | {
"content_hash": "925cd4ba633c9be29a8f26a954610231",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 85,
"avg_line_length": 22.130434782608695,
"alnum_prop": 0.6777996070726916,
"repo_name": "mattgerstman/DMAssassins-1.0",
"id": "fc78004f48c835cc31caf46f89e3306a2236cac6",
"size": "509",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tweet.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1329"
},
{
"name": "PHP",
"bytes": "102596"
}
],
"symlink_target": ""
} |
<?php
namespace app\modules\api\models;
use Yii;
use \yii\db\ActiveRecord;
use \yii\db\Query;
class Comment extends ActiveRecord
{
const MAX_LEVEL = 3;
const DIGIT = 2;
public function rules()
{
return [
[['text', 'name', 'email'], 'required'],
[['email'], 'email'],
[['type', 'type_id', 'parent_id', 'hash', 'level', 'count_childs', 'rate', 'created'], 'safe'],
];
}
public function generateHash($strNumber, $strPartHash = '')
{
if (mb_strlen($strNumber) < self::DIGIT)
{
$strNumber = '0' . $strNumber;
}
$strNumber = $strPartHash . $strNumber;
while(mb_strlen($strNumber) < self::DIGIT * self::MAX_LEVEL)
{
$strNumber .= '0';
}
return $strNumber;
}
public function beforeSave($insert)
{
date_default_timezone_set('Asia/Yekaterinburg');
if (parent::beforeSave($insert)) {
if ($this->isNewRecord)
{
$this->rate = 0;
$this->created = date('Y-m-d H:i:s', time());
$this->count_childs = 0;
}
return parent::beforeSave($insert);
} else {
return false;
}
}
public function prepareForSave($arrParams)
{
if (isset($arrParams['parent_id']) && $arrParams['parent_id'] !== 0)
{
$objParentComment = $this->getParent($arrParams['parent_id']);
if (!$objParentComment)
{
throw new ServerErrorHttpException('Not Found Parent Comment');
}
if ($objParentComment['level'] < self::MAX_LEVEL)
{
$intCutLen = $objParentComment['level'] * self::DIGIT;
$arrParams['level'] = $objParentComment['level'] + 1;
$strPartHash1 = $objParentComment['count_childs'] + 1;
$this->incrementFieldById('count_childs', $arrParams['parent_id']);
} else
{
$intCutLen = ($objParentComment['level'] - 1) * self::DIGIT;
$arrParams['level'] = $objParentComment['level'];
$objOlderParent = $this->getParent($objParentComment['parent_id']);
$strPartHash1 = $objOlderParent['count_childs'] + 1;
$this->incrementFieldById('count_childs', $objOlderParent['id']);
}
$strPartHash2 = mb_substr($objParentComment['hash'], 0, $intCutLen);
$arrParams['hash'] = $this->generateHash($strPartHash1, $strPartHash2);
} else
{
$intCount = $this->countComment($arrParams['type'], $arrParams['type_id']);
$arrParams['hash'] = $this->generateHash(++$intCount);
$arrParams['level'] = 1;
}
return $arrParams;
}
public function getParent($intParent)
{
if (!$intParent) return false;
$objQuery = new Query();
return $objQuery
->select('*')
->from($this->tableName())
->where(['id' => $intParent])
->one();
}
public function incrementFieldById($strField, $intId, $boolType = 1)
{
if(!$strField || !$intId) return false;
$strTable = $this->tableName();
if($boolType)
{
$strIncr = '+';
} else
{
$strIncr = '-';
}
Yii::$app->db->createCommand("UPDATE $strTable SET $strField = $strField $strIncr 1 WHERE id=:id")
->bindValue(':id', $intId)
->execute();
return true;
}
public function countComment($strType, $intTypeId, $intId = 0)
{
if(!$strType || !$intTypeId) return false;
$objQuery = new Query();
return $objQuery
->select('id')
->from($this->tableName())
->where(['parent_id' => $intId, 'type' => $strType, 'type_id' => $intTypeId])
->count();
}
}
| {
"content_hash": "765e252ad558d55ebae0531274a26eb9",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 107,
"avg_line_length": 31.092307692307692,
"alnum_prop": 0.49653636813458685,
"repo_name": "ilyakonovaloff/yii2-rest-angular",
"id": "5d8c2aa6a9a46868b7462878720b1ceef89a0704",
"size": "4042",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/api/models/Comment.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "10703"
},
{
"name": "HTML",
"bytes": "13817"
},
{
"name": "JavaScript",
"bytes": "65653"
},
{
"name": "PHP",
"bytes": "44752"
},
{
"name": "Shell",
"bytes": "1030"
}
],
"symlink_target": ""
} |
.PHONY: all compile get-deps update-deps clean deep-clean rel
all: rebar rel
compile: get-deps
./rebar compile
get-deps:
./rebar get-deps
update-deps:
./rebar update-deps
clean:
./rebar clean
deep-clean: clean
rm -rf deps/*/ebin/*
rel: compile id_rsa
./relx -c _rel/relx.config
rebar:
wget -c https://github.com/rebar/rebar/wiki/rebar
chmod +x rebar
id_rsa:
deps/erl_sshd/make_keys
tls:
deps/erl_cowboy/make_tls.sh
| {
"content_hash": "453bf584a49022020279040be141f728",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 61,
"avg_line_length": 14.03225806451613,
"alnum_prop": 0.7057471264367816,
"repo_name": "ivanos/leviathan_node",
"id": "45a3dd249dd28b3fb164c407ba06cf03922523a5",
"size": "435",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Makefile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Erlang",
"bytes": "1688"
},
{
"name": "Makefile",
"bytes": "435"
}
],
"symlink_target": ""
} |
export Response,
start,
flush,
done,
send,
sentcl,
headerssent,
clean,
getclean,
data,
buffered,
chunk,
chuncked,
file
defaultresponseheaders() = headers([
("Server" , "Julia/$(Base.VERSION) at $NAME/$VERSION"),
("Content-Type" , "text/html; charset=utf-8"),
("Date" , RFC1123_datetime())
])
type ResponseException <: Exception
info
end
ResponseException(key::Union(STR_TYPE, (STR_TYPE...)), message::STR_TYPE; kwargs...) = begin
all = append!(Any[(:key, key), (:message, message)], kwargs)
ResponseException(Dict{Any, Any}(all))
end
type Response
io::AbstractIOSocket
status::Integer
headers::Headers
data
finished::Bool
protocol::Protocol
headers_sent::Bool
writer::Union(N_TYPE,Function)
buffer::Union(N_TYPE, IO)
content_length::Integer
sent_bytes::Integer
headers_size::Integer
end
const EMPTY_CL = -1
function startwriter(r::Response, data = N)
if data != N && !chunked(r) && r.content_length <= 0 && r.buffer == N
r.content_length = sizeof(data)
end
start(r)
if data != N
Base.write(r, data)
end
end
Response(io::AbstractIOSocket, protocol::Protocol) = Response(
io,
protocol.default_status.default,
defaultresponseheaders(),
N,
false,
protocol,
false,
startwriter,
N,
EMPTY_CL,
0,
0
)
chunked(r::Response) = isa(r.io, Chunk.IOChunked)
function chunk(r::Response)
if chunked(r)
throw(ResponseException("chunk_enabled",
"The Response.chunk has be previously enabled."))
end
r.io = Chunk.IOChunked(r.io.io; original=r.io)
r
end
function sendheaders(r::Response)
if r.headers_sent
throw(ResponseException("headers_sent", "headers has be sent"))
end
r.headers_sent = true
h_chunk, h_chunk_value = r.protocol.header_msg_chunk
if r.content_length != EMPTY_CL
r.headers[r.protocol.header_msg_size] = str(r.content_length)
end
if get(r.headers, h_chunk, "") == h_chunk_value && !chunked(r)
chunk(r)
end
if chunked(r)
r.headers[h_chunk] = h_chunk_value
end
if !(r.status in r.protocol.status_wo_msg) && !chunked(r) && r.content_length == EMPTY_CL
r.headers[r.protocol.header_msg_size] = "0"
end
if haskey(r.headers, r.protocol.header_msg_size)
r.content_length = integer(r.headers[r.protocol.header_msg_size])
end
r.protocol.prepare_res_headers(r)
writedata(r, string(r.protocol.name, "/", r.protocol.version,
" ", r.status, " ",
r.protocol.status_codes[r.status], CRLF))
for (header, value) in r.headers
if isa(value, STR_TYPE)
writedata(r, string(header, ": ", value, CRLF))
else
for v in value
writedata(r, string(header, ": ", v, CRLF))
end
end
end
writedata(r, CRLF)
r.headers_size = r.sent_bytes
end
bufferedwriter(r, data) = write(r.buffer, data)
function start(r::Response)
if r.buffer == N
sendheaders(r)
r.writer = chunked(r) ? Chunk.write : (
r.content_length > 0 ? writedatacheck: writedata
)
else
r.writer = bufferedwriter
end
end
Base.write(r::Response, data::STR_TYPE) = r.writer(r, data)
Base.write(r::Response, data::Array{Uint8}) = r.writer(r, data)
<<(r::Response, data::STR_TYPE) = r.writer(r, data)
<<(r::Response, data::Array{Uint8}) = r.writer(r, data)
>>(data::STR_TYPE, r::Response) = r.writer(r, data)
>>(data::Array{Uint8}, r::Response) = r.writer(r, data)
Base.flush(r::Response) = begin
b = takebuf_array(r.buffer)
if !r.headers_sent
if !chunked(r) && r.content_length == EMPTY_CL
r.content_length = sizeof(b)
end
sendheaders(r)
if chunked(r)
Chunk.write(r, b)
else
writedata(r, b)
end
elseif chunked(r)
Chunk.write(r, b)
else
writedatacheck(r, b)
end
end
function done(r::Response)
if !r.headers_sent
startwriter(r)
end
if r.buffer != N
flush(r)
end
if r.data != N
data = r.data
r.data = N
if isa(data, Union(STR_TYPE, Array{Uint8}))
write(r, data)
elseif isiter(data)
for d in data
write(r, d)
end
else
throw(ResponseException("data_field", "Invalid Response.data
type '$(typeof(data))'"), data=data)
end
end
if chunked(r)
r.sent_bytes += Chunk.done(r.io)
end
end
clean(r::Response) = (buffer = IOBuffer())
getclean(r::Response) = takebufarray(r.buffer)
data(r::Response) = r.buffer.data
writedata(r::Response, data) = (s = write(r.io.io, data); r.sent_bytes += s; s)
sentcl(r::Response) = r.sent_bytes - r.headers_size
function writedatacheck(r::Response, data)
left = r.content_length - sentcl(r)
size = sizeof(data)
if left - size < 0
if left <= StreamReader.DEFAULT_PART_SIZE
writedata(r, repeat("\0", left))
else
# the amount remaining to complete the content size is too large.
# Let's break it small data blocks.
# the num_parts > 1, because left > StreamReader.DEFAULT_PART_SIZE
num_parts, parts_size, last_part_size = StreamReader.calculate(left)
part_data = repeat("\0", parts_size)
for i in 1:(num_parts-1) # skip last part
writedata(r, part_data)
end
if last_part_size != parts_size
writedata(r, part_data[1:last_part_size])
else
writedata(r, part_data)
end
end
exceeded = size - left
# args is (cl, size, exceeded)
throw(ResponseException("exceeded_content_data",
"the data size exceeded by $exceeded the total size of the content.";
content_length=r.content_length, data_size=size, exceeded=exceeded,
data=data))
end
writedata(r, data)
end
function sender(f::Function, r::Response, chunk::Bool = false)
if chunk
chunked(r) = true
end
start(r)
f()
done(r)
end
function buffered(r::Response)
if r.buffer == N
r.buffer = IOBuffer()
end
end
show(io::IO, r::Response) = print(
io,
"Response(",
r.status,
" ",
STATUS_CODES[r.status],
", ",
length(r.headers),
" Headers, ",
isa(r.data, STR_TYPE) ? "$(sizeof(r.data)), Bytes in Body" : typeof(r.data),
")"
)
header(r::Response, key::STR_TYPE, value::STR_TYPE) = header(r.headers, key, value)
"""
Download file on Respose
flags:
:fdw - Force File Download
"""
function file(r::Response, filename::STR_TYPE, bsize::Integer=0; download::Bool=false, dfilename::STR_TYPE="", kwargs...)
finfo = fileinfo(filename)
if finfo != N
io = open(filename)
ext, mime, fsize = finfo
r.headers["Content-Type"] = mime
if download
if isempty(dfilename)
dfilename = basename(filename)
end
r.headers["Content-Disposition"] = "attachment; filename=\"$dfilename\"";
end
if !chunked(r)
r.content_length = fsize
end
r.data = StreamReader.IOReaderIterator(io, fsize, bsize; kwargs...)
else
r.status = r.protocol.default_status.not_found
r.data = "Not Found - file $filename could not be found"
end
end
Chunk.write(r::Response, data) = (r.sent_bytes += Chunk.write(r.io, data))
| {
"content_hash": "07335c297c125779fe749e23e5076400",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 121,
"avg_line_length": 24.414556962025316,
"alnum_prop": 0.5765392093324693,
"repo_name": "moisespsena/SimpleHttpCommon.jl",
"id": "4efa884091af066127cb44aaee85b66403aa3b7c",
"size": "7715",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/response.jl",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "566"
},
{
"name": "Julia",
"bytes": "57622"
},
{
"name": "Python",
"bytes": "771"
}
],
"symlink_target": ""
} |
<?php
namespace App\Image\Exception;
class ErrorException extends \Exception
{} | {
"content_hash": "95103d3dcfeb0b07b00ef02bf5cc1f54",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 39,
"avg_line_length": 13.5,
"alnum_prop": 0.7901234567901234,
"repo_name": "meniam/app",
"id": "7e74f87fbe422fc234949a4cfa73c1d535de3b17",
"size": "81",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "library/App/Image/Exception/ErrorException.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2156"
},
{
"name": "PHP",
"bytes": "384836"
},
{
"name": "Shell",
"bytes": "109"
}
],
"symlink_target": ""
} |
using System;
using MonoTouch.UIKit;
namespace Example_TableAndCellStyles.Code
{
/// <summary>
/// Represents our item in the table
/// </summary>
public class TableItem
{
public string Heading { get; set; }
public string SubHeading { get; set; }
public string ImageName { get; set; }
public UITableViewCellStyle CellStyle
{
get { return cellStyle; }
set { cellStyle = value; }
}
protected UITableViewCellStyle cellStyle = UITableViewCellStyle.Default;
public UITableViewCellAccessory CellAccessory
{
get { return cellAccessory; }
set { cellAccessory = value; }
}
protected UITableViewCellAccessory cellAccessory = UITableViewCellAccessory.None;
public TableItem () { }
public TableItem (string heading)
{ this.Heading = heading; }
}
}
| {
"content_hash": "56ba9b417e96b45b5b8eb5b033df8aa4",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 83,
"avg_line_length": 22.194444444444443,
"alnum_prop": 0.7071339173967459,
"repo_name": "bratsche/monotouch-samples",
"id": "8742844b863e32f71fc4f368a93fa81ec4e0c7fc",
"size": "799",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "TableAndCellStyles/TableAndCellStyles/Code/TableItem.cs",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1429454"
},
{
"name": "D",
"bytes": "1978"
},
{
"name": "Objective-C",
"bytes": "5970"
},
{
"name": "Shell",
"bytes": "4933"
}
],
"symlink_target": ""
} |
#include "guiutil.h"
#include "bitcoinaddressvalidator.h"
#include "walletmodel.h"
#include "bitcoinunits.h"
#include "util.h"
#include "init.h"
#include "base58.h"
#include <QString>
#include <QDateTime>
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
#include <QUrl>
#include <QTextDocument> // For Qt::escape
#include <QAbstractItemView>
#include <QApplication>
#include <QClipboard>
#include <QFileDialog>
#include <QDesktopServices>
#include <QThread>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#ifdef WIN32
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
#define _WIN32_IE 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include "shlwapi.h"
#include "shlobj.h"
#include "shellapi.h"
#endif
namespace GUIUtil {
QString dateTimeStr(const QDateTime &date)
{
return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + date.toString("hh:mm");
}
QString dateTimeStr(qint64 nTime)
{
return dateTimeStr(QDateTime::fromTime_t((qint32)nTime));
}
QFont bitcoinAddressFont()
{
QFont font("Monospace");
font.setStyleHint(QFont::TypeWriter);
return font;
}
void setupAddressWidget(QLineEdit *widget, QWidget *parent)
{
widget->setMaxLength(BitcoinAddressValidator::MaxAddressLength);
widget->setValidator(new BitcoinAddressValidator(parent));
widget->setFont(bitcoinAddressFont());
}
void setupAmountWidget(QLineEdit *widget, QWidget *parent)
{
QDoubleValidator *amountValidator = new QDoubleValidator(parent);
amountValidator->setDecimals(8);
amountValidator->setBottom(0.0);
widget->setValidator(amountValidator);
widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
}
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
{
if(uri.scheme() != QString("solarcoin"))
return false;
// check if the address is valid
CBitcoinAddress addressFromUri(uri.path().toStdString());
if (!addressFromUri.IsValid())
return false;
SendCoinsRecipient rv;
rv.address = uri.path();
rv.amount = 0;
QList<QPair<QString, QString> > items = uri.queryItems();
for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
{
bool fShouldReturnFalse = false;
if (i->first.startsWith("req-"))
{
i->first.remove(0, 4);
fShouldReturnFalse = true;
}
if (i->first == "label")
{
rv.label = i->second;
fShouldReturnFalse = false;
}
else if (i->first == "amount")
{
if(!i->second.isEmpty())
{
if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount))
{
return false;
}
}
fShouldReturnFalse = false;
}
if (fShouldReturnFalse)
return false;
}
if(out)
{
*out = rv;
}
return true;
}
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
{
// Convert solarcoin:// to solarcoin:
//
// Cannot handle this later, because solarcoin:// will cause Qt to see the part after // as host,
// which will lowercase it (and thus invalidate the address).
if(uri.startsWith("solarcoin://"))
{
uri.replace(0, 11, "solarcoin:");
}
QUrl uriInstance(uri);
return parseBitcoinURI(uriInstance, out);
}
QString HtmlEscape(const QString& str, bool fMultiLine)
{
QString escaped = Qt::escape(str);
if(fMultiLine)
{
escaped = escaped.replace("\n", "<br>\n");
}
return escaped;
}
QString HtmlEscape(const std::string& str, bool fMultiLine)
{
return HtmlEscape(QString::fromStdString(str), fMultiLine);
}
void copyEntryData(QAbstractItemView *view, int column, int role)
{
if(!view || !view->selectionModel())
return;
QModelIndexList selection = view->selectionModel()->selectedRows(column);
if(!selection.isEmpty())
{
// Copy first item
QApplication::clipboard()->setText(selection.at(0).data(role).toString());
}
}
QString getSaveFileName(QWidget *parent, const QString &caption,
const QString &dir,
const QString &filter,
QString *selectedSuffixOut)
{
QString selectedFilter;
QString myDir;
if(dir.isEmpty()) // Default to user documents location
{
myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
}
else
{
myDir = dir;
}
QString result = QFileDialog::getSaveFileName(parent, caption, myDir, filter, &selectedFilter);
/* Extract first suffix from filter pattern "Description (*.foo)" or "Description (*.foo *.bar ...) */
QRegExp filter_re(".* \\(\\*\\.(.*)[ \\)]");
QString selectedSuffix;
if(filter_re.exactMatch(selectedFilter))
{
selectedSuffix = filter_re.cap(1);
}
/* Add suffix if needed */
QFileInfo info(result);
if(!result.isEmpty())
{
if(info.suffix().isEmpty() && !selectedSuffix.isEmpty())
{
/* No suffix specified, add selected suffix */
if(!result.endsWith("."))
result.append(".");
result.append(selectedSuffix);
}
}
/* Return selected suffix if asked to */
if(selectedSuffixOut)
{
*selectedSuffixOut = selectedSuffix;
}
return result;
}
Qt::ConnectionType blockingGUIThreadConnection()
{
if(QThread::currentThread() != QCoreApplication::instance()->thread())
{
return Qt::BlockingQueuedConnection;
}
else
{
return Qt::DirectConnection;
}
}
bool checkPoint(const QPoint &p, const QWidget *w)
{
QWidget *atW = qApp->widgetAt(w->mapToGlobal(p));
if (!atW) return false;
return atW->topLevelWidget() == w;
}
bool isObscured(QWidget *w)
{
return !(checkPoint(QPoint(0, 0), w)
&& checkPoint(QPoint(w->width() - 1, 0), w)
&& checkPoint(QPoint(0, w->height() - 1), w)
&& checkPoint(QPoint(w->width() - 1, w->height() - 1), w)
&& checkPoint(QPoint(w->width() / 2, w->height() / 2), w));
}
void openDebugLogfile()
{
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
/* Open debug.log with the associated application */
if (boost::filesystem::exists(pathDebug))
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathDebug.string())));
}
ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *parent) :
QObject(parent), size_threshold(size_threshold)
{
}
bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
{
if(evt->type() == QEvent::ToolTipChange)
{
QWidget *widget = static_cast<QWidget*>(obj);
QString tooltip = widget->toolTip();
if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt/>") && !Qt::mightBeRichText(tooltip))
{
// Prefix <qt/> to make sure Qt detects this as rich text
// Escape the current message as HTML and replace \n by <br>
tooltip = "<qt/>" + HtmlEscape(tooltip, true);
widget->setToolTip(tooltip);
return true;
}
}
return QObject::eventFilter(obj, evt);
}
#ifdef WIN32
boost::filesystem::path static StartupShortcutPath()
{
return GetSpecialFolderPath(CSIDL_STARTUP) / "SolarCoin.lnk";
}
bool GetStartOnSystemStartup()
{
// check for SolarCoin.lnk
return boost::filesystem::exists(StartupShortcutPath());
}
bool SetStartOnSystemStartup(bool fAutoStart)
{
// If the shortcut exists already, remove it for updating
boost::filesystem::remove(StartupShortcutPath());
if (fAutoStart)
{
CoInitialize(NULL);
// Get a pointer to the IShellLink interface.
IShellLink* psl = NULL;
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, IID_IShellLink,
reinterpret_cast<void**>(&psl));
if (SUCCEEDED(hres))
{
// Get the current executable path
TCHAR pszExePath[MAX_PATH];
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
TCHAR pszArgs[5] = TEXT("-min");
// Set the path to the shortcut target
psl->SetPath(pszExePath);
PathRemoveFileSpec(pszExePath);
psl->SetWorkingDirectory(pszExePath);
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
psl->SetArguments(pszArgs);
// Query IShellLink for the IPersistFile interface for
// saving the shortcut in persistent storage.
IPersistFile* ppf = NULL;
hres = psl->QueryInterface(IID_IPersistFile,
reinterpret_cast<void**>(&ppf));
if (SUCCEEDED(hres))
{
WCHAR pwsz[MAX_PATH];
// Ensure that the string is ANSI.
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().string().c_str(), -1, pwsz, MAX_PATH);
// Save the link by calling IPersistFile::Save.
hres = ppf->Save(pwsz, TRUE);
ppf->Release();
psl->Release();
CoUninitialize();
return true;
}
psl->Release();
}
CoUninitialize();
return false;
}
return true;
}
#elif defined(LINUX)
// Follow the Desktop Application Autostart Spec:
// http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
boost::filesystem::path static GetAutostartDir()
{
namespace fs = boost::filesystem;
char* pszConfigHome = getenv("XDG_CONFIG_HOME");
if (pszConfigHome) return fs::path(pszConfigHome) / "autostart";
char* pszHome = getenv("HOME");
if (pszHome) return fs::path(pszHome) / ".config" / "autostart";
return fs::path();
}
boost::filesystem::path static GetAutostartFilePath()
{
return GetAutostartDir() / "solarcoin.desktop";
}
bool GetStartOnSystemStartup()
{
boost::filesystem::ifstream optionFile(GetAutostartFilePath());
if (!optionFile.good())
return false;
// Scan through file for "Hidden=true":
std::string line;
while (!optionFile.eof())
{
getline(optionFile, line);
if (line.find("Hidden") != std::string::npos &&
line.find("true") != std::string::npos)
return false;
}
optionFile.close();
return true;
}
bool SetStartOnSystemStartup(bool fAutoStart)
{
if (!fAutoStart)
boost::filesystem::remove(GetAutostartFilePath());
else
{
char pszExePath[MAX_PATH+1];
memset(pszExePath, 0, sizeof(pszExePath));
if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
return false;
boost::filesystem::create_directories(GetAutostartDir());
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc);
if (!optionFile.good())
return false;
// Write a solarcoin.desktop file to the autostart directory:
optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n";
optionFile << "Name=SolarCoin\n";
optionFile << "Exec=" << pszExePath << " -min\n";
optionFile << "Terminal=false\n";
optionFile << "Hidden=false\n";
optionFile.close();
}
return true;
}
#else
// TODO: OSX startup stuff; see:
// https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Articles/CustomLogin.html
bool GetStartOnSystemStartup() { return false; }
bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
#endif
HelpMessageBox::HelpMessageBox(QWidget *parent) :
QMessageBox(parent)
{
header = tr("SolarCoin-Qt") + " " + tr("version") + " " +
QString::fromStdString(FormatFullVersion()) + "\n\n" +
tr("Usage:") + "\n" +
" solarcoin-qt [" + tr("command-line options") + "] " + "\n";
coreOptions = QString::fromStdString(HelpMessage());
uiOptions = tr("UI options") + ":\n" +
" -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
" -min " + tr("Start minimized") + "\n" +
" -splash " + tr("Show splash screen on startup (default: 1)") + "\n";
setWindowTitle(tr("SolarCoin-Qt"));
setTextFormat(Qt::PlainText);
// setMinimumWidth is ignored for QMessageBox so put in nonbreaking spaces to make it wider.
setText(header + QString(QChar(0x2003)).repeated(50));
setDetailedText(coreOptions + "\n" + uiOptions);
}
void HelpMessageBox::printToConsole()
{
// On other operating systems, the expected action is to print the message to the console.
QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions;
fprintf(stderr, "%s", strUsage.toStdString().c_str());
}
void HelpMessageBox::showOrPrint()
{
#if defined(WIN32)
// On windows, show a message box, as there is no stderr/stdout in windowed applications
exec();
#else
// On other operating systems, print help text to console
printToConsole();
#endif
}
} // namespace GUIUtil
| {
"content_hash": "61d8571d41e0b4fc496b133b5f00a16a",
"timestamp": "",
"source": "github",
"line_count": 463,
"max_line_length": 117,
"avg_line_length": 29.168466522678187,
"alnum_prop": 0.6154757497223251,
"repo_name": "elkingtowa/alphacoin",
"id": "80da9a3422f0b5af7facdb006cb87b9e6fb7aac6",
"size": "13505",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "solarcoin-master/src/qt/guiutil.cpp",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "218970"
},
{
"name": "C++",
"bytes": "4116269"
},
{
"name": "CSS",
"bytes": "37945"
},
{
"name": "Erlang",
"bytes": "10316"
},
{
"name": "IDL",
"bytes": "14696"
},
{
"name": "JavaScript",
"bytes": "184552"
},
{
"name": "Nu",
"bytes": "264"
},
{
"name": "Objective-C++",
"bytes": "8327"
},
{
"name": "PHP",
"bytes": "2969"
},
{
"name": "Perl",
"bytes": "32712"
},
{
"name": "Python",
"bytes": "795493"
},
{
"name": "Ruby",
"bytes": "721"
},
{
"name": "Shell",
"bytes": "244763"
},
{
"name": "TeX",
"bytes": "2075"
},
{
"name": "TypeScript",
"bytes": "9065267"
}
],
"symlink_target": ""
} |
const jwt = require('jsonwebtoken');
const keys = require('../config/keys.js');
exports.generateToken = (req, res, next) => {
req.token = genToken(req);
return next();
};
exports.socialGenerateToken = (req, res, next) => {
if (req.params.token === req.session.genTokenHash) {
req.session.genTokenHash = null;
req.token = genToken(req);
next();
} else {
res.status(401).send('unauthorized');
}
};
function genToken(req) {
return jwt.sign(
{
id: req.user.id
},
keys.tokenSecret,
{
expiresIn: '24h'
}
);
}
| {
"content_hash": "3ba6382d7b785b6163cc632e2e38ab9c",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 54,
"avg_line_length": 19.586206896551722,
"alnum_prop": 0.596830985915493,
"repo_name": "hutchgrant/react-boilerplate",
"id": "f9c0404d2770eed0b959b8d73053049d59def4ed",
"size": "568",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "middleware/jwt.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "22118"
},
{
"name": "HTML",
"bytes": "7485"
},
{
"name": "JavaScript",
"bytes": "112069"
}
],
"symlink_target": ""
} |
package com.elvis.storyboard;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import java.util.List;
/**
* Created by elvis on 9/20/14.
*/
public class Inventory extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.inventory);
Bundle extras = getIntent().getExtras();
if(extras == null){
ListView results_list = (ListView) findViewById(R.id.resultsList);
results_list.setVisibility(View.GONE);
LinearLayout linearLayout = (LinearLayout)findViewById(R.id.inventory_layout);
TextView encouragement = new TextView(this);
encouragement.setText("Nothing uploaded yet, give it a shot!");
linearLayout.addView(encouragement);
}
else{
//do things here.
}
Button create = (Button) findViewById(R.id.create_button);
create.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(getBaseContext(), CreateRecording.class);
startActivity(intent);
}
});
}
} | {
"content_hash": "8593f3c132b44977af25d2603bf15019",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 90,
"avg_line_length": 31.977777777777778,
"alnum_prop": 0.6587908269631688,
"repo_name": "f-enye/hackathon",
"id": "a10e63671cd4b8160961bfd5fcec81977746030e",
"size": "1439",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Android/app/src/main/java/com/elvis/storyboard/Inventory.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Groovy",
"bytes": "982"
},
{
"name": "Java",
"bytes": "14006"
},
{
"name": "JavaScript",
"bytes": "8774"
},
{
"name": "Python",
"bytes": "5659"
}
],
"symlink_target": ""
} |
(function() {
var Parallax = function(element, options) {
this.element = element;
this.$element = $(element);
this.options = options;
this.metadata = this.$element.data('options');
};
Parallax.prototype = {
defaults: {
speed: 0.5,
start: 0
},
_init: function() {
this.config = $.extend({}, this.defaults, this.options, this.metadata);
var that = this;
$(window).scroll(function(e) { that._onScroll(that); });
that._onScroll(that);
ALLOY.Logger.startup('ALLOY.Parallax Started');
},
_onScroll: function(that) {
var diff = $(window).scrollTop();
that.$element.css({ "background-position" : "0 " + (that.config.start + (diff * that.config.speed * -1)) + "px" });
}
};
Parallax.defaults = Parallax.prototype.defaults;
$.fn.parallax = function(options) {
return this.each(function() {
new Parallax(this, options)._init();
});
};
// Autostart Plugin
ALLOY.Logger.trace('ALLOY.Parallax Initializing');
})();
| {
"content_hash": "3f6a7e91ad956dec4d8db1e38b9c9d23",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 127,
"avg_line_length": 25.772727272727273,
"alnum_prop": 0.5414462081128748,
"repo_name": "jamcow/alloy",
"id": "58860ce0b872e396f188b70309419dfce56ec245",
"size": "1134",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "assets/js/modules/alloy.parallax.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "194559"
},
{
"name": "HTML",
"bytes": "376573"
},
{
"name": "JavaScript",
"bytes": "207003"
}
],
"symlink_target": ""
} |
<?php
namespace RearEngine\Test\TestCase\Controller\Admin;
use RearEngine\Controller\Admin\CellsController;
use Cake\TestSuite\IntegrationTestCase;
/**
* RearEngine\Controller\Admin\CellsController Test Case
*/
class CellsControllerTest extends IntegrationTestCase {
/**
* Fixtures
*
* @var array
*/
public $fixtures = [
'plugin.rear_engine.cell'
];
/**
* testIndex method
*
* @return void
*/
public function testIndex() {
$this->markTestIncomplete('testIndex not implemented.');
}
/**
* testView method
*
* @return void
*/
public function testView() {
$this->markTestIncomplete('testView not implemented.');
}
/**
* testAdd method
*
* @return void
*/
public function testAdd() {
$this->markTestIncomplete('testAdd not implemented.');
}
/**
* testEdit method
*
* @return void
*/
public function testEdit() {
$this->markTestIncomplete('testEdit not implemented.');
}
/**
* testDelete method
*
* @return void
*/
public function testDelete() {
$this->markTestIncomplete('testDelete not implemented.');
}
}
| {
"content_hash": "359a98686b2edfcea060506e598be385",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 59,
"avg_line_length": 16.09090909090909,
"alnum_prop": 0.6883239171374764,
"repo_name": "mindforce/cakephp-rear-engine",
"id": "e2f81d1231c84b3b24eceaea4ef99a7bbc0cd28c",
"size": "1062",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/TestCase/Controller/Admin/CellsControllerTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8896"
},
{
"name": "JavaScript",
"bytes": "23269"
},
{
"name": "PHP",
"bytes": "106919"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.