text stringlengths 2 1.04M | meta dict |
|---|---|
Constructing the translations model manually
============================================
It's also possible to create the translated fields model manually:
.. code-block:: python
from django.db import models
from parler.models import TranslatableModel, TranslatedFieldsModel
from parler.fields import TranslatedField
class MyModel(TranslatableModel):
title = TranslatedField() # Optional, explicitly mention the field
class Meta:
verbose_name = _("MyModel")
def __unicode__(self):
return self.title
class MyModelTranslation(TranslatedFieldsModel):
master = models.ForeignKey(MyModel, related_name='translations', null=True)
title = models.CharField(_("Title"), max_length=200)
class Meta:
unique_together = ('language_code', 'master')
verbose_name = _("MyModel translation")
This has the same effect, but also allows to to override
the :func:`~django.db.models.Model.save` method, or add new methods yourself.
| {
"content_hash": "3a13e27d052f518e3d129d4db10a4d23",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 83,
"avg_line_length": 32.46875,
"alnum_prop": 0.65832531280077,
"repo_name": "HiddenData/django-parler",
"id": "8d735100154d6bba5815d39c5e1299b29bbae76f",
"size": "1039",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "docs/advanced/manual-models.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4695"
},
{
"name": "Makefile",
"bytes": "6790"
},
{
"name": "Python",
"bytes": "227701"
},
{
"name": "Shell",
"bytes": "6715"
}
],
"symlink_target": ""
} |
class ChartPanel
{
public:
ChartPanel();
virtual ~ChartPanel();
// Public interface
//////////////////////////////////////////////////////////////////////////
private:
// Data members
//////////////////////////////////////////////////////////////////////////
};
| {
"content_hash": "f3b331cba13b4283684f006304eecd75",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 15.526315789473685,
"alnum_prop": 0.2745762711864407,
"repo_name": "egorpushkin/neurolab",
"id": "9103dea6892af49881e65eb3704e8d70981abba1",
"size": "309",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/ControlsLib/UIControls/ChartingCtrl/Core/ChartPanel.h",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "112"
},
{
"name": "C",
"bytes": "1787692"
},
{
"name": "C++",
"bytes": "9312245"
},
{
"name": "CSS",
"bytes": "44465"
},
{
"name": "Clarion",
"bytes": "5268"
},
{
"name": "HTML",
"bytes": "408820"
},
{
"name": "JavaScript",
"bytes": "5476"
},
{
"name": "Makefile",
"bytes": "39256"
},
{
"name": "Objective-C",
"bytes": "97952"
},
{
"name": "TeX",
"bytes": "3128"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator"
content="HTML Tidy for Mac OS, see www.w3.org" />
<!-- testcase: h6_align_left.xml -->
<!-- description: HTML 4.0 Text Markup Element H6 with the ALIGN attribute set to left -->
<!-- Author: Frank Petitta, Date: 5/28/98 -->
<!-- Modified: Changed doctype to xhtml 1.0 transitional Author: Chris Petersen Date: 1/17/01 -->
<!--
- The contents of this file are subject to the Mozilla Public
- License Version 1.1 (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.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
-
- The Original Code is Mozilla Communicator Test Cases.
-
- The Initial Developer of the Original Code is Netscape Communications
- Corp. Portions created by Netscape Communications Corp. are
- Copyright (C) 1999 Netscape Communications Corp. All
- Rights Reserved.
-
- Contributor(s):
-->
<!-- Purpose: To test the H6 (heading) tag, with the ALIGN attribute.-->
<!-- Expected result: The text displayed below should display as H6, left aligned text. -->
<title>XHTML Functional -- H6 - ALIGN=left</title>
</head>
<body>
<h6 align="left">Heading Level 6 with "left" align</h6>
</body>
</html>
| {
"content_hash": "65f93cde7b18ea68e07eac618dc208e1",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 97,
"avg_line_length": 14.991379310344827,
"alnum_prop": 0.6630247268545141,
"repo_name": "operasoftware/presto-testo",
"id": "3196cc8c9af52bfe8ba79cf460ea7c2741af881b",
"size": "1739",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "core/standards/xhtml/h6_align_left.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "2312"
},
{
"name": "ActionScript",
"bytes": "23470"
},
{
"name": "AutoHotkey",
"bytes": "8832"
},
{
"name": "Batchfile",
"bytes": "5001"
},
{
"name": "C",
"bytes": "116512"
},
{
"name": "C++",
"bytes": "279128"
},
{
"name": "CSS",
"bytes": "208905"
},
{
"name": "Groff",
"bytes": "674"
},
{
"name": "HTML",
"bytes": "106576719"
},
{
"name": "Haxe",
"bytes": "3874"
},
{
"name": "Java",
"bytes": "185827"
},
{
"name": "JavaScript",
"bytes": "22531460"
},
{
"name": "Makefile",
"bytes": "13409"
},
{
"name": "PHP",
"bytes": "524372"
},
{
"name": "POV-Ray SDL",
"bytes": "6542"
},
{
"name": "Perl",
"bytes": "321672"
},
{
"name": "Python",
"bytes": "954636"
},
{
"name": "Ruby",
"bytes": "1006850"
},
{
"name": "Shell",
"bytes": "12140"
},
{
"name": "Smarty",
"bytes": "1860"
},
{
"name": "XSLT",
"bytes": "2567445"
}
],
"symlink_target": ""
} |
<html>
<head>
<script src="../http/tests/inspector/inspector-test.js"></script>
<script src="../http/tests/inspector/network-test.js"></script>
<script>
function readBlob()
{
var reader = new FileReader();
reader.onloadend = function () {
console.log('done');
};
reader.readAsArrayBuffer(new Blob([ 'test' ]));
}
function test()
{
InspectorTest.resetInspectorResourcesData(main);
function main()
{
InspectorTest.addConsoleSniffer(messageAdded);
InspectorTest.evaluateInPage("readBlob();");
}
function messageAdded(payload)
{
var requests = InspectorTest.networkRequests();
InspectorTest.addResult("requests in the network panel: " + requests.length);
InspectorTest.assertTrue(requests.length == 0, "Blob load request to the browser is shown in the network panel.");
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="runTest()">
<p>Tests that FileReader's Blob request isn't shown in network panel.</p>
</body>
</html>
| {
"content_hash": "59a8b9f855e531b5901f26de4a234114",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 122,
"avg_line_length": 26.615384615384617,
"alnum_prop": 0.6685934489402697,
"repo_name": "jtg-gg/blink",
"id": "b727b84ae5e2de4ffd3f5fe0ecb1c20d506c6bdb",
"size": "1038",
"binary": false,
"copies": "8",
"ref": "refs/heads/dev12-m41",
"path": "LayoutTests/inspector/file-reader-with-network-panel.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "28126"
},
{
"name": "Assembly",
"bytes": "12983"
},
{
"name": "Bison",
"bytes": "64327"
},
{
"name": "C",
"bytes": "68435"
},
{
"name": "C++",
"bytes": "41623716"
},
{
"name": "CSS",
"bytes": "536676"
},
{
"name": "GLSL",
"bytes": "11578"
},
{
"name": "Groff",
"bytes": "28067"
},
{
"name": "HTML",
"bytes": "53137251"
},
{
"name": "Java",
"bytes": "66510"
},
{
"name": "JavaScript",
"bytes": "26485747"
},
{
"name": "Makefile",
"bytes": "677"
},
{
"name": "Objective-C",
"bytes": "46814"
},
{
"name": "Objective-C++",
"bytes": "378647"
},
{
"name": "PHP",
"bytes": "166434"
},
{
"name": "Perl",
"bytes": "585757"
},
{
"name": "Python",
"bytes": "3997910"
},
{
"name": "Ruby",
"bytes": "141818"
},
{
"name": "Shell",
"bytes": "8806"
},
{
"name": "XSLT",
"bytes": "49099"
}
],
"symlink_target": ""
} |
package host
import (
"bytes"
"os/exec"
"regexp"
"strconv"
"time"
"github.com/weaveworks/scope/report"
)
var (
loadRe = regexp.MustCompile(`load averages: ([0-9\.]+) ([0-9\.]+) ([0-9\.]+)`)
uptimeRe = regexp.MustCompile(`up ([0-9]+) day[s]*,[ ]+([0-9]+)\:([0-9][0-9])`)
)
// GetKernelReleaseAndVersion returns the kernel version as reported by uname.
var GetKernelReleaseAndVersion = func() (string, string, error) {
release, err := exec.Command("uname", "-r").CombinedOutput()
if err != nil {
return "unknown", "unknown", err
}
release = bytes.Trim(release, " \n")
version, err := exec.Command("uname", "-v").CombinedOutput()
if err != nil {
return string(release), "unknown", err
}
version = bytes.Trim(version, " \n")
return string(release), string(version), nil
}
// GetLoad returns the current load averages as metrics.
var GetLoad = func(now time.Time) report.Metrics {
out, err := exec.Command("w").CombinedOutput()
if err != nil {
return nil
}
matches := loadRe.FindAllStringSubmatch(string(out), -1)
if matches == nil || len(matches) < 1 || len(matches[0]) < 4 {
return nil
}
one, err := strconv.ParseFloat(matches[0][1], 64)
if err != nil {
return nil
}
return report.Metrics{
Load1: report.MakeSingletonMetric(now, one),
}
}
// GetUptime returns the uptime of the host.
var GetUptime = func() (time.Duration, error) {
out, err := exec.Command("w").CombinedOutput()
if err != nil {
return 0, err
}
matches := uptimeRe.FindAllStringSubmatch(string(out), -1)
if matches == nil || len(matches) < 1 || len(matches[0]) < 4 {
return 0, err
}
d, err := strconv.Atoi(matches[0][1])
if err != nil {
return 0, err
}
h, err := strconv.Atoi(matches[0][2])
if err != nil {
return 0, err
}
m, err := strconv.Atoi(matches[0][3])
if err != nil {
return 0, err
}
return (time.Duration(d) * 24 * time.Hour) + (time.Duration(h) * time.Hour) + (time.Duration(m) * time.Minute), nil
}
// GetCPUUsagePercent returns the percent cpu usage and max (i.e. 100% or 0 if unavailable)
var GetCPUUsagePercent = func() (float64, float64) {
return 0.0, 0.0
}
// GetMemoryUsageBytes returns the bytes memory usage and max
var GetMemoryUsageBytes = func() (float64, float64) {
return 0.0, 0.0
}
| {
"content_hash": "005a0657da449191b09804a50c10d663",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 116,
"avg_line_length": 26.162790697674417,
"alnum_prop": 0.6502222222222223,
"repo_name": "kinvolk/scope",
"id": "24caa4b8bc9301b3e0e7d628c7a2fb86d34d4e31",
"size": "2250",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "probe/host/system_darwin.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2224"
},
{
"name": "CSS",
"bytes": "45979"
},
{
"name": "Go",
"bytes": "1043591"
},
{
"name": "HCL",
"bytes": "17975"
},
{
"name": "HTML",
"bytes": "642"
},
{
"name": "JavaScript",
"bytes": "512160"
},
{
"name": "Makefile",
"bytes": "15357"
},
{
"name": "Python",
"bytes": "28772"
},
{
"name": "Shell",
"bytes": "125462"
}
],
"symlink_target": ""
} |
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="FpsCounter.cs" company="Helix Toolkit">
// Copyright (c) 2014 Helix Toolkit contributors
// </copyright>
// <summary>
//
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace HelixToolkit.Wpf.SharpDX
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
public class FpsCounter : INotifyPropertyChanged
{
/// <summary>
///
/// </summary>
public TimeSpan AveragingInterval
{
get { return m_averagingInterval; }
set
{
if (value == m_averagingInterval)
return;
if (value < TimeSpan.FromSeconds(0.1))
throw new ArgumentOutOfRangeException();
m_averagingInterval = value;
OnPropertyChanged("AveragingInterval");
}
}
/// <summary>
///
/// </summary>
/// <param name="ts"></param>
public void AddFrame(TimeSpan ts)
{
var sec = AveragingInterval;
var index = m_frames.FindLastIndex(aTS => ts - aTS > sec);
if (index > -1)
m_frames.RemoveRange(0, index);
m_frames.Add(ts);
UpdateValue();
}
/// <summary>
///
/// </summary>
public void Clear()
{
m_frames.Clear();
UpdateValue();
}
/// <summary>
///
/// </summary>
public double Value
{
get { return m_value; }
private set
{
if (value == m_value)
return;
m_value = value;
OnPropertyChanged("Value");
}
}
/// <summary>
///
/// </summary>
private void UpdateValue()
{
if (m_frames.Count < 2)
{
Value = -1;
}
else
{
var dt = m_frames[m_frames.Count - 1] - m_frames[0];
Value = dt.Ticks > 100 ? m_frames.Count / dt.TotalSeconds : -1;
}
}
#region INotifyPropertyChanged Members
void OnPropertyChanged(string name)
{
var e = PropertyChanged;
if (e != null)
e(this, new PropertyChangedEventArgs(name));
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion
private double m_value;
private TimeSpan m_averagingInterval = TimeSpan.FromSeconds(1);
private List<TimeSpan> m_frames = new List<TimeSpan>();
}
} | {
"content_hash": "01c28f5969a2b90cf42f0b0b09c897b9",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 120,
"avg_line_length": 27.61467889908257,
"alnum_prop": 0.4132890365448505,
"repo_name": "CobraCalle/helix-toolkit",
"id": "51307d128b6b073da2ad5bb077b2022c956ef6e3",
"size": "3012",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "Source/HelixToolkit.Wpf.SharpDX/Controls/FpsCounter.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "4222"
},
{
"name": "C#",
"bytes": "3962461"
},
{
"name": "FLUX",
"bytes": "175569"
}
],
"symlink_target": ""
} |
package org.apache.hyracks.dataflow.std.map;
import java.util.Random;
import org.apache.hyracks.api.dataflow.IDataWriter;
import org.apache.hyracks.api.exceptions.HyracksDataException;
public class SamplerDeserializedMapperFactory implements IDeserializedMapperFactory {
private static final long serialVersionUID = 1L;
private final float sampleRatio;
public SamplerDeserializedMapperFactory(float sampleRatio) {
this.sampleRatio = sampleRatio;
}
@Override
public IDeserializedMapper createMapper() throws HyracksDataException {
return new IDeserializedMapper() {
private Random random = new Random();
@Override
public void map(Object[] data, IDataWriter<Object[]> writer) throws HyracksDataException {
if (random.nextFloat() <= sampleRatio) {
writer.writeData(data);
}
}
};
}
} | {
"content_hash": "5359932160c21b991ba0fe5371ee0631",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 102,
"avg_line_length": 31.266666666666666,
"alnum_prop": 0.6791044776119403,
"repo_name": "amoudi87/hyracks",
"id": "d0e695c663694f143981f6b9e6f27fbbb16cd120",
"size": "1745",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/map/SamplerDeserializedMapperFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2606"
},
{
"name": "CSS",
"bytes": "893"
},
{
"name": "HTML",
"bytes": "8762"
},
{
"name": "Java",
"bytes": "8496468"
},
{
"name": "JavaScript",
"bytes": "24904"
},
{
"name": "Shell",
"bytes": "16545"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.sxjs.common.widget.autoscrollviewpager.BGABanner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:banner_indicatorGravity="bottom|right"
app:banner_pointContainerBackground="@color/transparent"
app:banner_pageChangeDuration="3500"
app:banner_placeholderDrawable="@drawable/holder_img"
app:banner_tipTextSize="12sp"
app:banner_viewAspectRatio="2.32"
app:banner_transitionEffect="defaultEffect" />
</LinearLayout>
| {
"content_hash": "09fb323964870a880202e22711f8a8cd",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 72,
"avg_line_length": 40.095238095238095,
"alnum_prop": 0.7019002375296912,
"repo_name": "liu-xiao-dong/JD-Test",
"id": "8c8511f1c477220d298d51c3ed2c8c5d667ea6e4",
"size": "842",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "main/src/main/res/layout/homerecycle_item_top_banner.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "847355"
}
],
"symlink_target": ""
} |
package org.apache.hadoop.fs.contract;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.internal.AssumptionViolatedException;
import org.junit.rules.TestName;
import org.junit.rules.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.URI;
import static org.apache.hadoop.fs.contract.ContractTestUtils.cleanup;
import static org.apache.hadoop.fs.contract.ContractTestUtils.skip;
/**
* This is the base class for all the contract tests.
*/
public abstract class AbstractFSContractTestBase extends Assert
implements ContractOptions {
private static final Logger LOG =
LoggerFactory.getLogger(AbstractFSContractTestBase.class);
/**
* Length of files to work with: {@value}.
*/
public static final int TEST_FILE_LEN = 1024;
/**
* standard test timeout: {@value}.
*/
public static final int DEFAULT_TEST_TIMEOUT = 180 * 1000;
/**
* The FS contract used for these tests.
*/
private AbstractFSContract contract;
/**
* The test filesystem extracted from it.
*/
private FileSystem fileSystem;
/**
* The path for tests.
*/
private Path testPath;
@Rule
public TestName methodName = new TestName();
@BeforeClass
public static void nameTestThread() {
Thread.currentThread().setName("JUnit");
}
@Before
public void nameThread() {
Thread.currentThread().setName("JUnit-" + getMethodName());
}
protected String getMethodName() {
return methodName.getMethodName();
}
/**
* This must be implemented by all instantiated test cases.
* -provide the FS contract
* @return the FS contract
*/
protected abstract AbstractFSContract createContract(Configuration conf);
/**
* Get the contract.
* @return the contract, which will be non-null once the setup operation has
* succeeded
*/
protected AbstractFSContract getContract() {
return contract;
}
/**
* Get the filesystem created in startup.
* @return the filesystem to use for tests
*/
public FileSystem getFileSystem() {
return fileSystem;
}
/**
* Get the log of the base class.
* @return a logger
*/
public static Logger getLogger() {
return LOG;
}
/**
* Skip a test if a feature is unsupported in this FS.
* @param feature feature to look for
* @throws IOException IO problem
*/
protected void skipIfUnsupported(String feature) throws IOException {
if (!isSupported(feature)) {
skip("Skipping as unsupported feature: " + feature);
}
}
/**
* Is a feature supported?
* @param feature feature
* @return true iff the feature is supported
* @throws IOException IO problems
*/
protected boolean isSupported(String feature) throws IOException {
return contract.isSupported(feature, false);
}
/**
* Include at the start of tests to skip them if the FS is not enabled.
*/
protected void assumeEnabled() {
if (!contract.isEnabled())
throw new AssumptionViolatedException("test cases disabled for " + contract);
}
/**
* Create a configuration. May be overridden by tests/instantiations
* @return a configuration
*/
protected Configuration createConfiguration() {
return new Configuration();
}
/**
* Set the timeout for every test.
*/
@Rule
public Timeout testTimeout = new Timeout(getTestTimeoutMillis());
/**
* Option for tests to override the default timeout value.
* @return the current test timeout
*/
protected int getTestTimeoutMillis() {
return DEFAULT_TEST_TIMEOUT;
}
/**
* Setup: create the contract then init it.
* @throws Exception on any failure
*/
@Before
public void setup() throws Exception {
Thread.currentThread().setName("setup");
LOG.debug("== Setup ==");
contract = createContract(createConfiguration());
contract.init();
//skip tests if they aren't enabled
assumeEnabled();
//extract the test FS
fileSystem = contract.getTestFileSystem();
assertNotNull("null filesystem", fileSystem);
URI fsURI = fileSystem.getUri();
LOG.info("Test filesystem = {} implemented by {}",
fsURI, fileSystem);
//sanity check to make sure that the test FS picked up really matches
//the scheme chosen. This is to avoid defaulting back to the localFS
//which would be drastic for root FS tests
assertEquals("wrong filesystem of " + fsURI,
contract.getScheme(), fsURI.getScheme());
//create the test path
testPath = getContract().getTestPath();
mkdirs(testPath);
LOG.debug("== Setup complete ==");
}
/**
* Teardown.
* @throws Exception on any failure
*/
@After
public void teardown() throws Exception {
Thread.currentThread().setName("teardown");
LOG.debug("== Teardown ==");
deleteTestDirInTeardown();
if (contract != null) {
contract.teardown();
}
LOG.debug("== Teardown complete ==");
}
/**
* Delete the test dir in the per-test teardown.
* @throws IOException
*/
protected void deleteTestDirInTeardown() throws IOException {
cleanup("TEARDOWN", getFileSystem(), testPath);
}
/**
* Create a path under the test path provided by
* the FS contract.
* @param filepath path string in
* @return a path qualified by the test filesystem
* @throws IOException IO problems
*/
protected Path path(String filepath) throws IOException {
return getFileSystem().makeQualified(
new Path(getContract().getTestPath(), filepath));
}
/**
* Get a path whose name ends with the name of this method.
* @return a path implicitly unique amongst all methods in this class
* @throws IOException IO problems
*/
protected Path methodPath() throws IOException {
return path(methodName.getMethodName());
}
/**
* Take a simple path like "/something" and turn it into
* a qualified path against the test FS.
* @param filepath path string in
* @return a path qualified by the test filesystem
* @throws IOException IO problems
*/
protected Path absolutepath(String filepath) throws IOException {
return getFileSystem().makeQualified(new Path(filepath));
}
/**
* List a path in the test FS.
* @param path path to list
* @return the contents of the path/dir
* @throws IOException IO problems
*/
protected String ls(Path path) throws IOException {
return ContractTestUtils.ls(fileSystem, path);
}
/**
* Describe a test. This is a replacement for javadocs
* where the tests role is printed in the log output
* @param text description
*/
protected void describe(String text) {
LOG.info(text);
}
/**
* Handle the outcome of an operation not being the strictest
* exception desired, but one that, while still within the boundary
* of the contract, is a bit looser.
*
* If the FS contract says that they support the strictest exceptions,
* that is what they must return, and the exception here is rethrown
* @param action Action
* @param expectedException what was expected
* @param e exception that was received
*/
protected void handleRelaxedException(String action,
String expectedException,
Exception e) throws Exception {
if (getContract().isSupported(SUPPORTS_STRICT_EXCEPTIONS, false)) {
throw e;
}
LOG.warn("The expected exception {} was not the exception class" +
" raised on {}: {}", action , e.getClass(), expectedException, e);
}
/**
* Handle expected exceptions through logging and/or other actions.
* @param e exception raised.
*/
protected void handleExpectedException(Exception e) {
getLogger().debug("expected :{}" ,e, e);
}
/**
* assert that a path exists.
* @param message message to use in an assertion
* @param path path to probe
* @throws IOException IO problems
*/
public void assertPathExists(String message, Path path) throws IOException {
ContractTestUtils.assertPathExists(fileSystem, message, path);
}
/**
* Assert that a path does not exist.
* @param message message to use in an assertion
* @param path path to probe
* @throws IOException IO problems
*/
public void assertPathDoesNotExist(String message, Path path) throws
IOException {
ContractTestUtils.assertPathDoesNotExist(fileSystem, message, path);
}
/**
* Assert that a file exists and whose {@link FileStatus} entry
* declares that this is a file and not a symlink or directory.
*
* @param filename name of the file
* @throws IOException IO problems during file operations
*/
protected void assertIsFile(Path filename) throws IOException {
ContractTestUtils.assertIsFile(fileSystem, filename);
}
/**
* Assert that a file exists and whose {@link FileStatus} entry
* declares that this is a file and not a symlink or directory.
*
* @param path name of the file
* @throws IOException IO problems during file operations
*/
protected void assertIsDirectory(Path path) throws IOException {
ContractTestUtils.assertIsDirectory(fileSystem, path);
}
/**
* Assert that a file exists and whose {@link FileStatus} entry
* declares that this is a file and not a symlink or directory.
*
* @throws IOException IO problems during file operations
*/
protected void mkdirs(Path path) throws IOException {
assertTrue("Failed to mkdir " + path, fileSystem.mkdirs(path));
}
/**
* Assert that a delete succeeded.
* @param path path to delete
* @param recursive recursive flag
* @throws IOException IO problems
*/
protected void assertDeleted(Path path, boolean recursive) throws
IOException {
ContractTestUtils.assertDeleted(fileSystem, path, recursive);
}
/**
* Assert that the result value == -1; which implies
* that a read was successful.
* @param text text to include in a message (usually the operation)
* @param result read result to validate
*/
protected void assertMinusOne(String text, int result) {
assertEquals(text + " wrong read result " + result, -1, result);
}
protected boolean rename(Path src, Path dst) throws IOException {
return getFileSystem().rename(src, dst);
}
protected String generateAndLogErrorListing(Path src, Path dst) throws
IOException {
FileSystem fs = getFileSystem();
getLogger().error(
"src dir " + ContractTestUtils.ls(fs, src.getParent()));
String destDirLS = ContractTestUtils.ls(fs, dst.getParent());
if (fs.isDirectory(dst)) {
//include the dir into the listing
destDirLS = destDirLS + "\n" + ContractTestUtils.ls(fs, dst);
}
return destDirLS;
}
}
| {
"content_hash": "ca78cf43747d578079594fba4a9d456e",
"timestamp": "",
"source": "github",
"line_count": 385,
"max_line_length": 83,
"avg_line_length": 29.083116883116883,
"alnum_prop": 0.6730374207376976,
"repo_name": "steveloughran/hadoop",
"id": "ac9de6d7bfe8c6e1e0d1492a8ec38b97c223f66c",
"size": "12015",
"binary": false,
"copies": "1",
"ref": "refs/heads/trunk",
"path": "hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/AbstractFSContractTestBase.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "78591"
},
{
"name": "C",
"bytes": "1974547"
},
{
"name": "C++",
"bytes": "2861923"
},
{
"name": "CMake",
"bytes": "115553"
},
{
"name": "CSS",
"bytes": "117128"
},
{
"name": "Dockerfile",
"bytes": "7311"
},
{
"name": "HTML",
"bytes": "420629"
},
{
"name": "Java",
"bytes": "93884754"
},
{
"name": "JavaScript",
"bytes": "1245137"
},
{
"name": "Python",
"bytes": "23553"
},
{
"name": "Shell",
"bytes": "480813"
},
{
"name": "TLA",
"bytes": "14997"
},
{
"name": "TSQL",
"bytes": "30600"
},
{
"name": "TeX",
"bytes": "19322"
},
{
"name": "XSLT",
"bytes": "18026"
}
],
"symlink_target": ""
} |
package org.jhotdraw.samples.svg;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import org.jhotdraw.draw.io.TextInputFormat;
import org.jhotdraw.draw.io.OutputFormat;
import org.jhotdraw.draw.io.InputFormat;
import org.jhotdraw.draw.io.ImageOutputFormat;
import org.jhotdraw.draw.io.ImageInputFormat;
import java.lang.reflect.InvocationTargetException;
import java.util.prefs.*;
import org.jhotdraw.undo.*;
import org.jhotdraw.util.*;
import java.awt.image.BufferedImage;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.TransferHandler;
import org.jhotdraw.app.Disposable;
import org.jhotdraw.gui.ToolBarLayout;
import org.jhotdraw.draw.*;
import org.jhotdraw.gui.plaf.palette.PaletteLookAndFeel;
import org.jhotdraw.samples.svg.figures.SVGImageFigure;
import org.jhotdraw.samples.svg.figures.SVGTextFigure;
import org.jhotdraw.samples.svg.io.ImageMapOutputFormat;
import org.jhotdraw.samples.svg.io.SVGOutputFormat;
import org.jhotdraw.samples.svg.io.SVGZInputFormat;
import org.jhotdraw.samples.svg.io.SVGZOutputFormat;
import org.jhotdraw.util.prefs.PreferencesUtil;
import static org.jhotdraw.samples.svg.SVGAttributeKeys.*;
/**
* JSVGDrawingAppletPanel.
*
* @author Werner Randelshofer
* @version $Id: SVGDrawingPanel.java 717 2010-11-21 12:30:57Z rawcoder $
*/
public class SVGDrawingPanel extends JPanel implements Disposable {
private UndoRedoManager undoManager;
@Nullable private DrawingEditor editor;
private ResourceBundleUtil labels;
private Preferences prefs;
@Nullable private ContainerListener containerHandler;
public UndoRedoManager getUndoRedoManager() {
return undoManager;
}
public void setUndoRedoManager(UndoRedoManager undo) {
if (undoManager != null && getView().getDrawing() != null) {
getView().getDrawing().removeUndoableEditListener(undoManager);
}
undoManager = undo;
if (undoManager != null && getView().getDrawing() != null) {
getView().getDrawing().addUndoableEditListener(undoManager);
}
}
private class ItemChangeHandler implements ItemListener {
private JToolBar toolbar;
private String prefkey;
public ItemChangeHandler(JToolBar toolbar, String prefkey) {
this.toolbar = toolbar;
this.prefkey = prefkey;
}
@Override
public void itemStateChanged(ItemEvent e) {
boolean b = e.getStateChange() == ItemEvent.SELECTED;
toolbar.setVisible(b);
prefs.putBoolean(prefkey, b);
validate();
}
}
/** Creates new instance. */
public SVGDrawingPanel() {
labels = ResourceBundleUtil.getBundle("org.jhotdraw.samples.svg.Labels");
try {
prefs = PreferencesUtil.userNodeForPackage(getClass());
} catch (SecurityException e) {
// prefs is null, because we are not permitted to read preferences
}
initComponents();
toolsPane.setLayout(new ToolBarLayout());
toolsPane.setBackground(new Color(0xf0f0f0));
toolsPane.setOpaque(true);
viewToolBar.setView(view);
undoManager = new UndoRedoManager();
Drawing drawing = createDrawing();
view.setDrawing(drawing);
drawing.addUndoableEditListener(undoManager);
// Try to install the DnDDrawingViewTransferHandler
// Since this class only works on J2SE 6, we have to use reflection.
try {
view.setTransferHandler((TransferHandler) Class.forName("org.jhotdraw.draw.DnDDrawingViewTransferHandler").newInstance());
} catch (Exception e) {
// bail silently
}
// Sort the toolbars according to the user preferences
ArrayList<JToolBar> sortme = new ArrayList<JToolBar>();
for (Component c : toolsPane.getComponents()) {
if (c instanceof JToolBar) {
sortme.add((JToolBar) c);
}
}
Collections.sort(sortme, new Comparator<JToolBar>() {
@Override
public int compare(JToolBar tb1, JToolBar tb2) {
int i1 = prefs.getInt("toolBarIndex." + tb1.getName(), 0);
int i2 = prefs.getInt("toolBarIndex." + tb2.getName(), 0);
return i1 - i2;
}
});
toolsPane.removeAll();
for (JToolBar tb : sortme) {
toolsPane.add(tb);
}
toolsPane.addContainerListener(containerHandler = new ContainerListener() {
@Override
public void componentAdded(ContainerEvent e) {
int i = 0;
for (Component c : toolsPane.getComponents()) {
if (c instanceof JToolBar) {
JToolBar tb = (JToolBar) c;
prefs.putInt("toolBarIndex." + tb.getName(), i);
i++;
}
}
}
@Override
public void componentRemoved(ContainerEvent e) {
}
});
setEditor(new DefaultDrawingEditor());
}
@Override
public void dispose() {
toolsPane.removeContainerListener(containerHandler);
containerHandler = null;
setEditor(null);
for (PropertyChangeListener pcl : view.getListeners(PropertyChangeListener.class)) {
view.removePropertyChangeListener(pcl);
}
view.setDrawing(null);
actionToolBar.dispose();
alignToolBar.dispose();
arrangeToolBar.dispose();
canvasToolBar.dispose();
creationToolBar.dispose();
figureToolBar.dispose();
fillToolBar.dispose();
fontToolBar.dispose();
linkToolBar.dispose();
strokeToolBar.dispose();
viewToolBar.dispose();
removeAll();
}
/**
* Creates a new Drawing object which can be used with this
* {@code SVGDrawingPanel}.
*/
public Drawing createDrawing() {
Drawing drawing = new QuadTreeDrawing();
LinkedList<InputFormat> inputFormats = new LinkedList<InputFormat>();
inputFormats.add(new SVGZInputFormat());
inputFormats.add(new ImageInputFormat(new SVGImageFigure(), "PNG", "Portable Network Graphics (PNG)", "png", "image/png"));
inputFormats.add(new ImageInputFormat(new SVGImageFigure(), "JPG", "Joint Photographics Experts Group (JPEG)", "jpg","image/jpg"));
inputFormats.add(new ImageInputFormat(new SVGImageFigure(), "GIF", "Graphics Interchange Format (GIF)", "gif", "image/gif"));
inputFormats.add(new TextInputFormat(new SVGTextFigure()));
drawing.setInputFormats(inputFormats);
LinkedList<OutputFormat> outputFormats = new LinkedList<OutputFormat>();
outputFormats.add(new SVGOutputFormat());
outputFormats.add(new SVGZOutputFormat());
outputFormats.add(new ImageOutputFormat());
outputFormats.add(new ImageOutputFormat("JPG", "Joint Photographics Experts Group (JPEG)", "jpg", BufferedImage.TYPE_INT_RGB));
outputFormats.add(new ImageOutputFormat("BMP", "Windows Bitmap (BMP)", "bmp", BufferedImage.TYPE_BYTE_INDEXED));
outputFormats.add(new ImageMapOutputFormat());
drawing.setOutputFormats(outputFormats);
return drawing;
}
public void setDrawing(Drawing d) {
undoManager.discardAllEdits();
if (view.getDrawing() != null) {
view.getDrawing().removeUndoableEditListener(undoManager);
}
view.setDrawing(d);
d.addUndoableEditListener(undoManager);
}
public Drawing getDrawing() {
return view.getDrawing();
}
public DrawingView getView() {
return view;
}
@Nullable public DrawingEditor getEditor() {
return editor;
}
public void setEditor(@Nullable DrawingEditor newValue) {
DrawingEditor oldValue = editor;
if (oldValue != null) {
oldValue.remove(view);
}
editor = newValue;
if (newValue != null) {
newValue.add(view);
}
creationToolBar.setEditor(editor);
fillToolBar.setEditor(editor);
strokeToolBar.setEditor(editor);
actionToolBar.setUndoManager(undoManager);
actionToolBar.setEditor(editor);
alignToolBar.setEditor(editor);
arrangeToolBar.setEditor(editor);
fontToolBar.setEditor(editor);
figureToolBar.setEditor(editor);
linkToolBar.setEditor(editor);
DrawingView temp = (editor == null) ? null : editor.getActiveView();
if (editor != null) {
editor.setActiveView(view);
}
canvasToolBar.setEditor(editor);
viewToolBar.setEditor(editor);
if (editor != null) {
editor.setActiveView(temp);
}
}
/**
* Reads a drawing from the specified file into the SVGDrawingPanel.
* <p>
* This method should be called from a worker thread.
* Calling it from the Event Dispatcher Thread will block the user
* interface, until the drawing is read.
*/
public void read(URI f) throws IOException {
// Create a new drawing object
Drawing newDrawing = createDrawing();
if (newDrawing.getInputFormats().size() == 0) {
throw new InternalError("Drawing object has no input formats.");
}
// Try out all input formats until we succeed
IOException firstIOException = null;
for (InputFormat format : newDrawing.getInputFormats()) {
try {
format.read(f, newDrawing);
final Drawing loadedDrawing = newDrawing;
Runnable r = new Runnable() {
@Override
public void run() {
// Set the drawing on the Event Dispatcher Thread
setDrawing(loadedDrawing);
}
};
if (SwingUtilities.isEventDispatchThread()) {
r.run();
} else {
try {
SwingUtilities.invokeAndWait(r);
} catch (InterruptedException ex) {
// suppress silently
} catch (InvocationTargetException ex) {
InternalError ie = new InternalError("Error setting drawing.");
ie.initCause(ex);
throw ie;
}
}
// We get here if reading was successful.
// We can return since we are done.
return;
//
} catch (IOException e) {
// We get here if reading failed.
// We only preserve the exception of the first input format,
// because that's the one which is best suited for this drawing.
if (firstIOException == null) {
firstIOException = e;
}
}
}
throw firstIOException;
}
/**
* Reads a drawing from the specified file into the SVGDrawingPanel using
* the specified input format.
* <p>
* This method should be called from a worker thread.
* Calling it from the Event Dispatcher Thread will block the user
* interface, until the drawing is read.
*/
public void read(URI f, InputFormat format) throws IOException {
if (format == null) {
read(f);
return;
}
// Create a new drawing object
Drawing newDrawing = createDrawing();
if (newDrawing.getInputFormats().size() == 0) {
throw new InternalError("Drawing object has no input formats.");
}
format.read(f, newDrawing);
final Drawing loadedDrawing = newDrawing;
Runnable r = new Runnable() {
@Override
public void run() {
// Set the drawing on the Event Dispatcher Thread
setDrawing(loadedDrawing);
}
};
if (SwingUtilities.isEventDispatchThread()) {
r.run();
} else {
try {
SwingUtilities.invokeAndWait(r);
} catch (InterruptedException ex) {
// suppress silently
} catch (InvocationTargetException ex) {
InternalError ie = new InternalError("Error setting drawing.");
ie.initCause(ex);
throw ie;
}
}
}
/**
* Writes the drawing from the SVGDrawingPanel into a file.
* <p>
* This method should be called from a worker thread.
* Calling it from the Event Dispatcher Thread will block the user
* interface, until the drawing is written.
*/
public void write(URI uri) throws IOException {
// Defensively clone the drawing object, so that we are not
// affected by changes of the drawing while we write it into the file.
final Drawing[] helper = new Drawing[1];
Runnable r = new Runnable() {
@Override
public void run() {
helper[0] = (Drawing) getDrawing().clone();
}
};
if (SwingUtilities.isEventDispatchThread()) {
r.run();
} else {
try {
SwingUtilities.invokeAndWait(r);
} catch (InterruptedException ex) {
// suppress silently
} catch (InvocationTargetException ex) {
InternalError ie = new InternalError("Error getting drawing.");
ie.initCause(ex);
throw ie;
}
}
Drawing saveDrawing = helper[0];
if (saveDrawing.getOutputFormats().size() == 0) {
throw new InternalError("Drawing object has no output formats.");
}
// Try out all output formats until we find one which accepts the
// filename entered by the user.
File f = new File(uri);
for (OutputFormat format : saveDrawing.getOutputFormats()) {
if (format.getFileFilter().accept(f)) {
format.write(uri, saveDrawing);
// We get here if writing was successful.
// We can return since we are done.
return;
}
}
throw new IOException("No output format for " + f.getName());
}
/**
* Writes the drawing from the SVGDrawingPanel into a file using the
* specified output format.
* <p>
* This method should be called from a worker thread.
* Calling it from the Event Dispatcher Thread will block the user
* interface, until the drawing is written.
*/
public void write(URI f, OutputFormat format) throws IOException {
if (format == null) {
write(f);
return;
}
// Defensively clone the drawing object, so that we are not
// affected by changes of the drawing while we write it into the file.
final Drawing[] helper = new Drawing[1];
Runnable r = new Runnable() {
@Override
public void run() {
helper[0] = (Drawing) getDrawing().clone();
}
};
if (SwingUtilities.isEventDispatchThread()) {
r.run();
} else {
try {
SwingUtilities.invokeAndWait(r);
} catch (InterruptedException ex) {
// suppress silently
} catch (InvocationTargetException ex) {
InternalError ie = new InternalError("Error getting drawing.");
ie.initCause(ex);
throw ie;
}
}
// Write drawing to file
Drawing saveDrawing = helper[0];
format.write(f, saveDrawing);
}
/** Sets the actions for the "Action" popup menu in the toolbar.
* <p>
* This list may contain null items which are used to denote a
* separator in the popup menu.
* <p>
* Set this to null to set the drop down menus to the default actions.
*/
public void setPopupActions(List<Action> actions) {
actionToolBar.setPopupActions(actions);
}
/** Gets the actions of the "Action" popup menu in the toolbar.
* This list may contain null items which are used to denote a
* separator in the popup menu.
*
* @return An unmodifiable list with actions.
*/
public List<Action> getPopupActions() {
return actionToolBar.getPopupActions();
}
public JComponent getComponent() {
return this;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
toolButtonGroup = new javax.swing.ButtonGroup();
scrollPane = new javax.swing.JScrollPane();
view = new org.jhotdraw.draw.DefaultDrawingView();
toolsPanel = new javax.swing.JPanel();
toolsScrollPane = new javax.swing.JScrollPane();
toolsPane = new javax.swing.JPanel();
creationToolBar = new org.jhotdraw.samples.svg.gui.ToolsToolBar();
actionToolBar = new org.jhotdraw.samples.svg.gui.ActionsToolBar();
fillToolBar = new org.jhotdraw.samples.svg.gui.FillToolBar();
strokeToolBar = new org.jhotdraw.samples.svg.gui.StrokeToolBar();
fontToolBar = new org.jhotdraw.samples.svg.gui.FontToolBar();
arrangeToolBar = new org.jhotdraw.samples.svg.gui.ArrangeToolBar();
alignToolBar = new org.jhotdraw.samples.svg.gui.AlignToolBar();
figureToolBar = new org.jhotdraw.samples.svg.gui.FigureToolBar();
linkToolBar = new org.jhotdraw.samples.svg.gui.LinkToolBar();
canvasToolBar = new org.jhotdraw.samples.svg.gui.CanvasToolBar();
viewToolBar = new org.jhotdraw.samples.svg.gui.ViewToolBar();
setBackground(new java.awt.Color(255, 255, 255));
setLayout(new java.awt.BorderLayout());
scrollPane.setBorder(null);
scrollPane.setViewportView(view);
add(scrollPane, java.awt.BorderLayout.CENTER);
toolsPanel.setBackground(new java.awt.Color(255, 255, 255));
toolsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
toolsPanel.setOpaque(true);
toolsPanel.setLayout(new java.awt.GridBagLayout());
toolsScrollPane.setBorder(PaletteLookAndFeel.getInstance().getBorder("Ribbon.border"));
toolsScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
toolsScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
toolsScrollPane.setMinimumSize(new java.awt.Dimension(0, 0));
toolsPane.setForeground(new java.awt.Color(153, 153, 153));
toolsPane.add(creationToolBar);
toolsPane.add(actionToolBar);
toolsPane.add(fillToolBar);
strokeToolBar.setMargin(new java.awt.Insets(0, 10, 0, 0));
toolsPane.add(strokeToolBar);
toolsPane.add(fontToolBar);
toolsPane.add(arrangeToolBar);
toolsPane.add(alignToolBar);
toolsPane.add(figureToolBar);
toolsPane.add(linkToolBar);
toolsPane.add(canvasToolBar);
toolsPane.add(viewToolBar);
toolsScrollPane.setViewportView(toolsPane);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
toolsPanel.add(toolsScrollPane, gridBagConstraints);
add(toolsPanel, java.awt.BorderLayout.SOUTH);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private org.jhotdraw.samples.svg.gui.ActionsToolBar actionToolBar;
private org.jhotdraw.samples.svg.gui.AlignToolBar alignToolBar;
private org.jhotdraw.samples.svg.gui.ArrangeToolBar arrangeToolBar;
private org.jhotdraw.samples.svg.gui.CanvasToolBar canvasToolBar;
private org.jhotdraw.samples.svg.gui.ToolsToolBar creationToolBar;
private org.jhotdraw.samples.svg.gui.FigureToolBar figureToolBar;
private org.jhotdraw.samples.svg.gui.FillToolBar fillToolBar;
private org.jhotdraw.samples.svg.gui.FontToolBar fontToolBar;
private org.jhotdraw.samples.svg.gui.LinkToolBar linkToolBar;
private javax.swing.JScrollPane scrollPane;
private org.jhotdraw.samples.svg.gui.StrokeToolBar strokeToolBar;
private javax.swing.ButtonGroup toolButtonGroup;
private javax.swing.JPanel toolsPane;
private javax.swing.JPanel toolsPanel;
private javax.swing.JScrollPane toolsScrollPane;
private org.jhotdraw.draw.DefaultDrawingView view;
private org.jhotdraw.samples.svg.gui.ViewToolBar viewToolBar;
// End of variables declaration//GEN-END:variables
}
| {
"content_hash": "84d7ce30ae9c9033c46e3fb1a59a1d19",
"timestamp": "",
"source": "github",
"line_count": 586,
"max_line_length": 139,
"avg_line_length": 37.24061433447099,
"alnum_prop": 0.625395225221097,
"repo_name": "ahmedvc/umple",
"id": "b3855dc5bca871eb8ff0d2de2ef31d681715a383",
"size": "22173",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Umplificator/UmplifiedProjects/jhotdraw7/src/main/java/org/jhotdraw/samples/svg/SVGDrawingPanel.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "414"
},
{
"name": "CSS",
"bytes": "79771"
},
{
"name": "GAP",
"bytes": "1064953"
},
{
"name": "HTML",
"bytes": "2051125"
},
{
"name": "Java",
"bytes": "40683436"
},
{
"name": "JavaScript",
"bytes": "1550699"
},
{
"name": "Lex",
"bytes": "11050"
},
{
"name": "Matlab",
"bytes": "1160"
},
{
"name": "PHP",
"bytes": "450839"
},
{
"name": "Ruby",
"bytes": "365551"
},
{
"name": "Shell",
"bytes": "5247"
},
{
"name": "Xtend",
"bytes": "351"
}
],
"symlink_target": ""
} |
#pragma once
#include <aws/medialive/MediaLive_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/medialive/model/CaptionSelectorSettings.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace MediaLive
{
namespace Model
{
/**
* Output groups for this Live Event. Output groups contain information about where
* streams should be distributed.<p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/medialive-2017-10-14/CaptionSelector">AWS
* API Reference</a></p>
*/
class AWS_MEDIALIVE_API CaptionSelector
{
public:
CaptionSelector();
CaptionSelector(Aws::Utils::Json::JsonView jsonValue);
CaptionSelector& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* When specified this field indicates the three letter language code of the
* caption track to extract from the source.
*/
inline const Aws::String& GetLanguageCode() const{ return m_languageCode; }
/**
* When specified this field indicates the three letter language code of the
* caption track to extract from the source.
*/
inline bool LanguageCodeHasBeenSet() const { return m_languageCodeHasBeenSet; }
/**
* When specified this field indicates the three letter language code of the
* caption track to extract from the source.
*/
inline void SetLanguageCode(const Aws::String& value) { m_languageCodeHasBeenSet = true; m_languageCode = value; }
/**
* When specified this field indicates the three letter language code of the
* caption track to extract from the source.
*/
inline void SetLanguageCode(Aws::String&& value) { m_languageCodeHasBeenSet = true; m_languageCode = std::move(value); }
/**
* When specified this field indicates the three letter language code of the
* caption track to extract from the source.
*/
inline void SetLanguageCode(const char* value) { m_languageCodeHasBeenSet = true; m_languageCode.assign(value); }
/**
* When specified this field indicates the three letter language code of the
* caption track to extract from the source.
*/
inline CaptionSelector& WithLanguageCode(const Aws::String& value) { SetLanguageCode(value); return *this;}
/**
* When specified this field indicates the three letter language code of the
* caption track to extract from the source.
*/
inline CaptionSelector& WithLanguageCode(Aws::String&& value) { SetLanguageCode(std::move(value)); return *this;}
/**
* When specified this field indicates the three letter language code of the
* caption track to extract from the source.
*/
inline CaptionSelector& WithLanguageCode(const char* value) { SetLanguageCode(value); return *this;}
/**
* Name identifier for a caption selector. This name is used to associate this
* caption selector with one or more caption descriptions. Names must be unique
* within an event.
*/
inline const Aws::String& GetName() const{ return m_name; }
/**
* Name identifier for a caption selector. This name is used to associate this
* caption selector with one or more caption descriptions. Names must be unique
* within an event.
*/
inline bool NameHasBeenSet() const { return m_nameHasBeenSet; }
/**
* Name identifier for a caption selector. This name is used to associate this
* caption selector with one or more caption descriptions. Names must be unique
* within an event.
*/
inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; }
/**
* Name identifier for a caption selector. This name is used to associate this
* caption selector with one or more caption descriptions. Names must be unique
* within an event.
*/
inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); }
/**
* Name identifier for a caption selector. This name is used to associate this
* caption selector with one or more caption descriptions. Names must be unique
* within an event.
*/
inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); }
/**
* Name identifier for a caption selector. This name is used to associate this
* caption selector with one or more caption descriptions. Names must be unique
* within an event.
*/
inline CaptionSelector& WithName(const Aws::String& value) { SetName(value); return *this;}
/**
* Name identifier for a caption selector. This name is used to associate this
* caption selector with one or more caption descriptions. Names must be unique
* within an event.
*/
inline CaptionSelector& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}
/**
* Name identifier for a caption selector. This name is used to associate this
* caption selector with one or more caption descriptions. Names must be unique
* within an event.
*/
inline CaptionSelector& WithName(const char* value) { SetName(value); return *this;}
/**
* Caption selector settings.
*/
inline const CaptionSelectorSettings& GetSelectorSettings() const{ return m_selectorSettings; }
/**
* Caption selector settings.
*/
inline bool SelectorSettingsHasBeenSet() const { return m_selectorSettingsHasBeenSet; }
/**
* Caption selector settings.
*/
inline void SetSelectorSettings(const CaptionSelectorSettings& value) { m_selectorSettingsHasBeenSet = true; m_selectorSettings = value; }
/**
* Caption selector settings.
*/
inline void SetSelectorSettings(CaptionSelectorSettings&& value) { m_selectorSettingsHasBeenSet = true; m_selectorSettings = std::move(value); }
/**
* Caption selector settings.
*/
inline CaptionSelector& WithSelectorSettings(const CaptionSelectorSettings& value) { SetSelectorSettings(value); return *this;}
/**
* Caption selector settings.
*/
inline CaptionSelector& WithSelectorSettings(CaptionSelectorSettings&& value) { SetSelectorSettings(std::move(value)); return *this;}
private:
Aws::String m_languageCode;
bool m_languageCodeHasBeenSet;
Aws::String m_name;
bool m_nameHasBeenSet;
CaptionSelectorSettings m_selectorSettings;
bool m_selectorSettingsHasBeenSet;
};
} // namespace Model
} // namespace MediaLive
} // namespace Aws
| {
"content_hash": "c908c66d794971ec0a9fb5aa23ecff01",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 148,
"avg_line_length": 35.3068783068783,
"alnum_prop": 0.6924921324741495,
"repo_name": "cedral/aws-sdk-cpp",
"id": "3d0fa63192e08bcea1ad2f3e651ecda2da1ba78b",
"size": "6792",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-medialive/include/aws/medialive/model/CaptionSelector.h",
"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": ""
} |
package org.apache.sshd.server.x11;
/**
* Special marker interface used to signal to the forwarding filter that an exception
* has been caught on the forwarded channel
*
* @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
*/
public interface X11ForwardingExceptionMarker {
// nothing extra
}
| {
"content_hash": "a4318d24fdd3f21b7c35836c5e401b92",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 25.23076923076923,
"alnum_prop": 0.7408536585365854,
"repo_name": "lgoldstein/mina-sshd",
"id": "0c2416cf84cf8da5b88b0b14b724345e367041b6",
"size": "1129",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sshd-core/src/main/java/org/apache/sshd/server/x11/X11ForwardingExceptionMarker.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "15035"
},
{
"name": "HTML",
"bytes": "5769"
},
{
"name": "Java",
"bytes": "6840795"
},
{
"name": "Python",
"bytes": "11690"
},
{
"name": "Shell",
"bytes": "34849"
}
],
"symlink_target": ""
} |
"""EmPOWER cell pool and cell classes."""
from empower.core.serialize import serializable_dict
class CellPool(list):
"""Cell pool.
Extends the list in order to add a few filtering and sorting methods
"""
def sort_by_rsrp(self, ue_id):
"""Return list sorted by rsrp for the specified address."""
filtered = [x for x in self if ue_id in x.ue_measurements]
cells = sorted(filtered,
key=lambda x: x.ue_measurements[ue_id]['rsrp'],
reverse=True)
return CellPool(cells)
def sort_by_rsrq(self, ue_id):
"""Return list sorted by rsrq for the specified address."""
filtered = [x for x in self if ue_id in x.ue_measurements]
cells = sorted(filtered,
key=lambda x: x.ue_measurements[ue_id]['rsrq'],
reverse=True)
return CellPool(cells)
def first(self):
"""Return first entry in the list."""
if self:
cell = list.__getitem__(self, 0)
return cell
return None
def last(self):
"""Return last entry in the list."""
if self:
cell = list.__getitem__(self, -1)
return cell
return None
@serializable_dict
class Cell:
"""An LTE eNB cell.
Attributes:
vbs: The VBS at which this cell is available
pci: the physical cell id
dl_earfcn: downlink center frequency
dl_bandwidth: downlink bandwidth
ul_earfcn: uplink center frequency
ul_bandwidth: uplink bandwidth
ue_measurements: UE measurements (RSRP/RSRQ)
cell_measurements: cell measurements
"""
def __init__(self, vbs, pci, dl_earfcn, ul_earfcn, n_prbs):
self.vbs = vbs
self.pci = pci
self.dl_earfcn = dl_earfcn
self.ul_earfcn = ul_earfcn
self.n_prbs = n_prbs
self.ue_measurements = {}
self.cell_measurements = {}
def to_str(self):
"""Return an ASCII representation of the object."""
return "vbs %s pci %u dl_earfcn %u dl_earfcn %u n_prbs %u" % \
(self.vbs.addr, self.pci, self.dl_earfcn, self.ul_earfcn,
self.n_prbs)
def __str__(self):
return self.to_str()
def __repr__(self):
return self.__class__.__name__ + "('" + self.to_str() + "')"
def __hash__(self):
return hash(self.vbs) + hash(self.pci)
def __eq__(self, other):
if isinstance(other, Cell):
return self.vbs == other.vbs and self.pci == other.pci
return False
def __ne__(self, other):
return not self.__eq__(other)
def to_dict(self):
"""Return JSON-serializable representation of the object."""
out = {}
out['addr'] = self.vbs.addr
out['pci'] = self.pci
out['dl_earfcn'] = self.dl_earfcn
out['ul_earfcn'] = self.ul_earfcn
out['n_prbs'] = self.n_prbs
out['cell_measurements'] = self.cell_measurements
out['ue_measurements'] = self.ue_measurements
return out
| {
"content_hash": "5dd5c237046300ce254d308385d901a5",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 72,
"avg_line_length": 27.19298245614035,
"alnum_prop": 0.5590322580645162,
"repo_name": "rriggio/empower-runtime",
"id": "23f33be5d7d6fce6738ea6b8225e13cfed4cfe4e",
"size": "3709",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "empower/managers/ranmanager/vbsp/cellpool.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "33830"
},
{
"name": "HTML",
"bytes": "22883"
},
{
"name": "JavaScript",
"bytes": "2649924"
},
{
"name": "Python",
"bytes": "615969"
}
],
"symlink_target": ""
} |
Kitchen Sync
============
### Goal
Build your first Couchbase Mobile app in just a few minutes! Take an existing Android application
and add data persistence along with offline support with Sync-ing abilities!

### Setup
- Clone this repo, or download the [.zip](https://github.com/couchbaselabs/mini-hacks/archive/master.zip).
- Make sure you are on the latest Android Studio in the `Stable` channel.
- Launch Android Studio, choose 'Import Project...' and select the `android` folder.
- Verify your environment is working by debugging the app on your Android device.
Note: If you are running on a Mac, the Gradle build script will automatically download
Sync Gateway into your `build` folder. It will even start and stop it for you every time
you debug your app!
- Mac users: while your app is running on device, open the
[Sync Gateway admin console](http://localhost:4985/_admin/). Feel free to look around, but we'll
come back to this later.
- In addition to what is already in the MainActivity.java file, import..
import com.couchbase.lite.android.AndroidContext;
import com.couchbase.lite.Mapper;
import com.couchbase.lite.Emitter;
import java.util.ArrayList;
import java.net.URL;
### Tutorial
1. Let's begin by starting up Couchbase Lite. Create a new `startCBLite` method on `MainActivity`:
```java
protected void startCBLite() throws Exception {
```
2. Now we need to get a reference to our database object. To do that, add:
```java
manager = new Manager(new AndroidContext(this), Manager.DEFAULT_OPTIONS);
database = manager.getDatabase("kitchen-sync");
```
3. Next, we create an index to allow for fast queries. Couchbase Lite uses MapReduce queries, which
let us create our queries using plain-old Java functions. We can also do powerful
transformations of documents, compute aggregates, etc. In this project, however, we're going to
keep things simple and just index our documents by date.
```java
viewItemsByDate = database.getView("viewItemsByDate");
viewItemsByDate.setMap(new Mapper() {
@Override
public void map(Map<String, Object> document, Emitter emitter) {
Object createdAt = document.get("created_at");
if (createdAt != null) {
emitter.emit(createdAt.toString(), null);
}
}
}, "1.0");
```
4. Now that we've opened the database and created our index, lets call this new method from our
`onCreate` function:
```java
@Override
protected void onCreate(Bundle savedInstanceState) {
...
addItemEditText.setOnKeyListener(this);
startCBLite();
...
```
5. Next, let's initialize the `DataAdapter` for our list view. Create the following method, which
creates our custom adapter and listens for taps on each row:
```java
private void initItemListAdapter() {
kitchenSyncArrayAdapter = new KitchenSyncListAdapter(
getApplicationContext(),
R.layout.list_item,
R.id.label,
new ArrayList<QueryRow>()
);
itemListView.setAdapter(kitchenSyncArrayAdapter);
itemListView.setOnItemClickListener(this);
itemListView.setOnItemLongClickListener(this);
}
```
6. Now let's add this method to `onCreate`:
```java
@Override
protected void onCreate(Bundle savedInstanceState) {
...
addItemEditText.setOnKeyListener(this);
startCBLite();
initItemListAdapter();
...
```
7. We need the ability to create a new Couchbase Lite document from the text edit box's value. In
`MainActivity` you will find the `createListItem` method. Replace the last line, "return null;"
with the following:
```java
Document document = database.getDocument(id); // creates a document with the given id
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("_id", id);
properties.put("text", text);
properties.put("check", Boolean.FALSE);
properties.put("created_at", currentTimeString);
document.putProperties(properties);
return document;
```
That `putProperties()` method is the one that actually creates the document in Couchbase Lite.
8. Next, we start our `LiveQuery`. Like a regular `Query`, it gives us the ability to filter and
order the index we created in step 3. However, it also can send us results that appear
later--even after we've already iterated through the results! Let's create our new method like
this:
```java
private void startLiveQuery() throws Exception {
if (liveQuery == null) {
liveQuery = viewItemsByDate.createQuery().toLiveQuery();
liveQuery.addChangeListener(new LiveQuery.ChangeListener() {
public void changed(final LiveQuery.ChangeEvent event) {
runOnUiThread(new Runnable() {
public void run() {
kitchenSyncArrayAdapter.clear();
for (Iterator<QueryRow> it = event.getRows(); it.hasNext();) {
kitchenSyncArrayAdapter.add(it.next());
}
kitchenSyncArrayAdapter.notifyDataSetChanged();
}
});
}
});
liveQuery.start();
}
}
```
9. Add this method to `onCreate` as well:
```java
@Override
protected void onCreate(Bundle savedInstanceState) {
...
addItemEditText.setOnKeyListener(this);
startCBLite();
initItemListAdapter();
startLiveQuery();
...
```
10. Now we need to handle checkbox touches. Couchbase Lite documents are like versioned-maps. If we
want to change a `Document` we do it by adding a new `Revision`. We can do this easily by just
supplying a `HashMap` containing a snapshot of the new values our document should have. Add the
code below for the `onItemClick` handler that we already stubbed out for you in `MainActivity`:
```java
QueryRow row = (QueryRow) adapterView.getItemAtPosition(position);
Document document = row.getDocument();
Map<String, Object> newProperties = new HashMap<String, Object>(document.getProperties());
boolean checked = ((Boolean) newProperties.get("check")).booleanValue();
newProperties.put("check", !checked);
try {
document.putProperties(newProperties);
kitchenSyncArrayAdapter.notifyDataSetChanged();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Error updating database, see logs for details", Toast.LENGTH_LONG).show();
Log.e(TAG, "Error updating database", e);
}
```
11. What about deleting items? Let's add the following code to our `onItemLongClick` handler so
that long-presses let us prompt the user to delete that row:
```java
QueryRow row = (QueryRow) adapterView.getItemAtPosition(position);
final Document clickedDocument = row.getDocument();
String itemText = (String) clickedDocument.getCurrentRevision().getProperty("text");
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
AlertDialog alert = builder.setTitle("Delete Item?")
.setMessage("Are you sure you want to delete \"" + itemText + "\"?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
try {
clickedDocument.delete();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Error deleting document, see logs for details", Toast.LENGTH_LONG).show();
Log.e(TAG, "Error deleting document", e);
}
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// Handle Cancel
}
})
.create();
alert.show();
```
13. Now is a great time to build and run on device. You should see all of your new list items saved.
14. Let's add Sync! First, we need to provide a URL for our Couchbase Sync Gateway. If you are
doing this tutorial on a Mac and deploying to a real device, then enter the IP address of your
Wifi interface (i.e. don't use localhost). If you are deploying to an emulator, you will need
to use `10.0.2.2` for the IP. Add the following declaration near the other instance variable
declarations in `MainActivity`:
```java
private static final String SYNC_URL = "http://<YOUR_WIFI_OR_ETHERNET_IP>:4984/kitchen-sync";
```
15. That's the hardest part! Now we need to add our `startSync` method which, in this case, will
continuously sync all local and remote changes.
```java
private void startSync() throws Exception {
URL syncUrl;
try {
syncUrl = new URL(SYNC_URL);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
Replication pullReplication = database.createPullReplication(syncUrl);
pullReplication.setContinuous(true);
Replication pushReplication = database.createPushReplication(syncUrl);
pushReplication.setContinuous(true);
pullReplication.start();
pushReplication.start();
pullReplication.addChangeListener(this);
pushReplication.addChangeListener(this);
}
```
16. Now let's add a call to `startSync` in our `onCreate` override:
```java
@Override
protected void onCreate(Bundle savedInstanceState) {
...
addItemEditText.setOnKeyListener(this);
startCBLite();
initItemListAdapter();
startLiveQuery();
startSync();
...
```
17. Build and run time! Shortly after launching, you should see lots of sync activity scrolling by
in ADB's logcat window for your device. Make sure that you have some list items for
Couchbase Lite to sync.
18. Let's go see the results of sync in the Sync Gateway Admin Console. Open your browser to
[http://localhost:4985/_admin/](http://localhost:4985/_admin/), and click on the
[kitchen-sync](http://localhost:4985/_admin/db/kitchen-sync) link. You will land on the
**Documents** page, which will list all documents found. Clicking on a document id will reveal
the contents of the document.
19. Finally, we'd love to hear from you. [Tell us what you think](https://docs.google.com/forms/d/1Qs9svNccKCC5iji6NXC35uCvdmtFzB0dopz57iApSnY/viewform)!
| {
"content_hash": "3c47f8cd384c1a857c5ddd22dce4cf7d",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 160,
"avg_line_length": 36.62706270627063,
"alnum_prop": 0.6498468192467112,
"repo_name": "dhartwich1991/mini-hacks",
"id": "d2c9595756e7d4ab48222a9b0a5636ee9b991bfb",
"size": "11098",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "kitchen-sync/android/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "798"
},
{
"name": "C",
"bytes": "278"
},
{
"name": "C#",
"bytes": "45137"
},
{
"name": "Go",
"bytes": "1256"
},
{
"name": "HTML",
"bytes": "205"
},
{
"name": "Java",
"bytes": "24467"
},
{
"name": "JavaScript",
"bytes": "6017"
},
{
"name": "Objective-C",
"bytes": "6278"
},
{
"name": "Python",
"bytes": "452"
},
{
"name": "Ruby",
"bytes": "196"
},
{
"name": "Shell",
"bytes": "4137"
},
{
"name": "Swift",
"bytes": "21387"
}
],
"symlink_target": ""
} |
package filters
import (
"errors"
"fmt"
"net/http"
"time"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/authentication/authenticator"
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
"k8s.io/klog/v2"
)
// WithAuthentication creates an http handler that tries to authenticate the given request as a user, and then
// stores any such user found onto the provided context for the request. If authentication fails or returns an error
// the failed handler is used. On success, "Authorization" header is removed from the request and handler
// is invoked to serve the request.
func WithAuthentication(handler http.Handler, auth authenticator.Request, failed http.Handler, apiAuds authenticator.Audiences) http.Handler {
if auth == nil {
klog.Warningf("Authentication is disabled")
return handler
}
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
authenticationStart := time.Now()
if len(apiAuds) > 0 {
req = req.WithContext(authenticator.WithAudiences(req.Context(), apiAuds))
}
resp, ok, err := auth.AuthenticateRequest(req)
traceFilterStep(req.Context(), "Authenticate check done")
defer recordAuthMetrics(resp, ok, err, apiAuds, authenticationStart)
if err != nil || !ok {
if err != nil {
klog.Errorf("Unable to authenticate the request due to an error: %v", err)
}
failed.ServeHTTP(w, req)
return
}
if !audiencesAreAcceptable(apiAuds, resp.Audiences) {
err = fmt.Errorf("unable to match the audience: %v , accepted: %v", resp.Audiences, apiAuds)
klog.Error(err)
failed.ServeHTTP(w, req)
return
}
// authorization header is not required anymore in case of a successful authentication.
req.Header.Del("Authorization")
req = req.WithContext(genericapirequest.WithUser(req.Context(), resp.User))
handler.ServeHTTP(w, req)
})
}
func Unauthorized(s runtime.NegotiatedSerializer) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
ctx := req.Context()
requestInfo, found := genericapirequest.RequestInfoFrom(ctx)
if !found {
responsewriters.InternalError(w, req, errors.New("no RequestInfo found in the context"))
return
}
gv := schema.GroupVersion{Group: requestInfo.APIGroup, Version: requestInfo.APIVersion}
responsewriters.ErrorNegotiated(apierrors.NewUnauthorized("Unauthorized"), s, gv, w, req)
})
}
func audiencesAreAcceptable(apiAuds, responseAudiences authenticator.Audiences) bool {
if len(apiAuds) == 0 || len(responseAudiences) == 0 {
return true
}
return len(apiAuds.Intersect(responseAudiences)) > 0
}
| {
"content_hash": "4b4c4b2baf5f7935bbced2142d188b14",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 142,
"avg_line_length": 33.97530864197531,
"alnum_prop": 0.7452761627906976,
"repo_name": "luxas/kubernetes",
"id": "2af72f458f3062837c77069ed01c0951fd62915a",
"size": "3321",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "staging/src/k8s.io/apiserver/pkg/endpoints/filters/authentication.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2840"
},
{
"name": "Dockerfile",
"bytes": "61271"
},
{
"name": "Go",
"bytes": "46230250"
},
{
"name": "HTML",
"bytes": "38"
},
{
"name": "Lua",
"bytes": "17200"
},
{
"name": "Makefile",
"bytes": "75214"
},
{
"name": "PowerShell",
"bytes": "93355"
},
{
"name": "Python",
"bytes": "3342713"
},
{
"name": "Ruby",
"bytes": "430"
},
{
"name": "Shell",
"bytes": "1613035"
},
{
"name": "sed",
"bytes": "11973"
}
],
"symlink_target": ""
} |
#ifndef itkLevelSetVelocityNeighborhoodExtractor_h
#define itkLevelSetVelocityNeighborhoodExtractor_h
#include "itkLevelSetNeighborhoodExtractor.h"
namespace itk
{
/** \class LevelSetVelocityNeighborhoodExtractor
* \brief Locate pixels of a particular level set.
*
* LevelSetVelocityNeighborhoodExtractor extends the functionality of
* LevelSetNeighborhoodExtractor by also extracting the values
* of velocity variables at the specified level set. Specifically,
* it populates two containers: one containing the value of velocity
* variables immediately inside the contour defined by the level set and the
* other containing values for velocity variables immediately outside.
*
* The containers AuxInsideValues() and AuxOutsideValues() can
* be used in conjunction with Superclass::InsidePoints() and
* Superclass::OutsidePoints() in FastMarchingExtensionImageFilter
* to produce images which extends the velocity variables smoothly
* from the specified level set.
*
* This class is templated over the image type representing
* the level set, the type of the auxiliary/velocity variables and the
* number of auxiliary/velocity variables.
*
* Implemenation of this class is based on Chapter 11 of
* "Level Set Methods and Fast Marching Methods", J.A. Sethian,
* Cambridge Press, Second edition, 1999.
*
* \ingroup LevelSetSegmentation
*
* \ingroup ITKLevelSets
*/
template<
typename TLevelSet,
typename TAuxValue,
unsigned int VAuxDimension = 1
>
class LevelSetVelocityNeighborhoodExtractor:
public LevelSetNeighborhoodExtractor< TLevelSet >
{
public:
/** Standard class typdedefs. */
typedef LevelSetVelocityNeighborhoodExtractor Self;
typedef LevelSetNeighborhoodExtractor< TLevelSet > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(LevelSetVelocityNeighborhoodExtractor,
LevelSetNeighborhoodExtractor);
/** The type of the level set. */
typedef LevelSetTypeDefault< TLevelSet > LevelSetType;
/** The dimension of the level set. */
itkStaticConstMacro(SetDimension, unsigned int,
LevelSetType::SetDimension);
/** Index typedef support */
typedef::itk::Index< itkGetStaticConstMacro(SetDimension) > Index;
/** AuxVarType typedef support. */
typedef AuxVarTypeDefault< TAuxValue, VAuxDimension, itkGetStaticConstMacro(SetDimension) >
AuxVarType;
typedef typename AuxVarType::AuxValueType AuxValueType;
typedef typename AuxVarType::AuxValueVectorType AuxValueVectorType;
typedef typename AuxVarType::AuxValueContainer AuxValueContainer;
typedef typename AuxVarType::AuxImageType AuxImageType;
typedef typename AuxVarType::AuxImagePointer AuxImagePointer;
typedef typename AuxVarType::AuxImageConstPointer AuxImageConstPointer;
/** Set the auxiliary images. */
void SetAuxImage(const AuxImageType *ptr, unsigned int idx = 0)
{
if ( idx < VAuxDimension && m_AuxImage[idx] != ptr )
{
m_AuxImage[idx] = ptr;
}
this->Modified();
}
/** Get the auxiliary images. */
AuxImageConstPointer GetAuxImage(unsigned int idx = 0)
{
if ( idx >= VAuxDimension )
{
return ITK_NULLPTR;
}
else
{
return m_AuxImage[idx];
}
}
/** Get the container of auxiliary values associated with the inside
* points. */
itkGetModifiableObjectMacro(AuxInsideValues, AuxValueContainer);
/** Get the container of auxiliary values associate with the outside
* points. */
itkGetModifiableObjectMacro(AuxOutsideValues, AuxValueContainer);
protected:
LevelSetVelocityNeighborhoodExtractor();
~LevelSetVelocityNeighborhoodExtractor(){}
void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
virtual void Initialize() ITK_OVERRIDE;
virtual double CalculateDistance(Index & index) ITK_OVERRIDE;
private:
ITK_DISALLOW_COPY_AND_ASSIGN(LevelSetVelocityNeighborhoodExtractor);
typename AuxValueContainer::Pointer m_AuxInsideValues;
typename AuxValueContainer::Pointer m_AuxOutsideValues;
AuxImageConstPointer m_AuxImage[VAuxDimension];
};
} // namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkLevelSetVelocityNeighborhoodExtractor.hxx"
#endif
#endif
| {
"content_hash": "1cf731bac66fa4d094f9704434d4c361",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 93,
"avg_line_length": 33.71212121212121,
"alnum_prop": 0.7503370786516854,
"repo_name": "zachary-williamson/ITK",
"id": "0942434c5aaf29434e8efee6d9db655056bd0333",
"size": "5225",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Modules/Segmentation/LevelSets/include/itkLevelSetVelocityNeighborhoodExtractor.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Bison",
"bytes": "20428"
},
{
"name": "C",
"bytes": "25368914"
},
{
"name": "C#",
"bytes": "1714"
},
{
"name": "C++",
"bytes": "47570050"
},
{
"name": "CMake",
"bytes": "2128497"
},
{
"name": "CSS",
"bytes": "24960"
},
{
"name": "FORTRAN",
"bytes": "2241251"
},
{
"name": "HTML",
"bytes": "208088"
},
{
"name": "Io",
"bytes": "1833"
},
{
"name": "Java",
"bytes": "29970"
},
{
"name": "Makefile",
"bytes": "11691"
},
{
"name": "Objective-C",
"bytes": "72946"
},
{
"name": "Objective-C++",
"bytes": "6591"
},
{
"name": "OpenEdge ABL",
"bytes": "85139"
},
{
"name": "Perl",
"bytes": "19692"
},
{
"name": "Prolog",
"bytes": "4406"
},
{
"name": "Python",
"bytes": "882000"
},
{
"name": "Ruby",
"bytes": "296"
},
{
"name": "Shell",
"bytes": "128777"
},
{
"name": "Tcl",
"bytes": "74786"
},
{
"name": "XSLT",
"bytes": "194772"
}
],
"symlink_target": ""
} |
layout: model
title: Typo Detector for Icelandic
author: John Snow Labs
name: distilbert_token_classifier_typo_detector
date: 2022-01-19
tags: [typo, distilbert, icelandic, token_classification, is, open_source]
task: Named Entity Recognition
language: is
edition: Spark NLP 3.3.4
spark_version: 3.0
supported: true
annotator: DistilBertForTokenClassification
article_header:
type: cover
use_language_switcher: "Python-Scala-Java"
---
## Description
This model was imported from `Hugging Face` ([link](https://huggingface.co/m3hrdadfi/typo-detector-distilbert-is)) and it's been trained on a Icelandic synthetic data to detect typos, leveraging `DistilBERT` embeddings and `DistilBertForTokenClassification` for NER purposes. It classifies typo tokens as `PO`.
## Predicted Entities
`PO`
{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
<button class="button button-orange" disabled>Open in Colab</button>
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/distilbert_token_classifier_typo_detector_is_3.3.4_3.0_1642599810600.zip){:.button.button-orange.button-orange-trans.arr.button-icon}
## How to use
<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}
```python
documentAssembler = DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("document")
sentenceDetector = SentenceDetector()\
.setInputCols(["document"])\
.setOutputCol("sentence")
tokenizer = Tokenizer()\
.setInputCols(["sentence"])\
.setOutputCol("token")
tokenClassifier = DistilBertForTokenClassification.pretrained("distilbert_token_classifier_typo_detector", "is")\
.setInputCols(["sentence",'token'])\
.setOutputCol("ner")
ner_converter = NerConverter()\
.setInputCols(["sentence", "token", "ner"])\
.setOutputCol("ner_chunk")
nlpPipeline = Pipeline(stages=[documentAssembler, sentenceDetector, tokenizer, tokenClassifier, ner_converter])
text = """Það er miög auðvelt að draga marktækar álykanir af texta með Spark NLP."""
data = spark.createDataFrame([[text]]).toDF("text")
result = nlpPipeline.fit(data).transform(data)
```
```scala
val documentAssembler = DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")
val sentenceDetector = SentenceDetector()
.setInputCols(Array("document"))
.setOutputCol("sentence")
val tokenizer = Tokenizer()
.setInputCols(Array("sentence"))
.setOutputCol("token")
val tokenClassifier = DistilBertForTokenClassification.pretrained("distilbert_token_classifier_typo_detector", "is")
.setInputCols(Array("sentence","token"))
.setOutputCol("ner")
val ner_converter = NerConverter()
.setInputCols(Array("sentence", "token", "ner"))
.setOutputCol("ner_chunk")
val pipeline = new Pipeline().setStages(Array(documentAssembler, sentenceDetector, tokenizer, tokenClassifier, ner_converter))
val example = Seq.empty["Það er miög auðvelt að draga marktækar álykanir af texta með Spark NLP."].toDS.toDF("text")
val result = pipeline.fit(example).transform(example)
```
</div>
## Results
```bash
+--------+---------+
|chunk |ner_label|
+--------+---------+
|miög |PO |
|álykanir|PO |
+--------+---------+
```
{:.model-param}
## Model Information
{:.table-model}
|---|---|
|Model Name:|distilbert_token_classifier_typo_detector|
|Compatibility:|Spark NLP 3.3.4+|
|License:|Open Source|
|Edition:|Official|
|Input Labels:|[sentence, token]|
|Output Labels:|[ner]|
|Language:|is|
|Size:|505.7 MB|
|Case sensitive:|true|
|Max sentence length:|256|
## Benchmarking
```bash
label precision recall f1-score support
micro avg 0.98954 0.967603 0.978448 43800.0
macro-avg 0.98954 0.967603 0.978448 43800.0
weighted-avg 0.98954 0.967603 0.978448 43800.0
``` | {
"content_hash": "495dc534557b03cf03ff0599720f1b04",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 310,
"avg_line_length": 30.322834645669293,
"alnum_prop": 0.7115035055829655,
"repo_name": "JohnSnowLabs/spark-nlp",
"id": "5870be75188027a8aef987f91c384dcdfd64f7df",
"size": "3873",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/_posts/murat-gunay/2022-01-19-distilbert_token_classifier_typo_detector_is.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "14452"
},
{
"name": "Java",
"bytes": "223289"
},
{
"name": "Makefile",
"bytes": "819"
},
{
"name": "Python",
"bytes": "1694517"
},
{
"name": "Scala",
"bytes": "4116435"
},
{
"name": "Shell",
"bytes": "5286"
}
],
"symlink_target": ""
} |
class TagsController < ApplicationController
def auto_complete_responder
tags = Tag.find(:all,
:conditions => [ 'name LIKE ?', '%' + params[:tag] + '%'],
:order => 'name ASC',
:limit => 8)
if tags
render :partial => 'auto_complete_responder',
:locals => {
:tags => tags,
:typed => params[:tag]
}
else
render :nothing => true
end
end
end
| {
"content_hash": "dc108a02493d61e3277ab898dcf28f75",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 78,
"avg_line_length": 25.63157894736842,
"alnum_prop": 0.4537987679671458,
"repo_name": "prefeiturasp/controladoriacidada",
"id": "4cdf3e66e8ce7cbc61765be56cc6e41ca90e67c0",
"size": "487",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "app/controllers/tags_controller.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "92979"
},
{
"name": "JavaScript",
"bytes": "123642"
},
{
"name": "Perl",
"bytes": "476"
},
{
"name": "Ruby",
"bytes": "450215"
}
],
"symlink_target": ""
} |
"""Tools to work with checkpoints."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.python.ops import io_ops
from tensorflow.python.ops import state_ops
from tensorflow.python.ops import variable_scope as vs
from tensorflow.python.ops import variables
from tensorflow.python.platform import gfile
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.training import saver
from tensorflow.python.training import training as train
__all__ = [
"load_checkpoint", "load_variable", "list_variables", "init_from_checkpoint"
]
def load_checkpoint(ckpt_dir_or_file):
"""Returns `CheckpointReader` for checkpoint found in `ckpt_dir_or_file`.
If `ckpt_dir_or_file` resolves to a directory with multiple checkpoints,
reader for the latest checkpoint is returned.
Args:
ckpt_dir_or_file: Directory with checkpoints file or path to checkpoint
file.
Returns:
`CheckpointReader` object.
Raises:
ValueError: If `ckpt_dir_or_file` resolves to a directory with no
checkpoints.
"""
filename = _get_checkpoint_filename(ckpt_dir_or_file)
if filename is None:
raise ValueError("Couldn't find 'checkpoint' file or checkpoints in "
"given directory %s" % ckpt_dir_or_file)
return train.NewCheckpointReader(filename)
def load_variable(ckpt_dir_or_file, name):
"""Returns the tensor value of the given variable in the checkpoint.
Args:
ckpt_dir_or_file: Directory with checkpoints file or path to checkpoint.
name: Name of the variable to return.
Returns:
A numpy `ndarray` with a copy of the value of this variable.
"""
# TODO(b/29227106): Fix this in the right place and remove this.
if name.endswith(":0"):
name = name[:-2]
reader = load_checkpoint(ckpt_dir_or_file)
return reader.get_tensor(name)
def list_variables(ckpt_dir_or_file):
"""Returns list of all variables in the checkpoint.
Args:
ckpt_dir_or_file: Directory with checkpoints file or path to checkpoint.
Returns:
List of tuples `(name, shape)`.
"""
reader = load_checkpoint(ckpt_dir_or_file)
variable_map = reader.get_variable_to_shape_map()
names = sorted(variable_map.keys())
result = []
for name in names:
result.append((name, variable_map[name]))
return result
def init_from_checkpoint(ckpt_dir_or_file, assignment_map):
"""Initializes current variables with tensors loaded from given checkpoint.
Note: This overrides default initialization ops of specified variables and
redefines dtype.
Assignment map supports following syntax:
* `'checkpoint_scope_name/': 'scope_name/'` - will load all variables in
current `scope_name` from `checkpoint_scope_name` with matching tensor
names.
* `'checkpoint_scope_name/some_other_variable': 'scope_name/variable_name'` -
will initialize `scope_name/variable_name` variable
from `checkpoint_scope_name/some_other_variable`.
* `'scope_variable_name': variable` - will initialize given `tf.Variable`
object with tensor 'scope_variable_name' from the checkpoint.
* `'scope_variable_name': list(variable)` - will initialize list of
partitioned variables with tensor 'scope_variable_name' from the checkpoint.
* `'/': 'scope_name/'` - will load all variables in current `scope_name` from
checkpoint's root (e.g. no scope).
Supports loading into partitioned variables, which are represented as
`'<variable>/part_<part #>'`.
Example:
```python
# Say, '/tmp/model.ckpt' has the following tensors:
# -- name='old_scope_1/var1', shape=[20, 2]
# -- name='old_scope_1/var2', shape=[50, 4]
# -- name='old_scope_2/var3', shape=[100, 100]
# Create new model's variables
with tf.variable_scope('new_scope_1'):
var1 = tf.get_variable('var1', shape=[20, 2],
initializer=tf.zeros_initializer())
with tf.variable_scope('new_scope_2'):
var2 = tf.get_variable('var2', shape=[50, 4],
initializer=tf.zeros_initializer())
# Partition into 5 variables along the first axis.
var3 = tf.get_variable(name='var3', shape=[100, 100],
initializer=tf.zeros_initializer(),
partitioner=lambda shape, dtype: [5, 1])
# Initialize all variables in `new_scope_1` from `old_scope_1`.
init_from_checkpoint('/tmp/model.ckpt', {'old_scope_1/', 'new_scope_1'})
# Use names to specify which variables to initialize from checkpoint.
init_from_checkpoint('/tmp/model.ckpt',
{'old_scope_1/var1': 'new_scope_1/var1',
'old_scope_1/var2': 'new_scope_2/var2'})
# Or use tf.Variable objects to identify what to initialize.
init_from_checkpoint('/tmp/model.ckpt',
{'old_scope_1/var1': var1,
'old_scope_1/var2': var2})
# Initialize partitioned variables using variable's name
init_from_checkpoint('/tmp/model.ckpt',
{'old_scope_2/var3': 'new_scope_2/var3'})
# Or specify the list of tf.Variable objects.
init_from_checkpoint('/tmp/model.ckpt',
{'old_scope_2/var3': var3._get_variable_list()})
```
Args:
ckpt_dir_or_file: Directory with checkpoints file or path to checkpoint.
assignment_map: Dict, where keys are names of the variables in the
checkpoint and values are current variables or names of current variables
(in default graph).
Raises:
tf.errors.OpError: If missing checkpoints or tensors in checkpoints.
ValueError: If missing variables in current graph.
"""
ckpt_file = _get_checkpoint_filename(ckpt_dir_or_file)
reader = load_checkpoint(ckpt_dir_or_file)
variable_map = reader.get_variable_to_shape_map()
for tensor_name_in_ckpt, current_var_or_name in six.iteritems(assignment_map):
var = None
# Check if this is Variable object or list of Variable objects (in case of
# partitioned variables).
is_var = lambda x: isinstance(x, variables.Variable)
if is_var(current_var_or_name) or (
isinstance(current_var_or_name, list)
and all(is_var(v) for v in current_var_or_name)):
var = current_var_or_name
else:
store_vars = vs._get_default_variable_store()._vars # pylint:disable=protected-access
# Check if this variable is in var_store.
var = store_vars.get(current_var_or_name, None)
# Also check if variable is partitioned as list.
if var is None:
var = _collect_partitioned_variable(current_var_or_name, store_vars)
if var is not None:
# If 1 to 1 mapping was provided, find variable in the checkpoint.
if tensor_name_in_ckpt not in variable_map:
raise ValueError("Tensor %s is not found in %s checkpoint %s" % (
tensor_name_in_ckpt, ckpt_dir_or_file, variable_map
))
if is_var(var):
# Additional at-call-time checks.
if not var.get_shape().is_compatible_with(
variable_map[tensor_name_in_ckpt]):
raise ValueError(
"Shape of variable %s (%s) doesn't match with shape of "
"tensor %s (%s) from checkpoint reader." % (
var.name, str(var.get_shape()),
tensor_name_in_ckpt, str(variable_map[tensor_name_in_ckpt])
))
var_name = var.name
else:
var_name = ",".join([v.name for v in var])
_set_variable_or_list_initializer(var, ckpt_file, tensor_name_in_ckpt)
logging.info("Initialize variable %s from checkpoint %s with %s" % (
var_name, ckpt_dir_or_file, tensor_name_in_ckpt
))
else:
scopes = ""
# TODO(vihanjain): Support list of 'current_var_or_name' here.
if "/" in current_var_or_name:
scopes = current_var_or_name[:current_var_or_name.rindex("/")]
if not tensor_name_in_ckpt.endswith("/"):
raise ValueError(
"Assignment map with scope only name {} should map to scope only "
"{}. Should be 'scope/': 'other_scope/'.".format(
scopes, tensor_name_in_ckpt))
# If scope to scope mapping was provided, find all variables in the scope
# and create variable to variable mapping.
scope_variables = set()
for var_name in store_vars:
if not scopes or var_name.startswith(scopes + "/"):
# Consume /part_ if partitioned variable.
if "/part_" in var_name:
var_name = var_name[:var_name.index("/part_")]
scope_variables.add(var_name)
for var_name in scope_variables:
# Lookup name with specified prefix and suffix from current variable.
# If tensor_name given is '/' (root), don't use it for full name.
full_tensor_name = var_name[len(scopes):]
if current_var_or_name != "/":
full_tensor_name = full_tensor_name[1:]
if tensor_name_in_ckpt != "/":
full_tensor_name = tensor_name_in_ckpt + full_tensor_name
if full_tensor_name not in variable_map:
raise ValueError(
"Tensor %s (%s in %s) is not found in %s checkpoint" % (
full_tensor_name, var_name[len(scopes) + 1:],
tensor_name_in_ckpt, ckpt_dir_or_file
))
var = store_vars.get(var_name, None)
if var is None:
var = _collect_partitioned_variable(var_name, store_vars)
_set_variable_or_list_initializer(var, ckpt_file, full_tensor_name)
logging.info("Initialize variable %s from checkpoint %s with %s" % (
var_name, ckpt_dir_or_file, full_tensor_name
))
def _get_checkpoint_filename(ckpt_dir_or_file):
"""Returns checkpoint filename given directory or specific checkpoint file."""
if gfile.IsDirectory(ckpt_dir_or_file):
return saver.latest_checkpoint(ckpt_dir_or_file)
return ckpt_dir_or_file
def _set_checkpoint_initializer(variable,
ckpt_file,
tensor_name,
slice_spec,
name="checkpoint_initializer"):
"""Overrides given variable's initialization op.
Sets variable initializer to assign op that initializes variable from tensor's
value in the checkpoint.
Args:
variable: `tf.Variable` object.
ckpt_file: string, full path of the checkpoint.
tensor_name: Name of the tensor to load from the checkpoint.
slice_spec: Slice specification for loading partitioned tensors.
name: Name of the operation.
"""
base_type = variable.dtype.base_dtype
restore_op = io_ops.restore_v2(
ckpt_file, [tensor_name], [slice_spec], [base_type], name=name)[0]
variable._initializer_op = state_ops.assign(variable, restore_op) # pylint:disable=protected-access
def _set_variable_or_list_initializer(variable_or_list, ckpt_file,
tensor_name):
"""Overrides initialization op of given variable or list of variables.
Calls `_set_checkpoint_initializer` for each variable in the given list of
variables.
Args:
variable_or_list: `tf.Variable` object or a list of `tf.Variable` objects.
ckpt_file: string, full path of the checkpoint.
tensor_name: Name of the tensor to load from the checkpoint.
Raises:
ValueError: if all objects in `variable_or_list` are not partitions of the
same large variable.
"""
if isinstance(variable_or_list, (list, tuple)):
# A set of slices.
slice_name = None
for v in variable_or_list:
slice_info = v._save_slice_info # pylint:disable=protected-access
if slice_name is None:
slice_name = slice_info.full_name
elif slice_name != slice_info.full_name:
raise ValueError("Slices must all be from the same tensor: %s != %s" %
(slice_name, slice_info.full_name))
_set_checkpoint_initializer(v, ckpt_file, tensor_name, slice_info.spec)
else:
_set_checkpoint_initializer(variable_or_list, ckpt_file, tensor_name, "")
def _collect_partitioned_variable(name, all_vars):
"""Returns list of `tf.Variable` that comprise the partitioned variable."""
if name + "/part_0" in all_vars:
var = []
i = 0
while name + "/part_%d" % i in all_vars:
var.append(all_vars[name + "/part_%d" % i])
i += 1
return var
return None
| {
"content_hash": "ed06d7f30cdd00d65a5c2f31c9c37a4a",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 102,
"avg_line_length": 39.554140127388536,
"alnum_prop": 0.6485507246376812,
"repo_name": "vrv/tensorflow",
"id": "ffa39b77930ca42c735caf4bc76c4bdcf783a8dd",
"size": "13109",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tensorflow/python/training/checkpoint_utils.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "7481"
},
{
"name": "C",
"bytes": "182510"
},
{
"name": "C++",
"bytes": "23619794"
},
{
"name": "CMake",
"bytes": "158007"
},
{
"name": "CSS",
"bytes": "774"
},
{
"name": "Go",
"bytes": "824401"
},
{
"name": "HTML",
"bytes": "886772"
},
{
"name": "Java",
"bytes": "286562"
},
{
"name": "JavaScript",
"bytes": "14005"
},
{
"name": "Jupyter Notebook",
"bytes": "1833654"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "Makefile",
"bytes": "37302"
},
{
"name": "Objective-C",
"bytes": "7037"
},
{
"name": "Objective-C++",
"bytes": "64142"
},
{
"name": "Protocol Buffer",
"bytes": "214419"
},
{
"name": "Python",
"bytes": "20580440"
},
{
"name": "Shell",
"bytes": "337420"
},
{
"name": "TypeScript",
"bytes": "1267602"
}
],
"symlink_target": ""
} |
using UnityEngine;
using System.Collections;
public class PackMunition : MonoBehaviour {
public int nombreDeMunitions;
void Start () {
}
void Update () {
}
void OnTriggerEnter(Collider col)
{
if (col.tag == "Player")
{
col.GetComponent<Joueur>().Munition += nombreDeMunitions;
Destroy(gameObject);
}
}
}
| {
"content_hash": "13578c1f8abc916c31c6f9f4437eb5a6",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 69,
"avg_line_length": 14.296296296296296,
"alnum_prop": 0.582901554404145,
"repo_name": "KevinBulme/PillsWar",
"id": "2d7083bb65a072bb006c6d38d1a86c23f000f13c",
"size": "388",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/Scripts/PackMunition.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "85441"
}
],
"symlink_target": ""
} |
"""Node classes for the AST for a Mojo IDL file."""
# Note: For convenience of testing, you probably want to define __eq__() methods
# for all node types; it's okay to be slightly lax (e.g., not compare filename
# and lineno). You may also define __repr__() to help with analyzing test
# failures, especially for more complex types.
class NodeBase(object):
"""Base class for nodes in the AST."""
def __init__(self, filename=None, lineno=None):
self.filename = filename
self.lineno = lineno
def __eq__(self, other):
# We want strict comparison of the two object's types. Disable pylint's
# insistence upon recommending isinstance().
# pylint: disable=unidiomatic-typecheck
return type(self) == type(other)
# Make != the inverse of ==. (Subclasses shouldn't have to override this.)
def __ne__(self, other):
return not self == other
# TODO(vtl): Some of this is complicated enough that it should be tested.
class NodeListBase(NodeBase):
"""Represents a list of other nodes, all having the same type. (This is meant
to be subclassed, with subclasses defining _list_item_type to be the class (or
classes, in a tuple) of the members of the list.)"""
def __init__(self, item_or_items=None, **kwargs):
super(NodeListBase, self).__init__(**kwargs)
self.items = []
if item_or_items is None:
pass
elif isinstance(item_or_items, list):
for item in item_or_items:
assert isinstance(item, self._list_item_type)
self.Append(item)
else:
assert isinstance(item_or_items, self._list_item_type)
self.Append(item_or_items)
# Support iteration. For everything else, users should just access |items|
# directly. (We intentionally do NOT supply |__len__()| or |__nonzero__()|, so
# |bool(NodeListBase())| is true.)
def __iter__(self):
return self.items.__iter__()
def __eq__(self, other):
return super(NodeListBase, self).__eq__(other) and \
self.items == other.items
# Implement this so that on failure, we get slightly more sensible output.
def __repr__(self):
return self.__class__.__name__ + "([" + \
", ".join([repr(elem) for elem in self.items]) + "])"
def Insert(self, item):
"""Inserts item at the front of the list."""
assert isinstance(item, self._list_item_type)
self.items.insert(0, item)
self._UpdateFilenameAndLineno()
def Append(self, item):
"""Appends item to the end of the list."""
assert isinstance(item, self._list_item_type)
self.items.append(item)
self._UpdateFilenameAndLineno()
def _UpdateFilenameAndLineno(self):
if self.items:
self.filename = self.items[0].filename
self.lineno = self.items[0].lineno
class Definition(NodeBase):
"""Represents a definition of anything that has a global name (e.g., enums,
enum values, consts, structs, struct fields, interfaces). (This does not
include parameter definitions.) This class is meant to be subclassed."""
def __init__(self, mojom_name, **kwargs):
assert isinstance(mojom_name, str)
NodeBase.__init__(self, **kwargs)
self.mojom_name = mojom_name
################################################################################
class Attribute(NodeBase):
"""Represents an attribute."""
def __init__(self, key, value, **kwargs):
assert isinstance(key, str)
super(Attribute, self).__init__(**kwargs)
self.key = key
self.value = value
def __eq__(self, other):
return super(Attribute, self).__eq__(other) and \
self.key == other.key and \
self.value == other.value
class AttributeList(NodeListBase):
"""Represents a list attributes."""
_list_item_type = Attribute
class Const(Definition):
"""Represents a const definition."""
def __init__(self, mojom_name, attribute_list, typename, value, **kwargs):
assert attribute_list is None or isinstance(attribute_list, AttributeList)
# The typename is currently passed through as a string.
assert isinstance(typename, str)
# The value is either a literal (currently passed through as a string) or a
# "wrapped identifier".
assert isinstance(value, str) or isinstance(value, tuple)
super(Const, self).__init__(mojom_name, **kwargs)
self.attribute_list = attribute_list
self.typename = typename
self.value = value
def __eq__(self, other):
return super(Const, self).__eq__(other) and \
self.attribute_list == other.attribute_list and \
self.typename == other.typename and \
self.value == other.value
class Enum(Definition):
"""Represents an enum definition."""
def __init__(self, mojom_name, attribute_list, enum_value_list, **kwargs):
assert attribute_list is None or isinstance(attribute_list, AttributeList)
assert enum_value_list is None or isinstance(enum_value_list, EnumValueList)
super(Enum, self).__init__(mojom_name, **kwargs)
self.attribute_list = attribute_list
self.enum_value_list = enum_value_list
def __eq__(self, other):
return super(Enum, self).__eq__(other) and \
self.attribute_list == other.attribute_list and \
self.enum_value_list == other.enum_value_list
class EnumValue(Definition):
"""Represents a definition of an enum value."""
def __init__(self, mojom_name, attribute_list, value, **kwargs):
# The optional value is either an int (which is current a string) or a
# "wrapped identifier".
assert attribute_list is None or isinstance(attribute_list, AttributeList)
assert value is None or isinstance(value, (str, tuple))
super(EnumValue, self).__init__(mojom_name, **kwargs)
self.attribute_list = attribute_list
self.value = value
def __eq__(self, other):
return super(EnumValue, self).__eq__(other) and \
self.attribute_list == other.attribute_list and \
self.value == other.value
class EnumValueList(NodeListBase):
"""Represents a list of enum value definitions (i.e., the "body" of an enum
definition)."""
_list_item_type = EnumValue
class Import(NodeBase):
"""Represents an import statement."""
def __init__(self, attribute_list, import_filename, **kwargs):
assert attribute_list is None or isinstance(attribute_list, AttributeList)
assert isinstance(import_filename, str)
super(Import, self).__init__(**kwargs)
self.attribute_list = attribute_list
self.import_filename = import_filename
def __eq__(self, other):
return super(Import, self).__eq__(other) and \
self.attribute_list == other.attribute_list and \
self.import_filename == other.import_filename
class ImportList(NodeListBase):
"""Represents a list (i.e., sequence) of import statements."""
_list_item_type = Import
class Interface(Definition):
"""Represents an interface definition."""
def __init__(self, mojom_name, attribute_list, body, **kwargs):
assert attribute_list is None or isinstance(attribute_list, AttributeList)
assert isinstance(body, InterfaceBody)
super(Interface, self).__init__(mojom_name, **kwargs)
self.attribute_list = attribute_list
self.body = body
def __eq__(self, other):
return super(Interface, self).__eq__(other) and \
self.attribute_list == other.attribute_list and \
self.body == other.body
class Method(Definition):
"""Represents a method definition."""
def __init__(self, mojom_name, attribute_list, ordinal, parameter_list,
response_parameter_list, **kwargs):
assert attribute_list is None or isinstance(attribute_list, AttributeList)
assert ordinal is None or isinstance(ordinal, Ordinal)
assert isinstance(parameter_list, ParameterList)
assert response_parameter_list is None or \
isinstance(response_parameter_list, ParameterList)
super(Method, self).__init__(mojom_name, **kwargs)
self.attribute_list = attribute_list
self.ordinal = ordinal
self.parameter_list = parameter_list
self.response_parameter_list = response_parameter_list
def __eq__(self, other):
return super(Method, self).__eq__(other) and \
self.attribute_list == other.attribute_list and \
self.ordinal == other.ordinal and \
self.parameter_list == other.parameter_list and \
self.response_parameter_list == other.response_parameter_list
# This needs to be declared after |Method|.
class InterfaceBody(NodeListBase):
"""Represents the body of (i.e., list of definitions inside) an interface."""
_list_item_type = (Const, Enum, Method)
class Module(NodeBase):
"""Represents a module statement."""
def __init__(self, mojom_namespace, attribute_list, **kwargs):
# |mojom_namespace| is either none or a "wrapped identifier".
assert mojom_namespace is None or isinstance(mojom_namespace, tuple)
assert attribute_list is None or isinstance(attribute_list, AttributeList)
super(Module, self).__init__(**kwargs)
self.mojom_namespace = mojom_namespace
self.attribute_list = attribute_list
def __eq__(self, other):
return super(Module, self).__eq__(other) and \
self.mojom_namespace == other.mojom_namespace and \
self.attribute_list == other.attribute_list
class Mojom(NodeBase):
"""Represents an entire .mojom file. (This is the root node.)"""
def __init__(self, module, import_list, definition_list, **kwargs):
assert module is None or isinstance(module, Module)
assert isinstance(import_list, ImportList)
assert isinstance(definition_list, list)
super(Mojom, self).__init__(**kwargs)
self.module = module
self.import_list = import_list
self.definition_list = definition_list
def __eq__(self, other):
return super(Mojom, self).__eq__(other) and \
self.module == other.module and \
self.import_list == other.import_list and \
self.definition_list == other.definition_list
def __repr__(self):
return "%s(%r, %r, %r)" % (self.__class__.__name__, self.module,
self.import_list, self.definition_list)
class Ordinal(NodeBase):
"""Represents an ordinal value labeling, e.g., a struct field."""
def __init__(self, value, **kwargs):
assert isinstance(value, int)
super(Ordinal, self).__init__(**kwargs)
self.value = value
def __eq__(self, other):
return super(Ordinal, self).__eq__(other) and \
self.value == other.value
class Parameter(NodeBase):
"""Represents a method request or response parameter."""
def __init__(self, mojom_name, attribute_list, ordinal, typename, **kwargs):
assert isinstance(mojom_name, str)
assert attribute_list is None or isinstance(attribute_list, AttributeList)
assert ordinal is None or isinstance(ordinal, Ordinal)
assert isinstance(typename, str)
super(Parameter, self).__init__(**kwargs)
self.mojom_name = mojom_name
self.attribute_list = attribute_list
self.ordinal = ordinal
self.typename = typename
def __eq__(self, other):
return super(Parameter, self).__eq__(other) and \
self.mojom_name == other.mojom_name and \
self.attribute_list == other.attribute_list and \
self.ordinal == other.ordinal and \
self.typename == other.typename
class ParameterList(NodeListBase):
"""Represents a list of (method request or response) parameters."""
_list_item_type = Parameter
class Struct(Definition):
"""Represents a struct definition."""
def __init__(self, mojom_name, attribute_list, body, **kwargs):
assert attribute_list is None or isinstance(attribute_list, AttributeList)
assert isinstance(body, StructBody) or body is None
super(Struct, self).__init__(mojom_name, **kwargs)
self.attribute_list = attribute_list
self.body = body
def __eq__(self, other):
return super(Struct, self).__eq__(other) and \
self.attribute_list == other.attribute_list and \
self.body == other.body
class StructField(Definition):
"""Represents a struct field definition."""
def __init__(self, mojom_name, attribute_list, ordinal, typename,
default_value, **kwargs):
assert isinstance(mojom_name, str)
assert attribute_list is None or isinstance(attribute_list, AttributeList)
assert ordinal is None or isinstance(ordinal, Ordinal)
assert isinstance(typename, str)
# The optional default value is currently either a value as a string or a
# "wrapped identifier".
assert default_value is None or isinstance(default_value, (str, tuple))
super(StructField, self).__init__(mojom_name, **kwargs)
self.attribute_list = attribute_list
self.ordinal = ordinal
self.typename = typename
self.default_value = default_value
def __eq__(self, other):
return super(StructField, self).__eq__(other) and \
self.attribute_list == other.attribute_list and \
self.ordinal == other.ordinal and \
self.typename == other.typename and \
self.default_value == other.default_value
# This needs to be declared after |StructField|.
class StructBody(NodeListBase):
"""Represents the body of (i.e., list of definitions inside) a struct."""
_list_item_type = (Const, Enum, StructField)
class Union(Definition):
"""Represents a union definition."""
def __init__(self, mojom_name, attribute_list, body, **kwargs):
assert attribute_list is None or isinstance(attribute_list, AttributeList)
assert isinstance(body, UnionBody)
super(Union, self).__init__(mojom_name, **kwargs)
self.attribute_list = attribute_list
self.body = body
def __eq__(self, other):
return super(Union, self).__eq__(other) and \
self.attribute_list == other.attribute_list and \
self.body == other.body
class UnionField(Definition):
def __init__(self, mojom_name, attribute_list, ordinal, typename, **kwargs):
assert isinstance(mojom_name, str)
assert attribute_list is None or isinstance(attribute_list, AttributeList)
assert ordinal is None or isinstance(ordinal, Ordinal)
assert isinstance(typename, str)
super(UnionField, self).__init__(mojom_name, **kwargs)
self.attribute_list = attribute_list
self.ordinal = ordinal
self.typename = typename
def __eq__(self, other):
return super(UnionField, self).__eq__(other) and \
self.attribute_list == other.attribute_list and \
self.ordinal == other.ordinal and \
self.typename == other.typename
class UnionBody(NodeListBase):
_list_item_type = UnionField
| {
"content_hash": "af48331556017e8e95aec9764bf77081",
"timestamp": "",
"source": "github",
"line_count": 414,
"max_line_length": 80,
"avg_line_length": 35.28502415458937,
"alnum_prop": 0.6645673603504929,
"repo_name": "endlessm/chromium-browser",
"id": "c9b6605cf43a4a1a25efefbbbb4ce52ac3477f8e",
"size": "14770",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mojo/public/tools/mojom/mojom/parse/ast.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
//-----------------------------------------------------------------------
// <copyright file="EsentDatabaseException.cs" company="The Phantom Coder">
// Copyright The Phantom Coder. All rights reserved.
// </copyright>
//----------------------------------------------------------------------
namespace Daytona.Store
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// EsentDatabaseException rasied from interactions with ESENT
/// </summary>
[Serializable]
public class EsentDatabaseException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="EsentDatabaseException" /> class.
/// </summary>
public EsentDatabaseException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EsentDatabaseException" /> class.
/// </summary>
/// <param name="message">The message.</param>
public EsentDatabaseException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EsentDatabaseException" /> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="ex">The ex.</param>
public EsentDatabaseException(string message, Exception ex)
: base(message, ex)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EsentDatabaseException" /> class.
/// </summary>
/// <param name="serializationInfo">The serialization info.</param>
/// <param name="streamingContext">The streaming context.</param>
protected EsentDatabaseException(SerializationInfo serializationInfo, StreamingContext streamingContext)
: base(serializationInfo, streamingContext)
{
}
}
}
| {
"content_hash": "d4ec9cf0a613522279e8d40225e10069",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 112,
"avg_line_length": 35.421052631578945,
"alnum_prop": 0.5661218424962853,
"repo_name": "nanderto/Daytona",
"id": "ae64daadcb72181347a8249cdbca0c766b1a712e",
"size": "2021",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Store/EsentDatabaseException.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "410344"
},
{
"name": "F#",
"bytes": "187"
},
{
"name": "Smalltalk",
"bytes": "3"
}
],
"symlink_target": ""
} |
/* card marking write barrier. a card is a byte storing a mark flag,
and the offset (in cells) of the first object in the card.
the mark flag is set by the write barrier when an object in the
card has a slot written to.
the offset of the first object is set by the allocator. */
/* if CARD_POINTS_TO_NURSERY is set, CARD_POINTS_TO_AGING must also be set. */
#define CARD_POINTS_TO_NURSERY 0x80
#define CARD_POINTS_TO_AGING 0x40
#define CARD_MARK_MASK (CARD_POINTS_TO_NURSERY | CARD_POINTS_TO_AGING)
typedef u8 F_CARD;
#define CARD_BITS 8
#define CARD_SIZE (1<<CARD_BITS)
#define ADDR_CARD_MASK (CARD_SIZE-1)
DLLEXPORT CELL cards_offset;
#define ADDR_TO_CARD(a) (F_CARD*)(((CELL)(a) >> CARD_BITS) + cards_offset)
#define CARD_TO_ADDR(c) (CELL*)(((CELL)(c) - cards_offset)<<CARD_BITS)
typedef u8 F_DECK;
#define DECK_BITS (CARD_BITS + 10)
#define DECK_SIZE (1<<DECK_BITS)
#define ADDR_DECK_MASK (DECK_SIZE-1)
DLLEXPORT CELL decks_offset;
#define ADDR_TO_DECK(a) (F_DECK*)(((CELL)(a) >> DECK_BITS) + decks_offset)
#define DECK_TO_ADDR(c) (CELL*)(((CELL)(c) - decks_offset) << DECK_BITS)
#define DECK_TO_CARD(d) (F_CARD*)((((CELL)(d) - decks_offset) << (DECK_BITS - CARD_BITS)) + cards_offset)
#define ADDR_TO_ALLOT_MARKER(a) (F_CARD*)(((CELL)(a) >> CARD_BITS) + allot_markers_offset)
#define CARD_OFFSET(c) (*((c) - (CELL)data_heap->cards + (CELL)data_heap->allot_markers))
#define INVALID_ALLOT_MARKER 0xff
DLLEXPORT CELL allot_markers_offset;
/* the write barrier must be called any time we are potentially storing a
pointer from an older generation to a younger one */
INLINE void write_barrier(CELL address)
{
*ADDR_TO_CARD(address) = CARD_MARK_MASK;
*ADDR_TO_DECK(address) = CARD_MARK_MASK;
}
#define SLOT(obj,slot) (UNTAG(obj) + (slot) * CELLS)
INLINE void set_slot(CELL obj, CELL slot, CELL value)
{
put(SLOT(obj,slot),value);
write_barrier(obj);
}
/* we need to remember the first object allocated in the card */
INLINE void allot_barrier(CELL address)
{
F_CARD *ptr = ADDR_TO_ALLOT_MARKER(address);
if(*ptr == INVALID_ALLOT_MARKER)
*ptr = (address & ADDR_CARD_MASK);
}
| {
"content_hash": "4180b2921dc55c0d4e147753cacecb52",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 105,
"avg_line_length": 31.833333333333332,
"alnum_prop": 0.7010947168015231,
"repo_name": "jwmerrill/factor",
"id": "be75d189de4f7bd2a8b52bdb7a5cd52cc76e70de",
"size": "2101",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "vm/write_barrier.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "223488"
},
{
"name": "Emacs Lisp",
"bytes": "199049"
},
{
"name": "JavaScript",
"bytes": "126360"
},
{
"name": "Objective-C",
"bytes": "1874"
},
{
"name": "Shell",
"bytes": "14155"
},
{
"name": "VimL",
"bytes": "18654"
}
],
"symlink_target": ""
} |
class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
def check_class
Nanoc::Extra::Checking::Checks::Stale
end
def calc_issues
site = Nanoc::Int::SiteLoader.new.new_from_cwd
runner = Nanoc::Extra::Checking::Runner.new(site)
runner.run_checks([check_class])
end
def test_run_ok
with_site do |_site|
assert Dir['content/*'].empty?
assert Dir['output/*'].empty?
# Empty
FileUtils.mkdir_p('output')
assert calc_issues.empty?
# One OK file
File.open('content/index.html', 'w') { |io| io.write('stuff') }
File.open('output/index.html', 'w') { |io| io.write('stuff') }
assert calc_issues.empty?
end
end
def test_run_error
with_site do |_site|
assert Dir['content/*'].empty?
assert Dir['output/*'].empty?
File.open('content/index.html', 'w') { |io| io.write('stuff') }
File.open('output/WRONG.html', 'w') { |io| io.write('stuff') }
assert_equal 1, calc_issues.count
issue = calc_issues.to_a[0]
assert_equal 'file without matching item', issue.description
assert_equal 'output/WRONG.html', issue.subject
end
end
def test_run_excluded
with_site do |_site|
assert Dir['content/*'].empty?
assert Dir['output/*'].empty?
File.open('nanoc.yaml', 'w') { |io| io.write "string_pattern_type: legacy\nprune:\n exclude: [ 'excluded.html' ]" }
File.open('content/index.html', 'w') { |io| io.write('stuff') }
File.open('output/excluded.html', 'w') { |io| io.write('stuff') }
assert calc_issues.empty?
end
end
def test_run_excluded_with_broken_config
with_site do |_site|
assert Dir['content/*'].empty?
assert Dir['output/*'].empty?
File.open('nanoc.yaml', 'w') { |io| io.write "string_pattern_type: legacy\nprune:\n blah: meh" }
File.open('content/index.html', 'w') { |io| io.write('stuff') }
File.open('output/excluded.html', 'w') { |io| io.write('stuff') }
refute calc_issues.empty?
end
end
end
| {
"content_hash": "11521d8d9b9954665222cc997dcc1485",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 122,
"avg_line_length": 31.476923076923075,
"alnum_prop": 0.6070381231671554,
"repo_name": "barraq/nanoc",
"id": "0fde96f4c7878fdb886243fcfc0eb208af28fb66",
"size": "2046",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/extra/checking/checks/test_stale.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "927047"
}
],
"symlink_target": ""
} |
class GURL;
@class NSDictionary;
namespace web {
struct FaviconStatus;
struct Referrer;
struct SSLStatus;
// A NavigationItem is a data structure that captures all the information
// required to recreate a browsing state. It represents one point in the
// chain of navigation managed by a NavigationManager.
class NavigationItem : public base::SupportsUserData {
public:
// Creates a new NavigationItem.
static std::unique_ptr<NavigationItem> Create();
// Page-related stuff --------------------------------------------------------
// A unique ID is preserved across commits and redirects, which means that
// sometimes a NavigationEntry's unique ID needs to be set (e.g. when
// creating a committed entry to correspond to a to-be-deleted pending entry,
// the pending entry's ID must be copied).
virtual int GetUniqueID() const = 0;
// The original URL for the navigation request. This may differ from GetURL()
// if a redirect occurs after attempting to load this original URL.
virtual void SetOriginalRequestURL(const GURL& url) = 0;
virtual const GURL& GetOriginalRequestURL() const = 0;
// The actual URL of the page. For some about pages, this may be a scary
// data: URL or something like that. Use GetVirtualURL() below for showing to
// the user.
virtual void SetURL(const GURL& url) = 0;
virtual const GURL& GetURL() const = 0;
// The referring URL. Can be empty.
virtual void SetReferrer(const Referrer& referrer) = 0;
virtual const Referrer& GetReferrer() const = 0;
// The virtual URL, when nonempty, will override the actual URL of the page
// when we display it to the user. This allows us to have nice and friendly
// URLs that the user sees for things like about: URLs, but actually feed
// the renderer a data URL that results in the content loading.
//
// GetVirtualURL() will return the URL to display to the user in all cases, so
// if there is no overridden display URL, it will return the actual one.
virtual void SetVirtualURL(const GURL& url) = 0;
virtual const GURL& GetVirtualURL() const = 0;
// The title as set by the page. This will be empty if there is no title set.
// The caller is responsible for detecting when there is no title and
// displaying the appropriate "Untitled" label if this is being displayed to
// the user.
virtual void SetTitle(const base::string16& title) = 0;
virtual const base::string16& GetTitle() const = 0;
// Stores the NavigationItem's last recorded scroll offset and zoom scale.
virtual void SetPageDisplayState(const PageDisplayState& page_state) = 0;
virtual const PageDisplayState& GetPageDisplayState() const = 0;
// Page-related helpers ------------------------------------------------------
// Returns the title to be displayed on the tab. This could be the title of
// the page if it is available or the URL.
virtual const base::string16& GetTitleForDisplay() const = 0;
// Tracking stuff ------------------------------------------------------------
// The transition type indicates what the user did to move to this page from
// the previous page.
virtual void SetTransitionType(ui::PageTransition transition_type) = 0;
virtual ui::PageTransition GetTransitionType() const = 0;
// The favicon data and tracking information. See web::FaviconStatus.
virtual const FaviconStatus& GetFavicon() const = 0;
virtual FaviconStatus& GetFavicon() = 0;
// All the SSL flags and state. See web::SSLStatus.
virtual const SSLStatus& GetSSL() const = 0;
virtual SSLStatus& GetSSL() = 0;
// The time at which the last known local navigation has
// completed. (A navigation can be completed more than once if the
// page is reloaded.)
//
// If GetTimestamp() returns a null time, that means that either:
//
// - this navigation hasn't completed yet;
// - this navigation was restored and for some reason the
// timestamp wasn't available;
// - or this navigation was copied from a foreign session.
virtual void SetTimestamp(base::Time timestamp) = 0;
virtual base::Time GetTimestamp() const = 0;
// The type of user agent requested for the navigation.
// TODO(crbug.com/697512): Create equivalent enum type for WebContents.
virtual void SetUserAgentType(UserAgentType type) = 0;
virtual UserAgentType GetUserAgentType(
id<UITraitEnvironment> web_view) const = 0;
// Returns the type of user agent to be used for inheritance. Inheritance is
// used to know the User Agent type when a new navigation is started. This
// type could be different from GetUserAgentType() as if the Inherited user
// agent could be the automatic one, whereas the GetUserAgentType is the one
// actually used by this item.
virtual UserAgentType GetUserAgentForInheritance() const = 0;
// |true| if this item is the result of a POST request with data.
virtual bool HasPostData() const = 0;
// Returns the item's current http request headers.
virtual NSDictionary* GetHttpRequestHeaders() const = 0;
// Adds headers from |additional_headers| to the item's http request headers.
// Existing headers with the same key will be overridden.
virtual void AddHttpRequestHeaders(NSDictionary* additional_headers) = 0;
};
} // namespace web
#endif // IOS_WEB_PUBLIC_NAVIGATION_NAVIGATION_ITEM_H_
| {
"content_hash": "7dec359ca80f97df531877e131de8fea",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 80,
"avg_line_length": 43.63934426229508,
"alnum_prop": 0.7092411720510894,
"repo_name": "endlessm/chromium-browser",
"id": "271ef2ffd7eab3509fadd0c38c45e6263aabbefd",
"size": "5847",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ios/web/public/navigation/navigation_item.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
namespace Microsoft.Azure.Management.DataFactory.Models
{
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// MariaDB server linked service.
/// </summary>
[Newtonsoft.Json.JsonObject("MariaDB")]
[Rest.Serialization.JsonTransformation]
public partial class MariaDBLinkedService : LinkedService
{
/// <summary>
/// Initializes a new instance of the MariaDBLinkedService class.
/// </summary>
public MariaDBLinkedService()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the MariaDBLinkedService class.
/// </summary>
/// <param name="additionalProperties">Unmatched properties from the
/// message are deserialized this collection</param>
/// <param name="connectVia">The integration runtime reference.</param>
/// <param name="description">Linked service description.</param>
/// <param name="parameters">Parameters for linked service.</param>
/// <param name="annotations">List of tags that can be used for
/// describing the Dataset.</param>
/// <param name="connectionString">An ODBC connection string. Type:
/// string, SecureString or AzureKeyVaultSecretReference.</param>
/// <param name="pwd">The Azure key vault secret reference of password
/// in connection string.</param>
/// <param name="encryptedCredential">The encrypted credential used for
/// authentication. Credentials are encrypted using the integration
/// runtime credential manager. Type: string (or Expression with
/// resultType string).</param>
public MariaDBLinkedService(IDictionary<string, object> additionalProperties = default(IDictionary<string, object>), IntegrationRuntimeReference connectVia = default(IntegrationRuntimeReference), string description = default(string), IDictionary<string, ParameterSpecification> parameters = default(IDictionary<string, ParameterSpecification>), IList<object> annotations = default(IList<object>), object connectionString = default(object), AzureKeyVaultSecretReference pwd = default(AzureKeyVaultSecretReference), object encryptedCredential = default(object))
: base(additionalProperties, connectVia, description, parameters, annotations)
{
ConnectionString = connectionString;
Pwd = pwd;
EncryptedCredential = encryptedCredential;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets an ODBC connection string. Type: string, SecureString
/// or AzureKeyVaultSecretReference.
/// </summary>
[JsonProperty(PropertyName = "typeProperties.connectionString")]
public object ConnectionString { get; set; }
/// <summary>
/// Gets or sets the Azure key vault secret reference of password in
/// connection string.
/// </summary>
[JsonProperty(PropertyName = "typeProperties.pwd")]
public AzureKeyVaultSecretReference Pwd { get; set; }
/// <summary>
/// Gets or sets the encrypted credential used for authentication.
/// Credentials are encrypted using the integration runtime credential
/// manager. Type: string (or Expression with resultType string).
/// </summary>
[JsonProperty(PropertyName = "typeProperties.encryptedCredential")]
public object EncryptedCredential { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Pwd != null)
{
Pwd.Validate();
}
}
}
}
| {
"content_hash": "d58f4b5143964c8c53917d35a09ccb28",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 567,
"avg_line_length": 44.51063829787234,
"alnum_prop": 0.6453154875717018,
"repo_name": "shahabhijeet/azure-sdk-for-net",
"id": "e4db1314305e99fbc4053a70013a728251046257",
"size": "4537",
"binary": false,
"copies": "1",
"ref": "refs/heads/psSdkJson6",
"path": "src/SDKs/DataFactory/Management.DataFactory/Generated/Models/MariaDBLinkedService.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "15346"
},
{
"name": "C#",
"bytes": "131793423"
},
{
"name": "HTML",
"bytes": "191432"
},
{
"name": "JavaScript",
"bytes": "7875"
},
{
"name": "PowerShell",
"bytes": "108166"
},
{
"name": "Shell",
"bytes": "32482"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<android.support.v7.internal.view.menu.ListMenuItemView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall">
<!-- Icon will be inserted here. -->
<!-- The title and summary have some gap between them, and this 'group' should be centered vertically. -->
<RelativeLayout
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="?attr/listPreferredItemPaddingLeft"
android:layout_marginRight="?attr/listPreferredItemPaddingRight"
android:duplicateParentState="true">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:textAppearance="?attr/textAppearanceListItemSmall"
android:singleLine="true"
android:duplicateParentState="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView
android:id="@+id/shortcut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/title"
android:layout_alignParentLeft="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true"
android:duplicateParentState="true" />
</RelativeLayout>
<!-- Checkbox, and/or radio button will be inserted here. -->
</android.support.v7.internal.view.menu.ListMenuItemView>
<!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-sdk-release/frameworks/support/v7/appcompat/res/layout/abc_list_menu_item_layout.xml --><!-- From: file:/Users/northfoxz/Documents/TIL/reactnative/gitcamera/node_modules/react-native-camera-android/android/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/layout/abc_list_menu_item_layout.xml --> | {
"content_hash": "22669b686706ef4058261a73b7ca202b",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 451,
"avg_line_length": 48.622950819672134,
"alnum_prop": 0.6844234659474039,
"repo_name": "NorthFoxz/react-native-camera-android",
"id": "a361cef0654efc7fae877e71e25beebd410c9ac1",
"size": "2966",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "android/build/intermediates/res/merged/release/layout/abc_list_menu_item_layout.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1454007"
},
{
"name": "JavaScript",
"bytes": "2373"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_101) on Mon Sep 19 15:00:28 UTC 2016 -->
<title>org.springframework.aop (Spring Framework 4.3.3.RELEASE API)</title><script>var _hmt = _hmt || [];(function() {var hm = document.createElement("script");hm.src = "//hm.baidu.com/hm.js?dd1361ca20a10cc161e72d4bc4fef6df";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm, s);})();</script>
<meta name="date" content="2016-09-19">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="org.springframework.aop (Spring Framework 4.3.3.RELEASE API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Spring Framework</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/apache/catalina/loader/package-summary.html">Prev Package</a></li>
<li><a href="../../../org/springframework/aop/aspectj/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/springframework/aop/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package org.springframework.aop</h1>
<div class="docSummary">
<div class="block">Core Spring AOP interfaces, built on AOP Alliance AOP interoperability interfaces.</div>
</div>
<p>See: <a href="#package.description">Description</a></p>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation">
<caption><span>Interface Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/Advisor.html" title="interface in org.springframework.aop">Advisor</a></td>
<td class="colLast">
<div class="block">Base interface holding AOP <b>advice</b> (action to take at a joinpoint)
and a filter determining the applicability of the advice (such as
a pointcut).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../org/springframework/aop/AfterAdvice.html" title="interface in org.springframework.aop">AfterAdvice</a></td>
<td class="colLast">
<div class="block">Common marker interface for after advice,
such as <a href="../../../org/springframework/aop/AfterReturningAdvice.html" title="interface in org.springframework.aop"><code>AfterReturningAdvice</code></a> and <a href="../../../org/springframework/aop/ThrowsAdvice.html" title="interface in org.springframework.aop"><code>ThrowsAdvice</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/AfterReturningAdvice.html" title="interface in org.springframework.aop">AfterReturningAdvice</a></td>
<td class="colLast">
<div class="block">After returning advice is invoked only on normal method return, not if an
exception is thrown.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../org/springframework/aop/BeforeAdvice.html" title="interface in org.springframework.aop">BeforeAdvice</a></td>
<td class="colLast">
<div class="block">Common marker interface for before advice, such as <a href="../../../org/springframework/aop/MethodBeforeAdvice.html" title="interface in org.springframework.aop"><code>MethodBeforeAdvice</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/ClassFilter.html" title="interface in org.springframework.aop">ClassFilter</a></td>
<td class="colLast">
<div class="block">Filter that restricts matching of a pointcut or introduction to
a given set of target classes.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../org/springframework/aop/DynamicIntroductionAdvice.html" title="interface in org.springframework.aop">DynamicIntroductionAdvice</a></td>
<td class="colLast">
<div class="block">Subinterface of AOP Alliance Advice that allows additional interfaces
to be implemented by an Advice, and available via a proxy using that
interceptor.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/IntroductionAdvisor.html" title="interface in org.springframework.aop">IntroductionAdvisor</a></td>
<td class="colLast">
<div class="block">Superinterface for advisors that perform one or more AOP <b>introductions</b>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../org/springframework/aop/IntroductionAwareMethodMatcher.html" title="interface in org.springframework.aop">IntroductionAwareMethodMatcher</a></td>
<td class="colLast">
<div class="block">A specialized type of <a href="../../../org/springframework/aop/MethodMatcher.html" title="interface in org.springframework.aop"><code>MethodMatcher</code></a> that takes into account introductions
when matching methods.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/IntroductionInfo.html" title="interface in org.springframework.aop">IntroductionInfo</a></td>
<td class="colLast">
<div class="block">Interface supplying the information necessary to describe an introduction.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../org/springframework/aop/IntroductionInterceptor.html" title="interface in org.springframework.aop">IntroductionInterceptor</a></td>
<td class="colLast">
<div class="block">Subinterface of AOP Alliance MethodInterceptor that allows additional interfaces
to be implemented by the interceptor, and available via a proxy using that
interceptor.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/MethodBeforeAdvice.html" title="interface in org.springframework.aop">MethodBeforeAdvice</a></td>
<td class="colLast">
<div class="block">Advice invoked before a method is invoked.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../org/springframework/aop/MethodMatcher.html" title="interface in org.springframework.aop">MethodMatcher</a></td>
<td class="colLast">
<div class="block">Part of a <a href="../../../org/springframework/aop/Pointcut.html" title="interface in org.springframework.aop"><code>Pointcut</code></a>: Checks whether the target method is eligible for advice.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/Pointcut.html" title="interface in org.springframework.aop">Pointcut</a></td>
<td class="colLast">
<div class="block">Core Spring pointcut abstraction.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../org/springframework/aop/PointcutAdvisor.html" title="interface in org.springframework.aop">PointcutAdvisor</a></td>
<td class="colLast">
<div class="block">Superinterface for all Advisors that are driven by a pointcut.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/ProxyMethodInvocation.html" title="interface in org.springframework.aop">ProxyMethodInvocation</a></td>
<td class="colLast">
<div class="block">Extension of the AOP Alliance <a href="../../../org/aopalliance/intercept/MethodInvocation.html" title="interface in org.aopalliance.intercept"><code>MethodInvocation</code></a>
interface, allowing access to the proxy that the method invocation was made through.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../org/springframework/aop/RawTargetAccess.html" title="interface in org.springframework.aop">RawTargetAccess</a></td>
<td class="colLast">
<div class="block">Marker for AOP proxy interfaces (in particular: introduction interfaces)
that explicitly intend to return the raw target object (which would normally
get replaced with the proxy object when returned from a method invocation).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/SpringProxy.html" title="interface in org.springframework.aop">SpringProxy</a></td>
<td class="colLast">
<div class="block">Marker interface implemented by all AOP proxies.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../org/springframework/aop/TargetClassAware.html" title="interface in org.springframework.aop">TargetClassAware</a></td>
<td class="colLast">
<div class="block">Minimal interface for exposing the target class behind a proxy.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/TargetSource.html" title="interface in org.springframework.aop">TargetSource</a></td>
<td class="colLast">
<div class="block">A <code>TargetSource</code> is used to obtain the current "target" of
an AOP invocation, which will be invoked via reflection if no around
advice chooses to end the interceptor chain itself.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../org/springframework/aop/ThrowsAdvice.html" title="interface in org.springframework.aop">ThrowsAdvice</a></td>
<td class="colLast">
<div class="block">Tag interface for throws advice.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Exception Summary table, listing exceptions, and an explanation">
<caption><span>Exception Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Exception</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../org/springframework/aop/AopInvocationException.html" title="class in org.springframework.aop">AopInvocationException</a></td>
<td class="colLast">
<div class="block">Exception that gets thrown when an AOP invocation failed
because of misconfiguration or unexpected runtime issues.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
<a name="package.description">
<!-- -->
</a>
<h2 title="Package org.springframework.aop Description">Package org.springframework.aop Description</h2>
<div class="block">Core Spring AOP interfaces, built on AOP Alliance AOP interoperability interfaces.
<p>Any AOP Alliance MethodInterceptor is usable in Spring.
<br>Spring AOP also offers:
<ul>
<li>Introduction support
<li>A Pointcut abstraction, supporting "static" pointcuts
(class and method-based) and "dynamic" pointcuts (also considering method arguments).
There are currently no AOP Alliance interfaces for pointcuts.
<li>A full range of advice types, including around, before, after returning and throws advice.
<li>Extensibility allowing arbitrary custom advice types to
be plugged in without modifying the core framework.
</ul>
<p>Spring AOP can be used programmatically or (preferably)
integrated with the Spring IoC container.</div>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Spring Framework</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/apache/catalina/loader/package-summary.html">Prev Package</a></li>
<li><a href="../../../org/springframework/aop/aspectj/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/springframework/aop/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "c6fe2f1cebd9c26dc30577196af533a0",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 323,
"avg_line_length": 45.37341772151899,
"alnum_prop": 0.702887431998884,
"repo_name": "piterlin/piterlin.github.io",
"id": "a7c4883501f243db0fc96f1c32ef1f4bdfae9a35",
"size": "14338",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/spring4.3.3-docs/javadoc-api/org/springframework/aop/package-summary.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "479"
},
{
"name": "HTML",
"bytes": "9480869"
},
{
"name": "JavaScript",
"bytes": "246"
}
],
"symlink_target": ""
} |
<div class='vzb-dialog-modal'>
<span class="thumb-tack-class thumb-tack-class-ico-pin fa" data-dialogtype="axesmc" data-click="pinDialog"></span>
<span class="thumb-tack-class thumb-tack-class-ico-drag fa" data-dialogtype="axesmc" data-click="dragDialog"></span>
<div class="vzb-dialog-title">
<%=t ( "buttons/axes") %>
</div>
<div class="vzb-dialog-content">
<div class="vzb-yaxis-container">
<p class="vzb-dialog-sublabel"><%=t ( "hints/mount/maxYvalue") %></p>
<form class="vzb-dialog-paragraph">
<label><input type="radio" name="ymax" value="immediate"><%=t ( "mount/maxYmode/immediate") %></label>
<label><input type="radio" name="ymax" value="latest"><%=t ( "mount/maxYmode/latest") %></label>
</form>
</div>
<div class="vzb-xaxis-container">
<p class="vzb-dialog-sublabel">
<%=t ( "hints/mount/logXstops") %>
</p>
<form class="vzb-dialog-paragraph">
<input type="checkbox" name="logstops" value="1">1
<input type="checkbox" name="logstops" value="2">2
<input type="checkbox" name="logstops" value="5">5
</form>
</div>
<p class="vzb-dialog-sublabel">
<%=t ( "hints/mount/xlimits") %>
</p>
<div class="vzb-xlimits-container vzb-dialog-paragraph"></div>
<div class="vzb-probe-container">
<p class="vzb-dialog-sublabel">
<%=t ( "hints/mount/probe") %>
</p>
<input type="text" class="vzb-probe-field" name="probe">
</div>
</div>
<div class="vzb-dialog-buttons">
<div data-click="closeDialog" class="vzb-dialog-button vzb-label-primary">
OK
</div>
</div>
</div> | {
"content_hash": "b8db3700feef0aa16de4362c3c239c9b",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 120,
"avg_line_length": 45.02439024390244,
"alnum_prop": 0.5411700975081257,
"repo_name": "alliance-timur/vizabi",
"id": "1c5274acfecf1c08ee5a7c4203c2541010ee2af5",
"size": "1846",
"binary": false,
"copies": "5",
"ref": "refs/heads/develop",
"path": "src/components/buttonlist/dialogs/axesmc/axesmc.html",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "90209"
},
{
"name": "HTML",
"bytes": "28564"
},
{
"name": "JavaScript",
"bytes": "794150"
},
{
"name": "Shell",
"bytes": "1508"
}
],
"symlink_target": ""
} |
$(document).ready(function() {
$("label").inFieldLabels();
$("select").each().change(function(){
$('label[for="reason"]').hide();
});
}); | {
"content_hash": "ec73273f0acd7fc86871937b5c26d1b9",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 39,
"avg_line_length": 24.833333333333332,
"alnum_prop": 0.5436241610738255,
"repo_name": "ner0tic/daviddurost.net",
"id": "e5cc3a019bbb3791ff681ec92454872df62492de",
"size": "149",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/js/form.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "441434"
},
{
"name": "PHP",
"bytes": "197983"
}
],
"symlink_target": ""
} |
data Enc a = Single a | Multiple Int a deriving (Show)
encodeDirect :: Eq a => [a] -> [Enc a]
encodeDirect [] = []
encodeDirect (x:xs) = encodeDirect' (Single x) xs
where
encodeDirect' x [] = [x]
encodeDirect' (Single x) (y:ys)
| x == y = encodeDirect' (Multiple 2 x) ys
encodeDirect' (Multiple n x) (y:ys)
| x == y = encodeDirect' (Multiple (n+1) x) ys
encodeDirect' x (y:ys) = x:(encodeDirect' (Single y) ys) | {
"content_hash": "a042c31d9b9b9f50dc9b5ea9538c4cb1",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 64,
"avg_line_length": 43.27272727272727,
"alnum_prop": 0.5546218487394958,
"repo_name": "alephnil/h99",
"id": "fd94b8e621bd1112e77c82fbec8d11646196f835",
"size": "476",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "13.hs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Haskell",
"bytes": "7839"
}
],
"symlink_target": ""
} |
Softmax Function
----------------
.. automodule:: Term_1.TensorFlow_3.softmax_7
:members:
:undoc-members:
:show-inheritance:
:private-members: | {
"content_hash": "7abdcacb38180234e937e155baf44fde",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 45,
"avg_line_length": 19.375,
"alnum_prop": 0.6258064516129033,
"repo_name": "akshaybabloo/Car-ND",
"id": "4c0bbdf55ceb474682af3b3e680a555dffd59624",
"size": "155",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/source/TensorFlow/softmax.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "551"
},
{
"name": "Jupyter Notebook",
"bytes": "16855408"
},
{
"name": "Python",
"bytes": "367767"
}
],
"symlink_target": ""
} |
@implementation UserTrainDB
//重写初始化
- (instancetype)init {
self = [super init];
if (self) {
self.dataBase = [FMDBManager shareInstanceWithDBName:DATABASENAME].dataBase;
}
return self;
}
//创建表
- (void)createDataTable {
//查询数据表中的元素个数
FMResultSet *set = [self.dataBase executeQuery:[NSString stringWithFormat:@"select count(*) from sqlite_master where type = 'table' and name = '%@' ",PROGRAMLISTTABLE]];
[set next];//结果集中就一条记录 且一个字段 无列名
NSInteger count = [set intForColumnIndex:0];//获取整形字段的信息
if (count) {
//不为0 表已经存在
NSLog(@"数据表已经存在");
} else {
//表不存在 创建新的表
NSString *createSql = [NSString stringWithFormat:@"create table IF NOT EXISTS %@(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, userID TEXT, programID TEXT)",PROGRAMLISTTABLE];
BOOL result = [self.dataBase executeUpdate:createSql];
if (!result) {
NSLog(@"数据表创建失败");
} else {
NSLog(@"数据表创建成功");
}
}
}
//插入
- (void)insertDataWithModel:(ProgramModel *)model {
//创建sql语句
NSMutableString *insertSql = [NSMutableString stringWithFormat:@"insert into %@(userID, programID) values(?, ?)",PROGRAMLISTTABLE];
//创建插入内容
NSMutableArray *arguments = [NSMutableArray array];
NSString *userID = [[UserInfoManager shareInstance] getUserID];
if (![userID isEqualToString:@" "]) {
[arguments addObject:userID];
}
if (model.programID) {
[arguments addObject:model.programID];
}
//执行
[self.dataBase executeUpdate:insertSql withArgumentsInArray:arguments];
}
//删除
- (void)deleteDataWithProgramID:(NSString *)programID {
NSString *delSql = [NSString stringWithFormat:@"delete from %@ where programID = '%@'",PROGRAMLISTTABLE, programID];
[self.dataBase executeUpdate:delSql];
}
//查询
- (NSArray *)selectDataWithUserID:(NSString *)userID {
NSString *selectSql = [NSString stringWithFormat:@"select * from %@ where userID = '%@'",PROGRAMLISTTABLE, userID];
FMResultSet *set = [self.dataBase executeQuery:selectSql];
NSMutableArray *listArray = [NSMutableArray array];
while ([set next]) {
ProgramModel *programModel = [[ProgramModel alloc] init];
programModel.programID = [set stringForColumn:@"programID"];
[listArray addObject:programModel];
}
[set close];
return listArray;
}
@end
| {
"content_hash": "29e0671d1a642b7d2e4fe64dd530dc3d",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 184,
"avg_line_length": 30.759493670886076,
"alnum_prop": 0.6502057613168725,
"repo_name": "MoDaBao/No-Fat",
"id": "9386acd26c84a54d63a47dcbe1799fdd949d2864",
"size": "2778",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "!Fat/!Fat/CodeClass/Train/Model/UserTrainDB.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Objective-C",
"bytes": "1442953"
},
{
"name": "Shell",
"bytes": "8163"
}
],
"symlink_target": ""
} |
<!doctype html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Somos una comunidad que reúne a varias comunidades de El Salvador enfocadas en diferentes tecnologías.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Developers SV</title>
<meta property="og:title" content="Developers SV — Comunidad">
<meta property="og:type" content="website">
<meta property="og:url" content="http://developers.sv/">
<meta property="og:image" content="http://developers.sv/images/devs-sv-share.png">
<meta property="og:site_name" content="Developers SV">
<meta property="og:description" content="Una comunidad que reúne a varias comunidades de El Salvador enfocadas en diferentes tecnologías.">
<meta name="twitter:card" content="summary">
<meta name="twitter:url" content="http://developers.sv/">
<meta name="twitter:title" content="Developers SV — Comunidad">
<meta name="twitter:description" content="Una comunidad que reúne a varias comunidades de El Salvador enfocadas en diferentes tecnologías.">
<meta name="twitter:image" content="http://developers.sv/images/devs-sv-share.png">
<!-- Color the status bar on mobile devices -->
<meta name="theme-color" content="#31373E">
<link rel="shortcut icon" type="image/png" href="images/devs-sv-icon.png"/>
<link rel="stylesheet" href="https://unpkg.com/tachyons@4.7.0/css/tachyons.min.css">
<link rel="stylesheet" href="styles/main.css">
</head>
<body>
<header class="header">
<span class="header__overlay"></span>
<img src="images/devs-sv-full.png" alt="Developers SV" class="header__logo">
<h1 class="header__title">Developers SV</h1>
<p class="header__description">Una comunidad que reúne a varias comunidades de El Salvador enfocadas en diferentes tecnologías.</p>
<a href="https://welcu.com/developers-sv/devup-3" target="_blank" class="button button--primary button--center white">Próximo evento: <br> <span class="f5 f3-ns">Sábado 15 de Julio</span></a>
</header>
<div class="nav-wrapper" id="conoce">
<div class="container">
<div class="nav">
<img src="images/devs-sv-horizontal.png" height="50" alt="Developers SV" class="nav__logo">
<ul class="menu">
<li class="menu__item">
<a href="#nosotros">Nosotros</a>
</li>
<li class="menu__item">
<a href="#comunidades">Comunidades</a>
</li>
<li class="menu__item">
<a href="#patrocinadores">Patrocinadores</a>
</li>
<li class="menu__item">
<a href="#organizadores">Organizadores</a>
</li>
</ul>
</div>
</div>
</div>
<section class="section tc" id="nosotros">
<div class="container container--small">
<h2 class="section__title">Sobre Nosotros</h2>
<p class="measure-wide center">Nuestro objetivo es hacer crecer la comunidad de desarrolladores/as en El Salvador a través de conferencias, charlas y talleres que ayuden a mejorar la calidad de profesionales en la industria. Actualmente organizamos una conferencia general cada 2 meses llamada DevUP y varias reuniones locales con cada unas de las comunidades que conforman Developers SV.</p>
<p class="measure-wide center">La comunidad se rige por un <a href="https://github.com/devs-sv/codigo-de-conducta">código de conducta</a> con el que procuramos mantener un ambiente agradable y seguro para todas las personas que nos acompañan.</p>
</div>
</section>
<section class="section tc" id="comunidades">
<div class="container container--small">
<h2 class="section__title">Comunidades</h2>
<p class="measure-wide center">Developers SV es conformada actualmente por estas comunidades:</p>
<div class="pv3 tc">
<div class="dib mv3 mh4 tc">
<a href="https://www.facebook.com/groups/androiddevssv" target="_blank" class="link">
<img src="images/comunidades/android-sv.png" class="db center h3 h4-ns" alt="Logo">
<h4>Android Developers SV</h4>
</a>
</div>
<div class="dib mv3 mh4 tc">
<a href="https://www.facebook.com/groups/horchatajs/" target="_blank" class="link">
<img src="images/comunidades/horchata-js.png" class="db center h3 h4-ns" alt="Logo">
<h4>HorchataJS</h4>
</a>
</div>
<div class="dib mv3 mh4 tc">
<a href="https://www.facebook.com/groups/1951939478466141/" target="_blank" class="link">
<img src="images/comunidades/sivar-on-rails.png" class="db center h3 h4-ns" alt="Logo">
<h4>Sivar on Rails</h4>
</a>
</div>
</div>
</div>
</section>
<section class="section tc" id="patrocinadores">
<div class="container">
<h2 class="section__title">Patrocinadores</h2>
<p class="measure-wide center">Empresas y organizaciones que nos apoyan</p>
<div class="pv3 tc">
<div class="dib mv4 mh4 tc">
<a href="http://www.applaudostudios.com/?ref=developers-sv" target="_blank">
<img src="images/patrocinadores/applaudostudios.png" class="db center h-auto h4-ns" alt="Applaudo Studios">
</a>
</div>
<div class="dib mv4 mh4 tc">
<a href="https://www.audiovisualesuca.com/?ref=developers-sv" target="_blank">
<img src="images/patrocinadores/audiovisuales-uca.jpg" class="db center h-auto h4-ns" alt="Audiovisuales UCA">
</a>
</div>
</div>
<div class="pv3 tc">
<div class="dib mv4 mh4 tc">
<a href="https://elaniin.com/?ref=developers-sv" target="_blank">
<img src="images/patrocinadores/elaniin.png" class="db center h-auto h3-ns" alt="Elaniin">
</a>
</div>
<div class="dib mv4 mh4 tc">
<a href="http://happypunkpanda.com?ref=developers-sv" target="_blank">
<img src="images/patrocinadores/hpp.png" class="db center h-auto h3-ns" alt="Happy Punk Panda">
</a>
</div>
<div class="dib mv4 mh4 tc">
<a href="http://www.telusinternational-ca.com/sp/el-salvador/?ref=developers-sv" target="_blank">
<img src="images/patrocinadores/telus.jpg" class="db center h-auto h3-ns" alt="Telus International">
</a>
</div>
<div class="dib mv4 mh4 tc">
<a href="http://www.svnet.org.sv/?ref=developers-sv" target="_blank">
<img src="images/patrocinadores/sv-net.jpg" class="db center h-auto h3-ns" alt="SV Net">
</a>
</div>
</div>
</div>
<a href="mailto:amilcar.serrano@developers.sv?subject=Patrocinio | Devs SV" class="button button--primary button--center white">Quiero patrocinar</a>
</section>
<section class="section tc" id="organizadores">
<div class="container container--small">
<h2 class="section__title">Organizadores</h2>
<p class="measure-wide center">Somos un grupo de voluntarios</p>
<div class="pv3 tc">
<div class="dib mv3 mh4 tc">
<a href="https://www.linkedin.com/in/amilcar-serrano" target="_blank" class="link">
<img src="images/organizadores/amilcar-serrano.jpg" class="db center w3 br-100" alt="Amilcar Serrano">
<p>Amilcar Serrano</p>
</a>
</div>
<div class="dib mv3 mh4 tc">
<a href="https://www.linkedin.com/in/carlos-moreno-6a28889/" target="_blank" class="link">
<img src="images/organizadores/carlos-moreno.jpg" class="db center w3 br-100" alt="Carlos Moreno">
<p>Carlos Moreno</p>
</a>
</div>
<div class="dib mv3 mh4 tc">
<a href="http://ricardoerl.com/?ref=developers-sv" target="_blank" class="link">
<img src="images/organizadores/ricardo-ramirez.jpg" class="db center w3 br-100" alt="Ricardo Ramirez">
<p>Ricardo Ramirez</p>
</a>
</div>
<div class="dib mv3 mh4 tc">
<a href="http://rodrigopuente.com/?ref=developers-sv" target="_blank" class="link">
<img src="images/organizadores/rodrigo-puente.jpg" class="db center w3 br-100" alt="Rodrigo Puente">
<p>Rodrigo Puente</p>
</a>
</div>
</div>
</div>
<a href="mailto:amilcar.serrano@developers.sv?subject=Voluntario | Devs SV" class="button button--primary button--center white">Quiero colaborar</a>
</section>
<section class="section tc bg-light-gray">
<a href="https://github.com/devs-sv/codigo-de-conducta" target="_blank" class="f5 f3-ns">Código de conducta</a>
<div class="pt3">
<ul class="list ph0">
<li class="dib mh3">
<a href="https://www.facebook.com/developers.sv/" target="_blank">Facebook</a>
</li>
<li class="dib mh3">
<a href="https://twitter.com/developers_sv" target="_blank">Twitter</a>
</li>
<li class="dib mh3">
<a href="https://www.instagram.com/developers.sv/" target="_blank">Instagram</a>
</li>
</ul>
</div>
</section>
<!-- build:js scripts/main.min.js -->
<script src="scripts/main.js"></script>
<!-- endbuild -->
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-101259715-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
| {
"content_hash": "a318ef1c3cc05d262c809ddd7082f250",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 400,
"avg_line_length": 49.21844660194175,
"alnum_prop": 0.6009468389387513,
"repo_name": "devs-sv/devs-landing",
"id": "f79e3275c2b50af5e2deb91ba023039bf91620bb",
"size": "10153",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2917"
},
{
"name": "HTML",
"bytes": "10153"
},
{
"name": "JavaScript",
"bytes": "13308"
}
],
"symlink_target": ""
} |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-parent</artifactId>
<version>1.2.6</version>
</parent>
<artifactId>redis-integration-test</artifactId>
<dependencies>
<dependency>
<groupId>com.ctrip.framework.xpipe</groupId>
<artifactId>core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-console</artifactId>
<type>test-jar</type>
<scope>test</scope>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-checker</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-proxy</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-keeper</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-meta</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-meta</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-console</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-checker</artifactId>
<scope>test</scope>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ctrip.framework.xpipe.redis</groupId>
<artifactId>redis-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-exec</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.unidal.framework</groupId>
<artifactId>test-framework</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project> | {
"content_hash": "bdba03198bc2e865ca278e756e332eb4",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 104,
"avg_line_length": 29.523364485981308,
"alnum_prop": 0.7027540360873694,
"repo_name": "ctripcorp/x-pipe",
"id": "b51a5f41eaee23e400a51279d07b81b0ab1deafc",
"size": "3159",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "redis/redis-integration-test/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1933"
},
{
"name": "Dockerfile",
"bytes": "1061"
},
{
"name": "HTML",
"bytes": "182469"
},
{
"name": "Java",
"bytes": "9045838"
},
{
"name": "JavaScript",
"bytes": "1615"
},
{
"name": "Python",
"bytes": "10427"
},
{
"name": "Shell",
"bytes": "73728"
},
{
"name": "TypeScript",
"bytes": "235225"
}
],
"symlink_target": ""
} |
import { IconDefinition, IconPrefix, IconName } from "@fortawesome/fontawesome-common-types";
export const definition: IconDefinition;
export const faWandMagicSparkles: IconDefinition;
export const prefix: IconPrefix;
export const iconName: IconName;
export const width: number;
export const height: number;
export const ligatures: (string | number)[];
export const unicode: string;
export const svgPathData: string;
export const aliases: (string | number)[]; | {
"content_hash": "b4e0947971f0a69ad8ee91fc46b8ddae",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 93,
"avg_line_length": 41.72727272727273,
"alnum_prop": 0.7995642701525054,
"repo_name": "GoogleCloudPlatform/prometheus-engine",
"id": "80c87d00d1dee7ba5fe2111332866f8d076cc79b",
"size": "459",
"binary": false,
"copies": "5",
"ref": "refs/heads/main",
"path": "third_party/prometheus_ui/base/web/ui/node_modules/@fortawesome/free-solid-svg-icons/faWandMagicSparkles.d.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "4035"
},
{
"name": "Go",
"bytes": "574177"
},
{
"name": "Makefile",
"bytes": "5189"
},
{
"name": "Shell",
"bytes": "11915"
}
],
"symlink_target": ""
} |
// ***********************************************************************
// Copyright (c) 2007 Charlie Poole, Rob Prouse
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework.Internal;
using NUnit.TestUtilities;
using NUnit.TestUtilities.Comparers;
namespace NUnit.Framework.Constraints
{
[TestFixture]
public class CollectionOrderedConstraintTests
{
private readonly string NL = Environment.NewLine;
#region Ordering Tests
[TestCaseSource("OrderedByData")]
public void IsOrderedBy(IEnumerable collection, Constraint constraint)
{
Assert.That(collection, constraint);
}
static readonly object[] OrderedByData = new[]
{
// Simple Ordering
new TestCaseData(
new[] { "x", "y", "z" },
Is.Ordered),
new TestCaseData(
new[] { 1, 2, 3 },
Is.Ordered),
new TestCaseData(
new[] { "x", "y", "z" },
Is.Ordered.Ascending),
new TestCaseData(
new[] { 1, 2, 3 },
Is.Ordered.Ascending),
new TestCaseData(
new[] { "z", "y", "x" },
Is.Ordered.Descending),
new TestCaseData(
new[] { 3, 2, 1 },
Is.Ordered.Descending),
new TestCaseData(
new[] { "x", "x", "z" },
Is.Ordered),
new TestCaseData(
new[] { null, "x", "y" },
Is.Ordered),
new TestCaseData(
new[] {"y", "x", null},
Is.Ordered.Descending),
new TestCaseData(
new[] { "x", null, "y" },
Is.Not.Ordered),
// Ordered By Single Property
new TestCaseData(
new[] { new TestClass1(1), new TestClass1(2), new TestClass1(3) },
Is.Ordered.By("Value") ),
new TestCaseData(
new[] { new TestClass1(1), new TestClass1(2), new TestClass1(3) },
Is.Ordered.By("Value").Ascending ),
new TestCaseData(
new[] { new TestClass1(1), new TestClass1(2), new TestClass1(3) },
Is.Ordered.Ascending.By("Value") ),
new TestCaseData(
new[] { new TestClass1(3), new TestClass1(2), new TestClass1(1) },
Is.Ordered.By("Value").Descending ),
new TestCaseData(
new[] { new TestClass1(3), new TestClass1(2), new TestClass1(1) },
Is.Ordered.Descending.By("Value") ),
new TestCaseData(
new[] { new TestClass1(1), new TestClass1(2), new TestClass1(3) },
Is.Ordered.By("Value").Using(ObjectComparer.Default) ),
new TestCaseData(
new object[] { new TestClass1(1), new TestClass2(2) },
Is.Ordered.By("Value") ),
// Ordered By Two Properties
new TestCaseData(
new [] { new TestClass3("ABC", 1), new TestClass3("ABC", 42), new TestClass3("XYZ", 2) },
Is.Ordered.By("A").By("B") ),
new TestCaseData(
new [] { new TestClass3("ABC", 1), new TestClass3("ABC", 42), new TestClass3("XYZ", 2) },
Is.Ordered.By("A").Then.By("B") ),
new TestCaseData(
new [] { new TestClass3("ABC", 1), new TestClass3("ABC", 42), new TestClass3("XYZ", 2) },
Is.Ordered.Ascending.By("A").Then.Ascending.By("B") ),
new TestCaseData(
new [] { new TestClass3("ABC", 1), new TestClass3("ABC", 42), new TestClass3("XYZ", 2) },
Is.Ordered.By("A").Ascending.Then.By("B").Ascending ),
new TestCaseData(
new [] { new TestClass3("ABC", 42), new TestClass3("XYZ", 99), new TestClass3("XYZ", 2) },
Is.Not.Ordered.By("A").Then.By("B") ),
new TestCaseData(
new [] { new TestClass3("XYZ", 2), new TestClass3("ABC", 1), new TestClass3("ABC", 42) },
Is.Ordered.By("A").Descending.Then.By("B") ),
new TestCaseData(
new [] { new TestClass3("XYZ", 2), new TestClass3("ABC", 1), new TestClass3("ABC", 42) },
Is.Ordered.Descending.By("A").Then.By("B") ),
new TestCaseData(
new [] { new TestClass3("ABC", 42), new TestClass3("ABC", 1), new TestClass3("XYZ", 2) },
Is.Ordered.By("A").Ascending.Then.By("B").Descending ),
new TestCaseData(
new [] { new TestClass3("ABC", 42), new TestClass3("ABC", 1), new TestClass3("XYZ", 2) },
Is.Ordered.Ascending.By("A").Then.Descending.By("B") ),
new TestCaseData(
new [] { new TestClass3("ABC", 42), new TestClass3("ABC", 1), new TestClass3("XYZ", 2) },
Is.Not.Ordered.By("A").Then.By("B") ),
new TestCaseData(
new[] { new TestClass3("XYZ", 2), new TestClass3("ABC", 42), new TestClass3("ABC", 1) },
Is.Ordered.By("A").Descending.Then.By("B").Descending ),
new TestCaseData(
new[] { new TestClass3("XYZ", 2), new TestClass3("ABC", 42), new TestClass3("ABC", 1) },
Is.Ordered.Descending.By("A").Then.Descending.By("B") )
};
#endregion
#region Error Message Tests
[Test]
public void IsOrdered_Fails()
{
var expectedMessage =
" Expected: collection ordered" + NL +
" But was: < \"x\", \"z\", \"y\" >" + NL;
var ex = Assert.Throws<AssertionException>(() => Assert.That(new[] { "x", "z", "y" }, Is.Ordered));
Assert.That(ex.Message, Is.EqualTo(expectedMessage));
}
#endregion
#region Custom Comparer Tests
[Test]
public void IsOrdered_HandlesCustomComparison()
{
AlwaysEqualComparer comparer = new AlwaysEqualComparer();
Assert.That(new[] { new object(), new object() }, Is.Ordered.Using(comparer));
Assert.That(comparer.CallCount, Is.GreaterThan(0), "TestComparer was not called");
}
[Test]
public void ExceptionThrownForMultipleComparersInStep()
{
Assert.That(() => Is.Ordered.Using(new TestComparer()).Using(new AlwaysEqualComparer()), Throws.TypeOf<InvalidOperationException>());
}
[Test]
public void MultipleComparersUsedInDifferentSteps()
{
var comparer1 = new TestComparer();
var comparer2 = new AlwaysEqualComparer();
var collection = new[] { new TestClass3("XYZ", 2), new TestClass3("ABC", 42), new TestClass3("ABC", 1) };
Assert.That(collection, Is.Ordered.By("A").Using(comparer1).Then.By("B").Using(comparer2));
// First comparer is called for every pair of items in the collection
Assert.That(comparer1.CallCount, Is.EqualTo(2), "First comparer should be called twice");
// Second comparer is only called where the first property matches
Assert.That(comparer2.CallCount, Is.EqualTo(1), "Second comparer should be called once");
}
[Test]
public void IsOrdered_HandlesCustomComparison2()
{
TestComparer comparer = new TestComparer();
Assert.That(new[] { 2, 1 }, Is.Ordered.Using(comparer));
Assert.That(comparer.CallCount, Is.GreaterThan(0), "TestComparer was not called");
}
[Test]
public void UsesProvidedGenericComparer()
{
var comparer = new GenericComparer<int>();
Assert.That(new[] { 1, 2 }, Is.Ordered.Using(comparer));
Assert.That(comparer.WasCalled, "Comparer was not called");
}
[Test]
public void UsesProvidedGenericComparison()
{
var comparer = new GenericComparison<int>();
Assert.That(new[] { 1, 2 }, Is.Ordered.Using(comparer.Delegate));
Assert.That(comparer.WasCalled, "Comparer was not called");
}
[Test]
public void UsesProvidedLambda()
{
Comparison<int> comparer = (x, y) => x.CompareTo(y);
Assert.That(new[] { 1, 2 }, Is.Ordered.Using(comparer));
}
#endregion
#region Exception Tests
[Test]
public void ExceptionThrownForRepeatedAscending()
{
Assert.That(() => Is.Ordered.Ascending.Ascending, Throws.TypeOf<InvalidOperationException>());
}
[Test]
public void ExceptionThrownForRepeatedDescending()
{
Assert.That(() => Is.Ordered.Descending.Descending, Throws.TypeOf<InvalidOperationException>());
}
[Test]
public void ExceptionThrownForAscendingPlusDescending()
{
Assert.That(() => Is.Ordered.Ascending.Descending, Throws.TypeOf<InvalidOperationException>());
}
[Test]
public void ExceptionThrownForAscendingByDescending()
{
Assert.That(() => Is.Ordered.Ascending.By("A").Descending, Throws.TypeOf<InvalidOperationException>());
}
[Test]
public void IsOrderedByProperty_ThrowsOnNull()
{
var ex = Assert.Throws<ArgumentNullException>(() => Assert.That(new[] { new TestClass4("x"), null, new TestClass4("z") }, Is.Ordered.By("Value")));
Assert.That(ex.Message, Does.Contain("index 1"));
}
[Test]
public void IsOrdered_TypesMustBeComparable()
{
Assert.Throws<ArgumentException>(() => Assert.That(new object[] { 1, "x" }, Is.Ordered));
}
[Test]
public void IsOrdered_AtLeastOneArgMustImplementIComparable()
{
Assert.Throws<ArgumentException>(() => Assert.That(new [] { new object(), new object() }, Is.Ordered));
}
[TestCaseSource(nameof(InvalidOrderedByData))]
public void IsOrdered_ThrowsOnMissingProperty(object[] collection, string property, string expectedIndex)
{
Assert.That(() => Assert.That(collection, Is.Ordered.By(property)), Throws.ArgumentException.With.Message.Contain(expectedIndex));
}
static readonly object[] InvalidOrderedByData = new[]
{
new TestCaseData(
new object [] { "a", "b" },
"A",
"index 0"),
new TestCaseData(
new object [] { new TestClass3("a", 1), "b" },
"A",
"index 1"),
new TestCaseData(
new object [] { new TestClass3("a", 1), new TestClass3("b", 1), new TestClass4("c") },
"A",
"index 2"),
};
#endregion
#region Test Classes
public class TestClass1
{
public int Value { get; private set; }
public TestClass1(int value)
{
Value = value;
}
public override string ToString()
{
return Value.ToString();
}
}
class TestClass2
{
public int Value { get; private set; }
public TestClass2(int value)
{
Value = value;
}
public override string ToString()
{
return Value.ToString();
}
}
public class TestClass3
{
public string A { get; private set; }
public int B { get; private set; }
public TestClass3(string a, int b)
{
A = a;
B = b;
}
public override string ToString()
{
return A.ToString() + "," + B.ToString();
}
}
public class TestClass4
{
public readonly string A;
public TestClass4(string a)
{
A = a;
}
public override string ToString()
{
return A;
}
}
#endregion
}
} | {
"content_hash": "d53b4b3e3833da19b934461611dfe0b6",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 159,
"avg_line_length": 37.787114845938376,
"alnum_prop": 0.5320978502594514,
"repo_name": "ggeurts/nunit",
"id": "5f3c70e1723603f3ea17c257d2b543a5c6a27cd5",
"size": "13492",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/NUnitFramework/tests/Constraints/CollectionOrderedConstraintTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "48"
},
{
"name": "C#",
"bytes": "4328053"
},
{
"name": "PowerShell",
"bytes": "7834"
},
{
"name": "Shell",
"bytes": "3695"
},
{
"name": "Visual Basic",
"bytes": "1689"
}
],
"symlink_target": ""
} |
include(Platform/AIX-XL-Fortran)
| {
"content_hash": "4a469c2923ecff35492e887aea9d2362",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 32,
"avg_line_length": 34,
"alnum_prop": 0.7941176470588235,
"repo_name": "dava/dava.engine",
"id": "3d1f297e1635149a891df65da595ecdf3df3adec",
"size": "34",
"binary": false,
"copies": "10",
"ref": "refs/heads/development",
"path": "Bin/CMakeWin32/share/cmake-3.9/Modules/Platform/AIX-VisualAge-Fortran.cmake",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Ada",
"bytes": "89080"
},
{
"name": "Assembly",
"bytes": "166572"
},
{
"name": "Batchfile",
"bytes": "18562"
},
{
"name": "C",
"bytes": "61621347"
},
{
"name": "C#",
"bytes": "574524"
},
{
"name": "C++",
"bytes": "50229645"
},
{
"name": "CLIPS",
"bytes": "5291"
},
{
"name": "CMake",
"bytes": "11439187"
},
{
"name": "CSS",
"bytes": "32773"
},
{
"name": "Cuda",
"bytes": "37073"
},
{
"name": "DIGITAL Command Language",
"bytes": "27303"
},
{
"name": "Emacs Lisp",
"bytes": "44259"
},
{
"name": "Fortran",
"bytes": "8835"
},
{
"name": "GLSL",
"bytes": "3726"
},
{
"name": "Go",
"bytes": "1235"
},
{
"name": "HTML",
"bytes": "8621333"
},
{
"name": "Java",
"bytes": "232072"
},
{
"name": "JavaScript",
"bytes": "2560"
},
{
"name": "Lua",
"bytes": "43080"
},
{
"name": "M4",
"bytes": "165145"
},
{
"name": "Makefile",
"bytes": "1349214"
},
{
"name": "Mathematica",
"bytes": "4633"
},
{
"name": "Module Management System",
"bytes": "15224"
},
{
"name": "Objective-C",
"bytes": "1909821"
},
{
"name": "Objective-C++",
"bytes": "498191"
},
{
"name": "Pascal",
"bytes": "99390"
},
{
"name": "Perl",
"bytes": "396608"
},
{
"name": "Python",
"bytes": "782784"
},
{
"name": "QML",
"bytes": "43105"
},
{
"name": "QMake",
"bytes": "156"
},
{
"name": "Roff",
"bytes": "71083"
},
{
"name": "Ruby",
"bytes": "22742"
},
{
"name": "SAS",
"bytes": "16030"
},
{
"name": "Shell",
"bytes": "2482394"
},
{
"name": "Slash",
"bytes": "117430"
},
{
"name": "Smalltalk",
"bytes": "5908"
},
{
"name": "TeX",
"bytes": "428489"
},
{
"name": "Vim script",
"bytes": "133255"
},
{
"name": "Visual Basic",
"bytes": "54056"
},
{
"name": "WebAssembly",
"bytes": "13987"
}
],
"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_65) on Thu Jan 22 19:02:37 GMT 2015 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class org.apache.taverna.scufl2.validation.correctness.DefaultDispatchingVisitor (Apache Taverna Language APIs (Scufl2, Databundle) 0.16.1-incubating-SNAPSHOT API)</title>
<meta name="date" content="2015-01-22">
<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="Uses of Class org.apache.taverna.scufl2.validation.correctness.DefaultDispatchingVisitor (Apache Taverna Language APIs (Scufl2, Databundle) 0.16.1-incubating-SNAPSHOT API)";
}
//-->
</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><a href="../../../../../../../org/apache/taverna/scufl2/validation/correctness/DefaultDispatchingVisitor.html" title="class in org.apache.taverna.scufl2.validation.correctness">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/taverna/scufl2/validation/correctness/class-use/DefaultDispatchingVisitor.html" target="_top">Frames</a></li>
<li><a href="DefaultDispatchingVisitor.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.taverna.scufl2.validation.correctness.DefaultDispatchingVisitor" class="title">Uses of Class<br>org.apache.taverna.scufl2.validation.correctness.DefaultDispatchingVisitor</h2>
</div>
<div class="classUseContainer">No usage of org.apache.taverna.scufl2.validation.correctness.DefaultDispatchingVisitor</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../org/apache/taverna/scufl2/validation/correctness/DefaultDispatchingVisitor.html" title="class in org.apache.taverna.scufl2.validation.correctness">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/taverna/scufl2/validation/correctness/class-use/DefaultDispatchingVisitor.html" target="_top">Frames</a></li>
<li><a href="DefaultDispatchingVisitor.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2015 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "ecfbf2305a229bbdf7ef4391936c2c11",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 211,
"avg_line_length": 42.87179487179487,
"alnum_prop": 0.6385566188197768,
"repo_name": "stain/incubator-taverna-site",
"id": "e781d90db3778658ab6aea4d5b7b283ffc139538",
"size": "5016",
"binary": false,
"copies": "1",
"ref": "refs/heads/trunk",
"path": "src/site/resources/javadoc/taverna-language/org/apache/taverna/scufl2/validation/correctness/class-use/DefaultDispatchingVisitor.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "3813"
},
{
"name": "CSS",
"bytes": "10003"
},
{
"name": "Clojure",
"bytes": "49413"
},
{
"name": "HTML",
"bytes": "82818"
},
{
"name": "M",
"bytes": "1705"
},
{
"name": "Perl",
"bytes": "3148"
},
{
"name": "Python",
"bytes": "31455"
},
{
"name": "Shell",
"bytes": "374"
}
],
"symlink_target": ""
} |
using System;
using Xunit;
using Quartz.DynamoDB.DataModel.Storage;
using Quartz.DynamoDB.DataModel;
using System.Linq;
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
namespace Quartz.DynamoDB.Tests.Integration.Repository
{
/// <summary>
/// Contains tests for the repository class.
/// </summary>
public class RepositoryTests : IDisposable
{
private Repository<DynamoScheduler> _sut;
private DynamoClientFactory _testFactory;
[Fact]
[Trait("Category", "Integration")]
public void PersistTwoSchedulersSameId_OneRecord()
{
_testFactory = new DynamoClientFactory();
var client = _testFactory.BootStrapDynamo();
_sut = new Repository<DynamoScheduler>(client);
int initialSchedulerCount = _sut.Scan(null, null, null).Count();
var scheduler = new DynamoScheduler
{
InstanceId = "testInstance" + DateTime.UtcNow.Ticks.ToString(),
ExpiresUtc = (SystemTime.Now() + new TimeSpan(0, 10, 0)).UtcDateTime,
State = "Running"
};
_sut.Store(scheduler);
var expressionAttributeValues = new Dictionary<string, AttributeValue>
{
{":instance", new AttributeValue { S = scheduler.InstanceId }}
};
var scheduler2 = _sut.Scan(expressionAttributeValues, null, "InstanceId = :instance").Single();
scheduler2.ExpiresUtc = (SystemTime.Now() + new TimeSpan(0, 20, 0)).UtcDateTime;
_sut.Store(scheduler2);
int finalCount = _sut.Scan(null, null, null).Count();
Assert.Equal(initialSchedulerCount + 1, finalCount);
}
/// <summary>
/// Tests the repository Store method that wraps the Dynamo BatchWriteItem API.
/// 25 is the maximum number of items for one batch.
/// </summary>
[Fact]
[Trait("Category", "Integration")]
public void StoreTwentyFiveEntities()
{
_testFactory = new DynamoClientFactory();
var client = _testFactory.BootStrapDynamo();
_sut = new Repository<DynamoScheduler>(client);
int initialSchedulerCount = _sut.Scan(null, null, null).Count();
var items = new List<DynamoScheduler>();
for (int i = 0; i < 25; i++)
{
var scheduler = new DynamoScheduler
{
InstanceId = "testInstance" + DateTime.UtcNow.Ticks.ToString() + i,
ExpiresUtc = (SystemTime.Now() + new TimeSpan(0, 10, 0)).UtcDateTime,
State = "Running"
};
items.Add(scheduler);
}
_sut.Store(items);
int finalCount = _sut.Scan(null, null, null).Count();
Assert.Equal(initialSchedulerCount + 25, finalCount);
}
/// <summary>
/// Tests the repository Store method that wraps the Dynamo BatchWriteItem API.
/// 26 is enough items for two batches.
/// </summary>
[Fact]
[Trait("Category", "Integration")]
public void StoreTwentySixEntities()
{
_testFactory = new DynamoClientFactory();
var client = _testFactory.BootStrapDynamo();
_sut = new Repository<DynamoScheduler>(client);
int initialSchedulerCount = _sut.Scan(null, null, null).Count();
var items = new List<DynamoScheduler>();
for (int i = 0; i < 26; i++)
{
var scheduler = new DynamoScheduler
{
InstanceId = "testInstance" + DateTime.UtcNow.Ticks.ToString() + i,
ExpiresUtc = (SystemTime.Now() + new TimeSpan(0, 10, 0)).UtcDateTime,
State = "Running"
};
items.Add(scheduler);
}
_sut.Store(items);
int finalCount = _sut.Scan(null, null, null).Count();
Assert.Equal(initialSchedulerCount + 26, finalCount);
}
#region IDisposable implementation
bool _disposedValue = false;
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
{
if (disposing)
{
_testFactory.CleanUpDynamo();
if (_sut != null)
{
_sut.Dispose();
}
}
_disposedValue = true;
}
}
// This code added to correctly implement the disposable pattern.
public void Dispose()
{
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
Dispose(true);
}
#endregion
}
}
| {
"content_hash": "7c4c3cb27a11406cddf1480da917d814",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 107,
"avg_line_length": 31.53205128205128,
"alnum_prop": 0.5377109168530189,
"repo_name": "lukeryannetnz/quartznet-dynamodb",
"id": "1567f66f9e981fc4687b8eeb2691fd4058885985",
"size": "4919",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/QuartzNET-DynamoDB.Tests/Integration/Repository/RepositoryTests.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "293247"
},
{
"name": "PowerShell",
"bytes": "752"
},
{
"name": "Shell",
"bytes": "703"
}
],
"symlink_target": ""
} |
import React from 'react';
import ProfileEditor from './profile-editor.react';
import RequestSubmitButton from '../common/request-submit-button.react';
import RequestMessage from '../common/request-message.react'
import {requestStates} from '../../../core/request-states';
import {StandardAjaxRequest} from '../../utils/ajax-request';
import {ApiUrls} from '../../utils/api-urls';
import {DefaultActions} from '../../flux/default/default-actions';
import './setup-profile.scss';
class SetupProfile extends React.Component {
constructor(props) {
super();
this.state = {
handle: '',
name: '',
requestState: requestStates.default
}
this._handleHandleChange = this._handleHandleChange.bind(this);
this._handleNameChange = this._handleNameChange.bind(this);
this._submitProfile = this._submitProfile.bind(this);
}
render() {
return (
<div className="setup-profile">
<ProfileEditor
handle={this.state.handle}
name={this.state.name}
onHandleChange={this._handleHandleChange}
onNameChange={this._handleNameChange}
/>
<RequestMessage
requestState={this.state.requestState}
/>
<RequestSubmitButton
requestState={this.state.requestState}
onSubmit={this._submitProfile}
/>
</div>
)
}
_handleHandleChange(event) {
this.setState({
handle: event.target.value
});
}
_handleNameChange(event) {
this.setState({
name: event.target.value
});
}
_submitProfile() {
this.setState({
requestState: requestStates.fetching
});
const request = new StandardAjaxRequest();
const user = {
handle: this.state.handle,
name: this.state.name
};
// console.log('ApiUrls: ', ApiUrls.user());
request.post({
url: ApiUrls.user(),
data: user,
success: (res) => {
this.setState({
requestState: requestStates.success
});
console.log('user', user);
global.setTimeout(() => {
DefaultActions.processProfile(user, res.token)
}, 0);
},
error: (err) => {
console.log(err);
this.setState({
requestState: requestStates.hasError
});
}
});
}
}
export default SetupProfile; | {
"content_hash": "68d6777fa9a8e0a2054362b4dd4d948d",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 72,
"avg_line_length": 27.98936170212766,
"alnum_prop": 0.5389585708855948,
"repo_name": "NYCSwan/whats-up",
"id": "3a980610a04a52f14b5acf388429becd03ae46a1",
"size": "2631",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/spa/components/profile/setup-profile.react.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7013"
},
{
"name": "HTML",
"bytes": "457"
},
{
"name": "JavaScript",
"bytes": "44296"
}
],
"symlink_target": ""
} |
//
// eLongHotelDetailModel.h
// ElongClient
//
// Created by Dawn on 15/1/22.
// Copyright (c) 2015年 elong. All rights reserved.
//
#import "eLongResponseBaseModel.h"
#import "eLongHotelDetailGroupModel.h"
@interface eLongHotelDetailModel : eLongResponseBaseModel
/**
* 酒店名称
*/
@property (nonatomic,copy) NSString *HotelName;
/**
* 酒店 Id
*/
@property (nonatomic,copy) NSString *HotelId;
/**
* 星级
*/
@property (nonatomic,assign) NSInteger Star;
/**
* 酒店封面图
*/
@property (nonatomic,copy) NSString *PicUrl;
/**
* 经度
*/
@property (nonatomic,assign) CGFloat Longitude;
/**
* 纬度
*/
@property (nonatomic,assign) CGFloat Latitude;
/**
* 百度纬度
*/
@property (nonatomic,assign) CGFloat BaiduLatitude;
/**
* 百度经度
*/
@property (nonatomic,assign) CGFloat BaiduLongitude;
/**
* 酒店地址
*/
@property (nonatomic,copy) NSString *Address;
/**
* 酒店电话
*/
@property (nonatomic,copy) NSString *Phone;
/**
* 开业日期
*/
@property (nonatomic,copy) NSString *OpenDate;
/**
* 酒店星级
*/
@property (nonatomic,assign) NSInteger NewStarCode;
/**
* 酒店设施
*/
@property (nonatomic,assign) NSInteger HotelFacilityCode;
/**
* 酒店评分
*/
@property (nonatomic,assign) CGFloat Rating;
/**
* 酒店好评率
*/
@property (nonatomic,assign) CGFloat CommentPoint;
/**
* 设施与服务
*/
@property (nonatomic,copy) NSString *GeneralAmenities;
/**
* 交通状况
*/
@property (nonatomic,copy) NSString *TrafficAndAroundInformations;
/**
* 推荐人数
*/
@property (nonatomic,assign) NSInteger GoodCommentCount;
/**
* 不推荐人数
*/
@property (nonatomic,assign) NSInteger BadCommentCount;
/**
* 评价人数
*/
@property (nonatomic,assign) NSInteger TotalCommentCount;
/**
* 行政区域
*/
@property (nonatomic,copy) NSString *AreaName;
/**
* 商圈ID
*/
@property (nonatomic,copy) NSString *BusinessAreaId;
/**
* 特色介绍
*/
@property (nonatomic,copy) NSString *FeatureInfo;
/**
* 酒店类型
*/
@property (nonatomic,assign) NSInteger HotelCategory;
/**
* 是否是买五送一酒店
*/
@property (nonatomic,assign) BOOL IsFiveToOneHotel;
/**
* 买五送一酒店活动描述详情
*/
@property (nonatomic,copy) NSString *FiveToOneHotelDesc;
/**
* 是否是五折酒店
*/
@property (nonatomic,assign) BOOL IsDiscountHotel;
/**
* 五折酒店描述
*/
@property (nonatomic,copy) NSString *discountDes;
/**
* 满减酒店描述
*/
@property (nonatomic,copy) NSString *fullCutDes;
/**
* 是否显示折后价开关
*/
@property (nonatomic,assign) BOOL IsShowSubCouponPrice;
/**
* 是否有返现
*/
@property (nonatomic,assign) BOOL isCouponFlag;
/**
* 城市名
*/
@property (nonatomic,copy) NSString *CityName;
/**
* 图片数量
*/
@property (nonatomic,assign) NSInteger ImagesCount;
@property (nonatomic,strong) NSArray<eLongHotelDetailGroupModel> *productsGroupByRoom;
/**
* 当前选中房间位置
*/
@property (nonatomic,strong) NSIndexPath *selectedRoomIndexPath;
/**
* 酒店确认率与同城均值的差值
*/
@property (nonatomic,assign) NSInteger HotelConfirmRateDiff;
/**
* 预定成功率与同城均值的差值
*/
@property (nonatomic,assign) NSInteger PreSuccessRateDiff;
/**
* 用户满意度与同城均值的差值
*/
@property (nonatomic,assign) NSInteger SatisfactionDiff;
/**
* 酒店确认率
*/
@property (nonatomic,copy) NSString *HotelConfirmRate;
/**
* 酒店预订成功率
*/
@property (nonatomic,copy) NSString *PreSuccessRate;
/**
* 用户满意度
*/
@property (nonatomic,copy) NSString *Satisfaction;
@end
| {
"content_hash": "df07be119ea617cac4638866ba58d4cc",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 86,
"avg_line_length": 17.48087431693989,
"alnum_prop": 0.6905282900906533,
"repo_name": "sky15179/Debug",
"id": "c0e5b45a64d49c5e95c1b5d1fbc474d0660ee033",
"size": "3631",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "TestTabelController/elongframework/eLongFramework/eLongHotel/Model/eLongHotelDetailModel.h",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1264019"
},
{
"name": "C++",
"bytes": "372476"
},
{
"name": "DTrace",
"bytes": "412"
},
{
"name": "Objective-C",
"bytes": "6915265"
},
{
"name": "Objective-C++",
"bytes": "172568"
},
{
"name": "Ruby",
"bytes": "27537"
},
{
"name": "Shell",
"bytes": "9017"
},
{
"name": "Swift",
"bytes": "227386"
}
],
"symlink_target": ""
} |
package org.everit.password.encryptor.pbkdf2.ecm.internal;
import java.util.Dictionary;
import java.util.Hashtable;
import org.everit.credential.encryptor.CredentialEncryptor;
import org.everit.credential.encryptor.CredentialMatcher;
import org.everit.osgi.ecm.annotation.Activate;
import org.everit.osgi.ecm.annotation.Component;
import org.everit.osgi.ecm.annotation.ConfigurationPolicy;
import org.everit.osgi.ecm.annotation.Deactivate;
import org.everit.osgi.ecm.annotation.ManualService;
import org.everit.osgi.ecm.annotation.ManualServices;
import org.everit.osgi.ecm.annotation.attribute.IntegerAttribute;
import org.everit.osgi.ecm.annotation.attribute.StringAttribute;
import org.everit.osgi.ecm.annotation.attribute.StringAttributeOption;
import org.everit.osgi.ecm.annotation.attribute.StringAttributes;
import org.everit.osgi.ecm.component.ComponentContext;
import org.everit.osgi.ecm.extender.ExtendComponent;
import org.everit.password.encryptor.pbkdf2.Algorithm;
import org.everit.password.encryptor.pbkdf2.PBKDF2PasswordEncryptorImpl;
import org.everit.password.encryptor.pbkdf2.ecm.PBKDF2PasswordEncryptorConstants;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
/**
* ECM component for {@link CredentialEncryptor} and {@link CredentialMatcher} interface based on
* {@link PBKDF2PasswordEncryptorImpl}.
*/
@ExtendComponent
@Component(componentId = PBKDF2PasswordEncryptorConstants.SERVICE_FACTORYPID_CREDENTIAL_ENCRYPTOR,
configurationPolicy = ConfigurationPolicy.FACTORY, label = "Everit PBKDF2 Password Encryptor",
description = "Component for password encryption and verification based on PBKDF2.")
@StringAttributes({
@StringAttribute(attributeId = Constants.SERVICE_DESCRIPTION,
defaultValue = PBKDF2PasswordEncryptorConstants.DEFAULT_SERVICE_DESCRIPTION,
priority = PBKDF2PasswordEncryptorComponent.P1_SERVICE_DESCRIPTION,
label = "Service Description",
description = "The description of this component configuration. It is used to easily "
+ "identify the service registered by this component.") })
@ManualServices(@ManualService({ CredentialEncryptor.class, CredentialMatcher.class }))
public class PBKDF2PasswordEncryptorComponent {
public static final int P1_SERVICE_DESCRIPTION = 1;
public static final int P2_ALGORITHM = 2;
public static final int P3_ITERATION_COUNT = 3;
private String algorithm;
/**
* Pick an iteration count that works for you. The NIST recommends at least 1,000 iterations:
* http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf iOS 4.x reportedly uses
* 10,000: http://blog.crackpassword.com/2010/09/smartphone-forensics-cracking-blackberry-backup-
* passwords/
*/
private int iterationCount;
private ServiceRegistration<?> serviceRegistration;
/**
* Component activator method.
*/
@Activate
public void activate(final ComponentContext<PBKDF2PasswordEncryptorComponent> componentContext) {
PBKDF2PasswordEncryptorImpl pbkdf2PasswordEncryptor =
new PBKDF2PasswordEncryptorImpl(algorithm, iterationCount);
Dictionary<String, Object> serviceProperties =
new Hashtable<>(componentContext.getProperties());
serviceRegistration =
componentContext.registerService(
new String[] { CredentialEncryptor.class.getName(), CredentialMatcher.class.getName() },
pbkdf2PasswordEncryptor, serviceProperties);
}
/**
* Component deactivate method.
*/
@Deactivate
public void deactivate() {
if (serviceRegistration != null) {
serviceRegistration.unregister();
}
}
@StringAttribute(attributeId = PBKDF2PasswordEncryptorConstants.PROP_ALGORITHM,
defaultValue = PBKDF2PasswordEncryptorConstants.DEFAULT_ALGORITHM, priority = P2_ALGORITHM,
options = {
@StringAttributeOption(label = "PBKDF2WithHmacSHA1 (since Java 1.6)",
value = Algorithm.PBKDF2_HMAC_SHA1),
@StringAttributeOption(label = "PBKDF2WithHmacSHA224 (since Java 1.8)",
value = Algorithm.PBKDF2_HMAC_SHA224),
@StringAttributeOption(label = "PBKDF2WithHmacSHA256 (since Java 1.8)",
value = Algorithm.PBKDF2_HMAC_SHA256),
@StringAttributeOption(label = "PBKDF2WithHmacSHA384 (since Java 1.8)",
value = Algorithm.PBKDF2_HMAC_SHA384),
@StringAttributeOption(label = "PBKDF2WithHmacSHA512 (since Java 1.8)",
value = Algorithm.PBKDF2_HMAC_SHA512) },
label = "Algorithm", description = "The secure algorithm used to encrypt the passwords.")
public void setAlgorithm(final String algorithm) {
this.algorithm = algorithm;
}
@IntegerAttribute(attributeId = PBKDF2PasswordEncryptorConstants.PROP_ITERATION_COUNT,
defaultValue = PBKDF2PasswordEncryptorConstants.DEFAULT_ITERATION_COUNT,
priority = P3_ITERATION_COUNT, label = "Iteration count",
description = "The higher value increases the time necessary to brute-force the password "
+ "and also increases the encryption and matching the passwords "
+ "(i.e. the authentication will be slower in case of higher iteration count).")
public void setIterationCount(final int iterationCount) {
this.iterationCount = iterationCount;
}
}
| {
"content_hash": "95951fa348ae31e76eb4af2463611800",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 100,
"avg_line_length": 46.2,
"alnum_prop": 0.758893280632411,
"repo_name": "everit-org/password-encryptor-pbkdf2-ecm",
"id": "b0a21c40e611ed6c3014f44630a8fc98681123ce",
"size": "5939",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "component/src/main/java/org/everit/password/encryptor/pbkdf2/ecm/internal/PBKDF2PasswordEncryptorComponent.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "12138"
}
],
"symlink_target": ""
} |
@interface RTActivityPoint : NSObject
@property (nonatomic, strong) NSNumber *value;
@property (nonatomic, strong) NSDate *timestamp;
- (instancetype)initWithValue:(NSInteger)value timestamp:(NSDate *)ts;
@end
| {
"content_hash": "e4374f5c0f95f05bfc1a9aa98bbde0f6",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 70,
"avg_line_length": 26.625,
"alnum_prop": 0.7746478873239436,
"repo_name": "radianttap/RTGraphLayout",
"id": "9d07672306a62fa2ceaff1e9861c6b1dd0d75405",
"size": "403",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "GraphLayoutDemo/GraphLayoutDemo/RTActivityPoint.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "148450"
}
],
"symlink_target": ""
} |
<?php
namespace Propel\Tests\Runtime\ActiveQuery;
use Propel\Tests\Helpers\Namespaces\NamespacesTestBase;
use Propel\Runtime\ActiveQuery\ModelCriteria;
/**
* Test class for ModelCriteria with namespaces.
*
* @author Pierre-Yves LEBECQ <py.lebecq@gmail.com>
*/
class ModelCriteriaWithNamespaceTest extends NamespacesTestBase
{
public static function conditionsForTestReplaceNamesWithNamespaces()
{
return array(
array('Foo\\Bar\\NamespacedBook.Title = ?', 'Title', 'namespaced_book.title = ?'), // basic case
array('Foo\\Bar\\NamespacedBook.Title=?', 'Title', 'namespaced_book.title=?'), // without spaces
array('Foo\\Bar\\NamespacedBook.Id<= ?', 'Id', 'namespaced_book.id<= ?'), // with non-equal comparator
array('Foo\\Bar\\NamespacedBook.AuthorId LIKE ?', 'AuthorId', 'namespaced_book.author_id LIKE ?'), // with SQL keyword separator
array('(Foo\\Bar\\NamespacedBook.AuthorId) LIKE ?', 'AuthorId', '(namespaced_book.author_id) LIKE ?'), // with parenthesis
array('(Foo\\Bar\\NamespacedBook.Id*1.5)=1', 'Id', '(namespaced_book.id*1.5)=1'), // ignore numbers
// dealing with quotes
array("Foo\\Bar\\NamespacedBook.Id + ' ' + Foo\\Bar\\NamespacedBook.AuthorId", null, "namespaced_book.id + ' ' + namespaced_book.author_id"),
array("'Foo\\Bar\\NamespacedBook.Id' + Foo\\Bar\\NamespacedBook.AuthorId", null, "'Foo\\Bar\\NamespacedBook.Id' + namespaced_book.author_id"),
array("Foo\\Bar\\NamespacedBook.Id + 'Foo\\Bar\\NamespacedBook.AuthorId'", null, "namespaced_book.id + 'Foo\\Bar\\NamespacedBook.AuthorId'"),
);
}
/**
* @dataProvider conditionsForTestReplaceNamesWithNamespaces
*/
public function testReplaceNamesWithNamespaces($origClause, $columnPhpName = false, $modifiedClause)
{
$c = new TestableModelCriteriaWithNamespace('bookstore_namespaced', 'Foo\\Bar\\NamespacedBook');
$this->doTestReplaceNames($c, \Foo\Bar\Map\NamespacedBookTableMap::getTableMap(), $origClause, $columnPhpName = false, $modifiedClause);
}
public function doTestReplaceNames($c, $tableMap, $origClause, $columnPhpName = false, $modifiedClause)
{
$c->replaceNames($origClause);
$columns = $c->replacedColumns;
if ($columnPhpName) {
$this->assertEquals(array($tableMap->getColumnByPhpName($columnPhpName)), $columns);
}
$this->assertEquals($modifiedClause, $origClause);
}
}
class TestableModelCriteriaWithNamespace extends ModelCriteria
{
public $joins = array();
public function replaceNames(&$sql)
{
return parent::replaceNames($sql);
}
}
| {
"content_hash": "f5767683d725b85af7b6d839d2fc037c",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 154,
"avg_line_length": 43.095238095238095,
"alnum_prop": 0.6662983425414365,
"repo_name": "kitsunde/Propel2",
"id": "3e87d1559ae131e406aa985c3e5bc767d2feae72",
"size": "2920",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "tests/Propel/Tests/Runtime/ActiveQuery/ModelCriteriaWithNamespaceTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "4454151"
},
{
"name": "Shell",
"bytes": "3455"
},
{
"name": "XSLT",
"bytes": "74572"
}
],
"symlink_target": ""
} |
Some example direct detection experiment files. | {
"content_hash": "72fb259338b13e1b9dc6194a5ed7f602",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 47,
"avg_line_length": 47,
"alnum_prop": 0.8723404255319149,
"repo_name": "bradkav/AntiparticleDM",
"id": "85aa6b3a2f485999857fe208fbe77e0de39c6dc8",
"size": "58",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "calc/WIMpy/DDexpt_examples/README.md",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "3649"
},
{
"name": "Mathematica",
"bytes": "217979"
},
{
"name": "Python",
"bytes": "71875"
},
{
"name": "Shell",
"bytes": "1803"
}
],
"symlink_target": ""
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE401_Memory_Leak__malloc_realloc_twoIntsStruct_02.c
Label Definition File: CWE401_Memory_Leak__malloc_realloc.label.xml
Template File: point-flaw-02.tmpl.c
*/
/*
* @description
* CWE: 401 Memory Leak
* Sinks:
* GoodSink: Ensure the memory block pointed to by data is always freed
* BadSink : malloc() and use then realloc() and use data before free()
* Flow Variant: 02 Control flow: if(1) and if(0)
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
#ifndef OMITBAD
void CWE401_Memory_Leak__malloc_realloc_twoIntsStruct_02_bad()
{
if(1)
{
{
twoIntsStruct * data = (twoIntsStruct *)malloc(100*sizeof(twoIntsStruct));
if (data == NULL) {exit(-1);}
/* Initialize and make use of data */
data[0].intOne = 0;
data[0].intTwo = 0;
printStructLine(&data[0]);
/* FLAW: If realloc() fails, the initial memory block will not be freed() */
data = (twoIntsStruct *)realloc(data, (130000)*sizeof(twoIntsStruct));
if (data != NULL)
{
/* Reinitialize and make use of data */
data[0].intOne = 1;
data[0].intTwo = 1;
printStructLine(&data[0]);
free(data);
}
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses if(0) instead of if(1) */
static void good1()
{
if(0)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
twoIntsStruct * data = (twoIntsStruct *)malloc(100*sizeof(twoIntsStruct));
if (data == NULL) {exit(-1);}
twoIntsStruct * tmpData;
/* Initialize and make use of data */
data[0].intOne = 0;
data[0].intTwo = 0;
printStructLine(&data[0]);
tmpData = (twoIntsStruct *)realloc(data, (130000)*sizeof(twoIntsStruct));
/* FIX: Ensure realloc() was successful before assigning data to the memory block
* allocated with realloc() */
if (tmpData != NULL)
{
data = tmpData;
/* Reinitialize and make use of data */
data[0].intOne = 1;
data[0].intTwo = 1;
printStructLine(&data[0]);
}
free(data);
}
}
}
/* good2() reverses the bodies in the if statement */
static void good2()
{
if(1)
{
{
twoIntsStruct * data = (twoIntsStruct *)malloc(100*sizeof(twoIntsStruct));
if (data == NULL) {exit(-1);}
twoIntsStruct * tmpData;
/* Initialize and make use of data */
data[0].intOne = 0;
data[0].intTwo = 0;
printStructLine(&data[0]);
tmpData = (twoIntsStruct *)realloc(data, (130000)*sizeof(twoIntsStruct));
/* FIX: Ensure realloc() was successful before assigning data to the memory block
* allocated with realloc() */
if (tmpData != NULL)
{
data = tmpData;
/* Reinitialize and make use of data */
data[0].intOne = 1;
data[0].intTwo = 1;
printStructLine(&data[0]);
}
free(data);
}
}
}
void CWE401_Memory_Leak__malloc_realloc_twoIntsStruct_02_good()
{
good1();
good2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE401_Memory_Leak__malloc_realloc_twoIntsStruct_02_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE401_Memory_Leak__malloc_realloc_twoIntsStruct_02_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| {
"content_hash": "77179068fb805566e7ed72ed353ea917",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 93,
"avg_line_length": 30.263513513513512,
"alnum_prop": 0.5385130609511052,
"repo_name": "JianpingZeng/xcc",
"id": "09f2105e1dbaefa5229a2d9c2d1d689e0806b5a7",
"size": "4479",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "xcc/test/juliet/testcases/CWE401_Memory_Leak/s01/CWE401_Memory_Leak__malloc_realloc_twoIntsStruct_02.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
window.onload = function() {
checkDefaultValues();
printTest(
new CPPEmitter(),
document.body.children[0],
document.body.children[1],
document.body.children[2]);
printTest(
new JavaEmitter(),
document.body.children[0],
document.body.children[1],
document.body.children[2]);
printTest(
new CSEmitter(),
document.body.children[0],
document.body.children[1],
document.body.children[2]);
printTest(
new JavascriptEmitter(),
document.body.children[0],
document.body.children[1],
document.body.children[2]);
}
function assert(condition, message) {
if (!condition) {
throw new Error(message);
}
}
function printTest(e, LTRContainer, RTLContainer, genericContainer) {
e.push([
'/*',
' * Copyright (c) Facebook, Inc. and its affiliates.',
' *',
' * This source code is licensed under the MIT license found in the',
' * LICENSE file in the root directory of this source tree.',
' */',
'// @Generated by gentest/gentest.rb from gentest/fixtures/' + document.title + '.html',
'',
]);
e.emitPrologue();
var LTRLayoutTree = calculateTree(LTRContainer);
var RTLLayoutTree = calculateTree(RTLContainer);
var genericLayoutTree = calculateTree(genericContainer);
for (var i = 0; i < genericLayoutTree.length; i++) {
e.emitTestPrologue(genericLayoutTree[i].name, genericLayoutTree[i].experiments);
if (genericLayoutTree[i].name == 'wrap_column') {
// Modify width and left values due to both safari and chrome not abiding by the
// specification. The undefined dimension of a parent should be defined by the total size
// of their children in that dimension.
// See diagram under flex-wrap header https://www.w3.org/TR/css-flexbox-1/
assert(LTRLayoutTree[0].width == 30, 'wrap_column LTR root.width should be 30');
LTRLayoutTree[0].width = 60;
assert(RTLLayoutTree[0].width == 30, 'wrap_column RTL root.width should be 30');
RTLLayoutTree[0].width = 60;
var children = RTLLayoutTree[0].children;
assert(children[0].left == 0, 'wrap_column RTL root_child0.left should be 0');
children[0].left = 30;
assert(children[1].left == 0, 'wrap_column RTL root_child0.left should be 0');
children[1].left = 30;
assert(children[2].left == 0, 'wrap_column RTL root_child2.left should be 0');
children[2].left = 30;
assert(children[3].left == -30, 'wrap_column RTL root_child3.left should be -30');
children[3].left = 0;
}
setupTestTree(
e,
undefined,
LTRLayoutTree[i],
genericLayoutTree[i],
'root',
null);
e.YGNodeCalculateLayout('root', e.YGDirectionLTR, genericLayoutTree[i].experiments);
e.push('');
assertTestTree(e, LTRLayoutTree[i], 'root', null);
e.push('');
e.YGNodeCalculateLayout('root', e.YGDirectionRTL, genericLayoutTree[i].experiments);
e.push('');
assertTestTree(e, RTLLayoutTree[i], 'root', null);
e.emitTestEpilogue(genericLayoutTree[i].experiments);
}
e.emitEpilogue();
e.print();
}
function assertTestTree(e, node, nodeName, parentName) {
e.AssertEQ(node.left, e.YGNodeLayoutGetLeft(nodeName));
e.AssertEQ(node.top, e.YGNodeLayoutGetTop(nodeName));
e.AssertEQ(node.width, e.YGNodeLayoutGetWidth(nodeName));
e.AssertEQ(node.height, e.YGNodeLayoutGetHeight(nodeName));
for (var i = 0; i < node.children.length; i++) {
e.push('');
var childName = nodeName + '_child' + i;
assertTestTree(e, node.children[i], childName, nodeName);
}
}
function checkDefaultValues() {
// Sanity check of the Yoga default values by test-template.html
[
{style:'flex-direction', value:'column'},
{style:'justify-content', value:'flex-start'},
{style:'align-content', value:'flex-start'},
{style:'align-items', value:'stretch'},
{style:'position', value:'relative'},
{style:'flex-wrap', value:'nowrap'},
{style:'overflow', value:'visible'},
{style:'flex-grow', value:'0'},
{style:'flex-shrink', value:'0'},
{style:'left', value:'undefined'},
{style:'top', value:'undefined'},
{style:'right', value:'undefined'},
{style:'bottom', value:'undefined'},
{style:'display', value:'flex'},
].forEach(function(item) {
assert(isDefaultStyleValue(item.style, item.value),
item.style + ' should be ' + item.value);
});
}
function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index) {
e.emitTestTreePrologue(nodeName);
for (var style in node.style) {
// Skip position info for root as it messes up tests
if (node.declaredStyle[style] === "" &&
(style == 'position' ||
style == 'left' ||
style == 'top' ||
style == 'right' ||
style == 'bottom' ||
style == 'width' ||
style == 'height')) {
continue;
}
if (!isDefaultStyleValue(style, node.style[style])) {
switch (style) {
case 'direction':
e.YGNodeStyleSetDirection(nodeName, directionValue(e, node.style[style]));
break;
case 'flex-direction':
e.YGNodeStyleSetFlexDirection(nodeName, flexDirectionValue(e, node.style[style]));
break;
case 'justify-content':
e.YGNodeStyleSetJustifyContent(nodeName, justifyValue(e, node.style[style]));
break;
case 'align-content':
e.YGNodeStyleSetAlignContent(nodeName, alignValue(e, node.style[style]));
break;
case 'align-items':
e.YGNodeStyleSetAlignItems(nodeName, alignValue(e, node.style[style]));
break;
case 'align-self':
if (!parent || node.style[style] !== parent.style['align-items']) {
e.YGNodeStyleSetAlignSelf(nodeName, alignValue(e, node.style[style]));
}
break;
case 'position':
e.YGNodeStyleSetPositionType(nodeName, positionValue(e, node.style[style]));
break;
case 'flex-wrap':
e.YGNodeStyleSetFlexWrap(nodeName, wrapValue(e, node.style[style]));
break;
case 'overflow':
e.YGNodeStyleSetOverflow(nodeName, overflowValue(e, node.style[style]));
break;
case 'flex-grow':
e.YGNodeStyleSetFlexGrow(nodeName, node.style[style]);
break;
case 'flex-shrink':
e.YGNodeStyleSetFlexShrink(nodeName, node.style[style]);
break;
case 'flex-basis':
e.YGNodeStyleSetFlexBasis(nodeName, pointValue(e, node.style[style]));
break;
case 'left':
if (genericNode.rawStyle.indexOf('start:') >= 0) {
e.YGNodeStyleSetPosition(nodeName, e.YGEdgeStart, pointValue(e, node.style[style]));
} else {
e.YGNodeStyleSetPosition(nodeName, e.YGEdgeLeft, pointValue(e, node.style[style]));
}
break;
case 'top':
e.YGNodeStyleSetPosition(nodeName, e.YGEdgeTop, pointValue(e, node.style[style]));
break;
case 'right':
if (genericNode.rawStyle.indexOf('end:') >= 0) {
e.YGNodeStyleSetPosition(nodeName, e.YGEdgeEnd, pointValue(e, node.style[style]));
} else {
e.YGNodeStyleSetPosition(nodeName, e.YGEdgeRight, pointValue(e, node.style[style]));
}
break;
case 'bottom':
e.YGNodeStyleSetPosition(nodeName, e.YGEdgeBottom, pointValue(e, node.style[style]));
break;
case 'margin-left':
if (genericNode.rawStyle.indexOf('margin-start:') >= 0) {
e.YGNodeStyleSetMargin(nodeName, e.YGEdgeStart, pointValue(e, node.style[style]));
} else {
e.YGNodeStyleSetMargin(nodeName, e.YGEdgeLeft, pointValue(e, node.style[style]));
}
break;
case 'margin-top':
e.YGNodeStyleSetMargin(nodeName, e.YGEdgeTop, pointValue(e, node.style[style]));
break;
case 'margin-right':
if (genericNode.rawStyle.indexOf('margin-end:') >= 0) {
e.YGNodeStyleSetMargin(nodeName, e.YGEdgeEnd, pointValue(e, node.style[style]));
} else {
e.YGNodeStyleSetMargin(nodeName, e.YGEdgeRight, pointValue(e, node.style[style]));
}
break;
case 'margin-bottom':
e.YGNodeStyleSetMargin(nodeName, e.YGEdgeBottom, pointValue(e, node.style[style]));
break;
case 'padding-left':
if (genericNode.rawStyle.indexOf('padding-start:') >= 0) {
e.YGNodeStyleSetPadding(nodeName, e.YGEdgeStart, pointValue(e, node.style[style]));
} else {
e.YGNodeStyleSetPadding(nodeName, e.YGEdgeLeft, pointValue(e, node.style[style]));
}
break;
case 'padding-top':
e.YGNodeStyleSetPadding(nodeName, e.YGEdgeTop, pointValue(e, node.style[style]));
break;
case 'padding-right':
if (genericNode.rawStyle.indexOf('padding-end:') >= 0) {
e.YGNodeStyleSetPadding(nodeName, e.YGEdgeEnd, pointValue(e, node.style[style]));
} else {
e.YGNodeStyleSetPadding(nodeName, e.YGEdgeRight, pointValue(e, node.style[style]));
}
break;
case 'padding-bottom':
e.YGNodeStyleSetPadding(nodeName, e.YGEdgeBottom, pointValue(e, node.style[style]));
break;
case 'border-left-width':
if (genericNode.rawStyle.indexOf('border-start-width:') >= 0) {
e.YGNodeStyleSetBorder(nodeName, e.YGEdgeStart, pointValue(e, node.style[style]));
} else {
e.YGNodeStyleSetBorder(nodeName, e.YGEdgeLeft, pointValue(e, node.style[style]));
}
break;
case 'border-top-width':
e.YGNodeStyleSetBorder(nodeName, e.YGEdgeTop, pointValue(e, node.style[style]));
break;
case 'border-right-width':
if (genericNode.rawStyle.indexOf('border-end-width:') >= 0) {
e.YGNodeStyleSetBorder(nodeName, e.YGEdgeEnd, pointValue(e, node.style[style]));
} else {
e.YGNodeStyleSetBorder(nodeName, e.YGEdgeRight, pointValue(e, node.style[style]));
}
break;
case 'border-bottom-width':
e.YGNodeStyleSetBorder(nodeName, e.YGEdgeBottom, pointValue(e, node.style[style]));
break;
case 'width':
e.YGNodeStyleSetWidth(nodeName, pointValue(e, node.style[style]));
break;
case 'min-width':
e.YGNodeStyleSetMinWidth(nodeName, pointValue(e, node.style[style]));
break;
case 'max-width':
e.YGNodeStyleSetMaxWidth(nodeName, pointValue(e, node.style[style]));
break;
case 'height':
e.YGNodeStyleSetHeight(nodeName, pointValue(e, node.style[style]));
break;
case 'min-height':
e.YGNodeStyleSetMinHeight(nodeName, pointValue(e, node.style[style]));
break;
case 'max-height':
e.YGNodeStyleSetMaxHeight(nodeName, pointValue(e, node.style[style]));
break;
case 'display':
e.YGNodeStyleSetDisplay(nodeName, displayValue(e, node.style[style]))
break;
}
}
}
if (parentName) {
e.YGNodeInsertChild(parentName, nodeName, index);
}
for (var i = 0; i < node.children.length; i++) {
e.push('');
var childName = nodeName + '_child' + i;
setupTestTree(
e,
node,
node.children[i],
genericNode.children[i],
childName,
nodeName,
i);
}
}
function overflowValue(e, value) {
switch (value) {
case 'visible': return e.YGOverflowVisible;
case 'hidden': return e.YGOverflowHidden;
}
}
function wrapValue(e, value) {
switch (value) {
case 'wrap': return e.YGWrapWrap;
case 'wrap-reverse': return e.YGWrapWrapReverse;
case 'nowrap': return e.YGWrapNoWrap;
}
}
function flexDirectionValue(e, value) {
switch (value) {
case 'row': return e.YGFlexDirectionRow;
case 'row-reverse': return e.YGFlexDirectionRowReverse;
case 'column': return e.YGFlexDirectionColumn;
case 'column-reverse': return e.YGFlexDirectionColumnReverse;
}
}
function justifyValue(e, value) {
switch (value) {
case 'center': return e.YGJustifyCenter;
case 'space-around': return e.YGJustifySpaceAround;
case 'space-between': return e.YGJustifySpaceBetween;
case 'space-evenly': return e.YGJustifySpaceEvenly;
case 'flex-start': return e.YGJustifyFlexStart;
case 'flex-end': return e.YGJustifyFlexEnd;
}
}
function positionValue(e, value) {
switch (value) {
case 'absolute': return e.YGPositionTypeAbsolute;
default: return e.YGPositionTypeRelative
}
}
function directionValue(e, value) {
switch (value) {
case 'ltr': return e.YGDirectionLTR;
case 'rtl': return e.YGDirectionRTL;
case 'inherit': return e.YGDirectionInherit;
}
}
function alignValue(e, value) {
switch (value) {
case 'auto': return e.YGAlignAuto;
case 'center': return e.YGAlignCenter;
case 'stretch': return e.YGAlignStretch;
case 'flex-start': return e.YGAlignFlexStart;
case 'flex-end': return e.YGAlignFlexEnd;
case 'space-between': return e.YGAlignSpaceBetween;
case 'space-around': return e.YGAlignSpaceAround;
case 'baseline': return e.YGAlignBaseline;
}
}
function pointValue(e, value) {
switch (value) {
case 'auto': return e.YGAuto;
case 'undefined': return e.YGUndefined;
default: return value;
}
}
function displayValue(e, value){
switch(value){
case 'flex': return e.YGDisplayFlex;
case 'none': return e.YGDisplayNone;
}
}
var DEFAULT_STYLES = new Map();
function isDefaultStyleValue(style, value) {
let defaultStyle = DEFAULT_STYLES.get(style);
if (defaultStyle == null) {
switch (style) {
case 'position':
defaultStyle = new Set(['relative']);;
break;
case 'left':
case 'top':
case 'right':
case 'bottom':
case 'start':
case 'end':
defaultStyle = new Set(['undefined']);
break;
case 'min-height':
case 'min-width':
defaultStyle = new Set(['0', '0px', 'auto']);
break;
default:
var node = document.getElementById('default');
defaultStyle = new Set([getComputedStyle(node, null)[style]]);
break;
}
DEFAULT_STYLES.set(style, defaultStyle);
}
return DEFAULT_STYLES.get(style).has(value);
}
function getRoundedSize(node) {
var boundingRect = node.getBoundingClientRect();
return {
width: Math.round(boundingRect.right) - Math.round(boundingRect.left),
height: Math.round(boundingRect.bottom) - Math.round(boundingRect.top)
};
}
function calculateTree(root, roundToPixelGrid) {
var rootLayout = [];
for (var i = 0; i < root.children.length; i++) {
var child = root.children[i];
var layout = {
name: child.id !== '' ? child.id : 'INSERT_NAME_HERE',
left: child.offsetLeft + child.parentNode.clientLeft,
top: child.offsetTop + child.parentNode.clientTop,
width: child.offsetWidth,
height: child.offsetHeight,
children: calculateTree(child, roundToPixelGrid),
style: getYogaStyle(child),
declaredStyle: child.style,
rawStyle: child.getAttribute('style'),
experiments: child.getAttribute('experiments')
? child.getAttribute('experiments').split(' ')
: [],
};
var size = getRoundedSize(child);
layout.width = size.width;
layout.height = size.height;
rootLayout.push(layout);
}
return rootLayout;
}
function getYogaStyle(node) {
return [
'direction',
'flex-direction',
'justify-content',
'align-content',
'align-items',
'align-self',
'position',
'flex-wrap',
'overflow',
'flex-grow',
'flex-shrink',
'flex-basis',
'left',
'top',
'right',
'bottom',
'margin-left',
'margin-top',
'margin-right',
'margin-bottom',
'padding-left',
'padding-top',
'padding-right',
'padding-bottom',
'border-left-width',
'border-top-width',
'border-right-width',
'border-bottom-width',
'width',
'min-width',
'max-width',
'height',
'min-height',
'max-height',
'display',
].reduce(function(map, key) {
map[key] = node.style[key] || getComputedStyle(node, null).getPropertyValue(key);
return map;
}, {});
}
var Emitter = function(lang, indent) {
this.lang = lang;
this.indent = indent;
this.indents = [];
this.lines = [];
};
Emitter.prototype = Object.create(Object.prototype, {
constructor:{value:Emitter},
pushIndent:{value:function() {
this.indents.push(this.indent);
}},
popIndent:{value:function() {
this.indents.pop();
}},
push:{value:function(line) {
if (line instanceof Array) {
line.forEach(function(element) {
this.push(element);
}, this);
return;
} else if (line.length > 0) {
line = this.indents.join('') + line;
}
this.lines.push(line);
}},
print:{value:function() {
console.log(this.lines.join('\n'));
}},
});
| {
"content_hash": "0757b318164e4f9bf640b71169c97919",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 96,
"avg_line_length": 31.605504587155963,
"alnum_prop": 0.6183454281567489,
"repo_name": "facebook/css-layout",
"id": "12e76f33baeda6420ad830eb4d65abc89c5bbb9a",
"size": "17413",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "gentest/gentest.js",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "145693"
},
{
"name": "C#",
"bytes": "257813"
},
{
"name": "C++",
"bytes": "570222"
},
{
"name": "HTML",
"bytes": "19254"
},
{
"name": "Java",
"bytes": "225700"
},
{
"name": "JavaScript",
"bytes": "37516"
},
{
"name": "Objective-C",
"bytes": "21708"
},
{
"name": "Python",
"bytes": "15315"
},
{
"name": "Ruby",
"bytes": "1605"
},
{
"name": "Shell",
"bytes": "2485"
}
],
"symlink_target": ""
} |
module ActiveRecord
module ConnectionAdapters
module Redshift
module OID # :nodoc:
class Decimal < Type::Decimal # :nodoc:
def infinity(options = {})
BigDecimal.new("Infinity") * (options[:negative] ? -1 : 1)
end
end
end
end
end
end
| {
"content_hash": "ecd5f75a862c33c348de336ebf6aca27",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 70,
"avg_line_length": 23.46153846153846,
"alnum_prop": 0.5639344262295082,
"repo_name": "khwangster/activerecord4-redshift-adapter",
"id": "57d3d1b803bfbcf7dff77354dec847a90facf929",
"size": "305",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/active_record/connection_adapters/redshift/oid/decimal.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "93843"
}
],
"symlink_target": ""
} |
//
// Copyright (c) 2008-2018 the Urho3D project.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#include "Vehicle.h"
#include <Urho3D/Core/Context.h>
#include <Urho3D/Graphics/DebugRenderer.h>
#include <Urho3D/Graphics/DecalSet.h>
#include <Urho3D/Graphics/Material.h>
#include <Urho3D/Graphics/Model.h>
#include <Urho3D/Graphics/ParticleEffect.h>
#include <Urho3D/Graphics/ParticleEmitter.h>
#include <Urho3D/Graphics/StaticModel.h>
#include <Urho3D/IO/Log.h>
#include <Urho3D/Physics/CollisionShape.h>
#include <Urho3D/Physics/Constraint.h>
#include <Urho3D/Physics/PhysicsEvents.h>
#include <Urho3D/Physics/PhysicsWorld.h>
#include <Urho3D/Physics/RaycastVehicle.h>
#include <Urho3D/Resource/ResourceCache.h>
#include <Urho3D/Scene/Scene.h>
using namespace Urho3D;
const float CHASSIS_WIDTH = 2.6f;
void Vehicle::RegisterObject(Context* context)
{
context->RegisterFactory<Vehicle>();
URHO3D_ATTRIBUTE("Steering", float, steering_, 0.0f, AM_DEFAULT);
URHO3D_ATTRIBUTE("Controls Yaw", float, controls_.yaw_, 0.0f, AM_DEFAULT);
URHO3D_ATTRIBUTE("Controls Pitch", float, controls_.pitch_, 0.0f, AM_DEFAULT);
}
Vehicle::Vehicle(Urho3D::Context* context)
: LogicComponent(context),
steering_(0.0f)
{
SetUpdateEventMask(USE_FIXEDUPDATE | USE_POSTUPDATE);
engineForce_ = 0.0f;
brakingForce_ = 50.0f;
vehicleSteering_ = 0.0f;
maxEngineForce_ = 2500.0f;
wheelRadius_ = 0.5f;
suspensionRestLength_ = 0.6f;
wheelWidth_ = 0.4f;
suspensionStiffness_ = 14.0f;
suspensionDamping_ = 2.0f;
suspensionCompression_ = 4.0f;
wheelFriction_ = 1000.0f;
rollInfluence_ = 0.12f;
emittersCreated = false;
}
Vehicle::~Vehicle() = default;
void Vehicle::Init()
{
auto* vehicle = node_->CreateComponent<RaycastVehicle>();
vehicle->Init();
auto* hullBody = node_->GetComponent<RigidBody>();
hullBody->SetMass(800.0f);
hullBody->SetLinearDamping(0.2f); // Some air resistance
hullBody->SetAngularDamping(0.5f);
hullBody->SetCollisionLayer(1);
// This function is called only from the main program when initially creating the vehicle, not on scene load
auto* cache = GetSubsystem<ResourceCache>();
auto* hullObject = node_->CreateComponent<StaticModel>();
// Setting-up collision shape
auto* hullColShape = node_->CreateComponent<CollisionShape>();
Vector3 v3BoxExtents = Vector3::ONE;
hullColShape->SetBox(v3BoxExtents);
node_->SetScale(Vector3(2.3f, 1.0f, 4.0f));
hullObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
hullObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
hullObject->SetCastShadows(true);
float connectionHeight = -0.4f;
bool isFrontWheel = true;
Vector3 wheelDirection(0, -1, 0);
Vector3 wheelAxle(-1, 0, 0);
// We use not scaled coordinates here as everything will be scaled.
// Wheels are on bottom at edges of the chassis
// Note we don't set wheel nodes as children of hull (while we could) to avoid scaling to affect them.
float wheelX = CHASSIS_WIDTH / 2.0f - wheelWidth_;
// Front left
connectionPoints_[0] = Vector3(-wheelX, connectionHeight, 2.5f - GetWheelRadius() * 2.0f);
// Front right
connectionPoints_[1] = Vector3(wheelX, connectionHeight, 2.5f - GetWheelRadius() * 2.0f);
// Back left
connectionPoints_[2] = Vector3(-wheelX, connectionHeight, -2.5f + GetWheelRadius() * 2.0f);
// Back right
connectionPoints_[3] = Vector3(wheelX, connectionHeight, -2.5f + GetWheelRadius() * 2.0f);
const Color LtBrown(0.972f, 0.780f, 0.412f);
for (int id = 0; id < sizeof(connectionPoints_) / sizeof(connectionPoints_[0]); id++)
{
Node* wheelNode = GetScene()->CreateChild();
Vector3 connectionPoint = connectionPoints_[id];
// Front wheels are at front (z > 0)
// back wheels are at z < 0
// Setting rotation according to wheel position
bool isFrontWheel = connectionPoints_[id].z_ > 0.0f;
wheelNode->SetRotation(connectionPoint.x_ >= 0.0 ? Quaternion(0.0f, 0.0f, -90.0f) : Quaternion(0.0f, 0.0f, 90.0f));
wheelNode->SetWorldPosition(node_->GetWorldPosition() + node_->GetWorldRotation() * connectionPoints_[id]);
vehicle->AddWheel(wheelNode, wheelDirection, wheelAxle, suspensionRestLength_, wheelRadius_, isFrontWheel);
vehicle->SetWheelSuspensionStiffness(id, suspensionStiffness_);
vehicle->SetWheelDampingRelaxation(id, suspensionDamping_);
vehicle->SetWheelDampingCompression(id, suspensionCompression_);
vehicle->SetWheelFrictionSlip(id, wheelFriction_);
vehicle->SetWheelRollInfluence(id, rollInfluence_);
wheelNode->SetScale(Vector3(1.0f, 0.65f, 1.0f));
auto* pWheel = wheelNode->CreateComponent<StaticModel>();
pWheel->SetModel(cache->GetResource<Model>("Models/Cylinder.mdl"));
pWheel->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
pWheel->SetCastShadows(true);
CreateEmitter(connectionPoints_[id]);
}
emittersCreated = true;
vehicle->ResetWheels();
}
void Vehicle::CreateEmitter(Vector3 place)
{
auto* cache = GetSubsystem<ResourceCache>();
Node* emitter = GetScene()->CreateChild();
emitter->SetWorldPosition(node_->GetWorldPosition() + node_->GetWorldRotation() * place + Vector3(0, -wheelRadius_, 0));
auto* particleEmitter = emitter->CreateComponent<ParticleEmitter>();
particleEmitter->SetEffect(cache->GetResource<ParticleEffect>("Particle/Dust.xml"));
particleEmitter->SetEmitting(false);
particleEmitterNodeList_.Push(emitter);
emitter->SetTemporary(true);
}
/// Applying attributes
void Vehicle::ApplyAttributes()
{
auto* vehicle = node_->GetOrCreateComponent<RaycastVehicle>();
if (emittersCreated)
return;
for (const auto& connectionPoint : connectionPoints_)
{
CreateEmitter(connectionPoint);
}
emittersCreated = true;
}
void Vehicle::FixedUpdate(float timeStep)
{
float newSteering = 0.0f;
float accelerator = 0.0f;
bool brake = false;
auto* vehicle = node_->GetComponent<RaycastVehicle>();
// Read controls
if (controls_.buttons_ & CTRL_LEFT)
{
newSteering = -1.0f;
}
if (controls_.buttons_ & CTRL_RIGHT)
{
newSteering = 1.0f;
}
if (controls_.buttons_ & CTRL_FORWARD)
{
accelerator = 1.0f;
}
if (controls_.buttons_ & CTRL_BACK)
{
accelerator = -0.5f;
}
if (controls_.buttons_ & CTRL_BRAKE)
{
brake = true;
}
// When steering, wake up the wheel rigidbodies so that their orientation is updated
if (newSteering != 0.0f)
{
SetSteering(GetSteering() * 0.95f + newSteering * 0.05f);
}
else
{
SetSteering(GetSteering() * 0.8f + newSteering * 0.2f);
}
// Set front wheel angles
vehicleSteering_ = steering_;
int wheelIndex = 0;
vehicle->SetSteeringValue(wheelIndex, vehicleSteering_);
wheelIndex = 1;
vehicle->SetSteeringValue(wheelIndex, vehicleSteering_);
// apply forces
engineForce_ = maxEngineForce_ * accelerator;
// 2x wheel drive
vehicle->SetEngineForce(2, engineForce_);
vehicle->SetEngineForce(3, engineForce_);
for (int i = 0; i < vehicle->GetNumWheels(); i++)
{
if (brake)
{
vehicle->SetBrake(i, brakingForce_);
}
else
{
vehicle->SetBrake(i, 0.0f);
}
}
}
void Vehicle::PostUpdate(float timeStep)
{
auto* vehicle = node_->GetComponent<RaycastVehicle>();
auto* vehicleBody = node_->GetComponent<RigidBody>();
Vector3 velocity = vehicleBody->GetLinearVelocity();
Vector3 accel = (velocity - prevVelocity_) / timeStep;
float planeAccel = Vector3(accel.x_, 0.0f, accel.z_).Length();
for (int i = 0; i < vehicle->GetNumWheels(); i++)
{
Node* emitter = particleEmitterNodeList_[i];
auto* particleEmitter = emitter->GetComponent<ParticleEmitter>();
if (vehicle->WheelIsGrounded(i) && (vehicle->GetWheelSkidInfoCumulative(i) < 0.9f || vehicle->GetBrake(i) > 2.0f ||
planeAccel > 15.0f))
{
particleEmitterNodeList_[i]->SetWorldPosition(vehicle->GetContactPosition(i));
if (!particleEmitter->IsEmitting())
{
particleEmitter->SetEmitting(true);
}
URHO3D_LOGDEBUG("GetWheelSkidInfoCumulative() = " +
String(vehicle->GetWheelSkidInfoCumulative(i)) + " " +
String(vehicle->GetMaxSideSlipSpeed()));
/* TODO: Add skid marks here */
}
else if (particleEmitter->IsEmitting())
{
particleEmitter->SetEmitting(false);
}
}
prevVelocity_ = velocity;
}
| {
"content_hash": "498b72e12897b6fe77339c88415c9d56",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 124,
"avg_line_length": 38.92125984251968,
"alnum_prop": 0.6708476633623306,
"repo_name": "kostik1337/Urho3D",
"id": "82aa7595552f97358cfc06d78d3b4a4d810bb526",
"size": "9886",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Source/Samples/46_RaycastVehicle/Vehicle.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AngelScript",
"bytes": "1448201"
},
{
"name": "Batchfile",
"bytes": "16483"
},
{
"name": "C++",
"bytes": "8319508"
},
{
"name": "CMake",
"bytes": "456796"
},
{
"name": "GLSL",
"bytes": "154112"
},
{
"name": "HLSL",
"bytes": "178063"
},
{
"name": "HTML",
"bytes": "1375"
},
{
"name": "Java",
"bytes": "93400"
},
{
"name": "Lua",
"bytes": "568614"
},
{
"name": "MAXScript",
"bytes": "94704"
},
{
"name": "Objective-C",
"bytes": "6539"
},
{
"name": "Ruby",
"bytes": "65069"
},
{
"name": "Shell",
"bytes": "27373"
}
],
"symlink_target": ""
} |
package me.wayne.leetcodetop100.listnode;
import me.wayne.leetcodetop100.ListNode;
/**
* 给你链表的头结点 head ,请将其按 升序 排列并返回 排序后的链表 。
* <p>
* https://leetcode-cn.com/problems/sort-list/
*/
public class LC148_SortList {
public ListNode sortList(ListNode head) {
if (head == null || head.next == null) {
return head;
}
ListNode half = getHalf(head);
ListNode anotherHalf = half.next;
half.next = null;
ListNode left = sortList(head);
ListNode right = sortList(anotherHalf);
return mergeList(left, right);
}
private ListNode getHalf(ListNode head) {
ListNode fast = head;
ListNode slow = head;
ListNode pre = new ListNode(-1);
pre.next = slow;
while (fast != null) {
fast = fast.next;
if (fast == null) {
break;
}
fast = fast.next;
slow = slow.next;
pre = pre.next;
}
return pre;
}
private ListNode mergeList(ListNode head1, ListNode head2) {
ListNode dummy = new ListNode(-1);
ListNode head = dummy;
while (head1 != null || head2 != null) {
if (head1 == null || head2 == null) {
if (head1 == null) {
dummy.next = head2;
head2 = head2.next;
} else {
dummy.next = head1;
head1 = head1.next;
}
} else {
if (head1.val <= head2.val) {
dummy.next = head1;
head1 = head1.next;
} else {
dummy.next = head2;
head2 = head2.next;
}
}
dummy = dummy.next;
}
return head.next;
}
}
| {
"content_hash": "0187aea81a5a525a538fcac39e8035a4",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 64,
"avg_line_length": 26.557142857142857,
"alnum_prop": 0.4658418504572351,
"repo_name": "wmh-demos/Secret",
"id": "374b18a98ac5e150fd5e0011055336a569bd76c9",
"size": "1913",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/me/wayne/leetcodetop100/listnode/LC148_SortList.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "165166"
},
{
"name": "Kotlin",
"bytes": "6098"
}
],
"symlink_target": ""
} |
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
global $Tools_model;
?>
<div class="row">
<div class="col s12" style="font-weight: bold;font-size: 120%;">Sent detail.</div>
</div>
<table class="striped">
<tr>
<th><?=$Tools_model->translate("Sent Date")?></th>
<th><?=$Tools_model->translate("Via")?></th>
<th><?=$Tools_model->translate("From")?></th>
<th><?=$Tools_model->translate("To")?></th>
<th><?=$Tools_model->translate("Detail")?></th>
</tr>
<?php
if(is_array($receiveDetail)){
foreach ($receiveDetail as $key => $value) {
?>
<tr class="bp-trHover shippingDetail-item" shippingID="<?=$value["shippingID"]?>">
<td><?=$value["sentDate-display"]?></td>
<td><?=$viaList[$value["viaID"]]["name"]?></td>
<td><?=$countryList[$value["sentFrom"]]["name"]?></td>
<td><?=$countryList[$value["sentTo"]]["name"]?></td>
<td><?=$value["detail"]?></td>
</tr>
<?php
}
}
?>
</table>
<script type="text/javascript">
var showShippingSampleObj = {
init: function(){
$('.shippingDetail-item').click(function(){
var shippingID=$(this).attr("shippingID");
window.open('shipping/receiveSample/'+shippingID+'/receive','_self');
});
Materialize.updateTextFields();
$('.modal-trigger').leanModal();
$('select').material_select();
}
};
showShippingSampleObj.init();
</script>
| {
"content_hash": "40d10ffe26c31f70532987b419cf2913",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 86,
"avg_line_length": 32.76923076923077,
"alnum_prop": 0.5334507042253521,
"repo_name": "thanaphutBenz/sourcing",
"id": "f4a84bda8362c870001953c34de38e47a3be3440",
"size": "1704",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/pages/shippingSample/showReceivedSample.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "365"
},
{
"name": "CSS",
"bytes": "2033658"
},
{
"name": "HTML",
"bytes": "6661"
},
{
"name": "JavaScript",
"bytes": "3231256"
},
{
"name": "PHP",
"bytes": "3473701"
}
],
"symlink_target": ""
} |
// Copyright 2012 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Provides the base Matcher interface. User code should use the
* matchers through assertThat statements and not directly.
*/
goog.provide('goog.labs.testing.Matcher');
/**
* A matcher object to be used in assertThat statements.
* @interface
*/
goog.labs.testing.Matcher = function() {};
/**
* Determines whether a value matches the constraints of the match.
*
* @param {*} value The object to match.
* @return {boolean} Whether the input value matches this matcher.
*/
goog.labs.testing.Matcher.prototype.matches = function(value) {};
/**
* Describes why the matcher failed.
*
* @param {*} value The value that didn't match.
* @param {string=} opt_description A partial description to which the reason
* will be appended.
*
* @return {string} Description of why the matcher failed.
*/
goog.labs.testing.Matcher.prototype.describe =
function(value, opt_description) {};
/**
* Generates a Matcher from the ‘matches’ and ‘describe’ functions passed in.
*
* @param {!Function} matchesFunction The ‘matches’ function.
* @param {Function=} opt_describeFunction The ‘describe’ function.
* @return {Function} The custom matcher.
*/
goog.labs.testing.Matcher.makeMatcher =
function(matchesFunction, opt_describeFunction) {
/**
* @constructor
* @implements {goog.labs.testing.Matcher}
*/
var matcherConstructor = function() {};
/** @override */
matcherConstructor.prototype.matches = matchesFunction;
if (opt_describeFunction) {
/** @override */
matcherConstructor.prototype.describe = opt_describeFunction;
}
return matcherConstructor;
};
| {
"content_hash": "f590ab52d825aed333c4f2084912b429",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 78,
"avg_line_length": 29.60759493670886,
"alnum_prop": 0.6930312099187687,
"repo_name": "be1be1/appinventor-polyu",
"id": "4a8928efa07ec13cc0a26cd316dff9c52d2c0e38",
"size": "2355",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "appinventor/lib/closure-library/closure/goog/labs/testing/matcher.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "225731"
},
{
"name": "HTML",
"bytes": "6412274"
},
{
"name": "Java",
"bytes": "5730619"
},
{
"name": "JavaScript",
"bytes": "13868207"
},
{
"name": "Python",
"bytes": "319218"
},
{
"name": "Scheme",
"bytes": "127667"
},
{
"name": "Shell",
"bytes": "2564"
}
],
"symlink_target": ""
} |
package org.apache.camel.language;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Base annotation for language expressions.
*/
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR })
public @interface LanguageExpression {
String language();
String expression();
}
| {
"content_hash": "a70afbdfefb5bbf3706308cce7b5452c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 74,
"avg_line_length": 26.526315789473685,
"alnum_prop": 0.7956349206349206,
"repo_name": "kevinearls/camel",
"id": "bcc94f6eafb2fa3d8b6f073cdfea119d4eec0c92",
"size": "1307",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "camel-core/src/main/java/org/apache/camel/language/LanguageExpression.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6519"
},
{
"name": "Batchfile",
"bytes": "6512"
},
{
"name": "CSS",
"bytes": "30373"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "11410"
},
{
"name": "Groovy",
"bytes": "54390"
},
{
"name": "HTML",
"bytes": "190929"
},
{
"name": "Java",
"bytes": "70990879"
},
{
"name": "JavaScript",
"bytes": "90399"
},
{
"name": "Makefile",
"bytes": "513"
},
{
"name": "Python",
"bytes": "36"
},
{
"name": "Ruby",
"bytes": "4802"
},
{
"name": "Scala",
"bytes": "323982"
},
{
"name": "Shell",
"bytes": "23616"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "546"
},
{
"name": "XSLT",
"bytes": "285105"
}
],
"symlink_target": ""
} |
package cn.intelvision.response.vqds;
import cn.intelvision.response.ZenoResponse;
/**
* Created by pc on 2016/3/16.
*/
public class VqdsRemoveImageResponse extends ZenoResponse {
private boolean success;
private int removed;
public boolean isSuccess() {
return success;
}
public int getRemoved() {
return removed;
}
}
| {
"content_hash": "9b4ff8cf1f38eae85ec32cd18156699c",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 59,
"avg_line_length": 17.476190476190474,
"alnum_prop": 0.6784741144414169,
"repo_name": "zeno-tech/intelvision-sdk-java",
"id": "8d2fcc9b53dbd990820108b1115338f28243662b",
"size": "367",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/cn/intelvision/response/vqds/VqdsRemoveImageResponse.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "159537"
}
],
"symlink_target": ""
} |
package ru.org.codingteam.keter.game
case class Faction(name: String) | {
"content_hash": "0f1a82fc8ea98111fad4305b678eac4a",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 36,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.8142857142857143,
"repo_name": "codingteam/Keter",
"id": "cc9be47f0f9f2b0c70de49d517e5796c07a24936",
"size": "70",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/scala/ru/org/codingteam/keter/game/Faction.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "125"
},
{
"name": "PowerShell",
"bytes": "170"
},
{
"name": "Scala",
"bytes": "75442"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace AdsListing.Models
{
public class EditUserViewModel
{
public ApplicationUser User { get; set; }
public string Password { get; set; }
[DisplayName("Confirm Password")]
[Compare("Password", ErrorMessage = "Password does not match.")]
public string ConfirmPassword { get; set; }
public IList<Role> Roles { get; set; }
}
} | {
"content_hash": "f46ccf6c870f9f1362acb6668ae969d3",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 72,
"avg_line_length": 24,
"alnum_prop": 0.6685606060606061,
"repo_name": "kemeh/AdsListing.NET",
"id": "b19b4e7fd314ab12f6e6296f113e5ea19796e9b4",
"size": "530",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AdsListing/Models/EditUserViewModel.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "101"
},
{
"name": "C#",
"bytes": "158290"
},
{
"name": "HTML",
"bytes": "5127"
},
{
"name": "JavaScript",
"bytes": "10918"
}
],
"symlink_target": ""
} |
@extends('backend::layout')
@section('page_header', trans("backend.profile.profile"))
@section('page_description', trans("backend.profile.edit"))
@section('content')
<div class="panel panel-default">
{!! Form::model($admin, ['method' => 'PATCH', 'route' => ['zxadmin.update']]) !!}
<div class="panel-body">
<div class="form-group">
{!! Form::label("email", trans("backend.profile.email"), ['class' => 'label-text']) !!}
{!! Form::text("email", null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label("name", trans("backend.profile.name"), ['class' => 'label-text']) !!}
{!! Form::text("name", null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label("password", trans("backend.profile.password"), ['class' => 'label-text']) !!}
<input class="form-control" name="password" type="password" id="password">
</div>
<div class="form-group">
{!! Form::label("password_confirmation", trans("backend.profile.password_confirmation"), ['class' => 'label-text']) !!}
<input type="password" id="password_confirmation" class="form-control" name="password_confirmation">
</div>
<hr>
<div class="form-group {{ $errors->has('my_password') ? 'has-error' : ''}}">
{!! Form::label("my_password", trans("backend.profile.current_password"), ['class' => 'label-text text-red']) !!}
<input class="form-control" name="my_password" type="password" id="my_password">
{!! $errors->first('my_password', '<p class="help-block">:message</p>') !!}
</div>
@if ($errors->has('demo_update_admin_profile'))
<div class="alert alert-danger">
{!! $errors->first('demo_update_admin_profile') !!}
</div>
@endif
</div>
<div class="panel-footer">
<button type="submit" class="btn btn-primary pull-right"><i class="fa fa-refresh"></i> {!! trans('backend.profile.edit') !!}</button>
<div class="clearfix"></div>
</div>
{!! Form::close() !!}
</div>
@endsection
| {
"content_hash": "71aec033829d80211c36cacb36f153e0",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 141,
"avg_line_length": 46.82222222222222,
"alnum_prop": 0.5733270052206929,
"repo_name": "indesign47/core",
"id": "a186e7fd84278c344906c15210100bccd9fae808",
"size": "2107",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "resources/views/backend/profile.blade.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "165235"
},
{
"name": "HTML",
"bytes": "252547"
},
{
"name": "PHP",
"bytes": "810245"
},
{
"name": "PowerShell",
"bytes": "468"
},
{
"name": "Ruby",
"bytes": "1348"
},
{
"name": "Shell",
"bytes": "1490"
}
],
"symlink_target": ""
} |
In this example we will walk you through the use of pretraining
to transfer learned weights from a trained model to a new model.
The code for transfering pretrained weights for a
fully-connected network is in `fnet_pretraining.py`. To run this
example, execute the following command in your shell
```
python fcnet_pretraining.py
```
| {
"content_hash": "e100dd418fee61a99b795ef273a1a301",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 64,
"avg_line_length": 33.5,
"alnum_prop": 0.7910447761194029,
"repo_name": "deepchem/deepchem",
"id": "393466fe90db4b74a8254436cff6e84115fed999",
"size": "358",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "examples/pretraining/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "6616"
},
{
"name": "Jupyter Notebook",
"bytes": "59756"
},
{
"name": "PowerShell",
"bytes": "1504"
},
{
"name": "Python",
"bytes": "3873744"
},
{
"name": "Shell",
"bytes": "5145"
}
],
"symlink_target": ""
} |
@implementation UIImage (UIImage_ImmediateLoading)
+ (UIImage *)imageImmediateLoadWithContentsOfFile:(NSString *)path
{
return [[UIImage alloc] initImmediateLoadWithContentsOfFile:path];
}
- (UIImage *)initImmediateLoadWithContentsOfFile:(NSString *)path
{
UIImage *image = [[UIImage alloc] initWithContentsOfFile:path];
if (!image) return nil;
CGImageRef imageRef = [image CGImage];
CGColorSpaceRef gray = CGColorSpaceCreateDeviceGray();
CGColorSpaceRef colorSpace = CGImageGetColorSpace(imageRef);
// Stack Overflow and this original gist tell us kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little
// is required for the work to stay off the main thread but we can't source this
// Considering you can't create a bitmap context for a grayscale with those flags,
// we'll take out chances this way
CGBitmapInfo info = 0;
if (colorSpace == gray) {
// |= to stop clang from complaining. From the docs:
// "The constants for specifying the alpha channel information
// are declared with the CGImageAlphaInfo type but can be passed to this parameter safely."
info |= kCGImageAlphaNone;
} else {
info = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little;
}
CGColorSpaceRelease(gray);
CGRect rect = CGRectMake(0.f, 0.f, CGImageGetWidth(imageRef), CGImageGetHeight(imageRef));
CGContextRef bitmapContext = CGBitmapContextCreate(NULL,
rect.size.width,
rect.size.height,
CGImageGetBitsPerComponent(imageRef),
0,
colorSpace,
info);
CGContextDrawImage(bitmapContext, rect, imageRef);
CGImageRef decompressedImageRef = CGBitmapContextCreateImage(bitmapContext);
UIImage *decompressedImage = [[UIImage alloc] initWithCGImage:decompressedImageRef];
CGImageRelease(decompressedImageRef);
CGContextRelease(bitmapContext);
return decompressedImage;
}
@end
| {
"content_hash": "2c9707ed5e7c7d6c737cfe9c26903a4f",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 113,
"avg_line_length": 44.6,
"alnum_prop": 0.6385650224215247,
"repo_name": "NghiaTranUIT/energy",
"id": "fa3b884caf345006241ae302930e5a728ff0be65",
"size": "2359",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "Classes/Categories/UIImage+ImmediateLoading.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "853"
},
{
"name": "C++",
"bytes": "810"
},
{
"name": "HTML",
"bytes": "10205"
},
{
"name": "JavaScript",
"bytes": "2832"
},
{
"name": "Makefile",
"bytes": "1944"
},
{
"name": "Objective-C",
"bytes": "1333160"
},
{
"name": "Ruby",
"bytes": "13313"
}
],
"symlink_target": ""
} |
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Super Regression" verbose="1" parallel="true">
<test name="test1">
<groups>
<define name="all">
<include name="unit"/>
</define>
<run>
<include name="all"/>
</run>
</groups>
<classes>
<class name="test.java.com.tango.uberscrum.services.test.DailyScrumControllerTest" />
</classes>
</test>
</suite> | {
"content_hash": "118c0dd41f08c52c936e91f4cf9f55f0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 87,
"avg_line_length": 25.647058823529413,
"alnum_prop": 0.591743119266055,
"repo_name": "mtang35/uberscrum-services",
"id": "ad5df2e4e7ea0edef8e037cafd01dd7197a2e50e",
"size": "436",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "testng.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "5076"
}
],
"symlink_target": ""
} |
///////////////////////////////////////////////////////////////////////////////
//
// @@@ START COPYRIGHT @@@
//
// 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.
//
// @@@ END COPYRIGHT @@@
//
///////////////////////////////////////////////////////////////////////////////
#ifndef TCDBSQLITE_H_
#define TCDBSQLITE_H_
#include <stdlib.h>
#include <sqlite3.h>
#include "trafconfig.h"
#include "tcdbstore.h"
class CTcdbSqlite : public CTcdbStore
{
public:
CTcdbSqlite( void );
~CTcdbSqlite( void );
int Close( void );
int AddRegistryKey( const char *key );
int AddRegistryProcess( const char *name );
int AddRegistryClusterData( const char *key, const char *dataValue );
int AddRegistryProcessData( const char *procName
, const char *key
, const char *dataValue );
int AddUniqueString( int nid, int id, const char *uniqStr );
int DeleteNodeData( int pnid );
int DeleteUniqueString( int nid );
int GetNode( int nid
, node_configuration_t &nodeConfig );
int GetNode( const char *name
, node_configuration_t &nodeConfig );
int GetNodes( int &count
, int max
, node_configuration_t nodeConfig[] );
int GetPNode( int pnid
, physical_node_configuration_t &pnodeConfig );
int GetPNode( const char *name
, physical_node_configuration_t &pnodeConfig );
int GetSNodes( int &count
, int max
, physical_node_configuration_t pNodeConfig[] );
int GetPersistProcess( const char *persistPrefix
, persist_configuration_t &persistConfig );
int GetPersistProcessKeys( const char *persistProcessKeys );
int GetRegistryClusterSet( int &count
, int max
, registry_configuration_t registryConfig[] );
int GetRegistryProcessSet( int &count
, int max
, registry_configuration_t registryConfig[] );
int GetUniqueString( int nid, int id, const char *uniqStr );
int GetUniqueStringId( int nid
, const char *uniqStr
, int &id );
int GetUniqueStringIdMax( int nid, int &id );
int Initialize( void );
inline bool IsInitialized( void ) { return( (db_ != NULL) ); }
int SaveLNodeData( int nid
, int pnid
, int firstCore
, int lastCore
, int processors
, int roles );
int SavePNodeData( const char *name
, int pnid
, int excludedFirstCore
, int excludedLastCore );
int UpdatePNodeConfig( int pnid
, const char *name
, int excludedFirstCore
, int excludedLastCore );
protected:
private:
int GetSNodeData( int pnid
, const char *nodename
, int excfirstcore
, int exclastcore
, physical_node_configuration_t &spareNodeConfig );
void SetLNodeData( int nid
, int pnid
, const char *nodename
, int excfirstcore
, int exclastcore
, int firstcore
, int lastcore
, int processors
, int roles
, node_configuration_t &nodeConfig );
void SetPNodeData( int pnid
, const char *nodename
, int excfirstcore
, int exclastcore
, physical_node_configuration_t &pnodeConfig );
int SetPersistProcessData( const char *persistkey
, const char *persistvalue
, persist_configuration_t &persistConfig );
int UpdatePNodeData( int pnid
, const char *name
, int excludedFirstCore
, int excludedLastCore );
sqlite3 *db_;
};
#endif /* TCDBSQLITE_H_ */
| {
"content_hash": "49e29b28d35b50223c215ac1dfa86fbc",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 83,
"avg_line_length": 41.707692307692305,
"alnum_prop": 0.4953891552932497,
"repo_name": "mashengchen/incubator-trafodion",
"id": "5659f31692ab94557ca2866ba9157939107f88f4",
"size": "5422",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/sqf/monitor/linux/tcdbsqlite.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "1C Enterprise",
"bytes": "27762"
},
{
"name": "Awk",
"bytes": "20971"
},
{
"name": "Batchfile",
"bytes": "27013"
},
{
"name": "C",
"bytes": "18877152"
},
{
"name": "C++",
"bytes": "68786466"
},
{
"name": "CSS",
"bytes": "99092"
},
{
"name": "GDB",
"bytes": "62692"
},
{
"name": "Groff",
"bytes": "46673"
},
{
"name": "HTML",
"bytes": "4618"
},
{
"name": "Inno Setup",
"bytes": "14579"
},
{
"name": "Java",
"bytes": "12232679"
},
{
"name": "JavaScript",
"bytes": "883279"
},
{
"name": "LLVM",
"bytes": "42952"
},
{
"name": "Makefile",
"bytes": "321639"
},
{
"name": "Objective-C",
"bytes": "637659"
},
{
"name": "PHP",
"bytes": "8438"
},
{
"name": "PLpgSQL",
"bytes": "197622"
},
{
"name": "Perl",
"bytes": "549860"
},
{
"name": "Protocol Buffer",
"bytes": "121282"
},
{
"name": "Python",
"bytes": "330201"
},
{
"name": "QMake",
"bytes": "3622"
},
{
"name": "Ruby",
"bytes": "8053"
},
{
"name": "SQLPL",
"bytes": "60330"
},
{
"name": "Shell",
"bytes": "1999068"
},
{
"name": "Tcl",
"bytes": "2763"
},
{
"name": "XSLT",
"bytes": "6100"
},
{
"name": "Yacc",
"bytes": "1368077"
}
],
"symlink_target": ""
} |
package org.hope6537.note.design.visitor.example;
/**
* 抽象元素
*/
public abstract class AbstractElement {
public abstract void doSomething();
public abstract void accept(Visitor visitor);
}
| {
"content_hash": "4c2bf42be5a266cd9246a84a79b710a9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 49,
"avg_line_length": 16.833333333333332,
"alnum_prop": 0.7277227722772277,
"repo_name": "Hope6537/hope-tactical-equipment",
"id": "966d4735258e46d597c4a541e5af6ff3bcef303b",
"size": "210",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "hope-note-module/hope-java-native-note/src/main/java/org/hope6537/note/design/visitor/example/AbstractElement.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "794"
},
{
"name": "HTML",
"bytes": "681"
},
{
"name": "Java",
"bytes": "2198948"
},
{
"name": "Python",
"bytes": "237270"
},
{
"name": "Shell",
"bytes": "21218"
}
],
"symlink_target": ""
} |
<?php
namespace ApiPlatform\Core\Hal\Serializer;
use ApiPlatform\Core\Api\ResourceClassResolverInterface;
use ApiPlatform\Core\DataProvider\PaginatorInterface;
use ApiPlatform\Core\Serializer\ContextTrait;
use ApiPlatform\Core\Util\IriHelper;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
* Normalizes collections in the HAL format.
*
* @author Kevin Dunglas <dunglas@gmail.com>
* @author Hamza Amrouche <hamza@les-tilleuls.coop>
*/
final class CollectionNormalizer implements NormalizerInterface, NormalizerAwareInterface
{
use ContextTrait;
use NormalizerAwareTrait;
const FORMAT = 'jsonhal';
private $resourceClassResolver;
private $pageParameterName;
public function __construct(ResourceClassResolverInterface $resourceClassResolver, string $pageParameterName)
{
$this->resourceClassResolver = $resourceClassResolver;
$this->pageParameterName = $pageParameterName;
}
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
{
return self::FORMAT === $format && (is_array($data) || ($data instanceof \Traversable));
}
/**
* {@inheritdoc}
*/
public function normalize($object, $format = null, array $context = [])
{
$data = [];
if (isset($context['api_sub_level'])) {
foreach ($object as $index => $obj) {
$data[$index] = $this->normalizer->normalize($obj, $format, $context);
}
return $data;
}
$resourceClass = $this->resourceClassResolver->getResourceClass($object, $context['resource_class'] ?? null, true);
$context = $this->initContext($resourceClass, $context);
$parsed = IriHelper::parseIri($context['request_uri'] ?? '/', $this->pageParameterName);
$paginated = $isPaginator = $object instanceof PaginatorInterface;
if ($isPaginator) {
$currentPage = $object->getCurrentPage();
$lastPage = $object->getLastPage();
$itemsPerPage = $object->getItemsPerPage();
$paginated = 1. !== $lastPage;
}
$data = [
'_links' => [
'self' => IriHelper::createIri($parsed['parts'], $parsed['parameters'], $this->pageParameterName, $paginated ? $currentPage : null),
],
];
if ($paginated) {
$data['_links']['first'] = IriHelper::createIri($parsed['parts'], $parsed['parameters'], $this->pageParameterName, 1.);
$data['_links']['last'] = IriHelper::createIri($parsed['parts'], $parsed['parameters'], $this->pageParameterName, $lastPage);
if (1. !== $currentPage) {
$data['_links']['prev'] = IriHelper::createIri($parsed['parts'], $parsed['parameters'], $this->pageParameterName, $currentPage - 1.);
}
if ($currentPage !== $lastPage) {
$data['_links']['next'] = IriHelper::createIri($parsed['parts'], $parsed['parameters'], $this->pageParameterName, $currentPage + 1.);
}
}
foreach ($object as $obj) {
$item = $this->normalizer->normalize($obj, $format, $context);
$data['_embedded']['item'][] = $item;
$data['_links']['item'][] = $item['_links']['self'];
}
if (is_array($object) || $object instanceof \Countable) {
$data['totalItems'] = $object instanceof PaginatorInterface ? (int) $object->getTotalItems() : count($object);
}
if ($isPaginator) {
$data['itemsPerPage'] = (int) $itemsPerPage;
}
return $data;
}
}
| {
"content_hash": "460d4a9150c3adf1f3105f1448802ce2",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 149,
"avg_line_length": 35.083333333333336,
"alnum_prop": 0.6078120876220638,
"repo_name": "yoan-durand/test-api-platform",
"id": "a418f3fd1cd7bb8492fc6d7a09f7eea80c4a844b",
"size": "4020",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "apps/platform/vendor/api-platform/core/src/Hal/Serializer/CollectionNormalizer.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "102118"
},
{
"name": "HTML",
"bytes": "729"
},
{
"name": "JavaScript",
"bytes": "335574"
},
{
"name": "PHP",
"bytes": "68732"
},
{
"name": "Shell",
"bytes": "893"
},
{
"name": "TypeScript",
"bytes": "1933"
}
],
"symlink_target": ""
} |
'use strict';
var assert = require('assert'),
sinon = require('sinon'),
http = require('http'),
init = require('./init'),
common = require('../../lib/routes/common'),
refresh = require('../../lib/routes/refresh');
/* jshint unused: false */
suite('refresh', function () {
test('test_get_refresh', function () {
//given
var req = sinon.stub(),
res = sinon.stub();
req.param = sinon.stub().returns('region1');
req.session = sinon.stub();
req.session.role = 'Admin';
var requestStub = sinon.stub();
var httpStub = sinon.stub(http, 'request').returns(requestStub);
requestStub.on = sinon.stub();
requestStub.write = sinon.stub();
requestStub.end = sinon.stub();
//when
refresh.getRefresh(req, res);
//then
assert(requestStub.on.calledOnce);
assert(requestStub.write.calledOnce);
assert(requestStub.end.calledOnce);
httpStub.restore();
});
test('test_get_refresh_with_undefined_role', function () {
//given
var req = sinon.stub(),
res = sinon.stub();
req.param = sinon.stub().returns('region1');
req.session = sinon.stub();
req.session.role = undefined;
var commonStub = sinon.stub(common, 'notAuthorized');
//when
refresh.getRefresh(req, res);
//then
assert(commonStub.calledOnce);
commonStub.restore();
});
});
| {
"content_hash": "ffebe8b6f16558406a3d64dc93fc8b71",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 72,
"avg_line_length": 23.640625,
"alnum_prop": 0.5565102445472571,
"repo_name": "Fiware/ops.Health",
"id": "ab8c404694b355e7235a02345639074917de36d0",
"size": "2139",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "dashboard/test/unit/test_refresh.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "17406"
},
{
"name": "Gherkin",
"bytes": "498"
},
{
"name": "HTML",
"bytes": "20288"
},
{
"name": "JavaScript",
"bytes": "165656"
},
{
"name": "Python",
"bytes": "180332"
},
{
"name": "Ruby",
"bytes": "1887"
},
{
"name": "Shell",
"bytes": "43383"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types = 1);
namespace Go\Aop\Framework;
use RuntimeException;
class AfterThrowingInterceptorTest extends AbstractInterceptorTest
{
public function testAdviceIsNotCalledAfterInvocation()
{
$sequence = [];
$advice = $this->getAdvice($sequence);
$invocation = $this->getInvocation($sequence);
$interceptor = new AfterThrowingInterceptor($advice);
$result = $interceptor->invoke($invocation);
$this->assertEquals('invocation', $result, "Advice should not affect the return value of invocation");
$this->assertEquals(['invocation'], $sequence, "Advice should not be invoked");
}
public function testAdviceIsCalledAfterExceptionInInvocation()
{
$sequence = [];
$advice = $this->getAdvice($sequence);
$invocation = $this->getInvocation($sequence, true);
$interceptor = new AfterThrowingInterceptor($advice);
$this->expectException(RuntimeException::class);
try {
$interceptor->invoke($invocation);
} catch (\Exception $e) {
$this->assertEquals(['invocation', 'advice'], $sequence, "Advice should be invoked after invocation");
throw $e;
}
}}
| {
"content_hash": "af10dd5194384086ff21c61f5f5b47fb",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 114,
"avg_line_length": 31.45,
"alnum_prop": 0.6391096979332274,
"repo_name": "goaop/framework",
"id": "3123c4dbb6283b7c32c6643d0d823948862d880b",
"size": "1476",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/Go/Aop/Framework/AfterThrowingInterceptorTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "503202"
},
{
"name": "Shell",
"bytes": "176"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _05.CompareElementWithNeighbours
{
class CompareElementWithNeighbours
{
static void Main(string[] args)
{
}
}
}
| {
"content_hash": "a9613075ea4cef0651211e521bc57fde",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 42,
"avg_line_length": 18.4,
"alnum_prop": 0.6920289855072463,
"repo_name": "PolyaNM/TelerikAcademy",
"id": "e7716ac853298a303464b58839bb9f7619c198b3",
"size": "278",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "C#/CSharp2-Homework9-Methods/05.CompareElementWithNeighbours/CompareElementWithNeighbours.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "792195"
},
{
"name": "CSS",
"bytes": "3773"
},
{
"name": "JavaScript",
"bytes": "29424"
}
],
"symlink_target": ""
} |
function problem1(form) {
var numbers=[];
var counter;
for (counter=0;counter<20;counter+=1){
numbers.push(counter * 5);
console.log(counter +" - >" + numbers[counter]);
}
}
function problem2(form) {
var isEqual = false;
var line1= form.secondArray1.value;
var line2= form.secondArray2.value;
var array1 = line1.split(",");
var array2 = line2.split(",");
var diff, index;
if (array1.length === array2.length)
{
isEqual = true;
diff = 0;
for (index = 0; index < array1.length; index+=1)
{
if (array1[index] !== array2[index])
{
isEqual=false;
}
}
//isEqual = diff == 0 ? true : false;
}
if (isEqual === true)
{
console.log("The two arrays are equal");
}
else
{
console.log("The two arrays are NOT equal");
}
}
function problem3(form){
var line = form.third.value;
var arrayOfNumbers = line.split(",").map(function(i){
return parseInt(i, 10);
});
var index, currentCount = 1, maxCount = 0, equalNumber, arrayOfEquals = [];
for (index = 1; index < arrayOfNumbers.length;index+=1){
if (arrayOfNumbers[index]===arrayOfNumbers[index - 1]){
currentCount+=1;
if (currentCount>maxCount){
maxCount = currentCount;
equalNumber = arrayOfNumbers[index];
}
}
else{
currentCount = 1;
}
}
if (maxCount===0){
equalNumber = arrayOfNumbers[arrayOfNumbers.length - 1];
maxCount = 1;
}
for (index = 0;index<maxCount;index+=1){
arrayOfEquals[index] = equalNumber;
}
console.log(arrayOfEquals.join(","))
}
function problem4(form) {
var line = form.fourth.value;
var arrayOfNumbers = line.split(",").map(function (i) {
return parseInt(i, 10);
});
var index, currentCount = 1, maxCount = 0, currentStart, currentFinish, maxStart, maxFinish, isFirst = true, increasingSequence = false, maxIncrArray = [];
function checkMaxSequence() {
if (currentCount > maxCount) {
maxCount = currentCount;
maxStart = currentStart;
maxFinish = currentFinish;
}
}
for (index = 1; index < arrayOfNumbers.length; index += 1) {
if (arrayOfNumbers[index] > arrayOfNumbers[index - 1]) {
currentCount += 1;
if (isFirst === true) {
currentStart = index - 1;
isFirst = false;
increasingSequence = true;
}
if (index === arrayOfNumbers.length - 1) {
currentFinish = index;
checkMaxSequence();
}
}
else if (increasingSequence === true) {
currentFinish = index - 1;
isFirst = true;
checkMaxSequence();
currentCount = 1;
}
}
for (index = maxStart; index <= maxFinish; index += 1) {
maxIncrArray[index - maxStart] = arrayOfNumbers[index];
}
console.log(maxIncrArray.join(","));
}
function problem5(form) {
var line = form.fifth.value;
var arrayOfNumbers = line.split(",").map(function (i) {
return parseInt(i, 10);
});
var index,
currentMin = arrayOfNumbers[0],
indexOfMin,
temp,
currentMinIndex=0;
for (index = 1; index < arrayOfNumbers.length;index +=1){
if (arrayOfNumbers[index] < currentMin){
currentMin = arrayOfNumbers[index];
indexOfMin = index;
}
if (index === arrayOfNumbers.length - 1){
temp = arrayOfNumbers[currentMinIndex];
arrayOfNumbers[currentMinIndex] = currentMin;
arrayOfNumbers[indexOfMin] = temp;
currentMinIndex++;
indexOfMin = currentMinIndex;
index = currentMinIndex;
currentMin = arrayOfNumbers[currentMinIndex];
}
}
console.log(arrayOfNumbers.join(", "));
}
function problem6(form) {
var line = form.sixth.value;
var arrayOfNumbers = line.split(",").map(function (i) {
return parseInt(i, 10);
});
var mostFrequentNumber,
currentCheckedNumber = arrayOfNumbers[0],
currentCount = 0,
maxCount = 0,
index,
checkedPosition = 0;
for(index = 0; index < arrayOfNumbers.length;index+=1){
if (arrayOfNumbers[index] === currentCheckedNumber){
currentCount+=1;
}
if (arrayOfNumbers.length - 1 === index && index >= checkedPosition){
if (currentCount > maxCount){
maxCount = currentCount;
mostFrequentNumber = arrayOfNumbers[checkedPosition];
}
checkedPosition++;
currentCount = 0;
index = 0;
currentCheckedNumber = arrayOfNumbers[checkedPosition];
}
}
var final = mostFrequentNumber + ","
console.log(final.repeat(maxCount-1) + mostFrequentNumber);
}
function problem7(form) {
var line = form.seventhArray.value;
var arrayOfNumbers = line.split(",").map(function (i) {
return parseInt(i, 10);
});
var searchedNumber = form.seventhNumber.value * 1;
function compareNumbers(a, b) {
a - b;
}
arrayOfNumbers.sort(compareNumbers());
var targetPos =-1,
begin = 0,
end = arrayOfNumbers.length- 1,
mid;
while (begin <= end&&targetPos===-1)
{
mid = Math.round((begin + end) / 2);
if (arrayOfNumbers[mid] < searchedNumber)
{
begin = mid + 1;
continue;
}
else if (arrayOfNumbers[mid] > searchedNumber)
{
end = mid - 1;
continue;
}
else
{
targetPos=mid;
}
}
if (targetPos === -1)
{
console.log("No value found");
}
else
{
console.log("The number "+ searchedNumber+ " is at position "+ targetPos + " at the sorted array.");
}
} | {
"content_hash": "2f60fb928566a18a91ae6a3abe5874b9",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 159,
"avg_line_length": 28.17511520737327,
"alnum_prop": 0.543179587831207,
"repo_name": "emilti/Telerik-Academy-My-Courses",
"id": "ca54724d469b848f0127b6ada5f7c6e5cebb5e3b",
"size": "6114",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "JavaScript Fundamentals/05.Arrays/scripts.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "55351"
},
{
"name": "C#",
"bytes": "2038086"
},
{
"name": "CSS",
"bytes": "61494"
},
{
"name": "HTML",
"bytes": "216441"
},
{
"name": "JavaScript",
"bytes": "678560"
},
{
"name": "XSLT",
"bytes": "4923"
}
],
"symlink_target": ""
} |
package com.thinkbiganalytics.policy.rest.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* Represents a given validation policy/rule that should be applied to a given field upon ingest.
* Refer to the {@link FieldValidationRuleBuilder} for building this object
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class FieldValidationRule extends BaseUiPolicyRule {
}
| {
"content_hash": "b33d59b84e63fc279288a27eb65c3d20",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 97,
"avg_line_length": 28.857142857142858,
"alnum_prop": 0.806930693069307,
"repo_name": "claudiu-stanciu/kylo",
"id": "10f53a6a64a56e09135ac5beaf72ae2de360548c",
"size": "1071",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "services/field-policy-service/field-policy-rest-model/src/main/java/com/thinkbiganalytics/policy/rest/model/FieldValidationRule.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5006"
},
{
"name": "CSS",
"bytes": "265273"
},
{
"name": "FreeMarker",
"bytes": "785"
},
{
"name": "HTML",
"bytes": "764976"
},
{
"name": "Java",
"bytes": "10148636"
},
{
"name": "JavaScript",
"bytes": "3529132"
},
{
"name": "PLpgSQL",
"bytes": "31537"
},
{
"name": "SQLPL",
"bytes": "11241"
},
{
"name": "Scala",
"bytes": "32595"
},
{
"name": "Shell",
"bytes": "102225"
},
{
"name": "TypeScript",
"bytes": "543195"
}
],
"symlink_target": ""
} |
module.exports = (docLevel, level) => docLevel.split('.').length === (level + 1);
| {
"content_hash": "f3d2ffe409df2d49e431812c9811a253",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 81,
"avg_line_length": 82,
"alnum_prop": 0.6219512195121951,
"repo_name": "WarpWorks/warpjs",
"id": "9261994dc773fa569d46606a318b4527ba6aec25",
"size": "82",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/core/is-last-doc-level.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "688"
},
{
"name": "Handlebars",
"bytes": "96857"
},
{
"name": "JavaScript",
"bytes": "1248203"
},
{
"name": "Less",
"bytes": "76280"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Can. J. Bot. 67(5): 1554 (1989)
#### Original name
Phaeosphaeria pulchra Shoemaker & C.E. Babc.
### Remarks
null | {
"content_hash": "ce77f1a3e251ceeee2fc0504954ee704",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 44,
"avg_line_length": 13.538461538461538,
"alnum_prop": 0.6761363636363636,
"repo_name": "mdoering/backbone",
"id": "95d383c5903a1c82f37c6aa8ed0aa1f747c0a704",
"size": "244",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Dothideomycetes/Pleosporales/Phaeosphaeriaceae/Phaeosphaeria/Phaeosphaeria pulchra/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package com.huawei.esdk.tp.professional.local.impl.autogen;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.huawei.esdk.tp.professional.local.bean.VideoSourcesInfoEx;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="resultCode" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="videoSourcesInfos" type="{http://smc.huawei.com/}VideoSourcesInfoEx" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"resultCode",
"videoSourcesInfos"
})
@XmlRootElement(name = "queryVideoOutSrcStateExResponse")
public class QueryVideoOutSrcStateExResponse {
@XmlElement(required = true, type = String.class)
@XmlJavaTypeAdapter(Adapter3 .class)
@XmlSchemaType(name = "int")
protected Integer resultCode;
protected List<VideoSourcesInfoEx> videoSourcesInfos;
/**
* Gets the value of the resultCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public Integer getResultCode() {
return resultCode;
}
/**
* Sets the value of the resultCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setResultCode(Integer value) {
this.resultCode = value;
}
/**
* Gets the value of the videoSourcesInfos property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the videoSourcesInfos property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getVideoSourcesInfos().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link VideoSourcesInfoEx }
*
*
*/
public List<VideoSourcesInfoEx> getVideoSourcesInfos() {
if (videoSourcesInfos == null) {
videoSourcesInfos = new ArrayList<VideoSourcesInfoEx>();
}
return this.videoSourcesInfos;
}
}
| {
"content_hash": "77df81d487fb9233895160a46b399b9c",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 135,
"avg_line_length": 28.78846153846154,
"alnum_prop": 0.6526386105544422,
"repo_name": "eSDK/esdk_tp_native_java",
"id": "03dfac201ed69396efa7092b1c57feb3ed9bce5a",
"size": "2994",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/esdk_tp_native_professional_java/src/main/java/com/huawei/esdk/tp/professional/local/impl/autogen/QueryVideoOutSrcStateExResponse.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "130108"
},
{
"name": "Java",
"bytes": "1734672"
},
{
"name": "JavaScript",
"bytes": "1209974"
}
],
"symlink_target": ""
} |
.class public final Lcom/htc/protobuf/RpcUtil;
.super Ljava/lang/Object;
.source "RpcUtil.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/htc/protobuf/RpcUtil$AlreadyCalledException;
}
.end annotation
# direct methods
.method private constructor <init>()V
.locals 0
.prologue
.line 39
invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method static synthetic access$000(Lcom/htc/protobuf/Message;Lcom/htc/protobuf/Message;)Lcom/htc/protobuf/Message;
.locals 1
.parameter "x0"
.parameter "x1"
.prologue
.line 38
invoke-static {p0, p1}, Lcom/htc/protobuf/RpcUtil;->copyAsType(Lcom/htc/protobuf/Message;Lcom/htc/protobuf/Message;)Lcom/htc/protobuf/Message;
move-result-object v0
return-object v0
.end method
.method private static copyAsType(Lcom/htc/protobuf/Message;Lcom/htc/protobuf/Message;)Lcom/htc/protobuf/Message;
.locals 1
.parameter
.parameter "source"
.annotation system Ldalvik/annotation/Signature;
value = {
"<Type::",
"Lcom/htc/protobuf/Message;",
">(TType;",
"Lcom/htc/protobuf/Message;",
")TType;"
}
.end annotation
.prologue
.line 102
.local p0, typeDefaultInstance:Lcom/htc/protobuf/Message;,"TType;"
invoke-interface {p0}, Lcom/htc/protobuf/Message;->newBuilderForType()Lcom/htc/protobuf/Message$Builder;
move-result-object v0
invoke-interface {v0, p1}, Lcom/htc/protobuf/Message$Builder;->mergeFrom(Lcom/htc/protobuf/Message;)Lcom/htc/protobuf/Message$Builder;
move-result-object v0
invoke-interface {v0}, Lcom/htc/protobuf/Message$Builder;->build()Lcom/htc/protobuf/Message;
move-result-object v0
return-object v0
.end method
.method public static generalizeCallback(Lcom/htc/protobuf/RpcCallback;Ljava/lang/Class;Lcom/htc/protobuf/Message;)Lcom/htc/protobuf/RpcCallback;
.locals 1
.parameter
.parameter
.parameter
.annotation system Ldalvik/annotation/Signature;
value = {
"<Type::",
"Lcom/htc/protobuf/Message;",
">(",
"Lcom/htc/protobuf/RpcCallback",
"<TType;>;",
"Ljava/lang/Class",
"<TType;>;TType;)",
"Lcom/htc/protobuf/RpcCallback",
"<",
"Lcom/htc/protobuf/Message;",
">;"
}
.end annotation
.prologue
.line 81
.local p0, originalCallback:Lcom/htc/protobuf/RpcCallback;,"Lcom/htc/protobuf/RpcCallback<TType;>;"
.local p1, originalClass:Ljava/lang/Class;,"Ljava/lang/Class<TType;>;"
.local p2, defaultInstance:Lcom/htc/protobuf/Message;,"TType;"
new-instance v0, Lcom/htc/protobuf/RpcUtil$1;
invoke-direct {v0, p1, p2, p0}, Lcom/htc/protobuf/RpcUtil$1;-><init>(Ljava/lang/Class;Lcom/htc/protobuf/Message;Lcom/htc/protobuf/RpcCallback;)V
return-object v0
.end method
.method public static newOneTimeCallback(Lcom/htc/protobuf/RpcCallback;)Lcom/htc/protobuf/RpcCallback;
.locals 1
.parameter
.annotation system Ldalvik/annotation/Signature;
value = {
"<ParameterType:",
"Ljava/lang/Object;",
">(",
"Lcom/htc/protobuf/RpcCallback",
"<TParameterType;>;)",
"Lcom/htc/protobuf/RpcCallback",
"<TParameterType;>;"
}
.end annotation
.prologue
.line 120
.local p0, originalCallback:Lcom/htc/protobuf/RpcCallback;,"Lcom/htc/protobuf/RpcCallback<TParameterType;>;"
new-instance v0, Lcom/htc/protobuf/RpcUtil$2;
invoke-direct {v0, p0}, Lcom/htc/protobuf/RpcUtil$2;-><init>(Lcom/htc/protobuf/RpcCallback;)V
return-object v0
.end method
.method public static specializeCallback(Lcom/htc/protobuf/RpcCallback;)Lcom/htc/protobuf/RpcCallback;
.locals 0
.parameter
.annotation system Ldalvik/annotation/Signature;
value = {
"<Type::",
"Lcom/htc/protobuf/Message;",
">(",
"Lcom/htc/protobuf/RpcCallback",
"<",
"Lcom/htc/protobuf/Message;",
">;)",
"Lcom/htc/protobuf/RpcCallback",
"<TType;>;"
}
.end annotation
.prologue
.line 53
.local p0, originalCallback:Lcom/htc/protobuf/RpcCallback;,"Lcom/htc/protobuf/RpcCallback<Lcom/htc/protobuf/Message;>;"
return-object p0
.end method
| {
"content_hash": "728983c7a8d1f2b185ee0c890b20c40d",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 148,
"avg_line_length": 29.94,
"alnum_prop": 0.642618570474282,
"repo_name": "baidurom/devices-onex",
"id": "dd67db3352b4a8768b70f7bf6b81dd75cf387dde",
"size": "4491",
"binary": false,
"copies": "1",
"ref": "refs/heads/coron-4.0",
"path": "HTCExtension.jar.out/smali/com/htc/protobuf/RpcUtil.smali",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>paramcoq: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.9.0 / paramcoq - 1.0.5</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
paramcoq
<small>
1.0.5
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-19 19:56:23 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-19 19:56:23 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.9.0 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.03.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.03.0 Official 4.03.0 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "abhishek.anand.iitg@gmail.com"
homepage: "https://github.com/aa755/paramcoq"
dev-repo: "git+https://github.com/aa755/paramcoq"
authors: ["Chantal Keller" "Marc Lasson"]
bug-reports: "https://github.com/aa755/paramcoq/issues"
license: "MIT"
build: [
[make "-j%{jobs}%"]
]
install: [
[make "install"]
]
depends: [
"ocaml"
"coq" {>= "8.7" & < "8.7.2"}
]
synopsis: "Keller, Chantal, and Marc Lasson. “Parametricity in an Impredicative Sort.” Computer Science Logic, September 27, 2012. https://doi.org/10.4230/LIPIcs.CSL.2012.399"
description: "Originally implemented by the above authors."
url {
src: "https://github.com/aa755/paramcoq/archive/v1.0.5.tar.gz"
checksum: "md5=fe453f3983c0c711257b73e8f15fc255"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-paramcoq.1.0.5 coq.8.9.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.9.0).
The following dependencies couldn't be met:
- coq-paramcoq -> coq < 8.7.2 -> ocaml < 4.03.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-paramcoq.1.0.5</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "c7bc1553a233f8a43ac18a301c2648fa",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 185,
"avg_line_length": 40.78915662650602,
"alnum_prop": 0.534780682321666,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "3a55702a8d19c3cb699c44efb8c4a09866719228",
"size": "6800",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.03.0-2.0.5/released/8.9.0/paramcoq/1.0.5.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
cask 'font-hermeneus-one' do
version '1.2'
sha256 'c76245c77bcbe570e9146352de5bf6ae9a3c1c475ddd36cb6c50272e4000e4c1'
url 'http://www.impallari.com/media/uploads/commentsources/comment-239-source.zip'
name 'Hermeneus'
homepage 'http://www.impallari.com/projects/overview/hermeneus'
font "HermeneusOne-v#{version}/HermeneusOne-Regular.ttf"
end
| {
"content_hash": "d0cc770b323c5619dd1206aa46d2acba",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 84,
"avg_line_length": 35.6,
"alnum_prop": 0.7921348314606742,
"repo_name": "caskroom/homebrew-fonts",
"id": "2020b9962511cbf2d321a9058b60c2ae4df1e97e",
"size": "356",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Casks/font-hermeneus-one.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ruby",
"bytes": "518102"
},
{
"name": "Shell",
"bytes": "14376"
}
],
"symlink_target": ""
} |
"""
(c) Copyright 2016 Hewlett-Packard Enterprise Development Company, L.P.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from oslo_log import log
from freezer_api import context
LOG = log.getLogger(__name__)
def inject_context(req, resp, params):
user_id = req.get_header('X-USER-ID')
request_id = req.get_header('X-Openstack-Request-ID')
auth_token = req.get_header('X-AUTH-TOKEN')
tenant = req.get_header('X-TENANT-ID')
roles = req.get_header('X-ROLES')
roles = roles and roles.split(',') or []
ctxt = context.FreezerContext(auth_token=auth_token,
user=user_id,
tenant=tenant,
request_id=request_id,
roles=roles)
req.env['freezer.context'] = ctxt
LOG.info('Request context set')
def before_hooks():
return [inject_context]
class FuncMiddleware(object):
"""
Injecting some function as middleware for freezer-api
"""
def __init__(self, func):
self.func = func
def process_resource(self, req, resp, resource, params=None):
return self.func(req, resp, params)
| {
"content_hash": "b94c46d8d2ea610d4943804150dec01b",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 72,
"avg_line_length": 29.785714285714285,
"alnum_prop": 0.6510791366906474,
"repo_name": "szaher/freezer-api",
"id": "ba40e97b0773421195b9390864b2e64c0500ea97",
"size": "1668",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "freezer_api/api/common/utils.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "1942"
},
{
"name": "PHP",
"bytes": "20318"
},
{
"name": "Python",
"bytes": "424120"
},
{
"name": "Shell",
"bytes": "13072"
}
],
"symlink_target": ""
} |
// Copyright (C) 2006-2010 Jim Tilander. See COPYING for and README for more details.
using System;
using EnvDTE;
using System.Threading;
using System.Collections.Generic;
namespace Aurora
{
public static class AsyncProcess
{
private static int s_defaultTimeout = 30000; // in ms
public delegate void OnDone(bool ok, object arg0);
public static void Init()
{
m_helperThread = new System.Threading.Thread(new ThreadStart(ThreadMain));
m_helperThread.Start();
}
public static void Term()
{
m_helperThread.Abort();
}
public static bool Run(OutputWindowPane output, string executable, string commandline, string workingdir, OnDone callback, object callbackArg)
{
int timeout = 1000;
if (!RunCommand(output, executable, commandline, workingdir, timeout))
{
Log.Debug("Failed to run immediate (process hung?), trying again on a remote thread: " + commandline);
return Schedule(output, executable, commandline, workingdir, callback, callbackArg);
}
else
{
if (null != callback)
{
callback(true, callbackArg);
}
}
return true;
}
public static bool Schedule(OutputWindowPane output, string executable, string commandline, string workingdir, OnDone callback, object callbackArg)
{
return Schedule(output, executable, commandline, workingdir, callback, callbackArg, s_defaultTimeout);
}
public static bool Schedule(OutputWindowPane output, string executable, string commandline, string workingdir, OnDone callback, object callbackArg, int timeout)
{
CommandThread cmd = new CommandThread();
cmd.output = output;
cmd.executable = executable;
cmd.commandline = commandline;
cmd.workingdir = workingdir;
cmd.callback = callback;
cmd.callbackArg = callbackArg;
cmd.timeout = timeout;
try
{
m_queueLock.WaitOne();
m_commandQueue.Enqueue(cmd);
}
finally
{
m_queueLock.ReleaseMutex();
}
m_startEvent.Release();
Log.Debug("Scheduled {0} {1}\n", cmd.executable, cmd.commandline);
return true;
}
// ---------------------------------------------------------------------------------------------------------------------------------------------
//
// BEGIN INTERNALS
//
static private Mutex m_queueLock = new Mutex();
static private Semaphore m_startEvent = new Semaphore(0, 9999);
static private Queue<CommandThread> m_commandQueue = new Queue<CommandThread>();
static private System.Threading.Thread m_helperThread;
static private void ThreadMain()
{
while(true)
{
m_startEvent.WaitOne();
CommandThread cmd = null;
try
{
m_queueLock.WaitOne();
cmd = m_commandQueue.Dequeue();
}
finally
{
m_queueLock.ReleaseMutex();
}
try
{
System.Threading.Thread thread = new System.Threading.Thread(new ThreadStart(cmd.Run));
thread.Start();
}
catch
{
}
}
}
private class CommandThread
{
public string executable = "";
public string commandline = "";
public string workingdir = "";
public OutputWindowPane output = null;
public OnDone callback = null;
public object callbackArg = null;
public int timeout = 10000;
public void Run()
{
try
{
bool ok = RunCommand(output, executable, commandline, workingdir, timeout);
if (null != callback)
{
callback(ok, callbackArg);
}
}
catch
{
Log.Error("Caught unhandled exception in async process -- supressing so that we don't bring down Visual Studio");
}
}
}
static private bool RunCommand(OutputWindowPane output, string executable, string commandline, string workingdir, int timeout)
{
try
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = executable;
if( 0 == timeout )
{
// We are not for these processes reading the stdout and thus they could if they wrote more
// data on the output line hang.
process.StartInfo.RedirectStandardOutput = false;
process.StartInfo.RedirectStandardError = false;
}
else
{
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
}
process.StartInfo.CreateNoWindow = true;
process.StartInfo.WorkingDirectory = workingdir;
process.StartInfo.Arguments = commandline;
Log.Debug("executableName : " + executable);
Log.Debug("workingDirectory : " + workingdir);
Log.Debug("command : " + commandline);
if(!process.Start())
{
Log.Error("{0}: {1} Failed to start. Is Perforce installed and in the path?\n", executable, commandline);
return false;
}
if (0 == timeout)
{
// Fire and forget task.
return true;
}
bool exited = false;
string alloutput = "";
using (Process.Handler stderr = new Process.Handler(), stdout = new Process.Handler())
{
process.OutputDataReceived += stdout.OnOutput;
process.BeginOutputReadLine();
process.ErrorDataReceived += stderr.OnOutput;
process.BeginErrorReadLine();
exited = process.WaitForExit(timeout);
/*
* This causes the plugin to unexpectedly crash, since it brings the entire thread down, and thus the entire environment?!?
*
if (0 != process.ExitCode)
{
throw new Process.Error("Failed to execute {0} {1}, exit code was {2}", executable, process.StartInfo.Arguments, process.ExitCode);
}*/
stderr.sentinel.WaitOne();
stdout.sentinel.WaitOne();
alloutput = stdout.buffer + "\n" + stderr.buffer;
}
if(!exited)
{
Log.Info("{0}: {1} timed out ({2} ms)", executable, commandline, timeout);
process.Kill();
return false;
}
else
{
if(null != output)
{
output.OutputString(executable + ": " + commandline + "\n");
output.OutputString(alloutput);
}
System.Diagnostics.Debug.WriteLine(commandline + "\n");
System.Diagnostics.Debug.WriteLine(alloutput);
if(0 != process.ExitCode)
{
Log.Debug("{0}: {1} exit code {2}", executable, commandline, process.ExitCode);
return false;
}
}
return true;
}
catch(System.ComponentModel.Win32Exception e)
{
Log.Error("{0}: {1} failed to spawn: {2}", executable, commandline, e.ToString());
return false;
}
}
//
// END INTERNALS
//
// ---------------------------------------------------------------------------------------------------------------------------------------------
}
}
| {
"content_hash": "39a20d904db8528a9913bb1b58f6c672",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 168,
"avg_line_length": 30.04471544715447,
"alnum_prop": 0.5633879042078204,
"repo_name": "Nexuapex/niftyplugins",
"id": "f70d1eceedba847f74e77f827cf3409bd1a0d276",
"size": "7391",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "Shared/AsyncProcess.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "2265"
},
{
"name": "C#",
"bytes": "167664"
},
{
"name": "Python",
"bytes": "4809"
},
{
"name": "Smalltalk",
"bytes": "9628"
},
{
"name": "Visual Basic",
"bytes": "1190"
}
],
"symlink_target": ""
} |
<?php
namespace app\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\models\Comments;
/**
* CommentsSearch represents the model behind the search form about `app\models\Comments`.
*/
class CommentsSearch extends Comments
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'user_id', 'wine_id', 'created_at', 'updated_at'], 'integer'],
[['comment'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Comments::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere([
'id' => $this->id,
'user_id' => $this->user_id,
'wine_id' => $this->wine_id,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'comment', $this->comment]);
return $dataProvider;
}
}
| {
"content_hash": "8cf178b7d55227e646e0a44ace9309fa",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 106,
"avg_line_length": 22.87142857142857,
"alnum_prop": 0.5315427857589007,
"repo_name": "cybercog/mysommelier",
"id": "b4fadb1592715a53db591f82dfc1b28cb344adf1",
"size": "1601",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "models/CommentsSearch.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "1679"
},
{
"name": "Batchfile",
"bytes": "1030"
},
{
"name": "CSS",
"bytes": "1364"
},
{
"name": "PHP",
"bytes": "181397"
}
],
"symlink_target": ""
} |
import { ApplicationRef, enableProdMode } from '@angular/core'
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic()
.bootstrapModule(AppModule)
.then((module) => {
// could do useful stuff here.
let applicationRef = module.injector.get(ApplicationRef)
let rootComponentRef = applicationRef.components[0]
// seems it's not possible to get information about all modules and components though.
console.log('applicationRef', applicationRef)
console.log('rootComponentRef', rootComponentRef)
console.log('componentTypes', applicationRef.componentTypes)
console.log('components', applicationRef.components)
applicationRef.isStable
.subscribe(() => {
// stable
})
})
.catch(err => console.log(err));
| {
"content_hash": "5a384c9bccf668ed1a54661f116285c5",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 90,
"avg_line_length": 33.310344827586206,
"alnum_prop": 0.7194616977225673,
"repo_name": "psichi/chix-ui",
"id": "912efc71a7cee25679ecca52de3a27443fce1005",
"size": "966",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "105893"
},
{
"name": "HTML",
"bytes": "35558"
},
{
"name": "JavaScript",
"bytes": "558662"
}
],
"symlink_target": ""
} |
body {
font-family: Helvetica, Arial, sans-serif;
background: #FFFFFF;
background-image: url(http://www.pptbackgrounds.net/uploads/violet-blestyashki-line-backgrounds-wallpapers.jpg);
background-repeat:no-repeat;
background-position:center;
background-attachment: fixed;
}
h1 {
color: #990033;
font: 32px/1 Helvetica, Arial, sans-serif; }
header h1 {
font-size: 40px;
line-height: 80px;
background: transparent url(/images/logo.png) 0 0 no-repeat;
background-size: 5% 70%;
padding-left: 84px; }
nav {
font-weight: bold; }
nav ul {
list-style: none;
margin: 0;
padding: 0;
background: #444444;
overflow: hidden; }
nav li {
float: left; }
nav a {
text-decoration: none;
display: block;
padding: 8px;
background: #444444;
color: white; }
nav a:hover {
background-color: #002eb8; }
p {
font: 13px/1.4 Helvetica, Arial, sans-serif; }
label {
display: block; }
nav a.current {
background: #c4c4c4; }
.flash {
width: 600px;
padding: 5px;
font-weight: bold;
margin: 20px;
background: #ffccdd;
color: #990033;
border: 1px solid #990033; }
#like p {
font-weight: bold;
color: #990033; }
#like input {
background: #990033 url(/images/like.png) 0 2px no-repeat;
border: #660022 1px solid;
height: 28px;
padding-left: 24px; }
.loadfile {
background-color: #444444;
border-radius: 5px;
border: 2px solid #DDD;
line-height: 80px;
height: 20px;
padding: 5px; }
.loadfile button, .loadfile input {
color: #444444;
float: left;
list-style: none;
display: inline;
text-align: center;
font-weight: bolder; }
.loadfile button:hover, .loadfile input:hover {
cursor: pointer; }
.error {
color: red; }
.success {
color: #00ff33;}
.centered {
text-align: center; }
| {
"content_hash": "6bd8f0805a4a9b1ff043425dd2743bb3",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 114,
"avg_line_length": 20.054945054945055,
"alnum_prop": 0.6449315068493151,
"repo_name": "alu0100603866/TransformacionesArbolPL0",
"id": "520c7f89e91724a8d47f588eadfc71ff96896849",
"size": "1825",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "public/styles.css",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "323386"
},
{
"name": "JavaScript",
"bytes": "456773"
},
{
"name": "Ruby",
"bytes": "5607"
}
],
"symlink_target": ""
} |
#ifndef __HOOKPRIVATEINCLUDES_H_VERSION__
#define __HOOKPRIVATEINCLUDES_H_VERSION__ 100
#define METHOD_ENTRY_DETOUR_LENGTH 20
#define TAG_SAVED_BYTES ('aBS')
#define JMP 0xe9
typedef struct _HOOK
{
PVOID pOriginalFunction; /**< Address of the original function, function which is hooked*/
PVOID pNewFunction; /**< Address of the user supplied detour function*/
PUCHAR pSavedBytes; /**< Saved bytes which were overwritten by the hook*/
ULONG uSavedBytesLength; /**< Length of the saved bytes*/
} HOOK, *PHOOK;
typedef struct _HOOK_ENTRY
{
LIST_ENTRY ListEntry; /**< HOOK_ENTRY structures will be linked in a doubly linked list, so we need LIST_ENTRY member*/
HOOK Hook; /**< Embedded HOOK structure containing addresses of the original function, hook function and the saved bytes*/
} HOOK_ENTRY, *PHOOK_ENTRY;
typedef struct _MODULE_ENTRY {
LIST_ENTRY ModuleListEntry;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
PVOID ModuleBaseAddress;
PVOID ModuleEntryAddress;
ULONG_PTR ModuleSize;
UNICODE_STRING ModulePath;
UNICODE_STRING ModuleName;
} MODULE_ENTRY, *PMODULE_ENTRY;
#endif // __HOOKPRIVATEINCLUDES_H_VERSION__ | {
"content_hash": "8b8550071667f85970dbeb4fdd7d8b7e",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 128,
"avg_line_length": 37.42424242424242,
"alnum_prop": 0.7279352226720648,
"repo_name": "allewwaly/dementia-forensics",
"id": "ec7f4952765dd0011643cce229a318432bcb0c6f",
"size": "1235",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "DementiaKM/HookPrivateIncludes.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "340"
},
{
"name": "C",
"bytes": "89337"
},
{
"name": "C++",
"bytes": "544989"
},
{
"name": "Makefile",
"bytes": "534"
},
{
"name": "Objective-C",
"bytes": "6023"
},
{
"name": "Python",
"bytes": "12"
},
{
"name": "Shell",
"bytes": "1487"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<title>ScheduleChartView Sample</title>
<link rel="Stylesheet" href="app.css" type="text/css" />
<script src="Scripts/DlhSoft.ProjectData.GanttChart.HTML.Controls.js" type="text/javascript"></script>
<script src="Scripts/DlhSoft.Data.HTML.Controls.js" type="text/javascript"></script>
<script src="licensing.js" type="text/javascript"></script>
<script src="themes.js" type="text/javascript"></script>
<script src="app.js" type="text/javascript" defer="defer"></script>
</head>
<body>
<div class="ribbonContainer">
<div class="ribbonPanel">
<div class="ribbonHeader">Items</div>
<div class="ribbonCommandsArea">
<div class="ribbonCommand"><a href="javascript:addNewItem();" title="Add new item"><img src="Images/AddNew.png" alt="Add new"/></a></div>
<div class="ribbonCommand"><a href="javascript:insertNewItem();" title="Insert new item before selection"><img src="Images/InsertNew.png" alt="Add new"/></a></div>
<div class="ribbonCommand"><a href="javascript:deleteItem();" title="Delete selected item"><img src="Images/Delete.png" alt="Delete"/></a></div>
<div class="ribbonCommand"><a href="javascript:setCustomBarColorToItem12();" title="Set custom bar color to a specific task item"><img src="Images/SetColor.png" alt="Set color"/></a></div>
<div class="ribbonCommand"><a href="javascript:moveItemUp();" title="Move item up"><img src="Images/MoveUp.png" alt="Move up"/></a></div>
<div class="ribbonCommand"><a href="javascript:moveItemDown();" title="Move item down"><img src="Images/MoveDown.png" alt="Move down"/></a></div>
</div>
</div>
<div class="ribbonPanel">
<div class="ribbonHeader">Timeline/Schedule</div>
<div class="ribbonCommandsArea">
<div class="ribbonCommand"><a href="javascript:setCustomScales();" title="Set custom scales"><img src="Images/CustomScales.png" alt="Custom scales"/></a></div>
<div class="ribbonCommand"><a href="javascript:zoomIn();" title="Zoom in"><img src="Images/ZoomIn.png" alt="Zoom in"/></a></div>
<div class="ribbonCommand"><a href="javascript:decreaseTimelinePage();" title="Move towards past"><img src="Images/DecreaseTimelinePage.png" alt="Decrease timeline page"/></a></div>
<div class="ribbonCommand"><a href="javascript:increaseTimelinePage();" title="Move towards future"><img src="Images/IncreaseTimelinePage.png" alt="Increase timeline page"/></a></div>
</div>
</div>
<div class="ribbonPanel">
<div class="ribbonHeader">Printing</div>
<div class="ribbonCommandsArea">
<div class="ribbonCommand"><a href="javascript:print();" title="Print"><img src="Images/Print.png" alt="Print"/></a></div>
</div>
</div>
</div>
<div id="scheduleChartView" style="height: 388px">...</div>
</body>
</html>
| {
"content_hash": "95c1d6f9889de961b674d4186e6b310c",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 204,
"avg_line_length": 70.86046511627907,
"alnum_prop": 0.6314407614046603,
"repo_name": "DlhSoftTeam/GanttChartHyperLibrary-Demos",
"id": "0db424e7dc5e6fe0bdd6422c85d068cfeb641902",
"size": "3049",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "GanttChartHyperLibraryDemos/Demos/Samples/JavaScript/ScheduleChartView/MainFeatures/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP.NET",
"bytes": "314"
},
{
"name": "C#",
"bytes": "5479"
},
{
"name": "CSS",
"bytes": "124224"
},
{
"name": "HTML",
"bytes": "328867"
},
{
"name": "JavaScript",
"bytes": "11100647"
},
{
"name": "TypeScript",
"bytes": "1743971"
}
],
"symlink_target": ""
} |
* 2 channel isolator
* Used with SOIC8 footprint on M2FC, M2R successfully
* Farnell 1078200 (A grade)
* Farnell 1078201 (B grade)
* Farnell 1078202 (C grade)
### ADuM5201
* 2 channel isolator with isolated DC/DC converter
* Used with SOIC16W footprint on M2RL successfully
* Farnell 2067772 (A grade)
* Farnell 2067773 (C grade)
| {
"content_hash": "f2c4615f8fd29633606ea5c47dd8892b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 53,
"avg_line_length": 30.09090909090909,
"alnum_prop": 0.7552870090634441,
"repo_name": "JMW95/agg-kicad",
"id": "9d4624610b08b606774b6aed0fe4c137bbf249ce",
"size": "362",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "lib/ic/isolation/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "2457"
},
{
"name": "Python",
"bytes": "184648"
},
{
"name": "Shell",
"bytes": "529"
}
],
"symlink_target": ""
} |
#include <aws/s3/model/PutBucketLoggingRequest.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <aws/core/http/URI.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::S3::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
using namespace Aws::Http;
PutBucketLoggingRequest::PutBucketLoggingRequest() :
m_bucketHasBeenSet(false),
m_bucketLoggingStatusHasBeenSet(false),
m_contentMD5HasBeenSet(false),
m_expectedBucketOwnerHasBeenSet(false),
m_customizedAccessLogTagHasBeenSet(false)
{
}
Aws::String PutBucketLoggingRequest::SerializePayload() const
{
XmlDocument payloadDoc = XmlDocument::CreateWithRootNode("BucketLoggingStatus");
XmlNode parentNode = payloadDoc.GetRootElement();
parentNode.SetAttributeValue("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/");
m_bucketLoggingStatus.AddToNode(parentNode);
if(parentNode.HasChildren())
{
return payloadDoc.ConvertToString();
}
return {};
}
void PutBucketLoggingRequest::AddQueryStringParameters(URI& uri) const
{
Aws::StringStream ss;
if(!m_customizedAccessLogTag.empty())
{
// only accept customized LogTag which starts with "x-"
Aws::Map<Aws::String, Aws::String> collectedLogTags;
for(const auto& entry: m_customizedAccessLogTag)
{
if (!entry.first.empty() && !entry.second.empty() && entry.first.substr(0, 2) == "x-")
{
collectedLogTags.emplace(entry.first, entry.second);
}
}
if (!collectedLogTags.empty())
{
uri.AddQueryStringParameter(collectedLogTags);
}
}
}
Aws::Http::HeaderValueCollection PutBucketLoggingRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
Aws::StringStream ss;
if(m_contentMD5HasBeenSet)
{
ss << m_contentMD5;
headers.emplace("content-md5", ss.str());
ss.str("");
}
if(m_expectedBucketOwnerHasBeenSet)
{
ss << m_expectedBucketOwner;
headers.emplace("x-amz-expected-bucket-owner", ss.str());
ss.str("");
}
return headers;
}
| {
"content_hash": "a6e3d69cc43152dd895967f911658050",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 98,
"avg_line_length": 26.9390243902439,
"alnum_prop": 0.6912630149388864,
"repo_name": "jt70471/aws-sdk-cpp",
"id": "cfd236509f774adffeec4d11647c3411a9093ffd",
"size": "2328",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-s3/source/model/PutBucketLoggingRequest.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "13452"
},
{
"name": "C++",
"bytes": "278594037"
},
{
"name": "CMake",
"bytes": "653931"
},
{
"name": "Dockerfile",
"bytes": "5555"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "302182"
},
{
"name": "Python",
"bytes": "110380"
},
{
"name": "Shell",
"bytes": "4674"
}
],
"symlink_target": ""
} |
<?xml version="1.0"?>
<ruleset name="Custom ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
CDN PMD ruleset
</description>
<rule ref="rulesets/java/basic.xml"/>
<rule ref="rulesets/java/braces.xml"/>
<rule ref="rulesets/java/clone.xml"/>
<rule ref="rulesets/java/codesize.xml"/>
<rule ref="rulesets/java/comments.xml/CommentRequired">
<properties>
<property name="protectedMethodCommentRequirement" value="Ignored"/>
<property name="publicMethodCommentRequirement" value="Ignored"/>
<property name="fieldCommentRequirement" value="Ignored"/>
</properties>
</rule>
<rule ref="rulesets/java/controversial.xml">
<exclude name="AtLeastOneConstructor"/>
<exclude name="CallSuperInConstructor"/>
<exclude name="OnlyOneReturn"/>
<exclude name="DefaultPackage"/>
<exclude name="DataflowAnomalyAnalysis"/>
<exclude name="UseConcurrentHashMap"/>
</rule>
<rule ref="rulesets/java/coupling.xml">
<exclude name="LawOfDemeter"/>
<exclude name="LoosePackageCoupling"/>
</rule>
<rule ref="rulesets/java/design.xml">
<exclude name="AccessorClassGeneration"/>
<exclude name="AccessorMethodGeneration"/>
</rule>
<rule ref="rulesets/java/empty.xml"/>
<rule ref="rulesets/java/finalizers.xml"/>
<rule ref="rulesets/java/imports.xml"/>
<rule ref="rulesets/java/j2ee.xml"/>
<rule ref="rulesets/java/javabeans.xml/MissingSerialVersionUID"/>
<rule ref="rulesets/java/junit.xml"/>
<rule ref="rulesets/java/naming.xml">
<exclude name="ShortVariable"/>
<exclude name="LongVariable"/>
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="ShortClassName"/>
<exclude name="AbstractNaming"/>
</rule>
<rule ref="rulesets/java/optimizations.xml">
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="AvoidInstantiatingObjectsInLoops"/>
</rule>
<rule ref="rulesets/java/strictexception.xml"/>
<rule ref="rulesets/java/strings.xml"/>
<rule ref="rulesets/java/strings.xml/AvoidDuplicateLiterals">
<properties>
<property name="skipAnnotations" value="true"/>
</properties>
</rule>
<rule ref="rulesets/java/sunsecure.xml"/>
<rule ref="rulesets/java/typeresolution.xml"/>
<rule ref="rulesets/java/unnecessary.xml"/>
<rule ref="rulesets/java/unusedcode.xml"/>
</ruleset> | {
"content_hash": "3b8b27883b293756bb578765922af772",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 116,
"avg_line_length": 41.753846153846155,
"alnum_prop": 0.6547531319086219,
"repo_name": "jensborch/kontentsu",
"id": "b0362e68e1e340b9e2b16e158af74b1babf240d0",
"size": "2714",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/pmd/ruleset.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "631"
},
{
"name": "HTML",
"bytes": "2464"
},
{
"name": "Java",
"bytes": "584928"
},
{
"name": "JavaScript",
"bytes": "2601"
},
{
"name": "TypeScript",
"bytes": "23309"
},
{
"name": "XSLT",
"bytes": "20696"
}
],
"symlink_target": ""
} |
<?php
namespace PHPExiftool\Driver\Tag\Canon;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class SelfTimer extends AbstractTag
{
protected $Id = 2;
protected $Name = 'SelfTimer';
protected $FullName = 'Canon::CameraSettings';
protected $GroupName = 'Canon';
protected $g0 = 'MakerNotes';
protected $g1 = 'Canon';
protected $g2 = 'Camera';
protected $Type = 'int16s';
protected $Writable = true;
protected $Description = 'Self Timer';
protected $flag_Permanent = true;
}
| {
"content_hash": "a7a2f6ff9816fc0253d3b5482c7361e0",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 50,
"avg_line_length": 15.894736842105264,
"alnum_prop": 0.6639072847682119,
"repo_name": "bburnichon/PHPExiftool",
"id": "005d0c7b1d837832594afa978b156917b08aec42",
"size": "828",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/PHPExiftool/Driver/Tag/Canon/SelfTimer.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "22076400"
}
],
"symlink_target": ""
} |
<?php
namespace Test\Preview;
/**
* Class BitmapTest
*
* @group DB
*
* @package Test\Preview
*/
class BitmapTest extends Provider {
public function setUp(): void {
parent::setUp();
$fileName = 'testimage.eps';
$this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
$this->width = 2400;
$this->height = 1707;
$this->provider = new \OC\Preview\Postscript;
}
}
| {
"content_hash": "e1c538ffb281e4b0dcf35677b77f0ec2",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 100,
"avg_line_length": 18.52173913043478,
"alnum_prop": 0.6455399061032864,
"repo_name": "phil-davis/core",
"id": "2c808cffb787308cda9c529c5f081b746c056fef",
"size": "1172",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/lib/Preview/BitmapTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "262"
},
{
"name": "Makefile",
"bytes": "473"
},
{
"name": "Shell",
"bytes": "8644"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>SMTP::MXconnect()</title>
<style>
body, pre {
font-family: Verdana;
font-size: 10pt;
}
a { color: blue; text-decoration: none }
a:hover { text-decoration: underline }
</style>
</head>
<body bgcolor="#f1f3f5" topmargin="10" leftmargin="14">
<pre>
<hr color="white">
SMTP :: <i>mixed</i> <b>mxconnect</b> ( <i>string</i> hostname [, <i>integer</i> port [, <i>integer</i> timeout [, <i>string</i> name [, <i>resource</i> context ]]]] )
<hr>
Return RESOURCE connection if has been successfully connected, boolean FALSE if not.
Connect to <i>string</i> hostname MX zone.
Default values are:
<i>integer</i> port: 25
<i>integer</i> timeout: 30
<i>string</i> name: localhost
<i>string</i> name is used in EHLO/HELO SMTP conversation.
Example:
<table border="0" bgcolor="white">
<tr><td>
<pre><code>
// connect to 'hostname.tld' MX zone
$c = SMTP::MXconnect('hostname.tld');
// print result
if ($c) echo 'Successfully connected !';
else print_r($_RESULT); // <- for debugging
</code></pre>
</td></tr>
</table>
<hr color="white">
See Also: <a href="disconnect.html">SMTP::Disconnect()</a>, <a href="connect.html">SMTP::Connect()</a>, <a href="send.html">SMTP::Send()</a>
[ <a href="mailto:contact@xpertmailer.com?subject=Comment SMTP MXonnect">Comments</a> ]
Last update: Sunday, June 24, 2007
<hr>
</pre>
</body>
</html> | {
"content_hash": "0aafb2b78bafd925a0d31c40a7be0757",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 167,
"avg_line_length": 25.05263157894737,
"alnum_prop": 0.6617647058823529,
"repo_name": "cognitoedtech/assy",
"id": "1cb2be12104627b16e94fca9e6af8c8302016d65",
"size": "1428",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "3rd_party/xpm/DOCUMENTATION/smtp/mxconnect.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "15982"
},
{
"name": "ApacheConf",
"bytes": "1843"
},
{
"name": "CSS",
"bytes": "282109"
},
{
"name": "HTML",
"bytes": "2806581"
},
{
"name": "JavaScript",
"bytes": "4843756"
},
{
"name": "NSIS",
"bytes": "296797"
},
{
"name": "PHP",
"bytes": "9461062"
},
{
"name": "Perl",
"bytes": "25396"
},
{
"name": "Shell",
"bytes": "239"
},
{
"name": "Standard ML",
"bytes": "33"
}
],
"symlink_target": ""
} |
package com.uiguard.logger.imp;
import java.io.File;
import java.io.IOException;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.varia.LevelRangeFilter;
import com.uiguard.utils.setting.UiGuardSettings;
class SpliteLoggerFactory {
public static Logger createSplitLogger(final Class<?> c) {
Logger logger = null;
try {
logger = Logger.getLogger(c.getName());
logger.removeAllAppenders();
PatternLayout layout = new PatternLayout("%d [%t] %p %X{operationName} %X{userId} - %m%n");
logger.setLevel(Level.TRACE);
String infoFileName = UiGuardSettings.LogPath+File.separator+"infoSplit"+File.separator+c.getName()+".log";
String traceFileName = UiGuardSettings.LogPath+File.separator+"traceSplit"+File.separator+c.getName()+".log";
logger.setAdditivity(false);
logger.addAppender(getFileAppender(layout,infoFileName,Level.INFO));
logger.addAppender(getFileAppender(layout,traceFileName,Level.TRACE));
} catch (IOException e) {
e.printStackTrace();
}
return logger;
}
private static FileAppender getFileAppender(PatternLayout layout,
String fileName, Level minLevel) throws IOException{
FileAppender infoAppender;
infoAppender = new FileAppender(layout, fileName);
LevelRangeFilter filter = new LevelRangeFilter();
filter.setLevelMin(minLevel);
filter.setLevelMax(Level.ERROR);
filter.setAcceptOnMatch(true);
infoAppender.addFilter(filter);
infoAppender.setAppend(false);
infoAppender.activateOptions();
return infoAppender;
}
}
| {
"content_hash": "02c5878d8ff29b3a6fc88306ec78dc9e",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 112,
"avg_line_length": 34.02040816326531,
"alnum_prop": 0.7438512297540492,
"repo_name": "uiguard/uiguard",
"id": "404cb52b9c7b6752d68559875dcc4007830dc70e",
"size": "1667",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "UIGuard/src/com/uiguard/logger/imp/SpliteLoggerFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "141"
},
{
"name": "Java",
"bytes": "168181"
},
{
"name": "JavaScript",
"bytes": "6242"
}
],
"symlink_target": ""
} |
/*
*
* assign.c
*
*/
#define ASSIGN_CODE
/*
*
* Includes.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "types.h"
#include "assign.h"
#include "channel.h"
#include "vcg.h"
#include "hcg.h"
/*
*
* Code.
*
*/
void
AllocAssign(void)
{
ulong net;
/*
* Allocate cost matrix.
*/
// sm: changed long** to ulong** to silence warning
costMatrix = (ulong * COUNT(channelTracks+2) *)malloc((channelNets+1) * sizeof(* costMatrix /*long **/));
for (net = 1; net <= channelNets; net++) {
costMatrix[net] = (long *)malloc((channelTracks+2) * sizeof(long));
}
/*
* Allocate structures associated with cost matrix.
*/
tracksNotPref = (ulong *)malloc((channelTracks+2) * sizeof(ulong));
tracksTopNotPref = (ulong *)malloc((channelTracks+2) * sizeof(ulong));
tracksBotNotPref = (ulong *)malloc((channelTracks+2) * sizeof(ulong));
tracksNoHCV = (ulong *)malloc((channelTracks+2) * sizeof(ulong));
tracksAssign = (ulong *)malloc((channelTracks+2) * sizeof(ulong));
netsAssign = (ulong *)malloc((channelNets+1) * sizeof(ulong));
netsAssignCopy = (ulong *)malloc((channelNets+1) * sizeof(ulong));
}
void
FreeAssign(void)
{
ulong net;
/*
* Free cost matrix.
*/
for (net = 1; net <= channelNets; net++) {
free(costMatrix[net]);
}
free(costMatrix);
/*
* Free structures associated with cost matrix.
*/
free(tracksNotPref);
free(tracksTopNotPref);
free(tracksBotNotPref);
free(tracksNoHCV);
free(tracksAssign);
free(netsAssign);
free(netsAssignCopy);
}
void
NetsAssign(void)
{
ulong net;
/*
* Init.
*/
for (net = 1; net <= channelNets; net++) {
netsAssign[net] = 0;
}
/*
* Assign nets in max density column.
*/
MaxNetsAssign();
#ifdef SCOTT
/*
* Assign net in columns right of max density column.
*/
RightNetsAssign();
/*
* Assign net in columns left of max density column.
*/
LeftNetsAssign();
#else
/*
* Assign net in columns left of max density column.
*/
LeftNetsAssign();
/*
* Assign net in columns right of max density column.
*/
RightNetsAssign();
#endif
}
void
MaxNetsAssign(void)
{
ulong net;
ulong netSelect;
ulong netsCrossing;
;
#ifdef VERBOSE
printf("density = %d\n", channelDensity);
printf("pivot = %d\n\n", channelDensityColumn);
#endif
/*
* Determine nets crossing column of max channel density.
*/
netsCrossing = 0;
for (net = 1; net <= channelNets; net++) {
if ((FIRST[net] <= channelDensityColumn) && (LAST[net] >= channelDensityColumn)) {
CROSSING[net] = TRUE;
netsCrossing++;
}
else {
CROSSING[net] = FALSE;
}
}
while (netsCrossing > 0) {
/*
* Choose net from CROSSING to assign.
*/
Select(VCG, HCG, netsAssign, &netSelect, CROSSING);
/*
* Assign net to a track.
*/
Assign(VCG, netsAssign, netSelect);
/*
* Done net.
*/
CROSSING[netSelect] = FALSE;
netsCrossing--;
}
;
}
void
RightNetsAssign(void)
{
ulong net;
ulong col;
ulong top;
ulong bot;
ulong netsCrossing;
ulong netSelect;
;
/*
* Init.
*/
for (net = 1; net <= channelNets; net++) {
CROSSING[net] = FALSE;
}
netsCrossing = 0;
/*
* Assign nets within channel.
*/
for (col = channelDensityColumn+1; col <= channelColumns; col++) {
/*
* Collection.
*/
top = TOP[col];
bot = BOT[col];
if (top != bot) {
if (top && (FIRST[top] == col)) {
CROSSING[top] = TRUE;
netsCrossing++;
}
if (bot && (FIRST[bot] == col)) {
CROSSING[bot] = TRUE;
netsCrossing++;
}
}
else {
if (top && (FIRST[top] == col)) {
CROSSING[top] = TRUE;
netsCrossing++;
}
}
/*
* Assignment.
*/
if ((LAST[top] == col) || (LAST[bot] == col)) {
while (netsCrossing > 0) {
/*
* Choose net from CROSSING to assign.
*/
Select(VCG, HCG, netsAssign, &netSelect, CROSSING);
/*
* Assign net to a track.
*/
Assign(VCG, netsAssign, netSelect);
/*
* Done net.
*/
CROSSING[netSelect] = FALSE;
netsCrossing--;
}
}
}
assert(! netsCrossing);
;
}
void
LeftNetsAssign(void)
{
ulong net;
ulong col;
ulong top;
ulong bot;
ulong netsCrossing;
ulong netSelect;
;
/*
* Init.
*/
for (net = 1; net <= channelNets; net++) {
CROSSING[net] = FALSE;
}
netsCrossing = 0;
/*
* Assign nets within channel.
*/
for (col = channelDensityColumn-1; col >= 1; col--) {
/*
* Collection.
*/
top = TOP[col];
bot = BOT[col];
if (top != bot) {
if (top && (LAST[top] == col)) {
CROSSING[top] = TRUE;
netsCrossing++;
}
if (bot && (LAST[bot] == col)) {
CROSSING[bot] = TRUE;
netsCrossing++;
}
}
else {
if (top && (LAST[top] == col)) {
CROSSING[top] = TRUE;
netsCrossing++;
}
}
/*
* Assignment.
*/
if ((FIRST[top] == col) || (FIRST[bot] == col)) {
while (netsCrossing > 0) {
/*
* Choose net from CROSSING to assign.
*/
Select(VCG, HCG, netsAssign, &netSelect, CROSSING);
/*
* Assign net to a track.
*/
Assign(VCG, netsAssign, netSelect);
/*
* Done net.
*/
CROSSING[netSelect] = FALSE;
netsCrossing--;
}
}
}
assert(! netsCrossing);
;
}
void
Assign(nodeVCGType * YACR_ARRAY VCG,
ulong * YACR_ARRAY assign,
ulong select)
{
long dist;
ulong ideal;
ulong track;
ulong tracks;
ulong trackAssign;
ulong vcv;
long vcvDist;
ulong vcvAssign;
long * costNet;
;
#ifdef VERBOSE
printf("\n*** Assign %d ***\n", select);
#endif
/*
* Need information for the selected net.
* (Must recompute...not current for the selected net)
*
* tracksNoHCV
* tracksNotPref
* tracksTopNotPref
* tracksBotNotPref
* cardNotPref
* cardTopNotPref
* cardBotNotPref
*/
LongestPathVCG(VCG, select);
NoHCV(HCG, select, assign, tracksNoHCV);
IdealTrack(channelTracks, cardTopNotPref, cardBotNotPref, &ideal);
#ifdef VERBOSE
printf("HCV's:\n");
for (track = 1; track <= channelTracks; track++) {
if (tracksNoHCV[track]) {
printf("[%d] no hcv\n", track);
}
else {
printf("[%d] hcv\n", track);
}
}
printf("\n");
#endif
/*
* What tracks to consider for assign.
*/
costNet = costMatrix[select];
assert((select >= 1) && (select <= channelNets));
tracks = 0;
for (track = 1; track <= channelTracks; track++) {
tracksAssign[track] = FALSE;
}
/*
* Choice 1.
*/
for (track = 1; track <= channelTracks; track++) {
if (tracksNoHCV[track] && (! tracksNotPref[track])) {
tracksAssign[track] = TRUE;
tracks++;
}
}
#ifdef VERBOSE
if (tracks != 0) {
printf("using choice 1...\n");
}
#endif
/*
* Choice 2.
*/
if (tracks == 0) {
for (track = 1; track <= channelTracks; track++) {
if (tracksNoHCV[track] && tracksTopNotPref[track] && tracksBotNotPref[track]) {
tracksAssign[track] = TRUE;
tracks++;
}
}
#ifdef VERBOSE
if (tracks != 0) {
printf("using choice 2...\n");
}
#endif
}
/*
* Choice 3.
*/
if (tracks == 0) {
for (track = 2; track < channelTracks; track++) {
if (tracksNoHCV[track] && tracksNotPref[track]) {
tracksAssign[track] = TRUE;
tracks++;
}
}
#ifdef VERBOSE
if (tracks != 0) {
printf("using choice 3...\n");
}
#endif
}
/*
* Choice 4.
*/
if (tracks == 0) {
if (tracksNoHCV[1]) {
tracksAssign[1] = TRUE;
tracks++;
}
if (tracksNoHCV[channelTracks]) {
tracksAssign[channelTracks] = TRUE;
tracks++;
}
#ifdef VERBOSE
printf("using choice 4...\n");
#endif
}
assert(tracks != 0);
/*
costNet = costMatrix[select];
assert((select >= 1) && (select <= channelNets));
tracks = 0;
for (track = 1; track <= channelTracks; track++) {
tracksAssign[track] = FALSE;
}
for (track = 1; track <= channelTracks; track++) {
if ((costNet[track] < HIGH) {
tracksAssign[track] = TRUE;
tracks++;
}
}
if (tracks == 0) {
for (track = 2; track < channelTracks; track++) {
if (costNet[track] < INFINITY) {
tracksAssign[track] = TRUE;
tracks++;
}
}
}
if (tracks == 0) {
if (costNet[1] < INFINITY) {
tracksAssign[1] = TRUE;
tracks++;
}
if (costNet[channelTracks] < INFINITY) {
tracksAssign[channelTracks] = TRUE;
tracks++;
}
}
assert(tracks != 0);
*/
/*
* Assign to one of the tracks under consideration.
*/
trackAssign = 0;
vcvAssign = INFINITY;
for (track = 1; track <= channelTracks; track++) {
if (tracksAssign[track]) {
vcv = VCV(VCG, select, track, netsAssign);
if (vcv < vcvAssign) {
vcvAssign = vcv;
trackAssign = track;
vcvDist = (long) (track - ideal);
if (vcvDist < 0) {
vcvDist *= -1;
}
}
else if (vcv == vcvAssign) {
assert(trackAssign);
dist = (long) (track - ideal);
if (dist < 0) {
dist *= -1;
}
if (dist < vcvDist) {
vcvDist = dist;
vcvAssign = vcv;
trackAssign = track;
}
}
}
}
assert(trackAssign);
assign[select] = trackAssign;
#ifdef VERBOSE
printf("\n*** Assign %d -> %d ***\n", select, trackAssign);
#endif
;
}
void
Select(nodeVCGType * YACR_ARRAY VCG,
nodeHCGType * YACR_ARRAY HCG,
ulong * YACR_ARRAY netsAssign,
ulong * SAFE netSelect,
ulong * YACR_ARRAY CROSSING)
{
ulong net;
ulong track;
ulong select;
long * costNet;
long cost;
long largest;
/*
* Build cost matrix.
*/
BuildCostMatrix(VCG, HCG, netsAssign, CROSSING);
/*
* Select most restricted net.
* That is, net with greatest column sum in cost matrix.
*/
largest = -1;
select = 0;
for (net = 1; net <= channelNets; net++) {
if (CROSSING[net]) {
cost = 0;
costNet = costMatrix[net];
for (track = 1; track <= channelTracks; track++) {
cost += costNet[track];
}
if (cost > largest) {
largest = cost;
select = net;
}
}
}
assert(select);
/*
* Net selected.
*/
*netSelect = select;
}
void
BuildCostMatrix(nodeVCGType * YACR_ARRAY VCG,
nodeHCGType * YACR_ARRAY HCG,
ulong * YACR_ARRAY netsAssign,
ulong * YACR_ARRAY CROSSING)
{
ulong net;
ulong track;
ulong ideal;
long dist;
long mult;
long * costNet;
;
/*
* Initialize cost matrix.
*/
for (net = 1; net <= channelNets; net++) {
costNet = costMatrix[net];
for (track = 1; track <= channelTracks; track++) {
costNet[track] = 0;
}
}
for (net = 1; net <= channelNets; net++) {
if (CROSSING[net]) {
/*
* Compute one column in cost matrix.
* That is, the cost associated with each track for some net.
*/
costNet = costMatrix[net];
/*
* Compute measures related to cost.
*/
LongestPathVCG(VCG, net);
NoHCV(HCG, net, netsAssign, tracksNoHCV);
IdealTrack(channelTracks, cardTopNotPref, cardBotNotPref, &ideal);
/*
* Compute cost associated with each track.
*/
for (track = 1; track <= channelTracks; track++) {
if (tracksNoHCV[track]) {
if (cardNotPref != channelTracks) {
if (tracksNotPref[track]) {
costNet[track] = HIGH;
}
else {
costNet[track] = MEDIUM * cardNotPref;
}
}
else {
if ((track > (channelTracks - cardBotNotPref)) && (track <= cardTopNotPref)) {
mult = cardNotPref - (cardTopNotPref + cardBotNotPref - channelTracks);
assert(mult >= 0);
costNet[track] = MEDIUM * mult;
}
else {
costNet[track] = HIGH;
}
}
if (costNet[track] < INFINITY) {
dist = (long) (ideal - track);
if (dist < 0) {
dist *= -1;
}
costNet[track] += LOW * dist;
}
}
else {
costNet[track] = INFINITY;
}
}
}
}
;
}
void
IdealTrack(ulong tracks,
ulong top,
ulong bot,
ulong * ideal)
{
ulong num;
ulong den;
num = (top * (tracks - bot)) + (bot * (top + 1));
den = top + bot;
if (den != 0) {
*ideal = (ulong) ((ulong) num / (ulong) den);
}
else {
*ideal = 1;
}
}
| {
"content_hash": "897761038ed993750a8a4f639e3a261f",
"timestamp": "",
"source": "github",
"line_count": 655,
"max_line_length": 109,
"avg_line_length": 18.981679389312976,
"alnum_prop": 0.5543312153140835,
"repo_name": "ucsd-progsys/csolve-bak",
"id": "207d4fbfeefc3b74bbc6aad2eb856384f0f87ff3",
"size": "12433",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "benchmarks/deputytests/ptrdist/yacr2/assign.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "18015830"
},
{
"name": "C++",
"bytes": "248734"
},
{
"name": "Common Lisp",
"bytes": "29486"
},
{
"name": "Go",
"bytes": "3361"
},
{
"name": "Java",
"bytes": "330824"
},
{
"name": "JavaScript",
"bytes": "1016635"
},
{
"name": "OCaml",
"bytes": "3737617"
},
{
"name": "Objective-C",
"bytes": "56874"
},
{
"name": "PHP",
"bytes": "5108"
},
{
"name": "Perl",
"bytes": "899168"
},
{
"name": "Prolog",
"bytes": "17049"
},
{
"name": "Python",
"bytes": "30924"
},
{
"name": "Racket",
"bytes": "38583"
},
{
"name": "Ruby",
"bytes": "3638"
},
{
"name": "Scala",
"bytes": "272"
},
{
"name": "Scheme",
"bytes": "471"
},
{
"name": "Shell",
"bytes": "1194181"
}
],
"symlink_target": ""
} |
from __future__ import print_function
from builtins import str
import sys
import os
from vmrunner import vmrunner
import socket
# Get an auto-created VM from the vmrunner
vm = vmrunner.vms[0]
def UDP_test():
print("<Test.py> Performing UDP tests")
HOST, PORT = "10.0.0.55", 4242
sock = socket.socket
# SOCK_DGRAM is the socket type to use for UDP sockets
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# NOTE: This is necessary for the test to exit after the VM has
# been shut down due to a VM timeout
sock.settimeout(20)
data = "Lucky".encode()
sock.sendto(data, (HOST, PORT))
received = sock.recv(1024)
print("<Test.py> Sent: {}".format(data))
print("<Test.py> Received: {}".format(received))
if received != data: return False
data = "Luke".encode()
sock.sendto(data, (HOST, PORT))
received = sock.recv(1024)
print("<Test.py> Sent: {}".format(data))
print("<Test.py> Received: {}".format(received))
if received != data: return False
data = "x".encode() * 1472
sock.sendto(data, (HOST, PORT))
received = sock.recv(1500)
if received != data:
print("<Test.py> Did not receive long string: {}".format(received))
return False
data = "x".encode() * 9216 # 9216 is apparently default max for MacOS
sock.sendto(data, (HOST, PORT))
received = bytearray()
while (len(received) < len(data)):
received.extend(sock.recv(len(data)))
print("RECEIVED: ", len(received))
if received != data:
print("<Test.py> Did not receive mega string (64k)")
return False
vm.exit(0, "Test completed without errors")
def UDP6_test(trigger_line):
print("<Test.py> Performing UDP6 tests")
HOST, PORT = 'fe80::4242%bridge43', 4242
sock = socket.socket
# SOCK_DGRAM is the socket type to use for UDP sockets
sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
res = socket.getaddrinfo(HOST, PORT, socket.AF_INET6, socket.SOCK_DGRAM)
af, socktype, proto, canonname, addr = res[0]
# NOTE: This is necessary for the test to exit after the VM has
# been shut down due to a VM timeout
sock.settimeout(20)
data = "Lucky".encode()
sock.sendto(data, addr)
received = sock.recv(1024)
print("<Test.py> Sent: {}".format(data))
print("<Test.py> Received: {}".format(received))
if received != data: return False
data = "Luke".encode()
sock.sendto(data, addr)
received = sock.recv(1024)
print("<Test.py> Sent: {}".format(data))
print("<Test.py> Received: {}".format(received))
if received != data: return False
data = "x".encode() * 1448
sock.sendto(data, addr)
received = sock.recv(1500)
if received != data:
print("<Test.py> Did not receive long string: {}".format(received))
return False
UDP_test()
# Add custom event-handler
vm.on_output("UDP test service", UDP6_test)
if len(sys.argv) > 1:
vm.boot(image_name=str(sys.argv[1]))
else:
# Boot the VM, taking a timeout as parameter
vm.cmake().boot(30,image_name="net_udp").clean()
| {
"content_hash": "5f14a29b5e7985980153bd332ef47376",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 74,
"avg_line_length": 30.14423076923077,
"alnum_prop": 0.6669856459330143,
"repo_name": "AnnikaH/IncludeOS",
"id": "c54983496ec661a763e20c172925247bf3c68e69",
"size": "3159",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "test/net/integration/udp/test.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "63075"
},
{
"name": "C",
"bytes": "49793"
},
{
"name": "C++",
"bytes": "3231859"
},
{
"name": "CMake",
"bytes": "139086"
},
{
"name": "Dockerfile",
"bytes": "3694"
},
{
"name": "GDB",
"bytes": "255"
},
{
"name": "JavaScript",
"bytes": "1956"
},
{
"name": "Makefile",
"bytes": "1719"
},
{
"name": "Python",
"bytes": "160249"
},
{
"name": "Shell",
"bytes": "87390"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
>
<ImageView android:layout_width="32dp" android:layout_height="32dp"
android:layout_margin="8dp"
android:id="@+id/nav_item_image"
android:layout_gravity="center_vertical"
/>
<TextView
android:id="@+id/nav_item_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
style="?android:textAppearanceMediumInverse"
/>
</LinearLayout>
| {
"content_hash": "c9c70f67e7b6c5492e9a7df9aa1b3ccd",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 86,
"avg_line_length": 41.73684210526316,
"alnum_prop": 0.6002522068095839,
"repo_name": "creaITve/apps-android-tbrc-works",
"id": "ea7e22d76fc4cfd9da0a27d5ceac7d84973e4ea2",
"size": "793",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "wikipedia/res/layout/item_nav_item.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "84467"
},
{
"name": "Java",
"bytes": "685091"
},
{
"name": "JavaScript",
"bytes": "98370"
},
{
"name": "Python",
"bytes": "26196"
},
{
"name": "Shell",
"bytes": "2801"
}
],
"symlink_target": ""
} |
'use strict';
var test = require('tap').test
var vminfo = require('../').sysinfo.vminfo
function inspect(obj, depth) {
console.error(require('util').inspect(obj, false, depth || 5, true));
}
test('\nvminfo', function (t) {
var r = vminfo();
t.ok(isFinite(r.nrDirty), 'has number nrDirty')
t.ok(isFinite(r.nrMapped), 'has number zero nrMapped')
t.ok(isFinite(r.pgpgin), 'has pgpgin')
t.ok(r.pgpgout > 0, 'has non zero pgpgout')
t.ok(isFinite(r.pgalloc), 'has number pgalloc')
t.ok(isFinite(r.pgfree), 'has number pgfree')
t.ok(isFinite(r.pgactivate), 'has number pgactivate')
t.ok(isFinite(r.pgfault), 'has number pgfault')
t.ok(isFinite(r.pgmajfault), 'has number pgmajfault')
t.end()
})
| {
"content_hash": "b459e785c16c3a5a33f5be10d1c9c048",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 71,
"avg_line_length": 32.59090909090909,
"alnum_prop": 0.6708507670850767,
"repo_name": "thlorenz/procps",
"id": "6de2966c9d148e2b996fb0a2de72b29673fba3de",
"size": "717",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/vminfo.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "29549"
},
{
"name": "JavaScript",
"bytes": "26642"
},
{
"name": "Python",
"bytes": "1620"
}
],
"symlink_target": ""
} |
// Copyright (C) 2004, 2006 International Business Machines and others.
// All Rights Reserved.
// This code is published under the Common Public License.
//
// $Id: IpIpoptApplication.hpp 759 2006-07-07 03:07:08Z andreasw $
//
// Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
#ifndef __IPIPOPTAPPLICATION_HPP__
#define __IPIPOPTAPPLICATION_HPP__
#include <iostream>
#include "IpJournalist.hpp"
#include "IpTNLP.hpp"
#include "IpNLP.hpp"
/* Return codes for the Optimize call for an application */
#include "IpReturnCodes.hpp"
namespace Ipopt
{
DECLARE_STD_EXCEPTION(IPOPT_APPLICATION_ERROR);
/* forward declarations */
class IpoptAlgorithm;
class IpoptNLP;
class IpoptData;
class IpoptCalculatedQuantities;
class AlgorithmBuilder;
class RegisteredOptions;
class OptionsList;
class SolveStatistics;
/** This is the main application class for making calls to Ipopt. */
class IpoptApplication : public ReferencedObject
{
public:
IpoptApplication(bool create_console_out = true);
virtual ~IpoptApplication();
/** Initialize method. This method reads the params file and initializes
* the journalists. You should call this method at some point before the
* first optimize call. Note: you can skip the processing of a params
* file by setting params_file to ""
*/
void Initialize(std::string params_file = "ipopt.opt");
void Initialize(std::istream& is);
/**@name Solve methods */
//@{
/** Solve a problem that inherits from TNLP */
ApplicationReturnStatus OptimizeTNLP(const SmartPtr<TNLP>& tnlp);
/** Solve a problem that inherits from NLP */
ApplicationReturnStatus OptimizeNLP(const SmartPtr<NLP>& nlp, SmartPtr<AlgorithmBuilder> alg_builder=NULL);
/** Solve a problem (that inherits from TNLP) for a repeated time.
* The OptimizeTNLP method must have been called before. The
* TNLP must be the same object, and the structure (number of
* variables and constraints and position of nonzeros in Jacobian
* and Hessian must be the same). */
ApplicationReturnStatus ReOptimizeTNLP(const SmartPtr<TNLP>& tnlp);
/** Solve a problem (that inherits from NLP) for a repeated time.
* The OptimizeNLP method must have been called before. The
* NLP must be the same object, and the structure (number of
* variables and constraints and position of nonzeros in Jacobian
* and Hessian must be the same). */
ApplicationReturnStatus ReOptimizeNLP(const SmartPtr<NLP>& nlp);
//@}
/** Method for opening an output file with given print_level.
* Returns false if there was a problem. */
bool OpenOutputFile(std::string file_name, EJournalLevel print_level);
/**@name Accessor methods */
//@{
/** Get the Journalist for printing output */
SmartPtr<Journalist> Jnlst()
{
return jnlst_;
}
/** Get a pointer to RegisteredOptions object to
* add new options */
SmartPtr<RegisteredOptions> RegOptions()
{
return reg_options_;
}
/** Get the options list for setting options */
SmartPtr<OptionsList> Options()
{
return options_;
}
/** Get the options list for setting options (const version) */
SmartPtr<const OptionsList> Options() const
{
return ConstPtr(options_);
}
/** Get the object with the statistics about the most recent
* optimization run. */
SmartPtr<SolveStatistics> Statistics();
//@}
/** @name Methods for IpoptTypeInfo */
//@{
static void RegisterOptions(SmartPtr<RegisteredOptions> roptions);
//@}
private:
/**@name Default Compiler Generated Methods
* (Hidden to avoid implicit creation/calling).
* These methods are not implemented and
* we do not want the compiler to implement
* them for us, so we declare them private
* and do not define them. This ensures that
* they will not be implicitly created/called. */
//@{
/** Default Constructor */
// IpoptApplication();
/** Copy Constructor */
IpoptApplication(const IpoptApplication&);
/** Overloaded Equals Operator */
void operator=(const IpoptApplication&);
//@}
/** Method to register all the options */
void RegisterAllOptions(const SmartPtr<RegisteredOptions>& roptions);
/** Method for the actual optimize call of the Ipopt algorithm.
* This is used both for Optimize and ReOptimize */
ApplicationReturnStatus call_optimize();
/**@name Variables that customize the application behavior */
//@{
/** Decide whether or not the ipopt.opt file should be read */
bool read_params_dat_;
//@}
/** Journalist for reporting output */
SmartPtr<Journalist> jnlst_;
/** RegisteredOptions */
SmartPtr<RegisteredOptions> reg_options_;
/** OptionsList used for the application */
SmartPtr<OptionsList> options_;
/** Object for storing statistics about the most recent
* optimization run. */
SmartPtr<SolveStatistics> statistics_;
/** Object with the algorithm sceleton.
*/
SmartPtr<IpoptAlgorithm> alg_;
/** IpoptNLP Object for the NLP. We keep this around for a
* ReOptimize warm start. */
SmartPtr<IpoptNLP> ip_nlp_;
/** IpoptData Object for the NLP. We keep this around for a
* ReOptimize warm start.
*/
SmartPtr<IpoptData> ip_data_;
/** IpoptCalculatedQuantities Object for the NLP. We keep this
* around for a ReOptimize warm start.
*/
SmartPtr<IpoptCalculatedQuantities> ip_cq_;
/** Pointer to the TNLPAdapter used to convert the TNLP to an NLP.
* We keep this around for the ReOptimizerTNLP call. */
SmartPtr<NLP> nlp_adapter_;
};
} // namespace Ipopt
#endif
| {
"content_hash": "bb1b12b399b25f6fd6ca5a22d0ba1fee",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 111,
"avg_line_length": 31.505434782608695,
"alnum_prop": 0.6793168880455408,
"repo_name": "chrisdembia/simbody",
"id": "536eaee6b5cf111a08f91bcf0c615e84ed3aa751",
"size": "5797",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "SimTKmath/Optimizers/src/IpOpt/IpIpoptApplication.hpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1945907"
},
{
"name": "C++",
"bytes": "18107398"
},
{
"name": "CMake",
"bytes": "126326"
},
{
"name": "HTML",
"bytes": "224"
}
],
"symlink_target": ""
} |
from .models import Place, Location, Activity
from django.core import serializers
from django.http import HttpResponse
from collections import Counter
from json import dumps
# Create your views here.
def get_locations(request):
location = request.GET.get('id')
locations = Location.objects.filter(activites_id=activity)
return HttpResponse(serializers.serialize("json", locations))
def get_places(request):
t = {}
activity = request.GET.get('id')
places = Place.objects.filter(activities_id=activity)
for place in places:
loc_name = place.location.name
if loc_name in t:
t[loc_name]['places'].append(
serializers.serialize("json", [place, ]))
else:
t[loc_name] = {}
t[loc_name]['id'] = place.location.id
t[loc_name]['places'] = []
t[loc_name]['name'] = place.location.name.title()
a = t.values()
return HttpResponse(dumps(a))
def get_activities(request):
activities = Activity.objects.all()
return HttpResponse(serializers.serialize("json", activities))
| {
"content_hash": "c7027cd7bfaec80d2bb72a6f12ca3b2b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 66,
"avg_line_length": 31.542857142857144,
"alnum_prop": 0.6512681159420289,
"repo_name": "silentninja/trippal",
"id": "7af34513f79d318e03bf8ead3e1d575333604b48",
"size": "1104",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/trippal/core/views.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1271896"
},
{
"name": "HTML",
"bytes": "37741"
},
{
"name": "JavaScript",
"bytes": "3269124"
},
{
"name": "Python",
"bytes": "15697"
}
],
"symlink_target": ""
} |
package org.apache.hadoop.raid;
import java.io.IOException;
import java.io.InputStream;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class TestParallelReader extends TestCase {
public static final Log LOG = LogFactory.getLog(TestParallelReader.class);
/**
* Allows read of one byte of data.
*/
public static class SleepInputStream extends InputStream {
private int remaining = 1;
private long millis;
public SleepInputStream(long millis) {
this.millis = millis;
}
public int available() { return remaining; }
public int read() {
if (remaining > 0) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {}
remaining--;
return 1;
}
return -1;
}
}
public void testParallelism() throws IOException, InterruptedException {
LOG.info("testParallelism starting");
int bufSize = 10;
long sleep = 100;
InputStream[] streams = new InputStream[10];
for (int i = 0; i < streams.length; i++) {
streams[i] = new SleepInputStream(sleep);
}
// Read using 1 thread.
ParallelStreamReader parallelReader;
long start;
long end;
parallelReader = new ParallelStreamReader(
RaidUtils.NULL_PROGRESSABLE,
streams,
bufSize,
1,
1,
bufSize);
try {
parallelReader.start();
ParallelStreamReader.ReadResult readResult =
parallelReader.getReadResult();
LOG.info("Reads using 1 thread finished in " +
parallelReader.readTime + " msec");
assertTrue("Sequential read", parallelReader.readTime >= sleep * 10);
} finally {
parallelReader.shutdown();
}
// Read using 10 threads.
for (int i = 0; i < streams.length; i++) {
streams[i] = new SleepInputStream(sleep);
}
parallelReader = new ParallelStreamReader(
RaidUtils.NULL_PROGRESSABLE,
streams,
bufSize,
10,
1,
bufSize);
try {
parallelReader.start();
ParallelStreamReader.ReadResult readResult =
parallelReader.getReadResult();
LOG.info("Reads using 10 threads finished in " +
parallelReader.readTime + " msec");
assertTrue("Parallel read", parallelReader.readTime <= sleep * 1.1);
} finally {
parallelReader.shutdown();
}
LOG.info("testParallelism finished");
}
}
| {
"content_hash": "1388b73b1cf2e4faf46f2935238480f8",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 76,
"avg_line_length": 25.625,
"alnum_prop": 0.6390243902439025,
"repo_name": "iVCE/RDFS",
"id": "532716e9e6fdd0c1dc402da5735c1ae10ba7f51d",
"size": "3266",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/contrib/raid/src/test/org/apache/hadoop/raid/TestParallelReader.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "AspectJ",
"bytes": "1817"
},
{
"name": "C",
"bytes": "519569"
},
{
"name": "C++",
"bytes": "250515"
},
{
"name": "CSS",
"bytes": "39718"
},
{
"name": "Erlang",
"bytes": "44463"
},
{
"name": "Java",
"bytes": "19378398"
},
{
"name": "JavaScript",
"bytes": "387630"
},
{
"name": "PHP",
"bytes": "101295"
},
{
"name": "Perl",
"bytes": "74440"
},
{
"name": "Python",
"bytes": "475166"
},
{
"name": "R",
"bytes": "55"
},
{
"name": "Shell",
"bytes": "1478533"
},
{
"name": "XSLT",
"bytes": "14484"
}
],
"symlink_target": ""
} |
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.lyn.mywidget;
public final class R {
public static final class attr {
}
public static final class color {
public static final int function_greenbutton_textcolor_selector=0x7f080000;
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f050000;
public static final int activity_vertical_margin=0x7f050001;
}
public static final class drawable {
public static final int function_greenbutton_normal=0x7f020000;
public static final int function_greenbutton_pressed=0x7f020001;
public static final int function_greenbutton_selector=0x7f020002;
public static final int ic_launcher=0x7f020003;
public static final int main_icon=0x7f020004;
public static final int widget_bg_portrait=0x7f020005;
public static final int widget_bg_portrait_child=0x7f020006;
public static final int widget_bg_portrait_child_divider=0x7f020007;
}
public static final class id {
public static final int action_settings=0x7f0a0000;
}
public static final class layout {
public static final int activity_main=0x7f030000;
public static final int appwidget=0x7f030001;
public static final int process_widget=0x7f030002;
}
public static final class menu {
public static final int main=0x7f090000;
}
public static final class string {
public static final int action_settings=0x7f060001;
public static final int app_name=0x7f060000;
public static final int hello_world=0x7f060002;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f070000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f070001;
}
public static final class xml {
public static final int appwidget_info=0x7f040000;
public static final int process_widget_provider=0x7f040001;
}
}
| {
"content_hash": "1632540258cbbc39840aec30555ba97c",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 83,
"avg_line_length": 40.464285714285715,
"alnum_prop": 0.6746101794645484,
"repo_name": "Nancy-Leeee/summer",
"id": "dbf2e45242874d06190be1f0eb47d71ae354fc0b",
"size": "3399",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MyWidget/gen/com/lyn/mywidget/R.java",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "4219"
}
],
"symlink_target": ""
} |
class CreateFacebookUserInfos < ActiveRecord::Migration
def change
create_table :facebook_user_infos do |t|
t.integer :user_id, null: false
t.integer :facebook_user_id, null: false
t.string :username, null: false
t.string :first_name
t.string :last_name
t.string :email
t.string :gender
t.string :name
t.string :link
t.timestamps
end
add_index :facebook_user_infos, :user_id, unique: true
add_index :facebook_user_infos, :facebook_user_id, unique: true
end
end
| {
"content_hash": "fc078f9d0d5edc0f6ac4e0c2ed410ab9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 67,
"avg_line_length": 28.526315789473685,
"alnum_prop": 0.6549815498154982,
"repo_name": "natefinch/discourse",
"id": "aa9c29099d35801bf977f18e689eb2b3ae4ddb97",
"size": "542",
"binary": false,
"copies": "276",
"ref": "refs/heads/master",
"path": "db/migrate/20121113200845_create_facebook_user_infos.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "15640"
},
{
"name": "Shell",
"bytes": "540"
}
],
"symlink_target": ""
} |
/**
* ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
* @version v14.1.0
* @link http://www.ag-grid.com/
* @license MIT
*/
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** The base frameworks, eg React & Angular 2, override this bean with implementations specific to their requirement. */
var BaseFrameworkFactory = (function () {
function BaseFrameworkFactory() {
}
BaseFrameworkFactory.prototype.dateComponent = function (gridOptions) {
return gridOptions.dateComponent;
};
BaseFrameworkFactory.prototype.colDefFloatingCellRenderer = function (colDef) {
return colDef.pinnedRowCellRenderer;
};
BaseFrameworkFactory.prototype.colDefCellRenderer = function (colDef) {
return colDef.cellRenderer;
};
BaseFrameworkFactory.prototype.colDefCellEditor = function (colDef) {
return colDef.cellEditor;
};
BaseFrameworkFactory.prototype.colDefFilter = function (colDef) {
return colDef.filter;
};
BaseFrameworkFactory.prototype.gridOptionsFullWidthCellRenderer = function (gridOptions) {
return gridOptions.fullWidthCellRenderer;
};
BaseFrameworkFactory.prototype.gridOptionsGroupRowRenderer = function (gridOptions) {
return gridOptions.groupRowRenderer;
};
BaseFrameworkFactory.prototype.gridOptionsGroupRowInnerRenderer = function (gridOptions) {
return gridOptions.groupRowInnerRenderer;
};
BaseFrameworkFactory.prototype.setTimeout = function (action, timeout) {
setTimeout(action, timeout);
};
return BaseFrameworkFactory;
}());
exports.BaseFrameworkFactory = BaseFrameworkFactory;
| {
"content_hash": "51cd39a20584b625674651362d366b4c",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 120,
"avg_line_length": 41.095238095238095,
"alnum_prop": 0.7282734646581692,
"repo_name": "sufuf3/cdnjs",
"id": "f4643bee5ce27b07c365672ed17b503265677c1a",
"size": "1726",
"binary": false,
"copies": "13",
"ref": "refs/heads/master",
"path": "ajax/libs/ag-grid/14.1.0/lib/baseFrameworkFactory.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Step2"
initialProperties:nil
launchOptions:launchOptions];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
@end
| {
"content_hash": "f52de3fe9d2112aeaa76df19c21b79cd",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 118,
"avg_line_length": 35.86666666666667,
"alnum_prop": 0.6821561338289963,
"repo_name": "soulmachine/react-native-starter-kit",
"id": "821ed56d6e992c7b6a5b4e5263b016a76fb6894c",
"size": "1384",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Step2/ios/Step2/AppDelegate.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3360"
},
{
"name": "JavaScript",
"bytes": "12618"
},
{
"name": "Objective-C",
"bytes": "13588"
},
{
"name": "Python",
"bytes": "4905"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.