text
stringlengths 2
1.04M
| meta
dict |
|---|---|
#include "GuardPageAllocator.h"
#include <sys/mman.h>
#include <unistd.h>
#include <mutex>
#include <folly/Singleton.h>
#include <folly/SpinLock.h>
#include <glog/logging.h>
namespace folly { namespace fibers {
/**
* Each stack with a guard page creates two memory mappings.
* Since this is a limited resource, we don't want to create too many of these.
*
* The upper bound on total number of mappings created
* is kNumGuarded * kMaxInUse.
*/
/**
* Number of guarded stacks per allocator instance
*/
constexpr size_t kNumGuarded = 100;
/**
* Maximum number of allocator instances with guarded stacks enabled
*/
constexpr size_t kMaxInUse = 100;
/**
* A cache for kNumGuarded stacks of a given size
*/
class StackCache {
public:
explicit StackCache(size_t stackSize)
: allocSize_(allocSize(stackSize)) {
auto p = ::mmap(nullptr, allocSize_ * kNumGuarded,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
PCHECK(p != (void*)(-1));
storage_ = reinterpret_cast<unsigned char*>(p);
/* Protect the bottommost page of every stack allocation */
for (size_t i = 0; i < kNumGuarded; ++i) {
auto allocBegin = storage_ + allocSize_ * i;
freeList_.push_back(allocBegin);
PCHECK(0 == ::mprotect(allocBegin, pagesize(), PROT_NONE));
}
}
unsigned char* borrow(size_t size) {
std::lock_guard<folly::SpinLock> lg(lock_);
assert(storage_);
auto as = allocSize(size);
if (as != allocSize_ || freeList_.empty()) {
return nullptr;
}
auto p = freeList_.back();
freeList_.pop_back();
/* We allocate minimum number of pages required, plus a guard page.
Since we use this for stack storage, requested allocation is aligned
at the top of the allocated pages, while the guard page is at the bottom.
-- increasing addresses -->
Guard page Normal pages
|xxxxxxxxxx|..........|..........|
<- allocSize_ ------------------->
p -^ <- size -------->
limit -^
*/
auto limit = p + allocSize_ - size;
assert(limit >= p + pagesize());
return limit;
}
bool giveBack(unsigned char* limit, size_t size) {
std::lock_guard<folly::SpinLock> lg(lock_);
assert(storage_);
auto as = allocSize(size);
auto p = limit + size - as;
if (p < storage_ || p >= storage_ + allocSize_ * kNumGuarded) {
/* not mine */
return false;
}
assert(as == allocSize_);
assert((p - storage_) % allocSize_ == 0);
freeList_.push_back(p);
return true;
}
~StackCache() {
assert(storage_);
PCHECK(0 == ::munmap(storage_, allocSize_ * kNumGuarded));
}
private:
folly::SpinLock lock_;
unsigned char* storage_{nullptr};
size_t allocSize_{0};
/**
* LIFO free list
*/
std::vector<unsigned char*> freeList_;
static size_t pagesize() {
static const size_t pagesize = sysconf(_SC_PAGESIZE);
return pagesize;
}
/* Returns a multiple of pagesize() enough to store size + one guard page */
static size_t allocSize(size_t size) {
return pagesize() * ((size + pagesize() - 1)/pagesize() + 1);
}
};
class CacheManager {
public:
static CacheManager& instance() {
static auto inst = new CacheManager();
return *inst;
}
std::unique_ptr<StackCacheEntry> getStackCache(size_t stackSize) {
std::lock_guard<folly::SpinLock> lg(lock_);
if (inUse_ < kMaxInUse) {
++inUse_;
return folly::make_unique<StackCacheEntry>(stackSize);
}
return nullptr;
}
private:
folly::SpinLock lock_;
size_t inUse_{0};
friend class StackCacheEntry;
void giveBack(std::unique_ptr<StackCache> stackCache_) {
assert(inUse_ > 0);
--inUse_;
/* Note: we can add a free list for each size bucket
if stack re-use is important.
In this case this needs to be a folly::Singleton
to make sure the free list is cleaned up on fork.
TODO(t7351705): fix Singleton destruction order
*/
}
};
class StackCacheEntry {
public:
explicit StackCacheEntry(size_t stackSize)
: stackCache_(folly::make_unique<StackCache>(stackSize)) {
}
StackCache& cache() const noexcept {
return *stackCache_;
}
~StackCacheEntry() {
CacheManager::instance().giveBack(std::move(stackCache_));
}
private:
std::unique_ptr<StackCache> stackCache_;
};
GuardPageAllocator::GuardPageAllocator() = default;
GuardPageAllocator::~GuardPageAllocator() = default;
unsigned char* GuardPageAllocator::allocate(size_t size) {
if (!stackCache_) {
stackCache_ = CacheManager::instance().getStackCache(size);
}
if (stackCache_) {
auto p = stackCache_->cache().borrow(size);
if (p != nullptr) {
return p;
}
}
return fallbackAllocator_.allocate(size);
}
void GuardPageAllocator::deallocate(unsigned char* limit, size_t size) {
if (!(stackCache_ && stackCache_->cache().giveBack(limit, size))) {
fallbackAllocator_.deallocate(limit, size);
}
}
}} // folly::fibers
|
{
"content_hash": "e4a71764ecca87d55cfe4e960aa347dc",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 80,
"avg_line_length": 24.83009708737864,
"alnum_prop": 0.621505376344086,
"repo_name": "colemancda/folly",
"id": "2d69a6427bdf963aa638108ab225dd7e01c6d0f4",
"size": "5710",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "folly/experimental/fibers/GuardPageAllocator.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "31230"
},
{
"name": "C++",
"bytes": "5406011"
},
{
"name": "CSS",
"bytes": "165"
},
{
"name": "Makefile",
"bytes": "700"
},
{
"name": "Python",
"bytes": "8495"
},
{
"name": "Ruby",
"bytes": "1531"
},
{
"name": "Shell",
"bytes": "3187"
}
],
"symlink_target": ""
}
|
<?php
namespace PHPExiftool\Driver\Tag\XMPXmpDM;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class TracksMarkersName extends AbstractTag
{
protected $Id = 'TracksMarkersName';
protected $Name = 'TracksMarkersName';
protected $FullName = 'XMP::xmpDM';
protected $GroupName = 'XMP-xmpDM';
protected $g0 = 'XMP';
protected $g1 = 'XMP-xmpDM';
protected $g2 = 'Image';
protected $Type = 'string';
protected $Writable = true;
protected $Description = 'Tracks Markers Name';
protected $flag_List = true;
}
|
{
"content_hash": "c8f4cdbcfa7d65cddb61f663f5301cd4",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 51,
"avg_line_length": 17.10810810810811,
"alnum_prop": 0.6729857819905213,
"repo_name": "romainneutron/PHPExiftool",
"id": "955e10eae99e7980150ccece98e84642faee7cf4",
"size": "855",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/PHPExiftool/Driver/Tag/XMPXmpDM/TracksMarkersName.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "22042446"
}
],
"symlink_target": ""
}
|
from functools import wraps
import sys
import requests
from mock import MagicMock, Mock, patch
from appvalidator.zip import ZipPackage
from appvalidator.errorbundle import ErrorBundle
from appvalidator.errorbundle.outputhandlers.shellcolors import OutputHandler
def _do_test(path, test, failure=True, set_type=0,
listed=False, xpi_mode="r"):
package_data = open(path, "rb")
package = ZipPackage(package_data, mode=xpi_mode, name=path)
err = ErrorBundle()
if listed:
err.save_resource("listed", True)
# Populate in the dependencies.
if set_type:
err.set_type(set_type) # Conduit test requires type
test(err, package)
print err.print_summary(verbose=True)
assert err.failed() if failure else not err.failed()
return err
def safe(func):
"""
Make sure that a test does not access external resources.
Note: This will mock `requests.get`. If you are mocking it yourself
already, this will throw an assertion error.
"""
@patch("appvalidator.testcases.webappbase.test_icon")
@wraps(func)
def wrap(test_icon, *args, **kwargs):
# Assert that we're not double-mocking `requests.get`.
from requests import get as _r_g
assert not isinstance(_r_g, (MagicMock, Mock)), (
"`requests.get` already mocked")
with patch("requests.get") as r_g:
def request_generator(*args, **kwargs):
url = kwargs.get("url", args[0])
if "://" not in url:
raise requests.exceptions.MissingSchema
request = Mock()
request.text = "foo bar"
request.status_code = 200
request.encoding = 'UTF-8'
# The first bit is the return value. The second bit tells whatever
# is requesting the data that there's no more data.
request.raw.read.side_effect = [request.text, ""]
return request
r_g.side_effect = request_generator
return func(*args, **kwargs)
return wrap
class TestCase(object):
def setUp(self):
self.err = None
self.is_bootstrapped = False
self.detected_type = None
self.listed = True
def reset(self):
"""
Reset the test case so that it can be run a second time (ideally with
different parameters).
"""
self.err = None
def setup_err(self):
"""
Instantiate the error bundle object. Use the `instant` parameter to
have it output errors as they're generated. `for_appversions` may be set
to target the test cases at a specific Gecko version range.
An existing error bundle will be overwritten with a fresh one that has
the state that the test case was setup with.
"""
self.err = ErrorBundle(instant=True,
listed=getattr(self, "listed", True))
self.err.handler = OutputHandler(sys.stdout, True)
def assert_failed(self, with_errors=False, with_warnings=None):
"""
First, asserts that the error bundle registers a failure (recognizing
whether warnings are acknowledged). Second, if with_errors is True,
the presence of errors is asserted. If it is not true (default), it
is tested that errors are not present. If with_warnings is not None,
the presence of warnings is tested just like with_errors)
"""
assert self.err.failed(fail_on_warnings=with_warnings or
with_warnings is None), \
"Test did not fail; failure was expected."
if with_errors:
assert self.err.errors, "Errors were expected."
elif self.err.errors:
raise AssertionError("Tests found unexpected errors: %s" %
self.err.print_summary(verbose=True))
if with_warnings is not None:
if with_warnings:
assert self.err.warnings, "Warnings were expected."
elif self.err.warnings:
raise ("Tests found unexpected warnings: %s" %
self.err.print_summary())
def assert_notices(self):
"""
Assert that notices have been generated during the validation process.
"""
assert self.err.notices, "Notices were expected."
def assert_passes(self, warnings_pass=False):
"""
Assert that no errors have been raised. If warnings_pass is True, also
assert that there are no warnings.
"""
assert not self.err.failed(fail_on_warnings=not warnings_pass), \
("Test was intended to pass%s, but it did not." %
(" with warnings" if warnings_pass else ""))
def assert_silent(self):
"""
Assert that no messages (errors, warnings, or notices) have been
raised.
"""
assert not self.err.errors, 'Got these: %s' % self.err.errors
assert not self.err.warnings, 'Got these: %s' % self.err.warnings
assert not self.err.notices, 'Got these: %s' % self.err.notices
def assert_got_errid(self, errid):
"""
Assert that a message with the given errid has been generated during
the validation process.
"""
assert any(msg["id"] == errid for msg in
(self.err.errors + self.err.warnings + self.err.notices)), \
"%s was expected, but it was not found." % repr(errid)
def assert_has_feature(self, name):
assert name in self.err.feature_profile, (
'"%s" not found in feature profile (%s)' % (
name, ', '.join(self.err.feature_profile)))
def assert_has_permission(self, name):
permissions = self.err.get_resource("permissions")
assert name in permissions, (
'"%s" not found in permissions (%s)' % (
name, ', '.join(permissions)))
class MockZipFile:
def namelist(self):
return []
class MockXPI:
def __init__(self, data=None, default_size=100):
if not data:
data = {}
self.zf = MockZipFile()
self.data = data
self.filename = "mock_xpi.xpi"
self.default_size = default_size
def test(self):
return True
def info(self, name):
name = name.split('/')[-1]
return {"name_lower": name.lower(),
"size": self.default_size,
"extension": name.lower().split(".")[-1]}
def __iter__(self):
for name in self.data.keys():
yield name
def __contains__(self, name):
return name in self.data
def read(self, name):
return open(self.data[name]).read()
|
{
"content_hash": "59d630a10382f05a2571fda3c25987c7",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 82,
"avg_line_length": 34.32828282828283,
"alnum_prop": 0.5879064293070472,
"repo_name": "mozilla/app-validator",
"id": "7f09c5f546f2873ae6561e93a27d464b5d105bdb",
"size": "6797",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tests/helper.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "466"
},
{
"name": "HTML",
"bytes": "2802"
},
{
"name": "JavaScript",
"bytes": "862"
},
{
"name": "Python",
"bytes": "474146"
},
{
"name": "Shell",
"bytes": "803"
}
],
"symlink_target": ""
}
|
import unittest2 as unittest
from mythbox.util import run_async
import time
import random
import threading
class Foo(object):
lock = threading.RLock()
gold = None
cnt = 0
@classmethod
def doWorkSerially(cls, i):
Foo.lock.acquire()
Foo.cnt +=1
print('doWorkSerially %s %s' % (i, Foo.cnt))
time.sleep(random.randint(1,5))
Foo.cnt -=1
Foo.lock.release()
def doWork(self, i):
print('doWork %s' % i)
Foo.doWorkSerially(i)
@run_async
def doWorkAsync(self, i):
print('doWorkAsync %s' % i)
self.doWork(i)
class StaticTest(unittest.TestCase):
def test_sometihng(self):
f = Foo()
f.doWork(1)
def test_multiple_threads(self):
foos = [Foo() for i in xrange(10)]
threads = [f.doWorkAsync(i) for i,f in enumerate(foos)]
[t.join() for t in threads]
|
{
"content_hash": "0495d61a61a4fbeb615d71135ae958f2",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 63,
"avg_line_length": 23.170731707317074,
"alnum_prop": 0.5578947368421052,
"repo_name": "GetSomeBlocks/Score_Soccer",
"id": "64593c70abd027c5cdad2d5a1a8fdfb77d72cedb",
"size": "950",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "resources/test/mythboxtest/test_static.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "930"
},
{
"name": "C",
"bytes": "293000"
},
{
"name": "C#",
"bytes": "9664"
},
{
"name": "CSS",
"bytes": "24716"
},
{
"name": "D",
"bytes": "542"
},
{
"name": "HTML",
"bytes": "374176"
},
{
"name": "Java",
"bytes": "206"
},
{
"name": "Objective-C",
"bytes": "9421"
},
{
"name": "Python",
"bytes": "8744725"
},
{
"name": "Ruby",
"bytes": "6773"
},
{
"name": "Shell",
"bytes": "13600"
}
],
"symlink_target": ""
}
|
package com.yahoo.glimmer.indexing.preprocessor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Random;
import org.apache.commons.codec.binary.Hex;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.lib.legacy.ClassImposteriser;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import com.yahoo.glimmer.indexing.preprocessor.ResourceRecordWriter.OUTPUT;
import com.yahoo.glimmer.indexing.preprocessor.ResourceRecordWriter.OutputCount;
import com.yahoo.glimmer.util.BlockCompressedDocumentCollection;
import com.yahoo.glimmer.util.BySubjectRecord;
import com.yahoo.glimmer.util.BySubjectRecord.BySubjectRecordException;
public class ResourceRecordWriterTest {
private Mockery context;
private Expectations e;
private FileSystem fs;
private FSDataOutputStream allOs;
private FSDataOutputStream subjectOs;
private FSDataOutputStream predicateOs;
private FSDataOutputStream objectOs;
private FSDataOutputStream contextOs;
@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
private Path tempDirPath;
@Before
public void before() throws IOException {
tempDirPath = new Path(tempFolder.getRoot().getCanonicalPath());
context = new Mockery();
context.setImposteriser(ClassImposteriser.INSTANCE);
fs = context.mock(FileSystem.class);
allOs = context.mock(FSDataOutputStream.class, "allOs");
subjectOs = context.mock(FSDataOutputStream.class, "subjectOs");
predicateOs = context.mock(FSDataOutputStream.class, "predicateOs");
objectOs = context.mock(FSDataOutputStream.class, "objectOs");
contextOs = context.mock(FSDataOutputStream.class, "contextOs");
e = new Expectations() {
{
one(fs).exists(with(tempDirPath));
will(returnValue(false));
one(fs).mkdirs(with(tempDirPath));
one(fs).create(with(new Path(tempDirPath, "all")), with(false));
will(returnValue(allOs));
one(fs).create(with(new Path(tempDirPath, "subjects")), with(false));
will(returnValue(subjectOs));
one(fs).create(with(new Path(tempDirPath, "predicates")), with(false));
will(returnValue(predicateOs));
one(fs).create(with(new Path(tempDirPath, "objects")), with(false));
will(returnValue(objectOs));
one(fs).create(with(new Path(tempDirPath, "contexts")), with(false));
will(returnValue(contextOs));
one(allOs).close();
one(subjectOs).close();
one(predicateOs).close();
one(objectOs).close();
one(contextOs).close();
}
};
}
@Test
public void writeSubjectAndObjectTest() throws IOException, InterruptedException, ClassNotFoundException {
ByteArrayOutputStream bySubjectBos = new ByteArrayOutputStream(1024);
FSDataOutputStream bySubjectOs = new FSDataOutputStream(bySubjectBos, null);
ByteArrayOutputStream bySubjectOffsetsBos = new ByteArrayOutputStream(1024);
FSDataOutputStream bySubjectOffsetsOs = new FSDataOutputStream(bySubjectOffsetsBos, null);
e.one(fs).create(e.with(new Path(tempDirPath, "bySubject.bz2")), e.with(false));
e.will(Expectations.returnValue(bySubjectOs));
e.one(fs).create(e.with(new Path(tempDirPath, "bySubject.blockOffsets")), e.with(false));
e.will(Expectations.returnValue(bySubjectOffsetsOs));
e.one(allOs).write(e.with(new ByteMatcher("http://a/key1\nhttp://a/key2\nhttp://a/key3\n", true)), e.with(0), e.with(42));
e.one(contextOs).write(e.with(new ByteMatcher("http://a/key\n", true)), e.with(0), e.with(13));
e.one(objectOs).write(e.with(new ByteMatcher("http://a/key\nbNode123\n", true)), e.with(0), e.with(22));
e.one(predicateOs).write(e.with(new ByteMatcher("3\thttp://a/key\n", true)), e.with(0), e.with(15));
e.one(subjectOs).write(e.with(new ByteMatcher("http://a/key\n", true)), e.with(0), e.with(13));
context.checking(e);
ResourceRecordWriter writer = new ResourceRecordWriter(fs, tempDirPath, null);
OutputCount outputCount = new OutputCount();
outputCount.output = OUTPUT.PREDICATE;
outputCount.count = 3;
writer.write(new Text("http://a/key"), outputCount);
outputCount.output = OUTPUT.OBJECT;
outputCount.count = 0;
writer.write(new Text("http://a/key"), outputCount);
outputCount.output = OUTPUT.CONTEXT;
outputCount.count = 0;
writer.write(new Text("http://a/key"), outputCount);
outputCount.output = OUTPUT.ALL;
outputCount.count = 0;
writer.write(new Text("http://a/key1"), outputCount);
writer.write(new Text("http://a/key2"), outputCount);
writer.write(new Text("http://a/key3"), outputCount);
BySubjectRecord record = new BySubjectRecord();
record.setId(66);
record.setPreviousId(55);
record.setSubject("http://a/key");
record.addRelation("<http://predicate/> <http://Object> .");
writer.write(new Text("http://a/key"), record);
outputCount.output = OUTPUT.OBJECT;
outputCount.count = 0;
writer.write(new Text("bNode123"), outputCount);
writer.close(null);
context.assertIsSatisfied();
BlockCompressedDocumentCollection collection = new BlockCompressedDocumentCollection("foo", null, 10);
InputStream blockOffsetsInputStream = new ByteArrayInputStream(bySubjectOffsetsBos.toByteArray());
File bySubjectTempFile = File.createTempFile(ResourceRecordWriterTest.class.getSimpleName(), "tmp");
FileOutputStream tempFileOutputStream = new FileOutputStream(bySubjectTempFile);
bySubjectBos.writeTo(tempFileOutputStream);
tempFileOutputStream.flush();
tempFileOutputStream.close();
FileInputStream bySubjectFileInputStream = new FileInputStream(bySubjectTempFile);
collection.init(bySubjectFileInputStream.getChannel(), blockOffsetsInputStream, 100000);
blockOffsetsInputStream.close();
// Size of collection. This is the same as the number of lines written to ALL.
assertEquals(3l, collection.size());
InputStream documentInputStream = collection.stream(65l);
assertEquals(-1, documentInputStream.read());
documentInputStream = collection.stream(67l);
assertEquals(-1, documentInputStream.read());
documentInputStream = collection.stream(66l);
assertNotNull(documentInputStream);
collection.close();
bySubjectFileInputStream.close();
}
@Test
public void bySubjectsTest() throws IOException, InterruptedException, NoSuchAlgorithmException, BySubjectRecordException {
FSDataOutputStream bySubjectOs = new FSDataOutputStream(new FileOutputStream(new File(tempDirPath.toUri().getPath(), "bySubject.bz2")), null);
FSDataOutputStream bySubjectOffsetsOs = new FSDataOutputStream(new FileOutputStream(new File(tempDirPath.toUri().getPath(), "bySubject.blockOffsets")), null);
e.one(fs).create(e.with(new Path(tempDirPath, "bySubject.bz2")), e.with(false));
e.will(Expectations.returnValue(bySubjectOs));
e.one(fs).create(e.with(new Path(tempDirPath, "bySubject.blockOffsets")), e.with(false));
e.will(Expectations.returnValue(bySubjectOffsetsOs));
e.allowing(subjectOs).write(e.with(new ByteMatcher()), e.with(0), e.with(Expectations.any(Integer.class)));
e.allowing(allOs).write(e.with(new ByteMatcher("all\nall\n", true)), e.with(0), e.with(Expectations.any(Integer.class)));
context.checking(e);
System.out.println("tempDirPath:" + tempDirPath);
ResourceRecordWriter writer = new ResourceRecordWriter(fs, tempDirPath, null);
BySubjectRecord record = new BySubjectRecord();
Random random = new Random();
for (long l = 100000 ; l < 200000 ; l += (random.nextInt(19) + 2)) {
record.setId(l);
record.setSubject("Subject:" + Integer.toString(random.nextInt()));
for (int i = 0 ; i < random.nextInt() % 100 ; i++) {
record.addRelation("a relation " + Long.toString(random.nextLong()));
}
writer.write(null, record);
record.setPreviousId(l);
record.clearRelations();
}
BySubjectRecord beforeBigRecord = new BySubjectRecord();
beforeBigRecord.setId(200200l);
beforeBigRecord.setPreviousId(record.getId());
beforeBigRecord.setSubject("Before Big Test Record");
writer.write(null, beforeBigRecord);
// Write a big record that will span multiple blocks of 100000 bytes.
BySubjectRecord bigRecord = new BySubjectRecord();
bigRecord.setId(200201l);
bigRecord.setPreviousId(beforeBigRecord.getId());
bigRecord.setSubject("Big Test Record");
MessageDigest md5Digest = MessageDigest.getInstance("MD5");
StringBuilder sb = new StringBuilder();
// 8k x 128 byte relations. The relation here is just a 128 byte hex string without delimiters.
for (int i = 0 ; i < 8192 ; i++) {
md5Digest.update((byte)((i * 1299299) & 0xFF));
byte[] digest = md5Digest.digest();
sb.append(Hex.encodeHex(digest));
md5Digest.update(digest);
digest = md5Digest.digest();
sb.append(Hex.encodeHex(digest));
md5Digest.update(digest);
digest = md5Digest.digest();
sb.append(Hex.encodeHex(digest));
md5Digest.update(digest);
digest = md5Digest.digest();
sb.append(Hex.encodeHex(digest));
bigRecord.addRelation(sb.toString());
sb.setLength(0);
}
writer.write(null, bigRecord);
BySubjectRecord afterBigRecord = new BySubjectRecord();
afterBigRecord.setId(200202l);
afterBigRecord.setPreviousId(bigRecord.getId());
afterBigRecord.setSubject("After Big Test Record");
writer.write(null, afterBigRecord);
OutputCount outputCount = new OutputCount();
outputCount.output = OUTPUT.ALL;
outputCount.count = 1;
Text key = new Text("all");
for (int i = 0 ; i < 200205 ; i++) {
writer.write(key, outputCount);
}
writer.write(new Text("http://a/key1"), outputCount);
writer.close(null);
BlockCompressedDocumentCollection collection = new BlockCompressedDocumentCollection("bySubject", null, 10);
String indexBaseName = new File(tempDirPath.toUri().getPath(), "bySubject").getCanonicalPath();
collection.filename(indexBaseName);
assertEquals(-1, collection.stream(99999).read());
InputStream documentInputStream = collection.stream(100000);
record.readFrom(new InputStreamReader(documentInputStream));
assertEquals(100000, record.getId());
documentInputStream = collection.stream(record.getId());
record.readFrom(new InputStreamReader(documentInputStream));
assertEquals(record.getId(), record.getId());
record.setPreviousId(3);
record.setSubject(null);
documentInputStream = collection.stream(record.getId() + 1);
assertEquals(-1, documentInputStream.read());
documentInputStream = collection.stream(beforeBigRecord.getId());
record.readFrom(new InputStreamReader(documentInputStream));
assertEquals(beforeBigRecord, record);
documentInputStream = collection.stream(afterBigRecord.getId());
record.readFrom(new InputStreamReader(documentInputStream));
assertEquals(afterBigRecord, record);
documentInputStream = collection.stream(bigRecord.getId());
record.readFrom(new InputStreamReader(documentInputStream));
System.out.println("BigRecord Relation count:" + bigRecord.getRelationsCount());
System.out.println("First:" + bigRecord.getRelation(0));
System.out.println("Last:" + bigRecord.getRelation(bigRecord.getRelationsCount() - 1));
System.out.println("Record Relation count:" + record.getRelationsCount());
System.out.println("First:" + record.getRelation(0));
System.out.println("Last:" + record.getRelation(record.getRelationsCount() - 1));
int limit = bigRecord.getRelationsCount() > record.getRelationsCount() ? record.getRelationsCount() : bigRecord.getRelationsCount();
for (int i = 0 ; i < limit ; i++) {
assertEquals("At index " + i, bigRecord.getRelation(i), record.getRelation(i));
}
assertEquals(bigRecord.getRelationsCount(), record.getRelationsCount());
assertEquals(bigRecord, record);
assertEquals(-1, collection.stream(afterBigRecord.getId() + 1).read());
collection.close();
}
private static class ByteMatcher extends BaseMatcher<byte[]> {
private byte[] bytes;
private boolean ignoreTrailingBytes;
public ByteMatcher() {
}
public ByteMatcher(String string, boolean ignoreTrailingBytes) {
bytes = string.getBytes();
this.ignoreTrailingBytes = ignoreTrailingBytes;
}
@Override
public boolean matches(Object object) {
if (bytes == null) {
return true;
}
assert object instanceof byte[];
byte[] other = (byte[]) object;
if (ignoreTrailingBytes) {
other = Arrays.copyOf(other, bytes.length);
}
return Arrays.equals(bytes, other);
}
@Override
public void describeTo(Description description) {
if (bytes == null) {
description.appendText("any byte array");
} else if (ignoreTrailingBytes) {
description.appendText(new String(bytes) + "...");
} else {
description.appendText(new String(bytes));
}
}
}
}
|
{
"content_hash": "c9792d25e447c1987198590dce043863",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 159,
"avg_line_length": 38.565597667638485,
"alnum_prop": 0.7460689446628364,
"repo_name": "yahoo/Glimmer",
"id": "1d7494c2b9a43dc966eca5feffae5a957076b200",
"size": "13867",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/test/java/com/yahoo/glimmer/indexing/preprocessor/ResourceRecordWriterTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "8120"
},
{
"name": "Java",
"bytes": "736066"
},
{
"name": "JavaScript",
"bytes": "21101"
},
{
"name": "Shell",
"bytes": "16237"
}
],
"symlink_target": ""
}
|
// Package logadmin contains mockable logadmin client wrappers.
package logadmin
|
{
"content_hash": "cbbb5d6b22fff138e82813a90cd234b0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 63,
"avg_line_length": 20.75,
"alnum_prop": 0.8192771084337349,
"repo_name": "google/knative-gcp",
"id": "551b661dc25b0434f599368a976e7418ae98fcbc",
"size": "639",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "pkg/gclient/logging/logadmin/doc.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "3344928"
},
{
"name": "Shell",
"bytes": "70016"
}
],
"symlink_target": ""
}
|
package ipxe
import (
"context"
"errors"
"fmt"
"io"
"net/url"
"path"
"strings"
"github.com/u-root/u-root/pkg/boot"
"github.com/u-root/u-root/pkg/curl"
"github.com/u-root/u-root/pkg/uio"
"github.com/u-root/u-root/pkg/ulog"
)
var (
// ErrNotIpxeScript is returned when the config file is not an
// ipxe script.
ErrNotIpxeScript = errors.New("config file is not ipxe as it does not start with #!ipxe")
)
// parser encapsulates a parsed ipxe configuration file.
//
// We currently only support kernel and initrd commands.
type parser struct {
bootImage *boot.LinuxImage
// wd is the current working directory.
//
// Relative file paths are interpreted relative to this URL.
wd *url.URL
log ulog.Logger
schemes curl.Schemes
}
// ParseConfig returns a new configuration with the file at URL and default
// schemes.
//
// `s` is used to get files referred to by URLs in the configuration.
func ParseConfig(ctx context.Context, l ulog.Logger, configURL *url.URL, s curl.Schemes) (*boot.LinuxImage, error) {
c := &parser{
schemes: s,
log: l,
}
if err := c.getAndParseFile(ctx, configURL); err != nil {
return nil, err
}
return c.bootImage, nil
}
// getAndParse parses the config file downloaded from `url` and fills in `c`.
func (c *parser) getAndParseFile(ctx context.Context, u *url.URL) error {
r, err := c.schemes.Fetch(ctx, u)
if err != nil {
return err
}
data, err := uio.ReadAll(r)
if err != nil {
return err
}
config := string(data)
if !strings.HasPrefix(config, "#!ipxe") {
return ErrNotIpxeScript
}
c.log.Printf("Got ipxe config file %s:\n%s\n", r, config)
// Parent dir of the config file.
c.wd = &url.URL{
Scheme: u.Scheme,
Host: u.Host,
Path: path.Dir(u.Path),
}
return c.parseIpxe(config)
}
// getFile parses `surl` and returns an io.Reader for the requested url.
func (c *parser) getFile(surl string) (io.ReaderAt, error) {
u, err := parseURL(surl, c.wd)
if err != nil {
return nil, fmt.Errorf("could not parse URL %q: %v", surl, err)
}
return c.schemes.LazyFetch(u)
}
func parseURL(name string, wd *url.URL) (*url.URL, error) {
u, err := url.Parse(name)
if err != nil {
return nil, fmt.Errorf("could not parse URL %q: %v", name, err)
}
// If it parsed, but it didn't have a Scheme or Host, use the working
// directory's values.
if len(u.Scheme) == 0 && wd != nil {
u.Scheme = wd.Scheme
if len(u.Host) == 0 {
// If this is not there, it was likely just a path.
u.Host = wd.Host
// Absolute file names don't get the parent
// directories, just the host and scheme.
if !path.IsAbs(name) {
u.Path = path.Join(wd.Path, path.Clean(u.Path))
}
}
}
return u, nil
}
// parseIpxe parses `config` and constructs a BootImage for `c`.
func (c *parser) parseIpxe(config string) error {
// A trivial ipxe script parser.
// Currently only supports kernel and initrd commands.
c.bootImage = &boot.LinuxImage{}
for _, line := range strings.Split(config, "\n") {
// Skip blank lines and comment lines.
line = strings.TrimSpace(line)
if line == "" || line[0] == '#' {
continue
}
args := strings.Fields(line)
if len(args) == 0 {
continue
}
cmd := strings.ToLower(args[0])
switch cmd {
case "kernel":
if len(args) > 1 {
k, err := c.getFile(args[1])
if err != nil {
return err
}
c.bootImage.Kernel = k
}
// Add cmdline if there are any.
if len(args) > 2 {
c.bootImage.Cmdline = strings.Join(args[2:], " ")
}
case "initrd":
if len(args) > 1 {
var initrds []io.ReaderAt
for _, f := range strings.Split(args[1], ",") {
i, err := c.getFile(f)
if err != nil {
return err
}
initrds = append(initrds, i)
}
c.bootImage.Initrd = boot.CatInitrds(initrds...)
}
case "boot":
// Stop parsing at this point, we should go ahead and
// boot.
return nil
default:
c.log.Printf("Ignoring unsupported ipxe cmd: %s", line)
}
}
return nil
}
|
{
"content_hash": "ece261f45dd3376f6b6755939f5a964e",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 116,
"avg_line_length": 23.122093023255815,
"alnum_prop": 0.6414382700528036,
"repo_name": "hugelgupf/u-root",
"id": "ba9dafb42eb43821246d436d748191d5896454d8",
"size": "4207",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pkg/boot/netboot/ipxe/ipxe.go",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "2717"
},
{
"name": "C",
"bytes": "598"
},
{
"name": "Dockerfile",
"bytes": "11562"
},
{
"name": "Go",
"bytes": "3924400"
},
{
"name": "Makefile",
"bytes": "185"
},
{
"name": "Python",
"bytes": "5194"
},
{
"name": "Shell",
"bytes": "952"
}
],
"symlink_target": ""
}
|
<div class="section">
<div class="row center">
<h5 class="header col s12 light">A modern responsive front-end framework based on Material Design</h5>
</div>
<div class="row center">
<a href="#/" id="download-button" class="btn-large waves-effect waves-light">Get Started</a>
</div>
</div>
<div class="section">
<!-- Icon Section -->
<div class="row">
<div class="col s12 m4">
<div class="icon-block">
<h2 class="center light-blue-text"><i class="mdi-image-flash-on"></i></h2>
<h5 class="center">Speeds up development</h5>
<p class="light">We did most of the heavy lifting for you to provide a default stylings that incorporate our custom components. Additionally, we refined animations and transitions to provide a smoother experience for developers.</p>
</div>
</div>
<div class="col s12 m4">
<div class="icon-block">
<h2 class="center light-blue-text"><i class="mdi-social-group"></i></h2>
<h5 class="center">User Experience Focused</h5>
<p class="light">By utilizing elements and principles of Material Design, we were able to create a framework that incorporates components and animations that provide more feedback to users. Additionally, a single underlying responsive system across all platforms allow for a more unified user experience.</p>
</div>
</div>
<div class="col s12 m4">
<div class="icon-block">
<h2 class="center light-blue-text"><i class="mdi-action-settings"></i></h2>
<h5 class="center">Easy to work with</h5>
<p class="light">We have provided detailed documentation as well as specific code examples to help new users get started. We are also always open to feedback and can answer any questions a user may have about Materialize.</p>
</div>
</div>
</div>
</div>
<div class="section">
</div>
|
{
"content_hash": "c4559e23861d9c227e43a6e4f277e5d3",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 324,
"avg_line_length": 44.26086956521739,
"alnum_prop": 0.6168958742632613,
"repo_name": "wesleyegbertsen/WesCMS",
"id": "a0ab2c8afb3594ade40bc943004d6b44c419fef8",
"size": "2037",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "templates/home.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "391"
},
{
"name": "CSS",
"bytes": "184616"
},
{
"name": "HTML",
"bytes": "13331"
},
{
"name": "JavaScript",
"bytes": "265379"
},
{
"name": "PHP",
"bytes": "194809"
}
],
"symlink_target": ""
}
|
Engine
======
|
{
"content_hash": "c8115f239cde1fb31eb5a3048ff862d5",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 6,
"avg_line_length": 7,
"alnum_prop": 0.42857142857142855,
"repo_name": "Ledge/Engine",
"id": "a4de8c67ffef71f039bc579cad67719c769ac234",
"size": "14",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "33698"
}
],
"symlink_target": ""
}
|
'''
Created on 23 Oct 2014
Copyright (c) 2014 Brendan Gray and Sylvermyst Technologies
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.
'''
def loadScrambles(fileName):
with open(fileName) as scrambleFile:
scrambles = scrambleFile.readlines()
for i in range(len(scrambles)):
scrambles[i] = scrambles[i].strip()
return scrambles
def testWCA():
# Note that 2x2 - 4x4 are random state, 5x5 - 7x7 are n random turns
puzzles = ['2x2x2', '3x3x3', '4x4x4', '5x5x5', '6x6x6', '7x7x7']
for j in range(len(puzzles)):
print(puzzles[j])
scrambles = loadScrambles("./Sample scrambles/"+puzzles[j]+" Cube Round 1.txt")
for i in range(len(scrambles)):
print(' ',i,'. Length: ', len(scrambles[i].split(' ')), ' Scramble: ',scrambles[i], sep='')
print('\n')
def main():
#testWCA()
scrambles = loadScrambles("./Sample scrambles/3x3test2.txt")
for i in range(len(scrambles)):
print(' ',i,'. Length: ', len(scrambles[i].split(' ')), ' Scramble: ',scrambles[i], sep='')
if __name__ == '__main__':
main()
|
{
"content_hash": "e7216a585c3dce16356b5645e6bcd8c6",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 109,
"avg_line_length": 39.089285714285715,
"alnum_prop": 0.6665143901324806,
"repo_name": "Sylvermyst-Technologies/Onnapt",
"id": "a54c2da7de6af1501ac06343c5b3ff77d7f0c82e",
"size": "2189",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Testing/scramblechecker.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "101997"
}
],
"symlink_target": ""
}
|
package webhook
import (
"socialapi/models"
"strconv"
"github.com/koding/bongo"
)
const botNick = "bot"
type Bot struct {
account *models.Account
}
type Message struct {
Body string `json:"body"`
ChannelId int64 `json:"channelId,string"`
ChannelIntegrationId int64 `json:"channelIntegrationId,string"`
Payload map[string]*string `json:"payload"`
}
func NewBot() (*Bot, error) {
acc := models.NewAccount()
if err := acc.ByNick(botNick); err != nil {
return nil, err
}
return &Bot{account: acc}, nil
}
func (b *Bot) SaveMessage(m *Message) error {
cm, err := b.createMessage(m)
if err != nil {
return err
}
return b.createMessageList(cm, m.ChannelId)
}
func (b *Bot) createMessage(m *Message) (*models.ChannelMessage, error) {
cm := models.NewChannelMessage()
cm.AccountId = b.account.Id
cm.InitialChannelId = m.ChannelId
cm.Body = m.Body
cm.TypeConstant = models.ChannelMessage_TYPE_BOT
cm.Payload = m.Payload
tid := strconv.FormatInt(m.ChannelIntegrationId, 10)
cm.SetPayload("channelIntegrationId", tid)
return cm, cm.Create()
}
func (b *Bot) createMessageList(cm *models.ChannelMessage, channelId int64) error {
cml := models.NewChannelMessageList()
cml.ChannelId = channelId
cml.MessageId = cm.Id
return cml.Create()
}
func (b *Bot) FetchBotChannel(a *models.Account, group *models.Channel) (*models.Channel, error) {
c, err := b.fetchOrCreateChannel(a, group.GroupName)
if err != nil {
return nil, err
}
// add user as participant
_, err = c.AddParticipant(a.Id)
if err == models.ErrAccountIsAlreadyInTheChannel {
return c, nil
}
if err != nil {
return nil, err
}
return c, nil
}
func (b *Bot) fetchOrCreateChannel(a *models.Account, groupName string) (*models.Channel, error) {
// fetch or create channel
c, err := Cache.BotChannel.ByAccountAndGroup(a, groupName)
if err == bongo.RecordNotFound {
return b.createBotChannel(a, groupName)
}
if err != nil {
return nil, err
}
return c, nil
}
func fetchBotChannel(a *models.Account, groupName string) (*models.Channel, error) {
c := models.NewChannel()
selector := map[string]interface{}{
"creator_id": a.Id,
"type_constant": models.Channel_TYPE_BOT,
"group_name": groupName,
}
// if err is nil it means we already have that channel
err := c.One(bongo.NewQS(selector))
if err != nil {
return nil, err
}
return c, nil
}
func (b *Bot) createBotChannel(a *models.Account, groupName string) (*models.Channel, error) {
c := models.NewChannel()
c.CreatorId = a.Id
c.GroupName = groupName
c.Name = models.RandomName()
c.TypeConstant = models.Channel_TYPE_BOT
err := c.Create()
if err != nil {
return nil, err
}
return c, nil
}
func (b *Bot) Account() *models.Account {
return b.account
}
|
{
"content_hash": "3d9fd3bbdb0a5f8054ae72f4d9cf855b",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 98,
"avg_line_length": 21.784615384615385,
"alnum_prop": 0.6758474576271186,
"repo_name": "jack89129/koding",
"id": "d823d3042554a04b76bff17b56f10d21aed949fe",
"size": "2832",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "go/src/socialapi/workers/integration/webhook/bot.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "736295"
},
{
"name": "CoffeeScript",
"bytes": "4698645"
},
{
"name": "Go",
"bytes": "3993614"
},
{
"name": "HTML",
"bytes": "98899"
},
{
"name": "JavaScript",
"bytes": "85244"
},
{
"name": "Makefile",
"bytes": "9533"
},
{
"name": "PHP",
"bytes": "1570"
},
{
"name": "PLpgSQL",
"bytes": "12770"
},
{
"name": "Perl",
"bytes": "1612"
},
{
"name": "Python",
"bytes": "27988"
},
{
"name": "Ruby",
"bytes": "4413"
},
{
"name": "SQLPL",
"bytes": "5187"
},
{
"name": "Shell",
"bytes": "108915"
}
],
"symlink_target": ""
}
|
@implementation RACMulticastConnectionRequest
+ (void)rac_MulticastConnectionRequestWithURLString:(NSString *)urlString rac_SuccessCompleteHandler:(void (^)(NSDictionary *responseObject))successCompleteHandler rac_FailureCompleteHandler:(void (^)(NSError *))failureCompleteHandler{
NSAssert(urlString,@"请设置好服务器接口url");
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
RACMulticastConnection *connection = [[[RACSignal createSignal:^RACDisposable * (id<RACSubscriber> subscriber) {
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSURLSession *urlsession = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [urlsession dataTaskWithRequest:request completionHandler:^(NSData * data, NSURLResponse * response, NSError * error) {
if (error) {
[subscriber sendError:error];
}else{
NSDictionary *resultDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
[subscriber sendNext:resultDict];
[subscriber sendCompleted];
}
}];
[dataTask resume];
return [RACDisposable disposableWithBlock:^{
[dataTask cancel];
}]; //保证信号源主线程执行,不然导致ui无法刷新
}] deliverOn:[RACScheduler mainThreadScheduler]]publish];
[connection.signal subscribeNext:^(NSDictionary *resultDict) {
if (successCompleteHandler) {
successCompleteHandler(resultDict);
}
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}];
[connection.signal subscribeError:^(NSError * error) {
if (failureCompleteHandler) {
failureCompleteHandler(error);
}
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}];
[connection connect];
}
@end
|
{
"content_hash": "637146fb0564c27fd528c7d4be646aea",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 236,
"avg_line_length": 34,
"alnum_prop": 0.6213235294117647,
"repo_name": "KBvsMJ/ReactiveCocoaDemo",
"id": "db0bf5113f233ddea9320b7a49d0801787c15e9b",
"size": "2440",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SXJFRAC_MVVMDEMO/SXJFRAC_MVVMDEMO/RACMulticastConnectionRequest.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "30482"
},
{
"name": "DTrace",
"bytes": "412"
},
{
"name": "Objective-C",
"bytes": "533804"
},
{
"name": "Ruby",
"bytes": "361"
},
{
"name": "Shell",
"bytes": "29853"
}
],
"symlink_target": ""
}
|
#ifndef LIEF_PE_DELAY_IMPORT_H
#define LIEF_PE_DELAY_IMPORT_H
#include <string>
#include <iostream>
#include "LIEF/Object.hpp"
#include "LIEF/types.hpp"
#include "LIEF/visibility.h"
#include "LIEF/iterators.hpp"
#include "LIEF/PE/DelayImportEntry.hpp"
namespace LIEF {
namespace PE {
namespace details {
struct delay_imports;
}
//! Class that represents a PE delayed import.
class LIEF_API DelayImport : public Object {
friend class Parser;
friend class Builder;
public:
using entries_t = std::vector<DelayImportEntry>;
using it_entries = ref_iterator<entries_t&>;
using it_const_entries = const_ref_iterator<const entries_t&>;
DelayImport();
DelayImport(const details::delay_imports& import, PE_TYPE type);
DelayImport(std::string name);
~DelayImport() override;
DelayImport(const DelayImport&);
DelayImport& operator=(const DelayImport&);
DelayImport(DelayImport&&);
DelayImport& operator=(DelayImport&&);
void swap(DelayImport& other);
//! According to the official PE specifications,
//! this value is reserved and should be set to 0.
uint32_t attribute() const;
void attribute(uint32_t hdl);
//! Return the library's name (e.g. `kernel32.dll`)
const std::string& name() const;
void name(std::string name);
//! The RVA of the module handle (in the ``.data`` section)
//! It is used for storage by the routine that is supplied to
//! manage delay-loading.
uint32_t handle() const;
void handle(uint32_t hdl);
//! RVA of the delay-load import address table.
uint32_t iat() const;
void iat(uint32_t iat);
//! RVA of the delay-load import names table.
//! The content of this table has the layout as the Import lookup table
uint32_t names_table() const;
void names_table(uint32_t value);
//! RVA of the **bound** delay-load import address table or 0
//! if the table does not exist.
uint32_t biat() const;
void biat(uint32_t value);
//! RVA of the **unload** delay-load import address table or 0
//! if the table does not exist.
//!
//! According to the PE specifications, this table is an
//! exact copy of the delay import address table that can be
//! used to to restore the original IAT the case of unloading.
uint32_t uiat() const;
void uiat(uint32_t value);
//! The timestamp of the DLL to which this image has been bound.
uint32_t timestamp() const;
void timestamp(uint32_t value);
//! Iterator over the DelayImport's entries (DelayImportEntry)
it_entries entries();
//! Iterator over the DelayImport's entries (DelayImportEntry)
it_const_entries entries() const;
void accept(Visitor& visitor) const override;
bool operator==(const DelayImport& rhs) const;
bool operator!=(const DelayImport& rhs) const;
LIEF_API friend std::ostream& operator<<(std::ostream& os, const DelayImport& entry);
private:
uint32_t attribute_ = 0;
std::string name_;
uint32_t handle_ = 0;
uint32_t iat_ = 0;
uint32_t names_table_ = 0;
uint32_t bound_iat_ = 0;
uint32_t unload_iat_ = 0;
uint32_t timestamp_ = 0;
entries_t entries_;
PE_TYPE type_ = PE_TYPE::PE32;
};
}
}
#endif
|
{
"content_hash": "cf4323cb998e689aa037df3dde50ea89",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 87,
"avg_line_length": 26.369747899159663,
"alnum_prop": 0.6950286806883366,
"repo_name": "lief-project/LIEF",
"id": "7c343cac4d2a7a34840beba92839733e19e050a1",
"size": "3769",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/LIEF/PE/DelayImport.hpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "115380"
},
{
"name": "C++",
"bytes": "5516502"
},
{
"name": "CMake",
"bytes": "185657"
},
{
"name": "Dockerfile",
"bytes": "994"
},
{
"name": "Objective-C",
"bytes": "736"
},
{
"name": "Python",
"bytes": "305524"
},
{
"name": "Shell",
"bytes": "21907"
},
{
"name": "SourcePawn",
"bytes": "130615"
}
],
"symlink_target": ""
}
|
<?php
namespace Github\Api\Repository\Actions;
use Github\Api\AbstractApi;
/**
* @link https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#self-hosted-runners
*/
class SelfHostedRunners extends AbstractApi
{
/**
* @link https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#list-self-hosted-runners-for-a-repository
*
* @param string $username
* @param string $repository
*
* @return array|string
*/
public function all(string $username, string $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurldecode($repository).'/actions/runners');
}
/**
* @link https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#get-a-self-hosted-runner-for-a-repository
*
* @param string $username
* @param string $repository
* @param int $runnerId
*
* @return array|string
*/
public function show(string $username, string $repository, int $runnerId)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurldecode($repository).'/actions/runners/'.$runnerId);
}
/**
* @link https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#delete-a-self-hosted-runner-from-a-repository
*
* @param string $username
* @param string $repository
* @param int $runnerId
*
* @return array|string
*/
public function remove(string $username, string $repository, int $runnerId)
{
return $this->delete('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/actions/runners/'.$runnerId);
}
/**
* @link https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#list-runner-applications-for-a-repository
*
* @param string $username
* @param string $repository
*
* @return array|string
*/
public function applications(string $username, string $repository)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/actions/runners/downloads');
}
}
|
{
"content_hash": "0609e3996bed535fa21e9f477c048afd",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 129,
"avg_line_length": 32.50769230769231,
"alnum_prop": 0.6497870326549929,
"repo_name": "getgrav/grav-plugin-github",
"id": "4a20b1169bf8c52649586c01fc35cd921b532631",
"size": "2113",
"binary": false,
"copies": "4",
"ref": "refs/heads/develop",
"path": "vendor/knplabs/github-api/lib/Github/Api/Repository/Actions/SelfHostedRunners.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "601"
},
{
"name": "PHP",
"bytes": "3053"
}
],
"symlink_target": ""
}
|
from base.db import Article, Feed
from base.crawler import CrawlerBase
import logging
from bs4 import BeautifulSoup
from mako.template import Template
l = logging.getLogger(__name__)
class Crawler(CrawlerBase):
def crawl(self):
# Retrieve content of all feeds
feeds_content = self._get_feeds_content()
# Let's start crawling..
articles_saved = 0
for feed in self.feeds.filter_by(refresh_todo=True):
feed.date_updated = self._date_updated
feed.date_updated_rfc3339 = self._date_updated_rfc3339
soup = BeautifulSoup(feeds_content[feed.url], "lxml")
for article in soup.findAll("article"):
article_url = article.footer.a.attrs.get('href', '')
# Article already retrieved
if self._is_article_in_db(feed, article_url):
continue
# New article
if not article.img:
continue
src_list = [{'src_img': article.img.attrs.get('src', '')}]
alt = article.img.attrs.get('alt', '')
tmpl = Template(
filename=self.conf['rss']['template']['article'],
module_directory=self.conf['misc']['root_path'] + "tmp",
)
content = tmpl.render(alt=alt, src_list=src_list, link=None)
self._add_article_in_db({
'feed': feed,
'url': article_url,
'title': "No title",
'content': content,
})
articles_saved += 1
# Finalize transaction
self.db_session.commit()
l.info("%s article(s) saved", articles_saved)
|
{
"content_hash": "861e9e17fc23e3bd2719a3311b5c1e66",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 76,
"avg_line_length": 35.24,
"alnum_prop": 0.5249716231555052,
"repo_name": "nicolasmartinelli/PyIMF",
"id": "aebebbaf575d9069c0c9345fc2b59cd347c7fa5f",
"size": "1809",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "addons/sarah/crawler.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "474"
},
{
"name": "Python",
"bytes": "44460"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.8.1 at 2019-02-06
| Rendered using Apache Maven Fluido Skin 1.6
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="Date-Revision-yyyymmdd" content="20190206" />
<meta http-equiv="Content-Language" content="en" />
<title>Play! 2.x Maven Plugin – play2:closure-compile</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.6.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido-1.6.min.js"></script>
<link rel="stylesheet" href="./css/site.css" type="text/css" />
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17472708-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="topBarDisabled">
<div class="container-fluid">
<div id="banner">
<div class="pull-left"><div id="bannerLeft"><h2>Play! 2.x Maven Plugin</h2>
</div>
</div>
<div class="pull-right"><div id="bannerRight"><img src="images/my-avatar-80.png" alt="avatar"/></div>
</div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li id="publishDate">Last Published: 2019-02-06<span class="divider">|</span>
</li>
<li id="projectVersion">Version: 1.0.0-rc5</li>
</ul>
</div>
<div class="row-fluid">
<div id="leftColumn" class="span3">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Parent Project</li>
<li><a href="../index.html" title="Play! 2.x"><span class="none"></span>Play! 2.x</a> </li>
<li class="nav-header">Overview</li>
<li><a href="index.html" title="Introduction"><span class="none"></span>Introduction</a> </li>
<li><a href="plugin-info.html" title="Goals"><span class="none"></span>Goals</a> </li>
<li><a href="apidocs/index.html" title="JavaDocs"><span class="none"></span>JavaDocs</a> </li>
<li class="nav-header">Project Documentation</li>
<li><a href="project-info.html" title="Project Information"><span class="icon-chevron-right"></span>Project Information</a> </li>
<li><a href="project-reports.html" title="Project Reports"><span class="icon-chevron-right"></span>Project Reports</a> </li>
</ul>
<hr />
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
</div>
</div>
</div>
<div id="bodyColumn" class="span9" >
<div class="section">
<h2><a name="play2:closure-compile"></a>play2:closure-compile</h2>
<p><b>Full name</b>:</p>
<p>com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc5:closure-compile</p>
<p><b>Description</b>:</p>
<div>Compile JavaScript assets</div>
<p><b>Attributes</b>:</p>
<ul>
<li>Requires a Maven project to be executed.</li>
<li>Since version: <tt>1.0.0</tt>.</li>
<li>Binds by default to the <a class="externalLink" href="http://maven.apache.org/ref/current/maven-core/lifecycles.html">lifecycle phase</a>: <tt>generate-resources</tt>.</li>
</ul>
<div class="section">
<h3><a name="Optional_Parameters"></a>Optional Parameters</h3>
<table class="table table-striped" border="0">
<tr class="a">
<th>Name</th>
<th>Type</th>
<th>Since</th>
<th>Description</th>
</tr>
<tr class="b">
<td><tt><a href="#closureCompilerOptions"><closureCompilerOptions></a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0.0</tt></td>
<td>Javascript compiler options, separated by spaces.<br /><b>User property is</b>: <tt>play2.closureCompilerOptions</tt>.<br /></td>
</tr>
<tr class="a">
<td><tt><a href="#javascriptEntryPointsExcludes"><javascriptEntryPointsExcludes></a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0.0</tt></td>
<td>Javascript compiler entry points excludes, separated by commas.<br /><b>Default value is</b>: <tt>**/_*</tt>.<br /><b>User property is</b>: <tt>play2.javascriptEntryPointsExcludes</tt>.<br /></td>
</tr>
<tr class="b">
<td><tt><a href="#javascriptEntryPointsIncludes"><javascriptEntryPointsIncludes></a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0.0</tt></td>
<td>Javascript compiler entry points includes, separated by commas.<br /><b>Default value is</b>: <tt>**/*.js</tt>.<br /><b>User property is</b>: <tt>play2.javascriptEntryPointsIncludes</tt>.<br /></td>
</tr>
<tr class="a">
<td><tt><a href="#playVersion"><playVersion></a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0.0</tt></td>
<td>Used to automatically select one of the "well known" Play!
providers if no provider added explicitly as plugin's dependency.<br /><b>User property is</b>: <tt>play2.version</tt>.<br /></td>
</tr>
</table>
</div>
<div class="section">
<h3><a name="Parameter_Details"></a>Parameter Details</h3>
<div class="section">
<h4><a name="a.3CclosureCompilerOptions.3E"></a><b><a name="closureCompilerOptions"><closureCompilerOptions></a></b></h4>
<div>Javascript compiler options, separated by spaces.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>play2.closureCompilerOptions</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CjavascriptEntryPointsExcludes.3E"></a><b><a name="javascriptEntryPointsExcludes"><javascriptEntryPointsExcludes></a></b></h4>
<div>Javascript compiler entry points excludes, separated by commas.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>play2.javascriptEntryPointsExcludes</tt></li>
<li><b>Default</b>: <tt>**/_*</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CjavascriptEntryPointsIncludes.3E"></a><b><a name="javascriptEntryPointsIncludes"><javascriptEntryPointsIncludes></a></b></h4>
<div>Javascript compiler entry points includes, separated by commas.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>play2.javascriptEntryPointsIncludes</tt></li>
<li><b>Default</b>: <tt>**/*.js</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CplayVersion.3E"></a><b><a name="playVersion"><playVersion></a></b></h4>
<div>Used to automatically select one of the "well known" Play!
providers if no provider added explicitly as plugin's dependency.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>User Property</b>: <tt>play2.version</tt></li>
</ul>
</div></div>
</div>
</div>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
<p>Copyright ©2013–2019.
All rights reserved.</p>
</div>
</div>
</footer>
</body>
</html>
|
{
"content_hash": "fe8e58f34e9d5194425edaf6f4560893",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 202,
"avg_line_length": 35.57551020408163,
"alnum_prop": 0.5680357962368059,
"repo_name": "play2-maven-plugin/play2-maven-plugin.github.io",
"id": "4e2c6b8f79c3e5867089b1ebcd1217ec85091a6c",
"size": "8716",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "play2-maven-plugin/1.0.0-rc5/play2-maven-plugin/closure-compile-mojo.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2793124"
},
{
"name": "HTML",
"bytes": "178221432"
},
{
"name": "JavaScript",
"bytes": "120742"
}
],
"symlink_target": ""
}
|
Offsets may be a number, a percentage (e.g. `50%`), or a keyword (e.g.
`center`).
Dimensions may be a number, or a percentage (e.g. `50%`).
Positions are treated almost _exactly_ the same as they are in CSS/CSSOM when
an element has the `position: absolute` CSS property.
When an element is created, it can be given coordinates in its constructor:
``` js
var box = blessed.box({
left: 'center',
top: 'center',
bg: 'yellow',
width: '50%',
height: '50%'
});
```
This tells blessed to create a box, perfectly centered __relative to its
parent__, 50% as wide and 50% as tall as its parent.
Percentages can also have offsets applied to them:
``` js
...
height: '50%-1',
left: '45%+1',
...
```
To access the calculated offsets, relative to the parent:
``` js
console.log(box.left);
console.log(box.top);
```
To access the calculated offsets, absolute (relative to the screen):
``` js
console.log(box.aleft);
console.log(box.atop);
```
##### Overlapping offsets and dimensions greater than parents'
This still needs to be tested a bit, but it should work.
|
{
"content_hash": "b6f3296109bd66b7ce220df78e3082bc",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 77,
"avg_line_length": 20.826923076923077,
"alnum_prop": 0.6795937211449676,
"repo_name": "piranna/blessed",
"id": "3ce75833b991e19255687c589bffc03baff53f12",
"size": "1101",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/mechanics/positioning.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "647063"
},
{
"name": "Makefile",
"bytes": "107"
},
{
"name": "Shell",
"bytes": "396"
}
],
"symlink_target": ""
}
|
"""
"""
from .device import Device
__all__ = ['Device']
|
{
"content_hash": "88183b9a896c9ee22dce75eb06c0c36c",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 26,
"avg_line_length": 11.4,
"alnum_prop": 0.543859649122807,
"repo_name": "sfinucane/deviceutils",
"id": "ff7d3dcfc51c265d8f034ea7777edec19b84ece9",
"size": "79",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "deviceutils/device/__init__.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "42599"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="description" content="Learn more about the Coalition for the Barbados Association of Central Florida last meeting.">
<meta name="keywords" content="CFLBAJANS, Coalition for the Barbados Association of Central Florida, CBAOCF, Bajans in Florida, Central Florida Bajans, Central Florida Barbadians, Orlando Bajans, Barbados Association" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="CFLBajans">
<title>CFLBajans July 2018 monthly Meeting</title>
<!-- Bootstrap Core CSS -->
<link href="../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="../vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>
<!-- Theme CSS -->
<link href="../css/agency.min.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" integrity="sha384-0s5Pv64cNZJieYFkXYOTId2HMA2Lfb6q2nAcx2n0RTLUnCAoTTsS0nKEO27XyKcY" crossorigin="anonymous"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js" integrity="sha384-ZoaMbDF+4LeFxg6WdScQ9nnR1QC2MIRxA1O9KWEXQwns1G8UNyIEZIQidzb0T1fo" crossorigin="anonymous"></script>
<![endif]-->
</head>
<body class="bg-light-gray" style="margin:0 auto">
<section id="description" style="margin:-75px 0">
<h3 class="section-heading text-center">July 2018 Summary</h3>
<ul class="nav nav-tabs">
<li class="active"><a href="#synopsis" data-toggle="tab" style="color:#0000c1">Synopsis</a></li>
<li><a href="#trivia" data-toggle="tab" style="color:#0000c1">Story</a></li>
<li><a href="#witticism" data-toggle="tab" style="color:#0000c1">Witticisms</a></li>
<li><a href="#gallery" data-toggle="tab" style="color:#0000c1">Photo Gallery</a></li>
<li><a href="#summaries" data-toggle="tab" style="color:#0000c1">Summaries</a></li>
</ul>
<div class="tab-content clearfix">
<div class="tab-pane active" id="synopsis">
<table>
<tr>
<td valign="top" style="width:75%;font-size:12px; padding-left:10px; padding-right:10px;">
<p>
The meeting highlights for this month are as follows:
<br>
<ul style="font-size:14px">
<li>
Guest speaker Ambassador Harriet Elam Thomas spoke to the group. Her presentation was very informative. In it she shared how she got involved, became an Ambassador, and outlined some of her many experiences. She also explained the role of Ambassador and requirements for it.
<br>
<br>
</li>
<li>
The group discussed the prospect of participating in a St. John's Riverboat Cruise. The event will occur on Saturday August 25th 2018 from 11am - 2:00pm. Please contact <a href="mailto:correspondingsecretary@cflbajans.com" style="color:blue">correspondingsecretary at cflbajans dot com</a> to join the cruise under the group rate.
</li>
<br>
<li>
The corresponding secretary indicated the following upcoming events from our friends.
<ul>
<li>BAOTB 9th Annual Dance for Hope will be October 27th 2018, tickets $40</li>
<li>Jamaican 56th year of Independence Gala will be August 11th 2018, tickets $70</li>
<li>TTAC Gala will be September 1st 2018, tickets $70</li>
</ul>
</li>
<br>
<li>
The Barbados Trivia focused on Crop Over.
</li>
</ul>
<p style="text-decoration:underline"><strong>REMINDERS:</strong></p>
<li style="font-size:14px">
The CFL Bajans' annual picnic at <a href="https://goo.gl/maps/BmcU5BHgWSt" target="_blank">Barnett Park, 4801 W Colonial Dr, Orlando, FL 32808</a> from 1pm - 7pm. Tickets for the event are available. Please contact <a href="mailto:correspondingsecretary@cflbajans.com" style="color:blue">correspondingsecretary at cflbajans dot com</a> to secure yours!
</li>
<li style="font-size:14px">
The CFL Bajans' annual Independence Gala on November 10th 2018 at the <a href="https://goo.gl/maps/ABobdq3zW922" target="_blank">Rosen Center, 9840 International Dr, Orlando, FL 32819</a>. Tickets for the event are $75. Please contact the <a href="mailto:president@cflbajans.com" style="color:blue">president at cflbajans dot com</a> or the <a href="mailto:correspondingsecretary@cflbajans.com" style="color:blue">corresponding secretary at cflbajans dot com</a> to secure your spot!
</li>
<br>
<li style="font-size:14px">
CFL Bajans upcoming volunteer/community activities:
<ul>
July 28th 2018 8:15am – 11:30am, <a href="https://goo.gl/maps/z44ntWnneFt" target="_blank">Second Harvest Food Bank of Central Florida, 411 Mercy Dr, Orlando, FL 32805</a>. You must wear closed in shoes for this activity.
</li>
A sign-up sheet will be circulating at the next meeting. Also, please feel free to contact the <a href="mailto:secretary@cflbajans.com" style="color:blue">secretary at cflbajans dot com</a> or the <a href="mailto:correspondingsecretary@cflbajans.com" style="color:blue">correspondingsecretary at cflbajans dot com</a> to sign up for the volunteer activity if interested.
</ul>
</li>
<br>
</p>
</td>
<td valign="top" style="text-align:center;">
<p> </p>
<img src="../img/FB/fb-jul-2018.jpg" alt="Guest speaker at July's 2018 meeting" class="img-responsive" width="250px" height="200px">
<p style="font-size:12px">Ambassador Harriet Elam Thomas, guest speaker at July's meeting</p>
</td>
</tr>
</table>
</div>
<div class="tab-pane" id="trivia">
<p class="large text-muted text-center"><br>Some Bajan trivia - 'How well do you remember' </p>
<p class="text-center" style="font-size:12px">By: Marjorie McCauley, a CFL Bajan<br></p>
<p>
Can you remember these aspects of old Barbados?
<br><br>
The former name for a district hospital?
<br>
Answer: almshouse
<br><br>
What we used to call a toilet?
<br>
Answer: chamber
<br><br>
What was the previous name of the Sir Grantley Adams International Airport?
<br>
Answer: Seawell
<br><br>
The name for a straw hat worn by school children years ago.
<br>
Answer: Panama hat
<br><br>
Today we say chickens, in the olden days they said ____.
<br>
Answer: yard fowl
<br><br>
A stiff undergarment worn by women in the olden days.
<br>
Answer: a can-can
<br><br>
A moveable cupboard used for storing food.
<br>
Answer: a larder
<br><br>
The hat once worn by the plantation owners.
<br>
Answer: cork hat
<br><br>
'Yuh know, Patsy did always a fair weather friend'. What does that mean?
<br>
Answer: She's unreliable person
<br><br>
'Yuh tell me, why would anybody let a 14-year old back back a car?'. What is the 14-year old doing to the car?
<br>
Answer: reversing
</p>
<p style="font-size:12px">
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">
<img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png">
</a>
<br>Bajan trivia by <a href="mailto:socialmedia@cflbajans.com">Marjorie McCauley</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License</a>.
</p>
</div>
<div class="tab-pane" id="witticism">
<p class="large text-muted text-center">
<br>
Because when Bajans hangout, they say the darnest things!
</p>
<ul>
<li>There are a whole heap of undertakers... yes, but that is a dead business!</li>
</ul>
<br>
</div>
<div class="tab-pane" id="gallery">
<p class="large text-muted text-center">Highlights</p>
<div class="row">
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<img class="img-responsive thumbnail" src="../img/FB/fb-jul-2018.jpg" alt="Guest speaker at July's 2018 meeting">
<p class="title text-center">Ambassador Harriet Elam Thomas, guest speaker at July's meeting</p>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<img class="img-responsive thumbnail" src="../img/FB/fb-jul-2018a.jpg" alt="attendees at July's meeting">
<p class="title text-center">Attendees at July's meeting</p>
</div>
<div class="col-lg-3 col-md-4 col-xs-6 thumb">
<img class="img-responsive thumbnail" src="../img/FB/fb-jul-2018b.jpg" alt="Age comparison">
<p class="title text-center">Our oldest and youngest members - 99yrs and 1mth old!</p>
</div>
</div>
<br>
<div style="text-align:center"><a href="https://www.facebook.com/CFLBAJANS/posts/1839268292821962" target="_blank" class="page-scroll btn btn-xl text-break-md">See all pics</a></div>
</div>
<div class="tab-pane" id="summaries">
<p class="large text-muted text-center">Summaries of past meetings</p>
<p>Need to catch up on what happened at a past meeting? Or you wish to re-live the moments? Check out the summaries below.</p>
<br>
<div class="row">
<div id="preview-indicators" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="item slides" style="width:100%">
<div class="slide-1"></div>
<div class="container">
<table class="table text-center" align="center" style="width:300px;max-width:100%">
<thead>
<tr>
<th></th>
<th><p class="large text-muted text-center" style="color:black">2017</p></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>JAN</td>
<td>FEB</td>
<td>MAR</td>
</tr>
<tr>
<td>APR</td>
<td>MAY</td>
<td><a href="june-2017.html" style="text-decoration:none">JUN</a></td>
</tr>
<tr>
<td><a href="july-2017.html" style="text-decoration:none">JUL</a></td>
<td><a href="aug-2017.html" style="text-decoration:none">AUG</a></td>
<td><a href="sep-2017.html" style="text-decoration:none">SEP</a></td>
</tr>
<tr>
<td><a href="oct-2017.html" style="text-decoration:none">OCT</a></td>
<td><a href="nov-2017.html" style="text-decoration:none">NOV</a></td>
<td><a href="dec-2017.html" style="text-decoration:none">DEC</a></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="item slides" style="width:100%">
<div class="slide-2"></div>
<div class="container">
<table class="table text-center" align="center" style="width:300px;max-width:100%">
<thead>
<tr>
<th></th>
<th><p class="large text-muted text-center" style="color:black">2018</p></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="jan-2018.html" style="text-decoration:none">JAN</a></td>
<td><a href="feb-2018.html" style="text-decoration:none">FEB</a></td>
<td><a href="mar-2018.html" style="text-decoration:none">MAR</a></td>
</tr>
<tr>
<td><a href="apr-2018.html" style="text-decoration:none">APR</a></td>
<td><a href="may-2018.html" style="text-decoration:none">MAY</a></td>
<td><a href="jun-2018.html" style="text-decoration:none">JUN</a></td>
</tr>
<tr>
<td><a href="jul-2018.html" style="text-decoration:none">JUL</a></td>
<td><a href="aug-2018.html" style="text-decoration:none">AUG</a></td>
<td><a href="sep-2018.html" style="text-decoration:none">SEP</a></td>
</tr>
<tr>
<td><a href="oct-2018.html" style="text-decoration:none">OCT</a></td>
<td><a href="nov-2018.html" style="text-decoration:none">NOV</a></td>
<td>DEC</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="item slides active">
<div class="slide-3"></div>
<div class="container">
<table class="table text-center" align="center" style="width:300px;max-width:100%">
<thead>
<tr>
<th></th>
<th><p class="large text-muted text-center" style="color:black">2019</p></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="jan-2019.html" style="text-decoration:none">JAN</a></td>
<td><a href="feb-2019.html" style="text-decoration:none">FEB</a></td>
<td><a href="mar-2019.html" style="text-decoration:none">MAR</a></td>
</tr>
<tr>
<td><a href="apr-2019.html" style="text-decoration:none">APR</a></td>
<td>MAY</td>
<td>JUN</td>
</tr>
<tr>
<td>JUL</td>
<td>AUG</td>
<td>SEP</td>
</tr>
<tr>
<td>OCT</td>
<td>NOV</td>
<td>DEC</td>
</tr>
</tbody>
</table>
</div>
</div>
<a class="left carousel-control" href="#preview-indicators" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#preview-indicators" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- jQuery -->
<script src="../vendor/jquery/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="../vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- Plugin JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js" integrity="sha384-mE6eXfrb8jxl0rzJDBRanYqgBxtJ6Unn4/1F7q4xRRyIw7Vdg9jP4ycT7x1iVsgb" crossorigin="anonymous"></script>
<!-- Contact Form JavaScript -->
<script src="../js/jqBootstrapValidation.js"></script>
<script src="../js/contact_me.js"></script>
<!-- Theme JavaScript -->
<script src="../js/agency.min.js"></script>
</body>
</html>
|
{
"content_hash": "b58317331ec405930f9f153cb441aa8d",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 527,
"avg_line_length": 72.49849849849849,
"alnum_prop": 0.38729185651561593,
"repo_name": "CFLBajans/cflbajans",
"id": "83f5442d35596fd2d6f8fdbd7bb7353229b9fa52",
"size": "24144",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "monthly-meetings/jul-2018.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "933429"
},
{
"name": "JavaScript",
"bytes": "43429"
},
{
"name": "Less",
"bytes": "17559"
},
{
"name": "PHP",
"bytes": "1172"
},
{
"name": "SCSS",
"bytes": "18186"
}
],
"symlink_target": ""
}
|
<?php
/** Zend_Search_Lucene_Analysis_Analyzer_Common */
#require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common.php';
/**
* @category Zend
* @package Zend_Search_Lucene
* @subpackage Analysis
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num extends Zend_Search_Lucene_Analysis_Analyzer_Common
{
/**
* Current char position in an UTF-8 stream
*
* @var integer
*/
private $_position;
/**
* Current binary position in an UTF-8 stream
*
* @var integer
*/
private $_bytePosition;
/**
* Object constructor
*
* @throws Zend_Search_Lucene_Exception
*/
public function __construct()
{
if (@preg_match('/\pL/u', 'a') != 1) {
// PCRE unicode support is turned off
#require_once 'Zend/Search/Lucene/Exception.php';
throw new Zend_Search_Lucene_Exception('Utf8Num analyzer needs PCRE unicode support to be enabled.');
}
}
/**
* Reset token stream
*/
public function reset()
{
$this->_position = 0;
$this->_bytePosition = 0;
// convert input into UTF-8
if (strcasecmp($this->_encoding, 'utf8' ) != 0 &&
strcasecmp($this->_encoding, 'utf-8') != 0 ) {
$this->_input = iconv($this->_encoding, 'UTF-8', $this->_input);
$this->_encoding = 'UTF-8';
}
}
/**
* Tokenization stream API
* Get next token
* Returns null at the end of stream
*
* @return Zend_Search_Lucene_Analysis_Token|null
*/
public function nextToken()
{
if ($this->_input === null) {
return null;
}
do {
if (! preg_match('/[\p{L}\p{N}]+/u', $this->_input, $match, PREG_OFFSET_CAPTURE, $this->_bytePosition)) {
// It covers both cases a) there are no matches (preg_match(...) === 0)
// b) error occured (preg_match(...) === FALSE)
return null;
}
// matched string
$matchedWord = $match[0][0];
// binary position of the matched word in the input stream
$binStartPos = $match[0][1];
// character position of the matched word in the input stream
$startPos = $this->_position +
iconv_strlen(substr($this->_input,
$this->_bytePosition,
$binStartPos - $this->_bytePosition),
'UTF-8');
// character postion of the end of matched word in the input stream
$endPos = $startPos + iconv_strlen($matchedWord, 'UTF-8');
$this->_bytePosition = $binStartPos + strlen($matchedWord);
$this->_position = $endPos;
$token = $this->normalize(new Zend_Search_Lucene_Analysis_Token($matchedWord, $startPos, $endPos));
} while ($token === null); // try again if token is skipped
return $token;
}
}
|
{
"content_hash": "43a0965fd079b0549d30f730e774a377",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 117,
"avg_line_length": 31.289719626168225,
"alnum_prop": 0.514336917562724,
"repo_name": "almadaocta/lordbike-production",
"id": "b976c3981df6dcd7b2cfd0274c06797594506475",
"size": "4139",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "errors/includes/src/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "20744"
},
{
"name": "ApacheConf",
"bytes": "6510"
},
{
"name": "Batchfile",
"bytes": "1053"
},
{
"name": "C",
"bytes": "25531"
},
{
"name": "CSS",
"bytes": "2695575"
},
{
"name": "HTML",
"bytes": "7607119"
},
{
"name": "JavaScript",
"bytes": "4942446"
},
{
"name": "Makefile",
"bytes": "266"
},
{
"name": "PHP",
"bytes": "111927807"
},
{
"name": "Perl",
"bytes": "1124"
},
{
"name": "PowerShell",
"bytes": "1042"
},
{
"name": "Roff",
"bytes": "1009"
},
{
"name": "Ruby",
"bytes": "298"
},
{
"name": "Shell",
"bytes": "2118"
},
{
"name": "XSLT",
"bytes": "2135"
}
],
"symlink_target": ""
}
|
package com.intellij.diff.actions.impl;
import com.intellij.diff.tools.util.SyncScrollSupport;
import com.intellij.diff.tools.util.base.HighlightingLevel;
import com.intellij.diff.tools.util.base.TextDiffSettingsHolder.TextDiffSettings;
import com.intellij.diff.tools.util.breadcrumbs.BreadcrumbsPlacement;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.diff.DiffBundle;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actions.AbstractToggleUseSoftWrapsAction;
import com.intellij.openapi.editor.ex.EditorGutterComponentEx;
import com.intellij.openapi.editor.impl.EditorImpl;
import com.intellij.openapi.project.DumbAware;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
public class SetEditorSettingsAction extends ActionGroup implements DumbAware {
@NotNull private final TextDiffSettings myTextSettings;
@NotNull private final List<? extends Editor> myEditors;
@Nullable private SyncScrollSupport.Support mySyncScrollSupport;
private final AnAction @NotNull [] myActions;
public SetEditorSettingsAction(@NotNull TextDiffSettings settings,
@NotNull List<? extends Editor> editors) {
super(DiffBundle.message("editor.settings"), null, AllIcons.General.GearPlain);
setPopup(true);
myTextSettings = settings;
myEditors = editors;
for (Editor editor : myEditors) {
((EditorGutterComponentEx)editor.getGutter()).setGutterPopupGroup(this);
}
myActions = new AnAction[]{
new EditorSettingToggleAction("EditorToggleShowWhitespaces") {
@Override
public boolean isSelected() {
return myTextSettings.isShowWhitespaces();
}
@Override
public void setSelected(boolean state) {
myTextSettings.setShowWhitespaces(state);
}
@Override
public void apply(@NotNull Editor editor, boolean value) {
if (editor.getSettings().isWhitespacesShown() != value) {
editor.getSettings().setWhitespacesShown(value);
editor.getComponent().repaint();
}
}
},
new EditorSettingToggleAction("EditorToggleShowLineNumbers") {
@Override
public boolean isSelected() {
return myTextSettings.isShowLineNumbers();
}
@Override
public void setSelected(boolean state) {
myTextSettings.setShowLineNumbers(state);
}
@Override
public void apply(@NotNull Editor editor, boolean value) {
if (editor.getSettings().isLineNumbersShown() != value) {
editor.getSettings().setLineNumbersShown(value);
editor.getComponent().repaint();
}
}
},
new EditorSettingToggleAction("EditorToggleShowIndentLines") {
@Override
public boolean isSelected() {
return myTextSettings.isShowIndentLines();
}
@Override
public void setSelected(boolean state) {
myTextSettings.setShowIndentLines(state);
}
@Override
public void apply(@NotNull Editor editor, boolean value) {
if (editor.getSettings().isIndentGuidesShown() != value) {
editor.getSettings().setIndentGuidesShown(value);
editor.getComponent().repaint();
}
}
},
new EditorSettingToggleAction("EditorToggleUseSoftWraps") {
private boolean myForcedSoftWrap;
@Override
public boolean isSelected() {
return myForcedSoftWrap || myTextSettings.isUseSoftWraps();
}
@Override
public void setSelected(boolean state) {
myForcedSoftWrap = false;
myTextSettings.setUseSoftWraps(state);
}
@Override
public void apply(@NotNull Editor editor, boolean value) {
if (editor.getSettings().isUseSoftWraps() == value) return;
if (mySyncScrollSupport != null) mySyncScrollSupport.enterDisableScrollSection();
try {
AbstractToggleUseSoftWrapsAction.toggleSoftWraps(editor, null, value);
}
finally {
if (mySyncScrollSupport != null) mySyncScrollSupport.exitDisableScrollSection();
}
}
@Override
public void applyDefaults(@NotNull List<? extends Editor> editors) {
if (!myTextSettings.isUseSoftWraps()) {
for (Editor editor : editors) {
myForcedSoftWrap = myForcedSoftWrap || ((EditorImpl)editor).shouldSoftWrapsBeForced();
}
}
super.applyDefaults(editors);
}
},
new EditorHighlightingLayerGroup(),
new EditorBreadcrumbsPlacementGroup(),
};
}
public void setSyncScrollSupport(@Nullable SyncScrollSupport.Support syncScrollSupport) {
mySyncScrollSupport = syncScrollSupport;
}
public void applyDefaults() {
for (AnAction action : myActions) {
((EditorSettingAction)action).applyDefaults(myEditors);
}
}
@Override
public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) {
AnAction editorSettingsGroup = ActionManager.getInstance().getAction("Diff.EditorGutterPopupMenu.EditorSettings");
List<AnAction> actions = new ArrayList<>();
ContainerUtil.addAll(actions, myActions);
actions.add(editorSettingsGroup);
actions.add(Separator.getInstance());
if (e != null && ActionPlaces.DIFF_TOOLBAR.equals(e.getPlace())) {
return actions.toArray(AnAction.EMPTY_ARRAY);
}
ActionGroup gutterGroup = (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_DIFF_EDITOR_GUTTER_POPUP);
List<AnAction> result = ContainerUtil.newArrayList(gutterGroup.getChildren(e));
result.add(Separator.getInstance());
replaceOrAppend(result, editorSettingsGroup, new DefaultActionGroup(actions));
return result.toArray(AnAction.EMPTY_ARRAY);
}
private static <T> void replaceOrAppend(List<T> list, T from, T to) {
int index = list.indexOf(from);
if (index == -1) index = list.size();
list.remove(from);
list.add(index, to);
}
private abstract class EditorSettingToggleAction extends ToggleAction implements DumbAware, EditorSettingAction {
private EditorSettingToggleAction(@NotNull String actionId) {
ActionUtil.copyFrom(this, actionId);
getTemplatePresentation().setIcon(null);
}
@Override
public boolean isSelected(@NotNull AnActionEvent e) {
return isSelected();
}
@Override
public void setSelected(@NotNull AnActionEvent e, boolean state) {
setSelected(state);
for (Editor editor : myEditors) {
apply(editor, state);
}
}
public abstract boolean isSelected();
public abstract void setSelected(boolean value);
public abstract void apply(@NotNull Editor editor, boolean value);
@Override
public void applyDefaults(@NotNull List<? extends Editor> editors) {
for (Editor editor : editors) {
apply(editor, isSelected());
}
}
}
private class EditorHighlightingLayerGroup extends ActionGroup implements EditorSettingAction, DumbAware {
private final AnAction[] myOptions;
EditorHighlightingLayerGroup() {
super(DiffBundle.message("highlighting.level"), true);
myOptions = ContainerUtil.map(HighlightingLevel.values(), level -> new OptionAction(level), AnAction.EMPTY_ARRAY);
}
@Override
public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) {
return myOptions;
}
@Override
public void applyDefaults(@NotNull List<? extends Editor> editors) {
apply(myTextSettings.getHighlightingLevel());
}
private void apply(@NotNull HighlightingLevel layer) {
for (Editor editor : myEditors) {
((EditorImpl)editor).setHighlightingFilter(layer.getCondition());
}
}
private class OptionAction extends ToggleAction implements DumbAware {
@NotNull private final HighlightingLevel myLayer;
OptionAction(@NotNull HighlightingLevel layer) {
super(layer.getText(), null, layer.getIcon());
myLayer = layer;
}
@Override
public boolean isSelected(@NotNull AnActionEvent e) {
return myTextSettings.getHighlightingLevel() == myLayer;
}
@Override
public void setSelected(@NotNull AnActionEvent e, boolean state) {
myTextSettings.setHighlightingLevel(myLayer);
apply(myLayer);
}
}
}
private class EditorBreadcrumbsPlacementGroup extends ActionGroup implements EditorSettingAction, DumbAware {
private final AnAction[] myOptions;
EditorBreadcrumbsPlacementGroup() {
ActionUtil.copyFrom(this, IdeActions.BREADCRUMBS_OPTIONS_GROUP);
myOptions = ContainerUtil.map(BreadcrumbsPlacement.values(), option -> new OptionAction(option), AnAction.EMPTY_ARRAY);
setPopup(true);
}
@Override
public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) {
return myOptions;
}
@Override
public void applyDefaults(@NotNull List<? extends Editor> editors) {
}
private class OptionAction extends ToggleAction implements DumbAware {
@NotNull private final BreadcrumbsPlacement myOption;
OptionAction(@NotNull BreadcrumbsPlacement option) {
ActionUtil.copyFrom(this, option.getActionId());
myOption = option;
}
@Override
public boolean isSelected(@NotNull AnActionEvent e) {
return myTextSettings.getBreadcrumbsPlacement() == myOption;
}
@Override
public void setSelected(@NotNull AnActionEvent e, boolean state) {
myTextSettings.setBreadcrumbsPlacement(myOption);
}
}
}
private interface EditorSettingAction {
void applyDefaults(@NotNull List<? extends Editor> editors);
}
}
|
{
"content_hash": "b14c0ec706c3b8a663bd9e04572bc4e9",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 125,
"avg_line_length": 33.841750841750844,
"alnum_prop": 0.687792259476669,
"repo_name": "leafclick/intellij-community",
"id": "5a192fd34c26f8a9c4cb9f7cda4f6a0c3a515e69",
"size": "10192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "platform/diff-impl/src/com/intellij/diff/actions/impl/SetEditorSettingsAction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
}
|
layout: page
title: Walker 15th Anniversary
date: 2016-05-24
author: James Tyler
tags: weekly links, java
status: published
summary: Donec placerat sagittis massa dictum faucibus.
banner: images/banner/leisure-02.jpg
booking:
startDate: 08/07/2019
endDate: 08/10/2019
ctyhocn: AVPTKHX
groupCode: W1A
published: true
---
Nam a est sed lectus finibus tincidunt et non est. Suspendisse tristique odio ut augue congue, eu ornare lorem accumsan. Donec accumsan mi eu odio pulvinar commodo. Quisque accumsan leo eget augue hendrerit, maximus viverra eros pellentesque. Curabitur ultricies enim molestie, tempus risus vel, blandit nunc. Nullam nec est tempor, volutpat est eget, faucibus nunc. Vivamus accumsan libero mi, id eleifend velit mollis venenatis. Vestibulum ac mi ac libero accumsan eleifend. Sed nec bibendum nibh. Aliquam pellentesque auctor mauris vel pretium. Praesent aliquam laoreet convallis. Nam commodo dolor ac leo imperdiet varius. Vestibulum pulvinar luctus ante, nec luctus ante iaculis eget. Etiam sodales magna leo, quis volutpat lorem aliquet vel. Curabitur eget massa sit amet lacus mattis semper hendrerit et elit.
Quisque sagittis vel massa non vulputate. Mauris lacus enim, fringilla ac nulla quis, convallis fringilla neque. Vivamus eu nisl viverra, pulvinar ipsum in, vulputate neque. Integer nibh turpis, porta gravida purus luctus, commodo commodo quam. Etiam arcu felis, porttitor vel congue at, bibendum vel sapien. Duis dignissim vulputate libero, sed facilisis augue commodo ut. Quisque in ipsum ligula. Donec porta felis nunc, sed porta ipsum lobortis a. Nulla facilisi.
* Praesent pulvinar eros sit amet lorem sollicitudin semper
* Aliquam accumsan mi eu tristique pretium
* Maecenas cursus enim in ex fermentum posuere
* In bibendum dui sodales, auctor erat at, dictum dui.
Sed lacus libero, interdum ut eros eget, ornare pretium libero. Nulla in dui quis erat euismod volutpat consectetur non orci. Integer turpis lectus, semper vel efficitur eget, pretium non felis. Vivamus vestibulum efficitur malesuada. Aliquam sed nulla lacus. Quisque eget nunc lobortis, rutrum mauris eu, mattis massa. Ut mi dui, sollicitudin sed maximus ut, feugiat sit amet mauris.
|
{
"content_hash": "9350598bca7d03ddb6e85f52c5e33b21",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 816,
"avg_line_length": 91.83333333333333,
"alnum_prop": 0.8076225045372051,
"repo_name": "KlishGroup/prose-pogs",
"id": "fcee3c7487a0b9ccca0669bf26b223d7c724b767",
"size": "2208",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "pogs/A/AVPTKHX/W1A/index.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
}
|
import functools
from pycadf import cadftaxonomy as taxonomy
from six.moves.urllib import parse
from keystone import auth
from keystone.auth import plugins as auth_plugins
from keystone.common import dependency
from keystone import exception
from keystone.federation import constants as federation_constants
from keystone.federation import utils
from keystone.i18n import _
from keystone.models import token_model
from keystone import notifications
METHOD_NAME = 'mapped'
@dependency.requires('federation_api', 'identity_api',
'resource_api', 'token_provider_api')
class Mapped(auth.AuthMethodHandler):
def _get_token_ref(self, auth_payload):
token_id = auth_payload['id']
response = self.token_provider_api.validate_token(token_id)
return token_model.KeystoneToken(token_id=token_id,
token_data=response)
def authenticate(self, context, auth_payload, auth_context):
"""Authenticate mapped user and set an authentication context.
:param context: keystone's request context
:param auth_payload: the content of the authentication for a
given method
:param auth_context: user authentication context, a dictionary
shared by all plugins.
In addition to ``user_id`` in ``auth_context``, this plugin sets
``group_ids``, ``OS-FEDERATION:identity_provider`` and
``OS-FEDERATION:protocol``
"""
if 'id' in auth_payload:
token_ref = self._get_token_ref(auth_payload)
handle_scoped_token(context, auth_payload, auth_context, token_ref,
self.federation_api,
self.identity_api,
self.token_provider_api)
else:
handle_unscoped_token(context, auth_payload, auth_context,
self.resource_api, self.federation_api,
self.identity_api)
def handle_scoped_token(context, auth_payload, auth_context, token_ref,
federation_api, identity_api, token_provider_api):
utils.validate_expiration(token_ref)
token_audit_id = token_ref.audit_id
identity_provider = token_ref.federation_idp_id
protocol = token_ref.federation_protocol_id
user_id = token_ref.user_id
group_ids = token_ref.federation_group_ids
send_notification = functools.partial(
notifications.send_saml_audit_notification, 'authenticate',
context, user_id, group_ids, identity_provider, protocol,
token_audit_id)
utils.assert_enabled_identity_provider(federation_api, identity_provider)
try:
mapping = federation_api.get_mapping_from_idp_and_protocol(
identity_provider, protocol)
utils.validate_groups(group_ids, mapping['id'], identity_api)
except Exception:
# NOTE(topol): Diaper defense to catch any exception, so we can
# send off failed authentication notification, raise the exception
# after sending the notification
send_notification(taxonomy.OUTCOME_FAILURE)
raise
else:
send_notification(taxonomy.OUTCOME_SUCCESS)
auth_context['user_id'] = user_id
auth_context['group_ids'] = group_ids
auth_context[federation_constants.IDENTITY_PROVIDER] = identity_provider
auth_context[federation_constants.PROTOCOL] = protocol
def handle_unscoped_token(context, auth_payload, auth_context,
resource_api, federation_api, identity_api):
def is_ephemeral_user(mapped_properties):
return mapped_properties['user']['type'] == utils.UserType.EPHEMERAL
def build_ephemeral_user_context(auth_context, user, mapped_properties,
identity_provider, protocol):
auth_context['user_id'] = user['id']
auth_context['group_ids'] = mapped_properties['group_ids']
auth_context[federation_constants.IDENTITY_PROVIDER] = (
identity_provider)
auth_context[federation_constants.PROTOCOL] = protocol
def build_local_user_context(auth_context, mapped_properties):
user_info = auth_plugins.UserAuthInfo.create(mapped_properties,
METHOD_NAME)
auth_context['user_id'] = user_info.user_id
assertion = extract_assertion_data(context)
identity_provider = auth_payload['identity_provider']
protocol = auth_payload['protocol']
utils.assert_enabled_identity_provider(federation_api, identity_provider)
group_ids = None
# NOTE(topol): The user is coming in from an IdP with a SAML assertion
# instead of from a token, so we set token_id to None
token_id = None
# NOTE(marek-denis): This variable is set to None and there is a
# possibility that it will be used in the CADF notification. This means
# operation will not be mapped to any user (even ephemeral).
user_id = None
try:
mapped_properties, mapping_id = apply_mapping_filter(
identity_provider, protocol, assertion, resource_api,
federation_api, identity_api)
if is_ephemeral_user(mapped_properties):
user = setup_username(context, mapped_properties)
user_id = user['id']
group_ids = mapped_properties['group_ids']
utils.validate_groups_cardinality(group_ids, mapping_id)
build_ephemeral_user_context(auth_context, user,
mapped_properties,
identity_provider, protocol)
else:
build_local_user_context(auth_context, mapped_properties)
except Exception:
# NOTE(topol): Diaper defense to catch any exception, so we can
# send off failed authentication notification, raise the exception
# after sending the notification
outcome = taxonomy.OUTCOME_FAILURE
notifications.send_saml_audit_notification('authenticate', context,
user_id, group_ids,
identity_provider,
protocol, token_id,
outcome)
raise
else:
outcome = taxonomy.OUTCOME_SUCCESS
notifications.send_saml_audit_notification('authenticate', context,
user_id, group_ids,
identity_provider,
protocol, token_id,
outcome)
def extract_assertion_data(context):
assertion = dict(utils.get_assertion_params_from_env(context))
return assertion
def apply_mapping_filter(identity_provider, protocol, assertion,
resource_api, federation_api, identity_api):
idp = federation_api.get_idp(identity_provider)
utils.validate_idp(idp, protocol, assertion)
mapped_properties, mapping_id = federation_api.evaluate(
identity_provider, protocol, assertion)
# NOTE(marek-denis): We update group_ids only here to avoid fetching
# groups identified by name/domain twice.
# NOTE(marek-denis): Groups are translated from name/domain to their
# corresponding ids in the auth plugin, as we need information what
# ``mapping_id`` was used as well as idenity_api and resource_api
# objects.
group_ids = mapped_properties['group_ids']
utils.validate_groups_in_backend(group_ids,
mapping_id,
identity_api)
group_ids.extend(
utils.transform_to_group_ids(
mapped_properties['group_names'], mapping_id,
identity_api, resource_api))
mapped_properties['group_ids'] = list(set(group_ids))
return mapped_properties, mapping_id
def setup_username(context, mapped_properties):
"""Setup federated username.
Function covers all the cases for properly setting user id, a primary
identifier for identity objects. Initial version of the mapping engine
assumed user is identified by ``name`` and his ``id`` is built from the
name. We, however need to be able to accept local rules that identify user
by either id or name/domain.
The following use-cases are covered:
1) If neither user_name nor user_id is set raise exception.Unauthorized
2) If user_id is set and user_name not, set user_name equal to user_id
3) If user_id is not set and user_name is, set user_id as url safe version
of user_name.
:param context: authentication context
:param mapped_properties: Properties issued by a RuleProcessor.
:type: dictionary
:raises keystone.exception.Unauthorized: If neither `user_name` nor
`user_id` is set.
:returns: dictionary with user identification
:rtype: dict
"""
user = mapped_properties['user']
user_id = user.get('id')
user_name = user.get('name') or context['environment'].get('REMOTE_USER')
if not any([user_id, user_name]):
msg = _("Could not map user while setting ephemeral user identity. "
"Either mapping rules must specify user id/name or "
"REMOTE_USER environment variable must be set.")
raise exception.Unauthorized(msg)
elif not user_name:
user['name'] = user_id
elif not user_id:
user_id = user_name
user['id'] = parse.quote(user_id)
return user
|
{
"content_hash": "b73e8db9e3df55e81f6a6c3a3f56136f",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 79,
"avg_line_length": 40.90717299578059,
"alnum_prop": 0.6258896338318721,
"repo_name": "dims/keystone",
"id": "ad630911cf380c3537ff8e7dbd2556e91643a7e2",
"size": "10241",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "keystone/auth/plugins/mapped.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "665"
},
{
"name": "Python",
"bytes": "4298962"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.endog_names — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/stylesheets/deprecation.css">
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/material.css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="../_static/plot_directive.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.exog_names" href="statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.exog_names.html" />
<link rel="prev" title="statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.score_obs" href="statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.score_obs.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.endog_names" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.13.0</span>
<span class="md-header-nav__topic"> statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.endog_names </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="get" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../../versions-v2.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../discretemod.html" class="md-tabs__link">Regression with Discrete Dependent Variable</a></li>
<li class="md-tabs__item"><a href="statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.html" class="md-tabs__link">statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.13.0</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../regression.html" class="md-nav__link">Linear Regression</a>
</li>
<li class="md-nav__item">
<a href="../glm.html" class="md-nav__link">Generalized Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../gee.html" class="md-nav__link">Generalized Estimating Equations</a>
</li>
<li class="md-nav__item">
<a href="../gam.html" class="md-nav__link">Generalized Additive Models (GAM)</a>
</li>
<li class="md-nav__item">
<a href="../rlm.html" class="md-nav__link">Robust Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../mixed_linear.html" class="md-nav__link">Linear Mixed Effects Models</a>
</li>
<li class="md-nav__item">
<a href="../discretemod.html" class="md-nav__link">Regression with Discrete Dependent Variable</a>
</li>
<li class="md-nav__item">
<a href="../mixed_glm.html" class="md-nav__link">Generalized Linear Mixed Effects Models</a>
</li>
<li class="md-nav__item">
<a href="../anova.html" class="md-nav__link">ANOVA</a>
</li>
<li class="md-nav__item">
<a href="../other_models.html" class="md-nav__link">Other Models <code class="xref py py-mod docutils literal notranslate"><span class="pre">othermod</span></code></a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.endog_names.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="generated-statsmodels-discrete-count-model-zeroinflatednegativebinomialp-endog-names--page-root">statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.endog_names<a class="headerlink" href="#generated-statsmodels-discrete-count-model-zeroinflatednegativebinomialp-endog-names--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="py property">
<dt class="sig sig-object py" id="statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.endog_names">
<em class="property"><span class="pre">property</span> </em><span class="sig-prename descclassname"><span class="pre">ZeroInflatedNegativeBinomialP.</span></span><span class="sig-name descname"><span class="pre">endog_names</span></span><a class="headerlink" href="#statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.endog_names" title="Permalink to this definition">¶</a></dt>
<dd><p>Names of endogenous variables.</p>
</dd></dl>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.score_obs.html" title="statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.score_obs"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.score_obs </span>
</div>
</a>
<a href="statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.exog_names.html" title="statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.exog_names"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.exog_names </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Oct 06, 2021.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 4.0.3.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html>
|
{
"content_hash": "73244ba73dcfc9ee03bf4fa0accc14b2",
"timestamp": "",
"source": "github",
"line_count": 496,
"max_line_length": 999,
"avg_line_length": 37.73185483870968,
"alnum_prop": 0.6021907560780123,
"repo_name": "statsmodels/statsmodels.github.io",
"id": "59a8bb746093e0f2a6d1fb2c5ddca067044b95b2",
"size": "18719",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "v0.13.0/generated/statsmodels.discrete.count_model.ZeroInflatedNegativeBinomialP.endog_names.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
}
|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8" /><link rel="canonical" href="http://mongoc.org/libbson/current/mongoc_uri_get_auth_source.html"/>
<title>mongoc_uri_get_auth_source() — libmongoc 1.21.2</title>
<link rel="stylesheet" href="_static/readable.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/readable.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="mongoc_uri_get_compressors()" href="mongoc_uri_get_compressors.html" />
<link rel="prev" title="mongoc_uri_get_auth_mechanism()" href="mongoc_uri_get_auth_mechanism.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="mongoc_uri_get_compressors.html" title="mongoc_uri_get_compressors()"
accesskey="N">next</a></li>
<li class="right" >
<a href="mongoc_uri_get_auth_mechanism.html" title="mongoc_uri_get_auth_mechanism()"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">libmongoc 1.21.2</a> »</li>
<li class="nav-item nav-item-1"><a href="api.html" >API Reference</a> »</li>
<li class="nav-item nav-item-2"><a href="mongoc_uri_t.html" accesskey="U">mongoc_uri_t</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="mongoc-uri-get-auth-source">
<h1>mongoc_uri_get_auth_source()<a class="headerlink" href="#mongoc-uri-get-auth-source" title="Permalink to this headline">¶</a></h1>
<div class="section" id="synopsis">
<h2>Synopsis<a class="headerlink" href="#synopsis" title="Permalink to this headline">¶</a></h2>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span>
<span class="nf">mongoc_uri_get_auth_source</span> <span class="p">(</span><span class="k">const</span> <span class="n">mongoc_uri_t</span> <span class="o">*</span><span class="n">uri</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="parameters">
<h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">uri</span></code>: A <a class="symbol reference internal" href="mongoc_uri_t.html"><span class="doc">mongoc_uri_t</span></a>.</p></li>
</ul>
</div>
<div class="section" id="description">
<h2>Description<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2>
<p>Fetches the <code class="docutils literal notranslate"><span class="pre">authSource</span></code> parameter of an URI if provided.</p>
</div>
<div class="section" id="returns">
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
<p>A string which should not be modified or freed if the <code class="docutils literal notranslate"><span class="pre">authSource</span></code> parameter is provided, otherwise <code class="docutils literal notranslate"><span class="pre">NULL</span></code>.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<div class="line-block">
<div class="line"><a class="symbol reference internal" href="authentication.html"><span class="doc">Authentication</span></a></div>
</div>
<div class="line-block">
<div class="line"><a class="symbol reference internal" href="mongoc_uri_get_auth_mechanism.html"><span class="doc">mongoc_uri_get_auth_mechanism()</span></a></div>
</div>
<div class="line-block">
<div class="line"><a class="symbol reference internal" href="#"><span class="doc">mongoc_uri_get_auth_source()</span></a></div>
</div>
<div class="line-block">
<div class="line"><a class="symbol reference internal" href="mongoc_uri_get_mechanism_properties.html"><span class="doc">mongoc_uri_get_mechanism_properties()</span></a></div>
</div>
<div class="line-block">
<div class="line"><a class="symbol reference internal" href="mongoc_uri_set_auth_mechanism.html"><span class="doc">mongoc_uri_set_auth_mechanism()</span></a></div>
</div>
<div class="line-block">
<div class="line"><a class="symbol reference internal" href="mongoc_uri_set_auth_source.html"><span class="doc">mongoc_uri_set_auth_source()</span></a></div>
</div>
<div class="line-block">
<div class="line"><a class="symbol reference internal" href="mongoc_uri_set_mechanism_properties.html"><span class="doc">mongoc_uri_set_mechanism_properties()</span></a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li class="toctree-l1"><a class="reference internal" href="installing.html">Installing the MongoDB C Driver (libmongoc) and BSON library (libbson)</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="tutorial.html">Tutorial</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="authentication.html">Authentication</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="basic-troubleshooting.html">Basic Troubleshooting</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="guides.html">Guides</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="api.html">API Reference</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="init-cleanup.html">Initialization and cleanup</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html">Logging</a></li>
<li class="toctree-l2"><a class="reference internal" href="errors.html">Error Reporting</a></li>
<li class="toctree-l2"><a class="reference internal" href="lifecycle.html">Object Lifecycle</a></li>
<li class="toctree-l2"><a class="reference internal" href="gridfs.html">GridFS</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_auto_encryption_opts_t.html">mongoc_auto_encryption_opts_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_bulk_operation_t.html">mongoc_bulk_operation_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_change_stream_t.html">mongoc_change_stream_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_client_encryption_t.html">mongoc_client_encryption_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_client_encryption_datakey_opts_t.html">mongoc_client_encryption_datakey_opts_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_client_encryption_encrypt_opts_t.html">mongoc_client_encryption_encrypt_opts_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_client_encryption_opts_t.html">mongoc_client_encryption_opts_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_client_pool_t.html">mongoc_client_pool_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_client_session_t.html">mongoc_client_session_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_client_session_with_transaction_cb_t.html">mongoc_client_session_with_transaction_cb_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_client_t.html">mongoc_client_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_collection_t.html">mongoc_collection_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_cursor_t.html">mongoc_cursor_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_database_t.html">mongoc_database_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_delete_flags_t.html">mongoc_delete_flags_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_find_and_modify_opts_t.html">mongoc_find_and_modify_opts_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_gridfs_file_list_t.html">mongoc_gridfs_file_list_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_gridfs_file_opt_t.html">mongoc_gridfs_file_opt_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_gridfs_file_t.html">mongoc_gridfs_file_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_gridfs_bucket_t.html">mongoc_gridfs_bucket_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_gridfs_t.html">mongoc_gridfs_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_host_list_t.html">mongoc_host_list_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_index_opt_geo_t.html">mongoc_index_opt_geo_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_index_opt_t.html">mongoc_index_opt_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_index_opt_wt_t.html">mongoc_index_opt_wt_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_insert_flags_t.html">mongoc_insert_flags_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_iovec_t.html">mongoc_iovec_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_matcher_t.html">mongoc_matcher_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_optional_t.html">mongoc_optional_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_query_flags_t.html">mongoc_query_flags_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_rand.html">mongoc_rand</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_read_concern_t.html">mongoc_read_concern_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_read_mode_t.html">mongoc_read_mode_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_read_prefs_t.html">mongoc_read_prefs_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_remove_flags_t.html">mongoc_remove_flags_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_reply_flags_t.html">mongoc_reply_flags_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_server_api_t.html">mongoc_server_api_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_server_api_version_t.html">mongoc_server_api_version_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_server_description_t.html">mongoc_server_description_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_session_opt_t.html">mongoc_session_opt_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_socket_t.html">mongoc_socket_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_ssl_opt_t.html">mongoc_ssl_opt_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_stream_buffered_t.html">mongoc_stream_buffered_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_stream_file_t.html">mongoc_stream_file_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_stream_socket_t.html">mongoc_stream_socket_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_stream_t.html">mongoc_stream_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_stream_tls_t.html">mongoc_stream_tls_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_topology_description_t.html">mongoc_topology_description_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_transaction_opt_t.html">mongoc_transaction_opt_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_transaction_state_t.html">mongoc_transaction_state_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_update_flags_t.html">mongoc_update_flags_t</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="mongoc_uri_t.html">mongoc_uri_t</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_version.html">Version Checks</a></li>
<li class="toctree-l2"><a class="reference internal" href="mongoc_write_concern_t.html">mongoc_write_concern_t</a></li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="application-performance-monitoring.html">Application Performance Monitoring (APM)</a></li>
</ul>
<!-- Because full_index.rst includes everything that index.rst includes, we have to exclude index.rst from the table-of-contents. This page is simply a link forced into the sidebar (in conf.py) to avoid including full_index.rst in the ToC. -->
<ul><li class='toctree-l1'><a href="full_index.html">Index</a></li></ul>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
© Copyright 2017-present, MongoDB, Inc.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 4.1.2.
</div>
</body>
</html>
|
{
"content_hash": "001e5662bf177a29b382de7e0eba39c9",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 260,
"avg_line_length": 70.41346153846153,
"alnum_prop": 0.6982793936911103,
"repo_name": "treefrogframework/treefrog-framework",
"id": "602a695bde3ea478e7c1d730d89efe47da323509",
"size": "14652",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "3rdparty/mongo-c-driver-1.21.2/src/libmongoc/doc/html/mongoc_uri_get_auth_source.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "19207"
},
{
"name": "C",
"bytes": "14971"
},
{
"name": "C++",
"bytes": "1717761"
},
{
"name": "CMake",
"bytes": "14155"
},
{
"name": "HTML",
"bytes": "9485"
},
{
"name": "JavaScript",
"bytes": "1140610"
},
{
"name": "QMake",
"bytes": "36422"
},
{
"name": "Shell",
"bytes": "4387"
}
],
"symlink_target": ""
}
|
{% block content %}
<form id="form-config-service" action="{% url 'cripts.services.views.edit_config' name %}" method="post">
<table class="form" style="width: 75%;">
{{ form }}
</table>
<input class="form_submit_button" type="submit" value="Submit" />
</form>
<span id="service_edit_results"></span>
{% endblock %}
|
{
"content_hash": "d73243932b50de6aa94f4b044f726003",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 109,
"avg_line_length": 40,
"alnum_prop": 0.5805555555555556,
"repo_name": "lakiw/cripts",
"id": "722970d8b0a8fe9ecf2405cee93b77d0b1d42a09",
"size": "362",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cripts/services/templates/services_config_form.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "8703"
},
{
"name": "CSS",
"bytes": "402627"
},
{
"name": "HTML",
"bytes": "274995"
},
{
"name": "JavaScript",
"bytes": "3306609"
},
{
"name": "Python",
"bytes": "1089011"
},
{
"name": "Shell",
"bytes": "21040"
}
],
"symlink_target": ""
}
|
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>HomeCinema-lib</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
|
{
"content_hash": "3360358136a3a7b042f7862b45757ef5",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 64,
"avg_line_length": 33.8,
"alnum_prop": 0.5364891518737672,
"repo_name": "berthise/HomeCinema",
"id": "3164841aea815b1ffd532c47ef9876246981e5d0",
"size": "507",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "HomeCinema-lib/nbproject/project.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "9338"
}
],
"symlink_target": ""
}
|
// Copyright (c) DotSpatial Team. All rights reserved.
// Licensed under the MIT license. See License.txt file in the project root for full license information.
using System.Drawing;
using DotSpatial.Data;
namespace DotSpatial.Symbology
{
/// <summary>
/// Extension methods for <see cref="Extent"/>.
/// </summary>
public static class ExtentExt
{
#region Methods
/// <summary>
/// This method assumes that there was a direct correlation between this envelope and the original
/// rectangle. This reproportions this window to match the specified newRectangle.
/// </summary>
/// <param name="self">The original envelope.</param>
/// <param name="original">The original rectangle. </param>
/// <param name="newRectangle">The new rectangle.</param>
/// <returns>A new Envelope. </returns>
public static Extent Reproportion(this Extent self, Rectangle original, Rectangle newRectangle)
{
double dx = self.Width * (newRectangle.X - original.X) / original.Width;
double dy = self.Height * (newRectangle.Y - original.Y) / original.Height;
double w = self.Width * newRectangle.Width / original.Width;
double h = self.Height * newRectangle.Height / original.Height;
return new Extent(self.X + dx, self.Y + dy - h, self.X + dx + w, self.Y + dy);
}
#endregion
}
}
|
{
"content_hash": "90279634f1b8f463640017f673d55b31",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 106,
"avg_line_length": 40.19444444444444,
"alnum_prop": 0.6351071181755356,
"repo_name": "DotSpatial/DotSpatial",
"id": "c3bab007a5001bf8efe8dbf9b5c2a439c2b1d7c2",
"size": "1449",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Core/DotSpatial.Symbology/ExtentExt.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP.NET",
"bytes": "1639"
},
{
"name": "Batchfile",
"bytes": "4625"
},
{
"name": "C#",
"bytes": "15483649"
},
{
"name": "CSS",
"bytes": "490"
},
{
"name": "HTML",
"bytes": "8176"
},
{
"name": "JavaScript",
"bytes": "133570"
},
{
"name": "Smalltalk",
"bytes": "406360"
},
{
"name": "Visual Basic .NET",
"bytes": "451767"
}
],
"symlink_target": ""
}
|
"""
===========================================================
Plot sensor denoising using oversampled temporal projection
===========================================================
This demonstrates denoising using the OTP algorithm [1]_ on data with
with sensor artifacts (flux jumps) and random noise.
"""
# Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import mne
import numpy as np
from mne import find_events, fit_dipole
from mne.datasets.brainstorm import bst_phantom_elekta
from mne.io import read_raw_fif
print(__doc__)
###############################################################################
# Plot the phantom data, lowpassed to get rid of high-frequency artifacts.
# We also crop to a single 10-second segment for speed.
# Notice that there are two large flux jumps on channel 1522 that could
# spread to other channels when performing subsequent spatial operations
# (e.g., Maxwell filtering, SSP, or ICA).
dipole_number = 1
data_path = bst_phantom_elekta.data_path()
raw = read_raw_fif(
op.join(data_path, 'kojak_all_200nAm_pp_no_chpi_no_ms_raw.fif'))
raw.crop(40., 50.).load_data()
order = list(range(160, 170))
raw.copy().filter(0., 40.).plot(order=order, n_channels=10)
###############################################################################
# Now we can clean the data with OTP, lowpass, and plot. The flux jumps have
# been suppressed alongside the random sensor noise.
raw_clean = mne.preprocessing.oversampled_temporal_projection(raw)
raw_clean.filter(0., 40.)
raw_clean.plot(order=order, n_channels=10)
###############################################################################
# We can also look at the effect on single-trial phantom localization.
# See the :ref:`sphx_glr_auto_tutorials_plot_brainstorm_phantom_elekta.py`
# for more information. Here we use a version that does single-trial
# localization across the 17 trials are in our 10-second window:
def compute_bias(raw):
events = find_events(raw, 'STI201', verbose=False)
events = events[1:] # first one has an artifact
tmin, tmax = -0.2, 0.1
epochs = mne.Epochs(raw, events, dipole_number, tmin, tmax,
baseline=(None, -0.01), preload=True, verbose=False)
sphere = mne.make_sphere_model(r0=(0., 0., 0.), head_radius=None,
verbose=False)
cov = mne.compute_covariance(epochs, tmax=0, method='shrunk',
verbose=False)
idx = epochs.time_as_index(0.036)[0]
data = epochs.get_data()[:, :, idx].T
evoked = mne.EvokedArray(data, epochs.info, tmin=0.)
dip = fit_dipole(evoked, cov, sphere, n_jobs=1, verbose=False)[0]
actual_pos = mne.dipole.get_phantom_dipoles()[0][dipole_number - 1]
misses = 1000 * np.linalg.norm(dip.pos - actual_pos, axis=-1)
return misses
bias = compute_bias(raw)
print('Raw bias: %0.1fmm (worst: %0.1fmm)'
% (np.mean(bias), np.max(bias)))
bias_clean = compute_bias(raw_clean)
print('OTP bias: %0.1fmm (worst: %0.1fmm)'
% (np.mean(bias_clean), np.max(bias_clean),))
###############################################################################
# References
# ----------
# .. [1] Larson E, Taulu S (2017). Reducing Sensor Noise in MEG and EEG
# Recordings Using Oversampled Temporal Projection.
# IEEE Transactions on Biomedical Engineering.
|
{
"content_hash": "8d8ca7110a6776a007361bbe7b08f6bc",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 79,
"avg_line_length": 40.45238095238095,
"alnum_prop": 0.5968216597998823,
"repo_name": "teonlamont/mne-python",
"id": "b549b0ba6b929c73e451f932e482dc15dca5eac4",
"size": "3398",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "examples/preprocessing/plot_otp.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Makefile",
"bytes": "3117"
},
{
"name": "PowerShell",
"bytes": "2988"
},
{
"name": "Python",
"bytes": "4354605"
},
{
"name": "Shell",
"bytes": "936"
}
],
"symlink_target": ""
}
|
'use strict'
var EventManager = require('remix-lib').EventManager
function Files (storage) {
var event = new EventManager()
this.event = event
var readonly = {}
this.type = 'browser'
this.exists = function (path) {
var unprefixedpath = this.removePrefix(path)
// NOTE: ignore the config file
if (path === '.remix.config') return false
return this.isReadOnly(unprefixedpath) || storage.exists(unprefixedpath)
}
this.init = function (cb) {
cb()
}
this.get = function (path, cb) {
var unprefixedpath = this.removePrefix(path)
// NOTE: ignore the config file
if (path === '.remix.config') {
return null
}
var content = readonly[unprefixedpath] || storage.get(unprefixedpath)
if (cb) {
cb(null, content)
}
return content
}
this.set = function (path, content) {
var unprefixedpath = this.removePrefix(path)
// NOTE: ignore the config file
if (path === '.remix.config') {
return false
}
if (!this.isReadOnly(unprefixedpath)) {
var exists = storage.exists(unprefixedpath)
if (!storage.set(unprefixedpath, content)) {
return false
}
if (!exists) {
event.trigger('fileAdded', [this.type + '/' + unprefixedpath, false])
} else {
event.trigger('fileChanged', [this.type + '/' + unprefixedpath])
}
return true
}
return false
}
this.addReadOnly = function (path, content) {
var unprefixedpath = this.removePrefix(path)
if (!storage.exists(unprefixedpath)) {
readonly[unprefixedpath] = content
event.trigger('fileAdded', [this.type + '/' + unprefixedpath, true])
return true
}
return false
}
this.isReadOnly = function (path) {
path = this.removePrefix(path)
return readonly[path] !== undefined
}
this.remove = function (path) {
var unprefixedpath = this.removePrefix(path)
if (!this.exists(unprefixedpath)) {
return false
}
if (this.isReadOnly(unprefixedpath)) {
readonly[unprefixedpath] = undefined
} else {
if (!storage.remove(unprefixedpath)) {
return false
}
}
event.trigger('fileRemoved', [this.type + '/' + unprefixedpath])
return true
}
this.rename = function (oldPath, newPath, isFolder) {
var unprefixedoldPath = this.removePrefix(oldPath)
var unprefixednewPath = this.removePrefix(newPath)
if (!this.isReadOnly(unprefixedoldPath) && storage.exists(unprefixedoldPath)) {
if (!storage.rename(unprefixedoldPath, unprefixednewPath)) {
return false
}
event.trigger('fileRenamed', [this.type + '/' + unprefixedoldPath, this.type + '/' + unprefixednewPath, isFolder])
return true
}
return false
}
this.resolveDirectory = function (path, callback) {
var self = this
if (path[0] === '/') path = path.substring(1)
if (!path) return callback(null, { [self.type]: { } })
path = self.removePrefix(path)
var filesList = {}
var tree = {}
// add r/w filesList to the list
storage.keys().forEach((path) => {
// NOTE: as a temporary measure do not show the config file
if (path !== '.remix.config') {
filesList[path] = false
}
})
// add r/o files to the list
Object.keys(readonly).forEach((path) => {
filesList[path] = true
})
Object.keys(filesList).forEach(function (path) {
tree[path] = { isDirectory: false }
})
return callback(null, tree)
}
this.removePrefix = function (path) {
return path.indexOf(this.type + '/') === 0 ? path.replace(this.type + '/', '') : path
}
// rename .browser-solidity.json to .remix.config
if (this.exists('.browser-solidity.json')) {
this.rename('.browser-solidity.json', '.remix.config')
}
}
module.exports = Files
|
{
"content_hash": "8ce090cd462aa904055e2c7e65b7dca2",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 120,
"avg_line_length": 27.156028368794328,
"alnum_prop": 0.6213110472708279,
"repo_name": "serapath-contribution/browser-solidity",
"id": "ce645a083cf3d2c57d03a10e010c9a0a7624a060",
"size": "3829",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/files/browser-files.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4168"
},
{
"name": "HTML",
"bytes": "1638"
},
{
"name": "JavaScript",
"bytes": "436050"
},
{
"name": "Shell",
"bytes": "4049"
}
],
"symlink_target": ""
}
|
from prime import Prime
def ans():
return sum(Prime.gen_nums(2000000))
if __name__ == '__main__':
print(ans())
|
{
"content_hash": "61fd9638e357e05d2d29265768e4e423",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 39,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.5853658536585366,
"repo_name": "mackorone/euler",
"id": "28c1dc5ebadba7cd9fd8f443a25e08e2bf93722d",
"size": "123",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/010.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "44836"
}
],
"symlink_target": ""
}
|
package com.nokia.xfolite.xforms.dom;
import java.util.Hashtable;
import com.nokia.xfolite.xml.dom.*;
import com.nokia.xfolite.xml.dom.events.DOMEvent;
import com.nokia.xfolite.xml.xpath.*;
public class ListenElement extends ActionElement {
ListenElement(Document ownerDocument, String aNamespaceURI, String aPrefix, String aLocalName) {
super(ownerDocument, aNamespaceURI, aPrefix, aLocalName);
}
public void handleEvent(DOMEvent evt) {
String src = this.getAttribute("src");
String ref = getAttribute("ref");
String userRef = getAttribute("user");
String action =getAttribute("action");
String frequencyAttr = getAttribute("frequency");
if (src == "" || ref == "" || action == "") {
logError("Empty src, ref or action attribute");
return;
}
String user = "";
try {
if (userRef != null) {
user = getValue(userRef).asString();
}
} catch (Exception ignore) {}
NodeSet nset = getValue(ref).asNodeSet();
Node refNode = null;
if (nset != null) {
refNode = nset.firstNode();
}
if (refNode == null) {
logError("Reference binding failed");
}
int frequency = 1000;
if (frequencyAttr != "") {
try {
frequency = Integer.parseInt(frequencyAttr);
} catch (NumberFormatException e) {
logError("Frequency is not a number (defaulting to 1000)");
}
}
if (action.equals("start")) {
((XFormsDocument)ownerDocument).startEventProvider(user,src, refNode, frequency, null);
} else if (action.equals("stop")){
((XFormsDocument)ownerDocument).stopEventProvider(src);
} else if (action.equals("initialize")){
((XFormsDocument)ownerDocument).initializeEventProvider(user, src);
} else if (action.equals("get")) {
((XFormsDocument)ownerDocument).getEventProvider(src, refNode, null);
} else {
logError("Unknown action definiton");
}
}
}
|
{
"content_hash": "87dc9dd0e2f05a7a8d4ac89418b6d414",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 99,
"avg_line_length": 34.359375,
"alnum_prop": 0.571168713051387,
"repo_name": "okoskimi/Xfolite",
"id": "3c7eaef72a8f85cd05b14a8e31fbdb7cfaa94a6b",
"size": "3059",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/com/nokia/xfolite/xforms/dom/ListenElement.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "28407"
},
{
"name": "Java",
"bytes": "1027484"
}
],
"symlink_target": ""
}
|
package com.plusub.lib.example.api;
import android.content.Context;
import com.plusub.lib.example.api.http.subscribers.ProgressSubscriber;
import com.plusub.lib.example.api.http.subscribers.SubscriberOnNextListener;
import com.plusub.lib.example.model.BookEntity;
import java.util.List;
import rx.Observable;
public class ApiWrapper extends RetrofitUtil{
/**
* 获取图书列表
* @param context
* @param queryString
* @param count
* @param mSubscriberOnNextListener
*/
public static void getBookList(Context context, String queryString, int count, SubscriberOnNextListener<List<BookEntity>> mSubscriberOnNextListener){
Observable observable = getService().getBookList(queryString, count);
toSubscribe(observable, new ProgressSubscriber(context, mSubscriberOnNextListener));
}
}
|
{
"content_hash": "318f6628c130b481bd3b72190c8cb914",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 153,
"avg_line_length": 29.785714285714285,
"alnum_prop": 0.7601918465227818,
"repo_name": "haodynasty/BaseUtilsLib",
"id": "19951112bc3a5294a23a5b5762c3084a810b770d",
"size": "1473",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/plusub/lib/example/api/ApiWrapper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "976734"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>T19224449255</title>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,600">
<link rel="stylesheet" href="/style.css">
<link rel="stylesheet" href="/custom.css">
<link rel="alternate" type="application/rss+xml" title="Des Paroz" href="https://desparoz.me/feed.xml" />
<link rel="alternate" type="application/json" title="Des Paroz" href="https://desparoz.me/feed.json" />
<link rel="EditURI" type="application/rsd+xml" href="/rsd.xml" />
<link rel="me" href="https://micro.blog/desparoz" />
<link rel="me" href="https://twitter.com/desparoz" />
<link rel="me" href="https://github.com/desparoz" />
<link rel="authorization_endpoint" href="https://indieauth.com/auth" />
<link rel="token_endpoint" href="https://tokens.indieauth.com/token" />
<link rel="micropub" href="https://micro.blog/micropub" />
<link rel="webmention" href="https://micro.blog/webmention" />
<link rel="subscribe" href="https://micro.blog/users/follow" />
</head>
<body>
<div class="container">
<header class="masthead">
<h1 class="masthead-title--small">
<a href="/">Des Paroz</a>
</h1>
</header>
<div class="content post h-entry">
<div class="post-date">
<time class="dt-published" datetime="2010-07-23 03:00:00 +0300">23 Jul 2010</time>
</div>
<div class="e-content">
<p>Skull Cave in PNG’s Milne Bay: </p>
<p>Skull Cave, originally uploaded by BlueBeyond.</p>
<p>One of the adventures of travel … <a href="http://bit.ly/bk6guz">bit.ly/bk6guz</a></p>
</div>
</div>
</div>
</body>
</html>
|
{
"content_hash": "974a0210b85368733674e96d54e5dabd",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 107,
"avg_line_length": 32.62264150943396,
"alnum_prop": 0.6564488143435512,
"repo_name": "desparoz/desparoz.github.io",
"id": "c06307dd9e2d1e93ac7e090729989139588e95da",
"size": "1733",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_site/2010/07/23/t19224449255.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "50311"
},
{
"name": "HTML",
"bytes": "135"
},
{
"name": "JavaScript",
"bytes": "1546"
},
{
"name": "Ruby",
"bytes": "5501"
}
],
"symlink_target": ""
}
|
require 'rubygems'
require 'sinatra/base'
require 'test/unit'
require 'rack/test'
require 'active_record'
require 'sinatra/simple-authentication'
require 'nokogiri'
module Sinatra
class Base
set :environment, :test
::ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => "#{Dir.pwd}/test.db")
register Sinatra::SimpleAuthentication
end
end
class TcActiveRecord < Test::Unit::TestCase
include Rack::Test::Methods
def app
Sinatra::Application
end
def teardown
Sinatra::SimpleAuthentication::Controllers::Session.model_class.delete_all
end
def test_signup_page
get '/signup'
assert last_response.ok?
html = Nokogiri::HTML(last_response.body)
assert html.css('[name="email"]')
assert html.css('[name="password"]')
assert html.css('[name="password_confirmation"]')
end
def test_login_page
get '/login'
assert last_response.ok?
html = Nokogiri::HTML(last_response.body)
assert html.css('[name="email"]')
assert html.css('[name="password"]')
end
def test_user_validations
taken_email = "Email has already been taken."
missing_email = "Email can't be blank."
invalid_email = "Invalid email format."
missing_password = "Password can't be blank."
short_password = "Password is too short, must be between 4 and 16 characters long."
long_password = "Password is too long, must be between 4 and 16 characters long."
#Empty user
user = Sinatra::SimpleAuthentication::Controllers::Session.model_class.new
assert !user.save
assert user.errors[:email].include?(missing_email)
assert user.errors[:password].include?(missing_password)
assert user.errors[:password].include?(short_password)
#Short password
user = Sinatra::SimpleAuthentication::Controllers::Session.model_class.new
user.password = "X" * 3
assert !user.save
assert user.errors[:email].include?(missing_email)
assert user.errors[:password].include?(short_password)
#Long password
user = Sinatra::SimpleAuthentication::Controllers::Session.model_class.new
user.password = "X" * 17
assert !user.save
assert user.errors[:email].include?(missing_email)
assert user.errors[:password].include?(long_password)
#Wrong format email
user = Sinatra::SimpleAuthentication::Controllers::Session.model_class.new
user.email = "InvaidEmailFormat"
assert !user.save
assert user.errors[:email].include?(invalid_email)
assert user.errors[:password].include?(missing_password)
assert user.errors[:password].include?(short_password)
#Valid user
user = Sinatra::SimpleAuthentication::Controllers::Session.model_class.new
user.email = "test@mail.com"
user.password = "PASSWORD"
assert user.save
#user_class duplicated email
user = Sinatra::SimpleAuthentication::Controllers::Session.model_class.new
user.email = "test@mail.com"
user.password = "PASSWORD"
assert !user.save
assert user.errors[:email].include?(taken_email)
end
end
|
{
"content_hash": "8fb83b53fea423eaa4f864f3fc58f433",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 103,
"avg_line_length": 29.92156862745098,
"alnum_prop": 0.7054390563564875,
"repo_name": "pmonfort/sinatra-simple-authentication",
"id": "bcf0142a42a7c6fb3601ef0bfba9b5e8672dc1f5",
"size": "3052",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/tc_active_record.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "31896"
}
],
"symlink_target": ""
}
|
| `master` | `dev` |
|----------|-------|
|[](https://travis-ci.org/SlaybaughLab/BART)[](https://codecov.io/gh/SlaybaughLab/BART/branch/master)|[](https://travis-ci.org/SlaybaughLab/BART)[](https://codecov.io/gh/SlaybaughLab/BART/branch/dev)|
# Bay Area Radiation Transport (BART)
## What is BART for?
Bay Area Radiation Transport (BART), is a C++-based research-purpose
code for parallel radiation transport computation in nuclear reactor
applications. BART is under active developed by the Computational
Neutronics group in Nuclear Engineering at University of California,
Berkeley.
### Documentation
BART documentation is generated using [doxygen](http://www.stack.nl/~dimitri/doxygen/).
### Test-driven development
BART uses the following applications and libraries for testing:
- [Travis CI](https://travis-ci.org) for continuous integration
- [CTest](https://cmake.org/Wiki/CMake/Testing_With_CTest) for unit testings requiring MPI
- [Google Test](https://github.com/google/googletest) for all other
serial unit testings.
- [Codecov](https://codecov.io/) for code coverage of unit tests.
## Rationale
### Finite element method based code
BART is based off the general purpose finite element method [deal.II](http://www.dealii.org/). It aims to solve first and second-order forms of linear Boltzmann equation for nuclear reactor applications using continuous/discontinuous finite element methods for spatial discretization with existing/developing acceleration methods. BART uses discrete ordinates method for angular discretization.
### Parallelism in meshing and linear algebra
BART uses MPI for parallelism and is designed for computation on distributed memory system:
- By utilizing distributed triangulation enabled by [p4est](https://www.mcs.anl.gov/petsc/) library wrapped in deal.II, BART can automatically partition the mesh by however many number of processors requested and distribute the triangulation onto different processors.
- BART heavily depends on [PETSc](https://www.mcs.anl.gov/petsc/) by utilizing deal.II wrappers of PETSc data structure. Therefore, all the parallel-supported functionalities in PETSc (if wrapped by deal.II) can be invoked by BART. This includes parallel sparse matrix, parallel vectors and parallel preconditioners/algebraic solvers.
### Formulations & Methods
BART supports the following formulations:
- the diffusion equation in 1/2/3D
- the Self-Adjoint Angular Flux formulation in 1D & 3D (2D pending implementation of a 2D quadrature)
One of the major design goals of BART is to provide a framework for testing acceleration methods. There are no methods implemented in the current version, but multiple methods are planned to be implemented, including:
- Nonlinear diffusion acceleration (NDA)
- Two-grid acceleration (TG)
Calculation of discrete Fourier transforms is provided via the [FFTW subroutine library](http://www.fftw.org/).
### Benchmarks
Benchmarks from Sood (1999) are provided in the `benchmarks` folder for validation of the code.
# Install and build
Please check [install_build.md](https://github.com/SlaybaughLab/BART/blob/master/install_build.md) for installation and building instructions.
# More to read
- [deal.II](http://www.dealii.org/): general purpose finite element library
- [PETSc](https://www.mcs.anl.gov/petsc/): high-performance parallel linear algebra library
- [Doxygen](http://www.stack.nl/~dimitri/doxygen/): documentation.
- [p4est](http://www.p4est.org/): distributed meshing in multi-D.
- [Google Style Guide](https://google.github.io/styleguide/cppguide.html): consistent code convention.
- [Google Test](https://github.com/google/googletest): efficient unit testing tools.
- [CTest](https://cmake.org/Wiki/CMake/Testing_With_CTest): unit testing tools with Google Test.
## Developers
The development work is led by [Dr. Rachel Slaybaugh](https://github.com/rachelslaybaugh). Graduate students actively involved in the development include:
- [Joshua Rehak](https://github.com/jsrehak/)
Previous developers include
- [Dr. Weixiong Zheng](https://github.com/weixiong-zheng-berkeley/).
- [Marissa Ramirez Zweiger](https://github.com/mzweig/)
- [Alexander Blank](https://github.com/AlexanderBlank)
|
{
"content_hash": "350f95d22db6dab495e2fdf6c745e722",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 504,
"avg_line_length": 62.69444444444444,
"alnum_prop": 0.7780239255649092,
"repo_name": "jsrehak/BART",
"id": "99fda48fe981d9a6040e82ba1da191cbd2333f3f",
"size": "4514",
"binary": false,
"copies": "1",
"ref": "refs/heads/thesis_fixes",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "956364"
},
{
"name": "CMake",
"bytes": "10641"
},
{
"name": "Roff",
"bytes": "131"
},
{
"name": "Shell",
"bytes": "545"
}
],
"symlink_target": ""
}
|
ACCEPTED
#### According to
Index Fungorum
#### Published in
null
#### Original name
Pycnocarpon nodulosum Syd. & P. Syd.
### Remarks
null
|
{
"content_hash": "1b12e648b1d962399fabe584bc07a057",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 36,
"avg_line_length": 10.846153846153847,
"alnum_prop": 0.6879432624113475,
"repo_name": "mdoering/backbone",
"id": "44fb79faef4de3bfdb0caae95abb00100fc62faa",
"size": "201",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Dothideomycetes/Pycnocarpon/Pycnocarpon nodulosum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
}
|
use middle::const_eval::{compare_const_vals, const_bool, const_float, const_nil, const_val};
use middle::const_eval::{const_expr_to_pat, eval_const_expr, lookup_const_by_id};
use middle::def::*;
use middle::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Init};
use middle::expr_use_visitor::{JustWrite, LoanCause, MutateMode};
use middle::expr_use_visitor::{WriteAndRead};
use middle::mem_categorization::cmt;
use middle::pat_util::*;
use middle::ty::*;
use middle::ty;
use std::fmt;
use std::iter::AdditiveIterator;
use std::iter::range_inclusive;
use std::slice;
use syntax::ast::*;
use syntax::ast_util::walk_pat;
use syntax::codemap::{Span, Spanned, DUMMY_SP};
use syntax::fold::{Folder, noop_fold_pat};
use syntax::print::pprust::pat_to_string;
use syntax::parse::token;
use syntax::ptr::P;
use syntax::visit::{mod, Visitor, FnKind};
use util::ppaux::ty_to_string;
static DUMMY_WILD_PAT: Pat = Pat {
id: DUMMY_NODE_ID,
node: PatWild(PatWildSingle),
span: DUMMY_SP
};
struct Matrix<'a>(Vec<Vec<&'a Pat>>);
/// Pretty-printer for matrices of patterns, example:
/// ++++++++++++++++++++++++++
/// + _ + [] +
/// ++++++++++++++++++++++++++
/// + true + [First] +
/// ++++++++++++++++++++++++++
/// + true + [Second(true)] +
/// ++++++++++++++++++++++++++
/// + false + [_] +
/// ++++++++++++++++++++++++++
/// + _ + [_, _, ..tail] +
/// ++++++++++++++++++++++++++
impl<'a> fmt::Show for Matrix<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, "\n"));
let &Matrix(ref m) = self;
let pretty_printed_matrix: Vec<Vec<String>> = m.iter().map(|row| {
row.iter()
.map(|&pat| pat_to_string(&*pat))
.collect::<Vec<String>>()
}).collect();
let column_count = m.iter().map(|row| row.len()).max().unwrap_or(0u);
assert!(m.iter().all(|row| row.len() == column_count));
let column_widths: Vec<uint> = range(0, column_count).map(|col| {
pretty_printed_matrix.iter().map(|row| row.get(col).len()).max().unwrap_or(0u)
}).collect();
let total_width = column_widths.iter().map(|n| *n).sum() + column_count * 3 + 1;
let br = String::from_char(total_width, '+');
try!(write!(f, "{}\n", br));
for row in pretty_printed_matrix.into_iter() {
try!(write!(f, "+"));
for (column, pat_str) in row.into_iter().enumerate() {
try!(write!(f, " "));
f.width = Some(*column_widths.get(column));
try!(f.pad(pat_str.as_slice()));
try!(write!(f, " +"));
}
try!(write!(f, "\n"));
try!(write!(f, "{}\n", br));
}
Ok(())
}
}
impl<'a> FromIterator<Vec<&'a Pat>> for Matrix<'a> {
fn from_iter<T: Iterator<Vec<&'a Pat>>>(mut iterator: T) -> Matrix<'a> {
Matrix(iterator.collect())
}
}
pub struct MatchCheckCtxt<'a, 'tcx: 'a> {
pub tcx: &'a ty::ctxt<'tcx>
}
#[deriving(Clone, PartialEq)]
pub enum Constructor {
/// The constructor of all patterns that don't vary by constructor,
/// e.g. struct patterns and fixed-length arrays.
Single,
/// Enum variants.
Variant(DefId),
/// Literal values.
ConstantValue(const_val),
/// Ranges of literal values (2..5).
ConstantRange(const_val, const_val),
/// Array patterns of length n.
Slice(uint),
/// Array patterns with a subslice.
SliceWithSubslice(uint, uint)
}
#[deriving(Clone, PartialEq)]
enum Usefulness {
Useful,
UsefulWithWitness(Vec<P<Pat>>),
NotUseful
}
enum WitnessPreference {
ConstructWitness,
LeaveOutWitness
}
impl<'a, 'tcx, 'v> Visitor<'v> for MatchCheckCtxt<'a, 'tcx> {
fn visit_expr(&mut self, ex: &Expr) {
check_expr(self, ex);
}
fn visit_local(&mut self, l: &Local) {
check_local(self, l);
}
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl,
b: &'v Block, s: Span, _: NodeId) {
check_fn(self, fk, fd, b, s);
}
}
pub fn check_crate(tcx: &ty::ctxt) {
visit::walk_crate(&mut MatchCheckCtxt { tcx: tcx }, tcx.map.krate());
tcx.sess.abort_if_errors();
}
fn check_expr(cx: &mut MatchCheckCtxt, ex: &Expr) {
visit::walk_expr(cx, ex);
match ex.node {
ExprMatch(ref scrut, ref arms) => {
// First, check legality of move bindings.
for arm in arms.iter() {
check_legality_of_move_bindings(cx,
arm.guard.is_some(),
arm.pats.as_slice());
for pat in arm.pats.iter() {
check_legality_of_bindings_in_at_patterns(cx, &**pat);
}
}
// Second, if there is a guard on each arm, make sure it isn't
// assigning or borrowing anything mutably.
for arm in arms.iter() {
match arm.guard {
Some(ref guard) => check_for_mutation_in_guard(cx, &**guard),
None => {}
}
}
let mut static_inliner = StaticInliner::new(cx.tcx);
let inlined_arms = arms.iter().map(|arm| {
(arm.pats.iter().map(|pat| {
static_inliner.fold_pat((*pat).clone())
}).collect(), arm.guard.as_ref().map(|e| &**e))
}).collect::<Vec<(Vec<P<Pat>>, Option<&Expr>)>>();
if static_inliner.failed {
return;
}
// Third, check if there are any references to NaN that we should warn about.
for &(ref pats, _) in inlined_arms.iter() {
check_for_static_nan(cx, pats.as_slice());
}
// Fourth, check for unreachable arms.
check_arms(cx, inlined_arms.as_slice());
// Finally, check if the whole match expression is exhaustive.
// Check for empty enum, because is_useful only works on inhabited types.
let pat_ty = node_id_to_type(cx.tcx, scrut.id);
if inlined_arms.is_empty() {
if !type_is_empty(cx.tcx, pat_ty) {
// We know the type is inhabited, so this must be wrong
span_err!(cx.tcx.sess, ex.span, E0002,
"non-exhaustive patterns: type {} is non-empty",
ty_to_string(cx.tcx, pat_ty)
);
}
// If the type *is* empty, it's vacuously exhaustive
return;
}
let matrix: Matrix = inlined_arms
.iter()
.filter(|&&(_, guard)| guard.is_none())
.flat_map(|arm| arm.ref0().iter())
.map(|pat| vec![&**pat])
.collect();
check_exhaustive(cx, ex.span, &matrix);
},
ExprForLoop(ref pat, _, _, _) => {
let mut static_inliner = StaticInliner::new(cx.tcx);
is_refutable(cx, &*static_inliner.fold_pat((*pat).clone()), |uncovered_pat| {
cx.tcx.sess.span_err(
pat.span,
format!("refutable pattern in `for` loop binding: \
`{}` not covered",
pat_to_string(uncovered_pat)).as_slice());
});
// Check legality of move bindings.
check_legality_of_move_bindings(cx, false, slice::ref_slice(pat));
check_legality_of_bindings_in_at_patterns(cx, &**pat);
}
_ => ()
}
}
fn is_expr_const_nan(tcx: &ty::ctxt, expr: &Expr) -> bool {
match eval_const_expr(tcx, expr) {
const_float(f) => f.is_nan(),
_ => false
}
}
// Check that we do not match against a static NaN (#6804)
fn check_for_static_nan(cx: &MatchCheckCtxt, pats: &[P<Pat>]) {
for pat in pats.iter() {
walk_pat(&**pat, |p| {
match p.node {
PatLit(ref expr) if is_expr_const_nan(cx.tcx, &**expr) => {
span_warn!(cx.tcx.sess, p.span, E0003,
"unmatchable NaN in pattern, \
use the is_nan method in a guard instead");
}
_ => ()
}
true
});
}
}
// Check for unreachable patterns
fn check_arms(cx: &MatchCheckCtxt, arms: &[(Vec<P<Pat>>, Option<&Expr>)]) {
let mut seen = Matrix(vec![]);
for &(ref pats, guard) in arms.iter() {
for pat in pats.iter() {
let v = vec![&**pat];
match is_useful(cx, &seen, v.as_slice(), LeaveOutWitness) {
NotUseful => span_err!(cx.tcx.sess, pat.span, E0001, "unreachable pattern"),
Useful => (),
UsefulWithWitness(_) => unreachable!()
}
if guard.is_none() {
let Matrix(mut rows) = seen;
rows.push(v);
seen = Matrix(rows);
}
}
}
}
fn raw_pat<'a>(p: &'a Pat) -> &'a Pat {
match p.node {
PatIdent(_, _, Some(ref s)) => raw_pat(&**s),
_ => p
}
}
fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, matrix: &Matrix) {
match is_useful(cx, matrix, &[&DUMMY_WILD_PAT], ConstructWitness) {
UsefulWithWitness(pats) => {
let witness = match pats.as_slice() {
[ref witness] => &**witness,
[] => &DUMMY_WILD_PAT,
_ => unreachable!()
};
span_err!(cx.tcx.sess, sp, E0004,
"non-exhaustive patterns: `{}` not covered",
pat_to_string(witness)
);
}
NotUseful => {
// This is good, wildcard pattern isn't reachable
},
_ => unreachable!()
}
}
fn const_val_to_expr(value: &const_val) -> P<Expr> {
let node = match value {
&const_bool(b) => LitBool(b),
&const_nil => LitNil,
_ => unreachable!()
};
P(Expr {
id: 0,
node: ExprLit(P(Spanned { node: node, span: DUMMY_SP })),
span: DUMMY_SP
})
}
pub struct StaticInliner<'a, 'tcx: 'a> {
pub tcx: &'a ty::ctxt<'tcx>,
pub failed: bool
}
impl<'a, 'tcx> StaticInliner<'a, 'tcx> {
pub fn new<'a>(tcx: &'a ty::ctxt<'tcx>) -> StaticInliner<'a, 'tcx> {
StaticInliner {
tcx: tcx,
failed: false
}
}
}
impl<'a, 'tcx> Folder for StaticInliner<'a, 'tcx> {
fn fold_pat(&mut self, pat: P<Pat>) -> P<Pat> {
match pat.node {
PatIdent(..) | PatEnum(..) => {
let def = self.tcx.def_map.borrow().find_copy(&pat.id);
match def {
Some(DefStatic(did, _)) => match lookup_const_by_id(self.tcx, did) {
Some(const_expr) => {
const_expr_to_pat(self.tcx, const_expr).map(|mut new_pat| {
new_pat.span = pat.span;
new_pat
})
}
None => {
self.failed = true;
span_err!(self.tcx.sess, pat.span, E0158,
"extern statics cannot be referenced in patterns");
pat
}
},
_ => noop_fold_pat(pat, self)
}
}
_ => noop_fold_pat(pat, self)
}
}
}
/// Constructs a partial witness for a pattern given a list of
/// patterns expanded by the specialization step.
///
/// When a pattern P is discovered to be useful, this function is used bottom-up
/// to reconstruct a complete witness, e.g. a pattern P' that covers a subset
/// of values, V, where each value in that set is not covered by any previously
/// used patterns and is covered by the pattern P'. Examples:
///
/// left_ty: tuple of 3 elements
/// pats: [10, 20, _] => (10, 20, _)
///
/// left_ty: struct X { a: (bool, &'static str), b: uint}
/// pats: [(false, "foo"), 42] => X { a: (false, "foo"), b: 42 }
fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
pats: Vec<&Pat>, left_ty: ty::t) -> P<Pat> {
let pats_len = pats.len();
let mut pats = pats.into_iter().map(|p| P((*p).clone()));
let pat = match ty::get(left_ty).sty {
ty::ty_tup(_) => PatTup(pats.collect()),
ty::ty_enum(cid, _) | ty::ty_struct(cid, _) => {
let (vid, is_structure) = match ctor {
&Variant(vid) =>
(vid, ty::enum_variant_with_id(cx.tcx, cid, vid).arg_names.is_some()),
_ =>
(cid, ty::lookup_struct_fields(cx.tcx, cid).iter()
.any(|field| field.name != token::special_idents::unnamed_field.name))
};
if is_structure {
let fields = ty::lookup_struct_fields(cx.tcx, vid);
let field_pats: Vec<FieldPat> = fields.into_iter()
.zip(pats)
.filter(|&(_, ref pat)| pat.node != PatWild(PatWildSingle))
.map(|(field, pat)| FieldPat {
ident: Ident::new(field.name),
pat: pat
}).collect();
let has_more_fields = field_pats.len() < pats_len;
PatStruct(def_to_path(cx.tcx, vid), field_pats, has_more_fields)
} else {
PatEnum(def_to_path(cx.tcx, vid), Some(pats.collect()))
}
}
ty::ty_rptr(_, ty::mt { ty: ty, .. }) => {
match ty::get(ty).sty {
ty::ty_vec(_, Some(n)) => match ctor {
&Single => {
assert_eq!(pats_len, n);
PatVec(pats.collect(), None, vec!())
},
_ => unreachable!()
},
ty::ty_vec(_, None) => match ctor {
&Slice(n) => {
assert_eq!(pats_len, n);
PatVec(pats.collect(), None, vec!())
},
_ => unreachable!()
},
ty::ty_str => PatWild(PatWildSingle),
_ => {
assert_eq!(pats_len, 1);
PatRegion(pats.nth(0).unwrap())
}
}
}
ty::ty_box(_) => {
assert_eq!(pats_len, 1);
PatBox(pats.nth(0).unwrap())
}
ty::ty_vec(_, Some(len)) => {
assert_eq!(pats_len, len);
PatVec(pats.collect(), None, vec![])
}
_ => {
match *ctor {
ConstantValue(ref v) => PatLit(const_val_to_expr(v)),
_ => PatWild(PatWildSingle),
}
}
};
P(Pat {
id: 0,
node: pat,
span: DUMMY_SP
})
}
fn missing_constructor(cx: &MatchCheckCtxt, &Matrix(ref rows): &Matrix,
left_ty: ty::t, max_slice_length: uint) -> Option<Constructor> {
let used_constructors: Vec<Constructor> = rows.iter()
.flat_map(|row| pat_constructors(cx, *row.get(0), left_ty, max_slice_length).into_iter())
.collect();
all_constructors(cx, left_ty, max_slice_length)
.into_iter()
.find(|c| !used_constructors.contains(c))
}
/// This determines the set of all possible constructors of a pattern matching
/// values of type `left_ty`. For vectors, this would normally be an infinite set
/// but is instead bounded by the maximum fixed length of slice patterns in
/// the column of patterns being analyzed.
fn all_constructors(cx: &MatchCheckCtxt, left_ty: ty::t,
max_slice_length: uint) -> Vec<Constructor> {
match ty::get(left_ty).sty {
ty::ty_bool =>
[true, false].iter().map(|b| ConstantValue(const_bool(*b))).collect(),
ty::ty_nil =>
vec!(ConstantValue(const_nil)),
ty::ty_rptr(_, ty::mt { ty: ty, .. }) => match ty::get(ty).sty {
ty::ty_vec(_, None) =>
range_inclusive(0, max_slice_length).map(|length| Slice(length)).collect(),
_ => vec!(Single)
},
ty::ty_enum(eid, _) =>
ty::enum_variants(cx.tcx, eid)
.iter()
.map(|va| Variant(va.id))
.collect(),
_ =>
vec!(Single)
}
}
// Algorithm from http://moscova.inria.fr/~maranget/papers/warn/index.html
//
// Whether a vector `v` of patterns is 'useful' in relation to a set of such
// vectors `m` is defined as there being a set of inputs that will match `v`
// but not any of the sets in `m`.
//
// This is used both for reachability checking (if a pattern isn't useful in
// relation to preceding patterns, it is not reachable) and exhaustiveness
// checking (if a wildcard pattern is useful in relation to a matrix, the
// matrix isn't exhaustive).
// Note: is_useful doesn't work on empty types, as the paper notes.
// So it assumes that v is non-empty.
fn is_useful(cx: &MatchCheckCtxt,
matrix: &Matrix,
v: &[&Pat],
witness: WitnessPreference)
-> Usefulness {
let &Matrix(ref rows) = matrix;
debug!("{:}", matrix);
if rows.len() == 0u {
return match witness {
ConstructWitness => UsefulWithWitness(vec!()),
LeaveOutWitness => Useful
};
}
if rows.get(0).len() == 0u {
return NotUseful;
}
let real_pat = match rows.iter().find(|r| r.get(0).id != DUMMY_NODE_ID) {
Some(r) => raw_pat(*r.get(0)),
None if v.len() == 0 => return NotUseful,
None => v[0]
};
let left_ty = if real_pat.id == DUMMY_NODE_ID {
ty::mk_nil()
} else {
ty::pat_ty(cx.tcx, &*real_pat)
};
let max_slice_length = rows.iter().filter_map(|row| match row.get(0).node {
PatVec(ref before, _, ref after) => Some(before.len() + after.len()),
_ => None
}).max().map_or(0, |v| v + 1);
let constructors = pat_constructors(cx, v[0], left_ty, max_slice_length);
if constructors.is_empty() {
match missing_constructor(cx, matrix, left_ty, max_slice_length) {
None => {
all_constructors(cx, left_ty, max_slice_length).into_iter().map(|c| {
match is_useful_specialized(cx, matrix, v, c.clone(), left_ty, witness) {
UsefulWithWitness(pats) => UsefulWithWitness({
let arity = constructor_arity(cx, &c, left_ty);
let mut result = {
let pat_slice = pats.as_slice();
let subpats = Vec::from_fn(arity, |i| {
pat_slice.get(i).map_or(&DUMMY_WILD_PAT, |p| &**p)
});
vec![construct_witness(cx, &c, subpats, left_ty)]
};
result.extend(pats.into_iter().skip(arity));
result
}),
result => result
}
}).find(|result| result != &NotUseful).unwrap_or(NotUseful)
},
Some(constructor) => {
let matrix = rows.iter().filter_map(|r| {
if pat_is_binding_or_wild(&cx.tcx.def_map, raw_pat(r[0])) {
Some(Vec::from_slice(r.tail()))
} else {
None
}
}).collect();
match is_useful(cx, &matrix, v.tail(), witness) {
UsefulWithWitness(pats) => {
let arity = constructor_arity(cx, &constructor, left_ty);
let wild_pats = Vec::from_elem(arity, &DUMMY_WILD_PAT);
let enum_pat = construct_witness(cx, &constructor, wild_pats, left_ty);
let mut new_pats = vec![enum_pat];
new_pats.extend(pats.into_iter());
UsefulWithWitness(new_pats)
},
result => result
}
}
}
} else {
constructors.into_iter().map(|c|
is_useful_specialized(cx, matrix, v, c.clone(), left_ty, witness)
).find(|result| result != &NotUseful).unwrap_or(NotUseful)
}
}
fn is_useful_specialized(cx: &MatchCheckCtxt, &Matrix(ref m): &Matrix,
v: &[&Pat], ctor: Constructor, lty: ty::t,
witness: WitnessPreference) -> Usefulness {
let arity = constructor_arity(cx, &ctor, lty);
let matrix = Matrix(m.iter().filter_map(|r| {
specialize(cx, r.as_slice(), &ctor, 0u, arity)
}).collect());
match specialize(cx, v, &ctor, 0u, arity) {
Some(v) => is_useful(cx, &matrix, v.as_slice(), witness),
None => NotUseful
}
}
/// Determines the constructors that the given pattern can be specialized to.
///
/// In most cases, there's only one constructor that a specific pattern
/// represents, such as a specific enum variant or a specific literal value.
/// Slice patterns, however, can match slices of different lengths. For instance,
/// `[a, b, ..tail]` can match a slice of length 2, 3, 4 and so on.
///
/// On the other hand, a wild pattern and an identifier pattern cannot be
/// specialized in any way.
fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
left_ty: ty::t, max_slice_length: uint) -> Vec<Constructor> {
let pat = raw_pat(p);
match pat.node {
PatIdent(..) =>
match cx.tcx.def_map.borrow().find(&pat.id) {
Some(&DefStatic(..)) =>
cx.tcx.sess.span_bug(pat.span, "static pattern should've been rewritten"),
Some(&DefStruct(_)) => vec!(Single),
Some(&DefVariant(_, id, _)) => vec!(Variant(id)),
_ => vec!()
},
PatEnum(..) =>
match cx.tcx.def_map.borrow().find(&pat.id) {
Some(&DefStatic(..)) =>
cx.tcx.sess.span_bug(pat.span, "static pattern should've been rewritten"),
Some(&DefVariant(_, id, _)) => vec!(Variant(id)),
_ => vec!(Single)
},
PatStruct(..) =>
match cx.tcx.def_map.borrow().find(&pat.id) {
Some(&DefStatic(..)) =>
cx.tcx.sess.span_bug(pat.span, "static pattern should've been rewritten"),
Some(&DefVariant(_, id, _)) => vec!(Variant(id)),
_ => vec!(Single)
},
PatLit(ref expr) =>
vec!(ConstantValue(eval_const_expr(cx.tcx, &**expr))),
PatRange(ref lo, ref hi) =>
vec!(ConstantRange(eval_const_expr(cx.tcx, &**lo), eval_const_expr(cx.tcx, &**hi))),
PatVec(ref before, ref slice, ref after) =>
match ty::get(left_ty).sty {
ty::ty_vec(_, Some(_)) => vec!(Single),
_ => if slice.is_some() {
range_inclusive(before.len() + after.len(), max_slice_length)
.map(|length| Slice(length))
.collect()
} else {
vec!(Slice(before.len() + after.len()))
}
},
PatBox(_) | PatTup(_) | PatRegion(..) =>
vec!(Single),
PatWild(_) =>
vec!(),
PatMac(_) =>
cx.tcx.sess.bug("unexpanded macro")
}
}
/// This computes the arity of a constructor. The arity of a constructor
/// is how many subpattern patterns of that constructor should be expanded to.
///
/// For instance, a tuple pattern (_, 42u, Some([])) has the arity of 3.
/// A struct pattern's arity is the number of fields it contains, etc.
pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: ty::t) -> uint {
match ty::get(ty).sty {
ty::ty_tup(ref fs) => fs.len(),
ty::ty_box(_) | ty::ty_uniq(_) => 1u,
ty::ty_rptr(_, ty::mt { ty: ty, .. }) => match ty::get(ty).sty {
ty::ty_vec(_, None) => match *ctor {
Slice(length) => length,
ConstantValue(_) => 0u,
_ => unreachable!()
},
ty::ty_str => 0u,
_ => 1u
},
ty::ty_enum(eid, _) => {
match *ctor {
Variant(id) => enum_variant_with_id(cx.tcx, eid, id).args.len(),
_ => unreachable!()
}
}
ty::ty_struct(cid, _) => ty::lookup_struct_fields(cx.tcx, cid).len(),
ty::ty_vec(_, Some(n)) => n,
_ => 0u
}
}
fn range_covered_by_constructor(ctor: &Constructor,
from: &const_val, to: &const_val) -> Option<bool> {
let (c_from, c_to) = match *ctor {
ConstantValue(ref value) => (value, value),
ConstantRange(ref from, ref to) => (from, to),
Single => return Some(true),
_ => unreachable!()
};
let cmp_from = compare_const_vals(c_from, from);
let cmp_to = compare_const_vals(c_to, to);
match (cmp_from, cmp_to) {
(Some(val1), Some(val2)) => Some(val1 >= 0 && val2 <= 0),
_ => None
}
}
/// This is the main specialization step. It expands the first pattern in the given row
/// into `arity` patterns based on the constructor. For most patterns, the step is trivial,
/// for instance tuple patterns are flattened and box patterns expand into their inner pattern.
///
/// OTOH, slice patterns with a subslice pattern (..tail) can be expanded into multiple
/// different patterns.
/// Structure patterns with a partial wild pattern (Foo { a: 42, .. }) have their missing
/// fields filled with wild patterns.
pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
constructor: &Constructor, col: uint, arity: uint) -> Option<Vec<&'a Pat>> {
let &Pat {
id: pat_id, node: ref node, span: pat_span
} = raw_pat(r[col]);
let head: Option<Vec<&Pat>> = match node {
&PatWild(_) =>
Some(Vec::from_elem(arity, &DUMMY_WILD_PAT)),
&PatIdent(_, _, _) => {
let opt_def = cx.tcx.def_map.borrow().find_copy(&pat_id);
match opt_def {
Some(DefStatic(..)) =>
cx.tcx.sess.span_bug(pat_span, "static pattern should've been rewritten"),
Some(DefVariant(_, id, _)) => if *constructor == Variant(id) {
Some(vec!())
} else {
None
},
_ => Some(Vec::from_elem(arity, &DUMMY_WILD_PAT))
}
}
&PatEnum(_, ref args) => {
let def = cx.tcx.def_map.borrow().get_copy(&pat_id);
match def {
DefStatic(..) =>
cx.tcx.sess.span_bug(pat_span, "static pattern should've been rewritten"),
DefVariant(_, id, _) if *constructor != Variant(id) => None,
DefVariant(..) | DefFn(..) | DefStruct(..) => {
Some(match args {
&Some(ref args) => args.iter().map(|p| &**p).collect(),
&None => Vec::from_elem(arity, &DUMMY_WILD_PAT)
})
}
_ => None
}
}
&PatStruct(_, ref pattern_fields, _) => {
// Is this a struct or an enum variant?
let def = cx.tcx.def_map.borrow().get_copy(&pat_id);
let class_id = match def {
DefStatic(..) =>
cx.tcx.sess.span_bug(pat_span, "static pattern should've been rewritten"),
DefVariant(_, variant_id, _) => if *constructor == Variant(variant_id) {
Some(variant_id)
} else {
None
},
_ => {
// Assume this is a struct.
match ty::ty_to_def_id(node_id_to_type(cx.tcx, pat_id)) {
None => {
cx.tcx.sess.span_bug(pat_span,
"struct pattern wasn't of a \
type with a def ID?!")
}
Some(def_id) => Some(def_id),
}
}
};
class_id.map(|variant_id| {
let struct_fields = ty::lookup_struct_fields(cx.tcx, variant_id);
let args = struct_fields.iter().map(|sf| {
match pattern_fields.iter().find(|f| f.ident.name == sf.name) {
Some(ref f) => &*f.pat,
_ => &DUMMY_WILD_PAT
}
}).collect();
args
})
}
&PatTup(ref args) =>
Some(args.iter().map(|p| &**p).collect()),
&PatBox(ref inner) | &PatRegion(ref inner) =>
Some(vec![&**inner]),
&PatLit(ref expr) => {
let expr_value = eval_const_expr(cx.tcx, &**expr);
match range_covered_by_constructor(constructor, &expr_value, &expr_value) {
Some(true) => Some(vec![]),
Some(false) => None,
None => {
cx.tcx.sess.span_err(pat_span, "mismatched types between arms");
None
}
}
}
&PatRange(ref from, ref to) => {
let from_value = eval_const_expr(cx.tcx, &**from);
let to_value = eval_const_expr(cx.tcx, &**to);
match range_covered_by_constructor(constructor, &from_value, &to_value) {
Some(true) => Some(vec![]),
Some(false) => None,
None => {
cx.tcx.sess.span_err(pat_span, "mismatched types between arms");
None
}
}
}
&PatVec(ref before, ref slice, ref after) => {
match *constructor {
// Fixed-length vectors.
Single => {
let mut pats: Vec<&Pat> = before.iter().map(|p| &**p).collect();
pats.grow_fn(arity - before.len() - after.len(), |_| &DUMMY_WILD_PAT);
pats.extend(after.iter().map(|p| &**p));
Some(pats)
},
Slice(length) if before.len() + after.len() <= length && slice.is_some() => {
let mut pats: Vec<&Pat> = before.iter().map(|p| &**p).collect();
pats.grow_fn(arity - before.len() - after.len(), |_| &DUMMY_WILD_PAT);
pats.extend(after.iter().map(|p| &**p));
Some(pats)
},
Slice(length) if before.len() + after.len() == length => {
let mut pats: Vec<&Pat> = before.iter().map(|p| &**p).collect();
pats.extend(after.iter().map(|p| &**p));
Some(pats)
},
SliceWithSubslice(prefix, suffix)
if before.len() == prefix
&& after.len() == suffix
&& slice.is_some() => {
let mut pats: Vec<&Pat> = before.iter().map(|p| &**p).collect();
pats.extend(after.iter().map(|p| &**p));
Some(pats)
}
_ => None
}
}
&PatMac(_) => {
cx.tcx.sess.span_err(pat_span, "unexpanded macro");
None
}
};
head.map(|head| head.append(r.slice_to(col)).append(r.slice_from(col + 1)))
}
fn check_local(cx: &mut MatchCheckCtxt, loc: &Local) {
visit::walk_local(cx, loc);
let name = match loc.source {
LocalLet => "local",
LocalFor => "`for` loop"
};
let mut static_inliner = StaticInliner::new(cx.tcx);
is_refutable(cx, &*static_inliner.fold_pat(loc.pat.clone()), |pat| {
span_err!(cx.tcx.sess, loc.pat.span, E0005,
"refutable pattern in {} binding: `{}` not covered",
name, pat_to_string(pat)
);
});
// Check legality of move bindings and `@` patterns.
check_legality_of_move_bindings(cx, false, slice::ref_slice(&loc.pat));
check_legality_of_bindings_in_at_patterns(cx, &*loc.pat);
}
fn check_fn(cx: &mut MatchCheckCtxt,
kind: FnKind,
decl: &FnDecl,
body: &Block,
sp: Span) {
visit::walk_fn(cx, kind, decl, body, sp);
for input in decl.inputs.iter() {
is_refutable(cx, &*input.pat, |pat| {
span_err!(cx.tcx.sess, input.pat.span, E0006,
"refutable pattern in function argument: `{}` not covered",
pat_to_string(pat)
);
});
check_legality_of_move_bindings(cx, false, slice::ref_slice(&input.pat));
check_legality_of_bindings_in_at_patterns(cx, &*input.pat);
}
}
fn is_refutable<A>(cx: &MatchCheckCtxt, pat: &Pat, refutable: |&Pat| -> A) -> Option<A> {
let pats = Matrix(vec!(vec!(pat)));
match is_useful(cx, &pats, [&DUMMY_WILD_PAT], ConstructWitness) {
UsefulWithWitness(pats) => {
assert_eq!(pats.len(), 1);
Some(refutable(&*pats[0]))
},
NotUseful => None,
Useful => unreachable!()
}
}
// Legality of move bindings checking
fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
has_guard: bool,
pats: &[P<Pat>]) {
let tcx = cx.tcx;
let def_map = &tcx.def_map;
let mut by_ref_span = None;
for pat in pats.iter() {
pat_bindings(def_map, &**pat, |bm, _, span, _path| {
match bm {
BindByRef(_) => {
by_ref_span = Some(span);
}
BindByValue(_) => {
}
}
})
}
let check_move: |&Pat, Option<&Pat>| = |p, sub| {
// check legality of moving out of the enum
// x @ Foo(..) is legal, but x @ Foo(y) isn't.
if sub.map_or(false, |p| pat_contains_bindings(def_map, &*p)) {
span_err!(cx.tcx.sess, p.span, E0007, "cannot bind by-move with sub-bindings");
} else if has_guard {
span_err!(cx.tcx.sess, p.span, E0008, "cannot bind by-move into a pattern guard");
} else if by_ref_span.is_some() {
span_err!(cx.tcx.sess, p.span, E0009,
"cannot bind by-move and by-ref in the same pattern");
span_note!(cx.tcx.sess, by_ref_span.unwrap(), "by-ref binding occurs here");
}
};
for pat in pats.iter() {
walk_pat(&**pat, |p| {
if pat_is_binding(def_map, &*p) {
match p.node {
PatIdent(BindByValue(_), _, ref sub) => {
let pat_ty = ty::node_id_to_type(tcx, p.id);
if ty::type_moves_by_default(tcx, pat_ty) {
check_move(p, sub.as_ref().map(|p| &**p));
}
}
PatIdent(BindByRef(_), _, _) => {
}
_ => {
cx.tcx.sess.span_bug(
p.span,
format!("binding pattern {} is not an \
identifier: {:?}",
p.id,
p.node).as_slice());
}
}
}
true
});
}
}
/// Ensures that a pattern guard doesn't borrow by mutable reference or
/// assign.
fn check_for_mutation_in_guard<'a, 'tcx>(cx: &'a MatchCheckCtxt<'a, 'tcx>, guard: &Expr) {
let mut checker = MutationChecker {
cx: cx,
};
let mut visitor = ExprUseVisitor::new(&mut checker, checker.cx.tcx);
visitor.walk_expr(guard);
}
struct MutationChecker<'a, 'tcx: 'a> {
cx: &'a MatchCheckCtxt<'a, 'tcx>,
}
impl<'a, 'tcx> Delegate for MutationChecker<'a, 'tcx> {
fn consume(&mut self, _: NodeId, _: Span, _: cmt, _: ConsumeMode) {}
fn consume_pat(&mut self, _: &Pat, _: cmt, _: ConsumeMode) {}
fn borrow(&mut self,
_: NodeId,
span: Span,
_: cmt,
_: Region,
kind: BorrowKind,
_: LoanCause) {
match kind {
MutBorrow => {
self.cx
.tcx
.sess
.span_err(span,
"cannot mutably borrow in a pattern guard")
}
ImmBorrow | UniqueImmBorrow => {}
}
}
fn decl_without_init(&mut self, _: NodeId, _: Span) {}
fn mutate(&mut self, _: NodeId, span: Span, _: cmt, mode: MutateMode) {
match mode {
JustWrite | WriteAndRead => {
self.cx
.tcx
.sess
.span_err(span, "cannot assign in a pattern guard")
}
Init => {}
}
}
}
/// Forbids bindings in `@` patterns. This is necessary for memory safety,
/// because of the way rvalues are handled in the borrow check. (See issue
/// #14587.)
fn check_legality_of_bindings_in_at_patterns(cx: &MatchCheckCtxt, pat: &Pat) {
AtBindingPatternVisitor { cx: cx, bindings_allowed: true }.visit_pat(pat);
}
struct AtBindingPatternVisitor<'a, 'b:'a, 'tcx:'b> {
cx: &'a MatchCheckCtxt<'b, 'tcx>,
bindings_allowed: bool
}
impl<'a, 'b, 'tcx, 'v> Visitor<'v> for AtBindingPatternVisitor<'a, 'b, 'tcx> {
fn visit_pat(&mut self, pat: &Pat) {
if !self.bindings_allowed && pat_is_binding(&self.cx.tcx.def_map, pat) {
self.cx.tcx.sess.span_err(pat.span,
"pattern bindings are not allowed \
after an `@`");
}
match pat.node {
PatIdent(_, _, Some(_)) => {
let bindings_were_allowed = self.bindings_allowed;
self.bindings_allowed = false;
visit::walk_pat(self, pat);
self.bindings_allowed = bindings_were_allowed;
}
_ => visit::walk_pat(self, pat),
}
}
}
|
{
"content_hash": "45ed9a088562044d7c5606906b7f8817",
"timestamp": "",
"source": "github",
"line_count": 1040,
"max_line_length": 98,
"avg_line_length": 37.333653846153844,
"alnum_prop": 0.4743091147912535,
"repo_name": "P1start/rust",
"id": "d3321e555a40ae264b7bd03357f266911b0c1db2",
"size": "39299",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/librustc/middle/check_match.rs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "3206"
},
{
"name": "Assembly",
"bytes": "26647"
},
{
"name": "Awk",
"bytes": "159"
},
{
"name": "C",
"bytes": "687966"
},
{
"name": "C++",
"bytes": "52990"
},
{
"name": "CSS",
"bytes": "20542"
},
{
"name": "Emacs Lisp",
"bytes": "43154"
},
{
"name": "JavaScript",
"bytes": "32270"
},
{
"name": "Perl",
"bytes": "1076"
},
{
"name": "Puppet",
"bytes": "10871"
},
{
"name": "Python",
"bytes": "101746"
},
{
"name": "Rust",
"bytes": "16997860"
},
{
"name": "Shell",
"bytes": "281700"
},
{
"name": "VimL",
"bytes": "35549"
}
],
"symlink_target": ""
}
|
using System;
namespace Gorilla.Api.Entities
{
public interface IImageEntity
{
int ID { get; set; }
string FileName { get; set; }
int FileSize { get; set; }
string MimeType { get; set; }
byte[] Data { get; set; }
DateTime CreatedOn { get; set; }
DateTime? ModifiedOn { get; set; }
}
}
|
{
"content_hash": "c5245e5ccda6f8e93c91facb5f4b6702",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 42,
"avg_line_length": 23.666666666666668,
"alnum_prop": 0.5464788732394367,
"repo_name": "tiesont/Gorilla",
"id": "62c155c6e68156d0a3ce9c96925b178d19ce0717",
"size": "357",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Gorilla.Api/Entities/IImageEntity.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "102"
},
{
"name": "C#",
"bytes": "342981"
},
{
"name": "CSS",
"bytes": "61104"
},
{
"name": "JavaScript",
"bytes": "1628303"
},
{
"name": "XSLT",
"bytes": "5866"
}
],
"symlink_target": ""
}
|
package com.github.gliviu.javaNonblockingFutures.unitTests.utils;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD })
public @interface Configurations {
Configuration[] value();
}
|
{
"content_hash": "7f9827bca6d06fb6f8613a9f3c83c6cb",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 65,
"avg_line_length": 30.25,
"alnum_prop": 0.8154269972451791,
"repo_name": "gliviu/java-nonblocking-futures",
"id": "be18c0c42aca312c246bb1ef242b89eff75ed480",
"size": "363",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/com/github/gliviu/javaNonblockingFutures/unitTests/utils/Configurations.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "116432"
}
],
"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>
<title>Uses of Package org.apache.poi.xssf.dev (POI API Documentation)</title>
<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 Package org.apache.poi.xssf.dev (POI API Documentation)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li>Class</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/poi/xssf/dev/package-use.html" target="_top">FRAMES</a></li>
<li><a href="package-use.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="Uses of Package org.apache.poi.xssf.dev" class="title">Uses of Package<br>org.apache.poi.xssf.dev</h1>
</div>
<div class="contentContainer">No usage of org.apache.poi.xssf.dev</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>Class</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/poi/xssf/dev/package-use.html" target="_top">FRAMES</a></li>
<li><a href="package-use.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<i>Copyright 2016 The Apache Software Foundation or
its licensors, as applicable.</i>
</small></p>
</body>
</html>
|
{
"content_hash": "abae1918b9641c938485790b5f218f72",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 113,
"avg_line_length": 33.282051282051285,
"alnum_prop": 0.6001540832049307,
"repo_name": "Aarhus-BSS/Aarhus-Research-Rebuilt",
"id": "15990014d7ad03a271f8d7687762eaa888a79f96",
"size": "3894",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/poi-3.16-beta1/docs/apidocs/org/apache/poi/xssf/dev/package-use.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "25053"
},
{
"name": "HTML",
"bytes": "99455840"
},
{
"name": "Java",
"bytes": "12711046"
},
{
"name": "Lua",
"bytes": "152042"
},
{
"name": "Python",
"bytes": "8613"
},
{
"name": "R",
"bytes": "20655"
},
{
"name": "Shell",
"bytes": "913"
}
],
"symlink_target": ""
}
|
{% load static %}
{% include 'app/header.html' with title='Login' %}
<body ng-cloak>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="container">
<div class="row">
<div class="col-sm-4 center">
<div class="vertical-align">
<div class="login-wrapper"> <!-- Login wrapper starts here -->
<h1 class="appname text-center"><img class="img img-responsive img-logo" src="{% static 'images/logo.png' %}"/> Photo Editr</h1>
<div class="tagline text-center">A 21st century photo editor for the inter-web {{sessionitems}}</div>
<div class="feature-story">
<ul>
<li><span class="fa fa-upload"></span>Upload images
<li><span class="fa fa-pencil-square-o"></span>Make nifty image effects
<li><span class="fa fa-paper-plane-o"></span>Share with your friends on Facebook
</ul>
</div>
<div class="row nudge down-50">
<div class="login-btn" data-scope="{{ allow_perms }}">
<div class="col-xs-2">
<i class="fa fa-facebook"></i>
</div>
<div class="col-xs-10">
<span class="login-text">
Login with Facebook to get started.
</span>
</div>
</div>
</div>
</div> <!-- Login wrapper ends here -->
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/static/bower_components/jquery/dist/jquery.min.js"><\/script>')</script>
<script src="{% static 'bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/plugins.js' %}"></script>
<script>
window.fbAsyncInit = function () {
FB.init({
appId : '{{ app_id }}',
status : true,
cookie : true,
xfbml : true,
version : 'v2.4'
});
FB.Event.subscribe('auth.login', function (response) {
window.location = window.location;
});
}
</script>
<script src="{% static 'js/main.js' %}"></script>
</body>
</html>
|
{
"content_hash": "4e2d855ca398b6c6db5cb10044232992",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 187,
"avg_line_length": 49.546875,
"alnum_prop": 0.413434247871334,
"repo_name": "andela-osule/photo-editing-application",
"id": "ba999477c06ef6360770a9098e66b584bf593491",
"size": "3171",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "photo_editor/app/templates/app/login.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6177"
},
{
"name": "HTML",
"bytes": "19742"
},
{
"name": "JavaScript",
"bytes": "16048"
},
{
"name": "Python",
"bytes": "35749"
}
],
"symlink_target": ""
}
|
<div class="row post-full">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1 col-xs-12">
<div class="page-header">
<h1>{{ page.title }} {% if page.subtitle %}<br />
<small>{{page.subtitle}}</small>{% endif %}
</h1>
</div>
<div class="date">
<span>{{ page.date | date_to_long_string }}</span>
</div>
<div class="content">
{{ content }}
</div>
{% unless page.categories == empty %}
<ul class="tag_box inline">
<li><i class="glyphicon glyphicon-open"></i></li>
{% assign categories_list = page.categories %}
{% include JB/categories_list %}
</ul>
{% endunless %}
{% unless page.tags == empty %}
<ul class="tag_box inline">
<li><i class="glyphicon glyphicon-tags"></i></li>
{% assign tags_list = page.tags %}
{% include JB/tags_list %}
</ul>
{% endunless %}
<hr>
<ul class="pagination">
{% if page.previous %}
<li class="prev"><a href="{{ BASE_PATH }}{{ page.previous.url }}" title="{{ page.previous.title }}">« Previous</a></li>
{% else %}
<li class="prev disabled"><a>← Previous</a></li>
{% endif %}
<li><a href="{{ BASE_PATH }}{{ site.JB.archive_path }}">Archive</a></li>
{% if page.next %}
<li class="next"><a href="{{ BASE_PATH }}{{ page.next.url }}" title="{{ page.next.title }}">Next »</a></li>
{% else %}
<li class="next disabled"><a>Next →</a>
{% endif %}
</ul>
<hr>
{% include JB/comments %}
</div>
</div>
|
{
"content_hash": "f60237d71b58798e9255f97c5091063d",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 131,
"avg_line_length": 32.3125,
"alnum_prop": 0.5299806576402321,
"repo_name": "isjia/isjia.me",
"id": "84f8869a64855e4ccb85180c6bdaca6a7a14ba77",
"size": "1553",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_includes/themes/bootswatch-united/post.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2533"
},
{
"name": "HTML",
"bytes": "18218"
},
{
"name": "JavaScript",
"bytes": "735"
},
{
"name": "Ruby",
"bytes": "11717"
}
],
"symlink_target": ""
}
|
package com.linkedin.thirdeye.client;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheBuilderSpec;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.linkedin.thirdeye.api.DimensionKey;
import com.linkedin.thirdeye.api.MetricTimeSeries;
import com.linkedin.thirdeye.api.MetricType;
import com.linkedin.thirdeye.api.StarTreeConfig;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
public class DefaultThirdEyeClient implements ThirdEyeClient {
private static final Logger LOG = LoggerFactory.getLogger(DefaultThirdEyeClient.class);
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private final HttpHost httpHost;
private final CloseableHttpClient httpClient;
private final LoadingCache<QuerySpec, Map<DimensionKey, MetricTimeSeries>> resultCache;
private final LoadingCache<String, Map<String, MetricType>> schemaCache;
private final LoadingCache<String, StarTreeConfig> starTreeConfigCache;
private final LoadingCache<String, ThirdEyeRawResponse> rawResultCache;
public DefaultThirdEyeClient(String hostname, int port) {
this(hostname, port, new DefaultThirdEyeClientConfig());
}
@SuppressWarnings("unchecked")
public DefaultThirdEyeClient(String hostname, int port, DefaultThirdEyeClientConfig config) {
this.httpHost = new HttpHost(hostname, port);
this.httpClient = HttpClients.createDefault();
CacheBuilder builder = CacheBuilder.newBuilder();
if (config.isExpireAfterAccess()) {
builder.expireAfterAccess(config.getExpirationTime(), config.getExpirationUnit());
} else {
builder.expireAfterWrite(config.getExpirationTime(), config.getExpirationUnit());
}
this.resultCache = builder.build(new ResultCacheLoader());
this.rawResultCache = builder.build(new RawResultCacheLoader());
this.schemaCache = CacheBuilder.newBuilder()
.expireAfterWrite(Long.MAX_VALUE, TimeUnit.MILLISECONDS) // never
.build(new SchemaCacheLoader());
this.starTreeConfigCache = CacheBuilder.newBuilder()
.expireAfterWrite(Long.MAX_VALUE, TimeUnit.MILLISECONDS) // never
.build(new StarTreeConfigCacheLoader());
LOG.info("Created DefaultThirdEyeClient to {}", httpHost);
}
@Override
public Map<DimensionKey, MetricTimeSeries> execute(ThirdEyeRequest request) throws Exception {
QuerySpec querySpec = new QuerySpec(request.getCollection(), request.toSql());
LOG.debug("Generated SQL {}", request.toSql());
return resultCache.get(querySpec);
}
@Override
public ThirdEyeRawResponse getRawResponse(String sql) throws Exception {
return rawResultCache.get(sql);
}
@Override
public StarTreeConfig getStarTreeConfig(String collection) throws Exception {
return starTreeConfigCache.get(collection);
}
@Override
public void close() throws Exception {
httpClient.close();
}
/**
* Executes SQL statements against the /query resource.
*/
private class ResultCacheLoader extends CacheLoader<QuerySpec, Map<DimensionKey, MetricTimeSeries>> {
@Override
public Map<DimensionKey, MetricTimeSeries> load(QuerySpec querySpec) throws Exception {
HttpGet req = new HttpGet("/query/" + URLEncoder.encode(querySpec.getSql(), "UTF-8"));
CloseableHttpResponse res = httpClient.execute(httpHost, req);
try {
if (res.getStatusLine().getStatusCode() != 200) {
throw new IllegalStateException(res.getStatusLine().toString());
}
// Parse response
InputStream content = res.getEntity().getContent();
ThirdEyeRawResponse rawResponse = OBJECT_MAPPER.readValue(content, ThirdEyeRawResponse.class);
// Figure out the metric types of the projection
Map<String, MetricType> metricTypes = schemaCache.get(querySpec.getCollection());
List<MetricType> projectionTypes = new ArrayList<>();
for (String metricName : rawResponse.getMetrics()) {
MetricType metricType = metricTypes.get(metricName);
if (metricType == null) { // could be derived
metricType = MetricType.DOUBLE;
}
projectionTypes.add(metricType);
}
return rawResponse.convert(projectionTypes);
} finally {
if (res.getEntity() != null) {
EntityUtils.consume(res.getEntity());
}
res.close();
}
}
}
/**
* Executes SQL statements against the /query resource.
*/
private class RawResultCacheLoader extends CacheLoader<String, ThirdEyeRawResponse> {
@Override
public ThirdEyeRawResponse load(String sql) throws Exception {
HttpGet req = new HttpGet("/query/" + URLEncoder.encode(sql, "UTF-8"));
CloseableHttpResponse res = httpClient.execute(httpHost, req);
try {
if (res.getStatusLine().getStatusCode() != 200) {
throw new IllegalStateException(res.getStatusLine().toString());
}
// Parse response
InputStream content = res.getEntity().getContent();
ThirdEyeRawResponse rawResponse = OBJECT_MAPPER.readValue(content, ThirdEyeRawResponse.class);
return rawResponse;
} finally {
if (res.getEntity() != null) {
EntityUtils.consume(res.getEntity());
}
res.close();
}
}
}
/**
* Retrieves starTreeConfig from server
*/
private class StarTreeConfigCacheLoader extends CacheLoader<String, StarTreeConfig> {
@Override
public StarTreeConfig load(String collection) throws Exception {
HttpGet req = new HttpGet("/collections/" + URLEncoder.encode(collection, "UTF-8"));
CloseableHttpResponse res = httpClient.execute(httpHost, req);
try {
if (res.getStatusLine().getStatusCode() != 200) {
throw new IllegalStateException(res.getStatusLine().toString());
}
InputStream content = res.getEntity().getContent();
StarTreeConfig starTreeConfig = OBJECT_MAPPER.readValue(content, StarTreeConfig.class);
return starTreeConfig;
} finally {
if (res.getEntity() != null) {
EntityUtils.consume(res.getEntity());
}
res.close();
}
}
}
private class SchemaCacheLoader extends CacheLoader<String, Map<String, MetricType>> {
@Override
public Map<String, MetricType> load(String collection) throws Exception {
HttpGet req = new HttpGet("/collections/" + URLEncoder.encode(collection, "UTF-8"));
CloseableHttpResponse res = httpClient.execute(httpHost, req);
try {
if (res.getStatusLine().getStatusCode() != 200) {
throw new IllegalStateException(res.getStatusLine().toString());
}
InputStream content = res.getEntity().getContent();
JsonNode json = OBJECT_MAPPER.readTree(content);
Map<String, MetricType> metricTypes = new HashMap<>();
for (JsonNode metricSpec : json.get("metrics")) {
String metricName = metricSpec.get("name").asText();
MetricType metricType = MetricType.valueOf(metricSpec.get("type").asText());
metricTypes.put(metricName, metricType);
}
LOG.info("Cached metric types for {}: {}", collection, metricTypes);
return metricTypes;
} finally {
if (res.getEntity() != null) {
EntityUtils.consume(res.getEntity());
}
res.close();
}
}
}
private static class QuerySpec {
private String collection;
private String sql;
QuerySpec(String collection, String sql) {
this.collection = collection;
this.sql = sql;
}
public String getCollection() {
return collection;
}
public String getSql() {
return sql;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof QuerySpec)) {
return false;
}
QuerySpec s = (QuerySpec) o;
return Objects.equals(sql, s.getSql()) && Objects.equals(collection, s.getCollection());
}
@Override
public int hashCode() {
return Objects.hash(sql, collection);
}
}
public static void main(String[] args) throws Exception {
if (args.length != 6 && args.length != 7) {
throw new IllegalArgumentException("usage: host port collection metricFunction startTime endTime [groupBy]");
}
String host = args[0];
int port = Integer.valueOf(args[1]);
String collection = args[2];
String metricFunction = args[3];
DateTime startTime = ISODateTimeFormat.dateTimeParser().parseDateTime(args[4]);
DateTime endTime = ISODateTimeFormat.dateTimeParser().parseDateTime(args[5]);
ThirdEyeRequest request = new ThirdEyeRequest()
.setCollection(collection)
.setStartTime(startTime)
.setEndTime(endTime)
.setMetricFunction(metricFunction);
if (args.length == 7) {
request.setGroupBy(args[6]);
}
ThirdEyeClient client = new DefaultThirdEyeClient(host, port);
try {
Map<DimensionKey, MetricTimeSeries> result = client.execute(request);
for (Map.Entry<DimensionKey, MetricTimeSeries> entry : result.entrySet()) {
System.out.println(entry.getKey() + " #=> " + entry.getValue());
}
} finally {
client.close();
}
}
}
|
{
"content_hash": "a3a152165c8d7b28d4e178086e886918",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 115,
"avg_line_length": 35.12587412587413,
"alnum_prop": 0.6934103125622139,
"repo_name": "pinotlytics/pinot",
"id": "a196f7e8a0096323a39446253b6b4ea1dfa88dea",
"size": "10046",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "thirdeye/thirdeye-client/src/main/java/com/linkedin/thirdeye/client/DefaultThirdEyeClient.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "4272"
},
{
"name": "CSS",
"bytes": "645585"
},
{
"name": "FreeMarker",
"bytes": "90822"
},
{
"name": "GAP",
"bytes": "121494"
},
{
"name": "HTML",
"bytes": "21171"
},
{
"name": "Java",
"bytes": "6631314"
},
{
"name": "JavaScript",
"bytes": "2274028"
},
{
"name": "Python",
"bytes": "22994"
},
{
"name": "R",
"bytes": "2430"
},
{
"name": "Shell",
"bytes": "1160"
},
{
"name": "Thrift",
"bytes": "6018"
}
],
"symlink_target": ""
}
|
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_github"
android:icon="@drawable/ic_github_circle_white_24dp"
android:title="GitHub"
app:showAsAction="always"></item>
</menu>
|
{
"content_hash": "7b8cb71d8d140757ad30b3c475b55eba",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 64,
"avg_line_length": 35.2,
"alnum_prop": 0.6448863636363636,
"repo_name": "BCsl/GalleryLayoutManager",
"id": "b474eef0c1628fbe3ec0aedb2c5d8d72f7ec3a71",
"size": "352",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/menu/base_github.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "94724"
}
],
"symlink_target": ""
}
|
namespace Domain {
class Entity
{
public:
int Id;
};
class AggregateRoot: public Entity
{
};
class ValueObject
{
};
class Provider
{
};
class Router: public Provider
{
public:
virtual int Selete() = 0;
};
static Router* router;
class ValueObjectC: public ValueObject
{
public:
ValueObjectC(){};
~ValueObjectC(){};
};
class ValueObjectD: public ValueObject
{
public:
ValueObjectD(){};
~ValueObjectD(){};
};
class EntityB: public Entity
{
public:
EntityB(){};
~EntityB(){};
ValueObjectD* vo_d;
void init(){
vo_d = new ValueObjectD();
std::cout << "entity b init" << "\n";
};
};
class AggregateRootA: public AggregateRoot
{
public:
AggregateRootA(){};
~AggregateRootA(){};
EntityB* entity_b;
ValueObjectC* vo_c;
void Init(){
entity_b = new EntityB();
entity_b->init();
router->Selete();
};
};
class AggregateRootB: public AggregateRoot
{
public:
AggregateRootB(){};
~AggregateRootB(){};
EntityB* entity_b;
AggregateRootA* a;
void Init(){
a = new AggregateRootA();
a->Init();
a->entity_b->init();
};
};
}
namespace Repositories {
using namespace Domain;
class Repository{
};
class AggregateRootARepo: public Repository
{
public:
AggregateRootARepo(){};
~AggregateRootARepo(){};
void Save(AggregateRootA *a){
a->Init();
std::cout << "saved" << "\n";
};
};
}
namespace Gateways {
using namespace Domain;
class FakeRouter: public Router
{
public:
FakeRouter(){};
~FakeRouter(){};
int Selete(){
std::cout << "routed" << "\n";
return 1;
}
};
}
|
{
"content_hash": "9642aa74c87383f9c4643e5cac611b63",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 43,
"avg_line_length": 12.520661157024794,
"alnum_prop": 0.6501650165016502,
"repo_name": "newlee/tequila",
"id": "6e7bd2430493512302fb96a62f066494d4cbc96e",
"size": "1536",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/step3-code/code.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "98276"
},
{
"name": "Shell",
"bytes": "427"
}
],
"symlink_target": ""
}
|
using System;
using System.Data;
using GeoAPI.Geometries;
namespace DotSpatial.Data
{
/// <summary>
/// A feature doesn't need to be abstract because the geometry is generic and the other
/// properties are all the same. It supports IRenderable so that even if you don't
/// know what type of feature this is, you can still tell it to draw itself. You won't
/// be able to specify any drawing characteristics from this object however.
/// </summary>
public interface IFeature : ICloneable, IComparable<IFeature>
{
#region Properties
/// <summary>
/// Gets or sets a valid IBasicGeometry associated with the data elements of this feature.
/// This will be enough geometry information to cast into a full fledged geometry
/// that can be used in coordination with DotSpatial.Analysis
/// </summary>
IGeometry Geometry { get; set; }
/// <summary>
/// Gets or sets the content length. If the geometry for this shape was loaded from a file, this contains the size
/// of this shape in 16-bit words as per the Esri Shapefile specification.
/// </summary>
int ContentLength { get; set; }
/// <summary>
/// Gets the datarow containing all the attributes related to this geometry
/// </summary>
DataRow DataRow { get; set; }
/// <summary>
/// Returns the FeatureType of the feature. This can either be Point, Multipoint, Line, Polygon or Unspecified if the feature has no geometry.
/// </summary>
FeatureType FeatureType { get; }
/// <summary>
/// Gets the key that is associated with this feature. This returns -1 if
/// this feature is not a member of a feature layer.
/// </summary>
int Fid { get; }
/// <summary>
/// Gets a reference to the IFeatureLayer that contains this item.
/// </summary>
IFeatureSet ParentFeatureSet { get; set; }
/// <summary>
/// An index value that is saved in some file formats.
/// </summary>
int RecordNumber { get; set; }
/// <summary>
/// This is simply a quick access to the Vertices list for this specific
/// feature. If the Vertices have not yet been defined, this will be null.
/// </summary>
ShapeRange ShapeIndex { get; set; }
/// <summary>
/// When a shape is loaded from a Shapefile, this will identify whether M or Z values are used
/// and whether or not the shape is null.
/// </summary>
ShapeType ShapeType { get; set; }
#endregion
#region Methods
/// <summary>
/// Creates a deep copy of this feature. the new datarow created will not be connected
/// to a data Table, so it should be added to one.
/// </summary>
/// <returns>Returns a deep copy of this feature as an IFeature</returns>
IFeature Copy();
/// <summary>
/// This uses the field names to copy attribute values from the source to this feature.
/// Even if columns are missing or if there are extra columns, this method should work.
/// </summary>
/// <param name="source">The IFeature source to copy attributes from.</param>
void CopyAttributes(IFeature source);
/// <summary>
/// Creates a new shape based on this feature by itself.
/// </summary>
/// <returns>A Shape object</returns>
Shape ToShape();
/// <summary>
/// Forces the features geometry to update its envelope.
/// </summary>
void UpdateEnvelope();
#endregion
}
}
|
{
"content_hash": "aa47f4c85cda76cab78472282e8a1ace",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 150,
"avg_line_length": 38.25,
"alnum_prop": 0.5903267973856209,
"repo_name": "bdgza/DotSpatial",
"id": "43137cf9e0b4f884a491b6229b5974cbcfd02235",
"size": "4539",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/DotSpatial.Data/IFeature.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "1639"
},
{
"name": "Batchfile",
"bytes": "1711"
},
{
"name": "C#",
"bytes": "17296243"
},
{
"name": "CSS",
"bytes": "490"
},
{
"name": "HTML",
"bytes": "8176"
},
{
"name": "JavaScript",
"bytes": "133570"
},
{
"name": "Smalltalk",
"bytes": "637626"
},
{
"name": "Visual Basic",
"bytes": "628617"
}
],
"symlink_target": ""
}
|
<?php
namespace Anax\Flashingmessage;
/**
* Class for display different type of status updates/messages in session.
* The messages are styled in four different styles for variuos message.
* You can display several massages at the same time.
*
*/
class CStatusMessageTest extends \PHPUnit_Framework_TestCase
{
public function testCreateElement()
{
$statusMessageObj = new CStatusMessage(new FakeSession());
$res = $statusMessageObj->isEmpty();
$exp = true;
$this->assertEquals($res, $exp, "Created element is created and deleted.");
}
public function testAddMessagesDebug()
{
$statusMessageObj = new CStatusMessage(new FakeSession());
$statusMessageObj->addDebugMessage("Debug Meddelande!");
$res = $statusMessageObj->messagesHtml();
$exp = "<div class='message-debug'>Debug Meddelande!</div>";
$this->assertEquals($res, $exp, "Debug message went wrong.");
$statusMessageObj->clearMessages();
}
public function testAddMessagesError()
{
$statusMessageObj = new CStatusMessage(new FakeSession());
$statusMessageObj->addErrorMessage("Fel Meddelande!");
$res = $statusMessageObj->messagesHtml();
$exp = "<div class='message-error'>Fel Meddelande!</div>";
$this->assertEquals($res, $exp, "Error message went wrong.");
$statusMessageObj->clearMessages();
}
public function testAddMessagesSuccess()
{
$statusMessageObj = new CStatusMessage(new FakeSession());
$statusMessageObj->addSuccessMessage("Godkänt Meddelande!");
$res = $statusMessageObj->messagesHtml();
$exp = "<div class='message-success'>Godkänt Meddelande!</div>";
$this->assertEquals($res, $exp, "Success message went wrong.");
$statusMessageObj->clearMessages();
}
public function testAddMessagesWarning()
{
$statusMessageObj = new CStatusMessage(new FakeSession());
$statusMessageObj->addWarningMessage("Varnings Meddelande!");
$res = $statusMessageObj->messagesHtml();
$exp = "<div class='message-warning'>Varnings Meddelande!</div>";
$this->assertEquals($res, $exp, "Warning message went wrong.");
$statusMessageObj->clearMessages();
}
public function testEmpty()
{
$statusMessageObj = new CStatusMessage(new FakeSession());
$res = $statusMessageObj->isEmpty();
$exp = true;
$this->assertEquals($res, $exp, "Something went wrong.");
$statusMessageObj->addDebugMessage("Debug meddelande!");
$res = $statusMessageObj->isEmpty();
$exp = false;
$this->assertEquals($res, $exp, "Something went wrong.");
}
}
class FakeSession
{
private $sessionData = array();
public function has($sessionVariable)
{
return isset($this->sessionData[$sessionVariable]);
}
public function set($sessionVariable, $allMessages)
{
$this->sessionData[$sessionVariable] = $allMessages;
}
public function get($sessionVariable)
{
if($this->sessionData != null && $this->sessionData[$sessionVariable] != null)
return $this->sessionData[$sessionVariable];
return null;
}
}
|
{
"content_hash": "a385c44db94f244a796559630dacd08a",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 86,
"avg_line_length": 32.410526315789475,
"alnum_prop": 0.6846378694381292,
"repo_name": "emwi/FlashingmessageTest",
"id": "11e231ca56307e244691a428d6322d9e29f4e662",
"size": "3079",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/Flashingmessage/CStatusMessageTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "14953"
},
{
"name": "JavaScript",
"bytes": "20234"
},
{
"name": "PHP",
"bytes": "13435"
}
],
"symlink_target": ""
}
|
<?php
/**
* Class Itabs_LogViewer_Helper_Data
*/
class Itabs_LogViewer_Helper_Data extends Mage_Core_Helper_Abstract
{
/**
* Retrieve the current file
*
* @return string|bool
*/
public function getCurrentFile()
{
$file = Mage::app()->getRequest()->getParam('file', false);
if ($file) {
$file = $this->decode($file);
// Check if file exists
$path = $this->getLogDir() . $file;
if (!file_exists($path)) {
return false;
}
}
return $file;
}
/**
* Retrieve the current lines count
*
* @return int
*/
public function getCurrentLines()
{
return Mage::app()->getRequest()->getParam('lines', 100);
}
/**
* Encode the given string for the url
*
* @param string $string String
* @return string
*/
public function encode($string)
{
return strtr(base64_encode($string), '+/=', '-_,');
}
/**
* Decode the given string from the url
*
* @param string $string String
* @return string
*/
public function decode($string)
{
return base64_decode(strtr($string, '-_,', '+/='));
}
/**
* Retrieve the log dir
*
* @return string
*/
public function getLogDir()
{
return Mage::getBaseDir('var') . DS . 'log' . DS;
}
}
|
{
"content_hash": "ef761a32702ee804454d97347a25623b",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 67,
"avg_line_length": 20.183098591549296,
"alnum_prop": 0.5017445917655269,
"repo_name": "itabs/Itabs_LogViewer",
"id": "fef4b7ae9df8cd31e6cd874496a5e23f14ca422d",
"size": "1788",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/code/community/Itabs/LogViewer/Helper/Data.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "718"
},
{
"name": "HTML",
"bytes": "2795"
},
{
"name": "PHP",
"bytes": "14995"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>User agent detail - Bimbot/1.0</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="../circle.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="section">
<h1 class="header center orange-text">User agent detail</h1>
<div class="row center">
<h5 class="header light">
Bimbot/1.0
</h5>
</div>
</div>
<div class="section">
<table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Test suite</th></tr><tr><td>Browscap<br /><small>6014</small><br /><small>vendor/browscap/browscap/tests/fixtures/issues/issue-900.php</small></td><td>Default Browser 0.0</td><td>unknown unknown</td><td>unknown unknown</td><td style="border-left: 1px solid #555">unknown</td><td>unknown</td><td>unknown</td><td></td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-b3ace57b-0c56-4fa0-aa1d-8ee4ba0e42c7">Detail</a>
<!-- Modal Structure -->
<div id="modal-b3ace57b-0c56-4fa0-aa1d-8ee4ba0e42c7" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Browscap result detail</h4>
<p><pre><code class="php">Array
(
[Comment] => Default Browser
[Browser] => Default Browser
[Browser_Type] => unknown
[Browser_Bits] => 0
[Browser_Maker] => unknown
[Browser_Modus] => unknown
[Version] => 0.0
[MajorVer] => 0
[MinorVer] => 0
[Platform] => unknown
[Platform_Version] => unknown
[Platform_Description] => unknown
[Platform_Bits] => 0
[Platform_Maker] => unknown
[Alpha] =>
[Beta] =>
[Win16] =>
[Win32] =>
[Win64] =>
[Frames] =>
[IFrames] =>
[Tables] =>
[Cookies] =>
[BackgroundSounds] =>
[JavaScript] =>
[VBScript] =>
[JavaApplets] =>
[ActiveXControls] =>
[isMobileDevice] =>
[isTablet] =>
[isSyndicationReader] =>
[Crawler] =>
[isFake] =>
[isAnonymized] =>
[isModified] =>
[CssVersion] => 0
[AolVersion] => 0
[Device_Name] => unknown
[Device_Maker] => unknown
[Device_Type] => unknown
[Device_Pointing_Method] => unknown
[Device_Code_Name] => unknown
[Device_Brand_Name] => unknown
[RenderingEngine_Name] => unknown
[RenderingEngine_Version] => unknown
[RenderingEngine_Maker] => unknown
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapFull<br /><small>6014</small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>BrowscapLite<br /><small>6014</small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>BrowscapPhp<br /><small>6014</small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>DonatjUAParser<br /><small>v0.5.1</small><br /></td><td>Bimbot 1.0</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-15fbc1f0-2615-4d42-b5d9-a30dd647b050">Detail</a>
<!-- Modal Structure -->
<div id="modal-15fbc1f0-2615-4d42-b5d9-a30dd647b050" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>DonatjUAParser result detail</h4>
<p><pre><code class="php">Array
(
[platform] =>
[browser] => Bimbot
[version] => 1.0
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>JenssegersAgent<br /><small>v2.3.3</small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>NeutrinoApiCom<br /><small></small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555">yes</td><td></td><td><i class="material-icons">close</i></td><td>0.20401</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-8c2a7a4e-3fbf-4df2-8d61-5e730422f67b">Detail</a>
<!-- Modal Structure -->
<div id="modal-8c2a7a4e-3fbf-4df2-8d61-5e730422f67b" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>NeutrinoApiCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[mobile_screen_height] => 0
[is_mobile] =>
[type] => robot
[mobile_brand] =>
[mobile_model] =>
[version] =>
[is_android] =>
[browser_name] => unknown
[operating_system_family] => unknown
[operating_system_version] =>
[is_ios] =>
[producer] =>
[operating_system] => unknown
[mobile_screen_width] => 0
[mobile_browser] =>
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>PiwikDeviceDetector<br /><small>3.6.1</small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td></td><td style="border-left: 1px solid #555">yes</td><td></td><td></td><td>0.003</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-4a941d34-a8d3-4914-9724-346f60ad7046">Detail</a>
<!-- Modal Structure -->
<div id="modal-4a941d34-a8d3-4914-9724-346f60ad7046" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>PiwikDeviceDetector result detail</h4>
<p><pre><code class="php">Array
(
[client] =>
[operatingSystem] =>
[device] => Array
(
[brand] =>
[brandName] =>
[model] =>
[device] =>
[deviceName] =>
)
[bot] => Array
(
[name] => Generic Bot
)
[extra] => Array
(
[isBot] => 1
[isBrowser] =>
[isFeedReader] =>
[isMobileApp] =>
[isPIM] =>
[isLibrary] =>
[isMediaPlayer] =>
[isCamera] =>
[isCarBrowser] =>
[isConsole] =>
[isFeaturePhone] =>
[isPhablet] =>
[isPortableMediaPlayer] =>
[isSmartDisplay] =>
[isSmartphone] =>
[isTablet] =>
[isTV] =>
[isDesktop] =>
[isMobile] =>
[isTouchEnabled] =>
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.1</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555">yes</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-ec1cd248-02b0-457e-8a9d-35bb99af008c">Detail</a>
<!-- Modal Structure -->
<div id="modal-ec1cd248-02b0-457e-8a9d-35bb99af008c" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>SinergiBrowserDetector result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Sinergi\BrowserDetector\Browser Object
(
[userAgent:Sinergi\BrowserDetector\Browser:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Bimbot/1.0
)
[name:Sinergi\BrowserDetector\Browser:private] => unknown
[version:Sinergi\BrowserDetector\Browser:private] => unknown
[isRobot:Sinergi\BrowserDetector\Browser:private] => 1
[isChromeFrame:Sinergi\BrowserDetector\Browser:private] =>
[isFacebookWebView:Sinergi\BrowserDetector\Browser:private] =>
[isCompatibilityMode:Sinergi\BrowserDetector\Browser:private] =>
)
[operatingSystem] => Sinergi\BrowserDetector\Os Object
(
[name:Sinergi\BrowserDetector\Os:private] => unknown
[version:Sinergi\BrowserDetector\Os:private] => unknown
[isMobile:Sinergi\BrowserDetector\Os:private] =>
[userAgent:Sinergi\BrowserDetector\Os:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Bimbot/1.0
)
)
[device] => Sinergi\BrowserDetector\Device Object
(
[name:Sinergi\BrowserDetector\Device:private] => unknown
[userAgent:Sinergi\BrowserDetector\Device:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Bimbot/1.0
)
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UAParser<br /><small>v3.4.5</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555">yes</td><td>Bimbot</td><td><i class="material-icons">close</i></td><td>0.001</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-3160e405-8a8f-46dd-8f47-5115f06462d2">Detail</a>
<!-- Modal Structure -->
<div id="modal-3160e405-8a8f-46dd-8f47-5115f06462d2" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UAParser result detail</h4>
<p><pre><code class="php">UAParser\Result\Client Object
(
[ua] => UAParser\Result\UserAgent Object
(
[major] => 1
[minor] => 0
[patch] =>
[family] => Bimbot
)
[os] => UAParser\Result\OperatingSystem Object
(
[major] =>
[minor] =>
[patch] =>
[patchMinor] =>
[family] => Other
)
[device] => UAParser\Result\Device Object
(
[brand] => Spider
[model] => Desktop
[family] => Spider
)
[originalUserAgent] => Bimbot/1.0
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UserAgentApiCom<br /><small></small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>UserAgentStringCom<br /><small></small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555">yes</td><td>Bimbot</td><td>Crawler</td><td>0.058</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-08a9ddfb-838f-48d7-9ede-1d132306b2ee">Detail</a>
<!-- Modal Structure -->
<div id="modal-08a9ddfb-838f-48d7-9ede-1d132306b2ee" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UserAgentStringCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[agent_type] => Crawler
[agent_name] => Bimbot
[agent_version] => 1.0
[os_type] => unknown
[os_name] => unknown
[os_versionName] =>
[os_versionNumber] =>
[os_producer] =>
[os_producerURL] =>
[linux_distibution] => Null
[agent_language] =>
[agent_languageTag] =>
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhatIsMyBrowserCom<br /><small></small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>WhichBrowser<br /><small>v2.0.18</small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555">yes</td><td></td><td><i class="material-icons">close</i></td><td>0.001</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-083a336f-5d73-4505-84f3-c5fc9bb78652">Detail</a>
<!-- Modal Structure -->
<div id="modal-083a336f-5d73-4505-84f3-c5fc9bb78652" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhichBrowser result detail</h4>
<p><pre><code class="php">Array
(
[device] => Array
(
[type] => bot
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Woothee<br /><small>v1.2.0</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555">yes</td><td></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-f00e7198-0e22-49fe-bad0-dbb3a9cde9b9">Detail</a>
<!-- Modal Structure -->
<div id="modal-f00e7198-0e22-49fe-bad0-dbb3a9cde9b9" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Woothee result detail</h4>
<p><pre><code class="php">Array
(
[name] => misc crawler
[category] => crawler
[os] => UNKNOWN
[version] => UNKNOWN
[vendor] => UNKNOWN
[os_version] => UNKNOWN
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Wurfl<br /><small>1.7.1.0</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td></td><td style="border-left: 1px solid #555">yes</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.016</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-a2bedf8c-4a95-42a7-96c5-aaf233b2ac50">Detail</a>
<!-- Modal Structure -->
<div id="modal-a2bedf8c-4a95-42a7-96c5-aaf233b2ac50" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Wurfl result detail</h4>
<p><pre><code class="php">Array
(
[virtual] => Array
(
[is_android] => false
[is_ios] => false
[is_windows_phone] => false
[is_app] => false
[is_full_desktop] => true
[is_largescreen] => true
[is_mobile] => false
[is_robot] => 1
[is_smartphone] => false
[is_touchscreen] => false
[is_wml_preferred] => false
[is_xhtmlmp_preferred] => false
[is_html_preferred] => true
[advertised_device_os] =>
[advertised_device_os_version] =>
[advertised_browser] =>
[advertised_browser_version] =>
[complete_device_name] => Robot Bot or Crawler
[device_name] => Robot Bot or Crawler
[form_factor] => Desktop
[is_phone] => false
[is_app_webview] => false
)
[all] => Array
(
[brand_name] => Robot
[model_name] => Bot or Crawler
[unique] => true
[ununiqueness_handler] =>
[is_wireless_device] => false
[device_claims_web_support] => true
[has_qwerty_keyboard] => true
[can_skip_aligned_link_row] => true
[uaprof] =>
[uaprof2] =>
[uaprof3] =>
[nokia_series] => 0
[nokia_edition] => 0
[device_os] =>
[mobile_browser] =>
[mobile_browser_version] =>
[device_os_version] =>
[pointing_method] => mouse
[release_date] => 2000_january
[marketing_name] =>
[model_extra_info] =>
[nokia_feature_pack] => 0
[can_assign_phone_number] => false
[is_tablet] => false
[manufacturer_name] =>
[is_bot] => true
[is_google_glass] => false
[proportional_font] => false
[built_in_back_button_support] => false
[card_title_support] => false
[softkey_support] => false
[table_support] => false
[numbered_menus] => false
[menu_with_select_element_recommended] => false
[menu_with_list_of_links_recommended] => false
[icons_on_menu_items_support] => false
[break_list_of_links_with_br_element_recommended] => false
[access_key_support] => false
[wrap_mode_support] => false
[times_square_mode_support] => false
[deck_prefetch_support] => false
[elective_forms_recommended] => false
[wizards_recommended] => false
[image_as_link_support] => false
[insert_br_element_after_widget_recommended] => false
[wml_can_display_images_and_text_on_same_line] => false
[wml_displays_image_in_center] => false
[opwv_wml_extensions_support] => false
[wml_make_phone_call_string] => none
[chtml_display_accesskey] => false
[emoji] => false
[chtml_can_display_images_and_text_on_same_line] => false
[chtml_displays_image_in_center] => false
[imode_region] => none
[chtml_make_phone_call_string] => tel:
[chtml_table_support] => true
[xhtml_honors_bgcolor] => true
[xhtml_supports_forms_in_table] => true
[xhtml_support_wml2_namespace] => false
[xhtml_autoexpand_select] => false
[xhtml_select_as_dropdown] => true
[xhtml_select_as_radiobutton] => true
[xhtml_select_as_popup] => true
[xhtml_display_accesskey] => false
[xhtml_supports_invisible_text] => false
[xhtml_supports_inline_input] => false
[xhtml_supports_monospace_font] => false
[xhtml_supports_table_for_layout] => false
[xhtml_supports_css_cell_table_coloring] => false
[xhtml_format_as_css_property] => false
[xhtml_format_as_attribute] => false
[xhtml_nowrap_mode] => false
[xhtml_marquee_as_css_property] => false
[xhtml_readable_background_color1] => #FFFFFF
[xhtml_readable_background_color2] => #FFFFFF
[xhtml_allows_disabled_form_elements] => false
[xhtml_document_title_support] => true
[xhtml_preferred_charset] => utf8
[opwv_xhtml_extensions_support] => false
[xhtml_make_phone_call_string] => none
[xhtmlmp_preferred_mime_type] => text/html
[xhtml_table_support] => false
[xhtml_send_sms_string] => none
[xhtml_send_mms_string] => none
[xhtml_file_upload] => supported
[cookie_support] => true
[accept_third_party_cookie] => true
[xhtml_supports_iframe] => full
[xhtml_avoid_accesskeys] => true
[xhtml_can_embed_video] => play_and_stop
[ajax_support_javascript] => true
[ajax_manipulate_css] => true
[ajax_support_getelementbyid] => true
[ajax_support_inner_html] => true
[ajax_xhr_type] => standard
[ajax_manipulate_dom] => true
[ajax_support_events] => true
[ajax_support_event_listener] => true
[ajax_preferred_geoloc_api] => none
[xhtml_support_level] => 4
[preferred_markup] => html_web_4_0
[wml_1_1] => false
[wml_1_2] => false
[wml_1_3] => false
[html_wi_w3_xhtmlbasic] => true
[html_wi_oma_xhtmlmp_1_0] => false
[html_wi_imode_html_1] => false
[html_wi_imode_html_2] => false
[html_wi_imode_html_3] => false
[html_wi_imode_html_4] => false
[html_wi_imode_html_5] => false
[html_wi_imode_htmlx_1] => false
[html_wi_imode_htmlx_1_1] => false
[html_wi_imode_compact_generic] => false
[html_web_3_2] => true
[html_web_4_0] => true
[voicexml] => false
[multipart_support] => false
[total_cache_disable_support] => false
[time_to_live_support] => false
[resolution_width] => 800
[resolution_height] => 600
[columns] => 120
[max_image_width] => 800
[max_image_height] => 600
[rows] => 200
[physical_screen_width] => 400
[physical_screen_height] => 400
[dual_orientation] => false
[density_class] => 1.0
[wbmp] => false
[bmp] => true
[epoc_bmp] => false
[gif_animated] => true
[jpg] => true
[png] => true
[tiff] => false
[transparent_png_alpha] => false
[transparent_png_index] => false
[svgt_1_1] => true
[svgt_1_1_plus] => false
[greyscale] => false
[gif] => true
[colors] => 65536
[webp_lossy_support] => false
[webp_lossless_support] => false
[post_method_support] => true
[basic_authentication_support] => true
[empty_option_value_support] => true
[emptyok] => false
[nokia_voice_call] => false
[wta_voice_call] => false
[wta_phonebook] => false
[wta_misc] => false
[wta_pdc] => false
[https_support] => true
[phone_id_provided] => false
[max_data_rate] => 3200
[wifi] => true
[sdio] => false
[vpn] => false
[has_cellular_radio] => false
[max_deck_size] => 100000
[max_url_length_in_requests] => 128
[max_url_length_homepage] => 0
[max_url_length_bookmark] => 0
[max_url_length_cached_page] => 0
[max_no_of_connection_settings] => 0
[max_no_of_bookmarks] => 0
[max_length_of_username] => 0
[max_length_of_password] => 0
[max_object_size] => 0
[downloadfun_support] => false
[directdownload_support] => false
[inline_support] => false
[oma_support] => false
[ringtone] => false
[ringtone_3gpp] => false
[ringtone_midi_monophonic] => false
[ringtone_midi_polyphonic] => false
[ringtone_imelody] => false
[ringtone_digiplug] => false
[ringtone_compactmidi] => false
[ringtone_mmf] => false
[ringtone_rmf] => false
[ringtone_xmf] => false
[ringtone_amr] => false
[ringtone_awb] => false
[ringtone_aac] => false
[ringtone_wav] => false
[ringtone_mp3] => false
[ringtone_spmidi] => false
[ringtone_qcelp] => false
[ringtone_voices] => 1
[ringtone_df_size_limit] => 0
[ringtone_directdownload_size_limit] => 0
[ringtone_inline_size_limit] => 0
[ringtone_oma_size_limit] => 0
[wallpaper] => false
[wallpaper_max_width] => 0
[wallpaper_max_height] => 0
[wallpaper_preferred_width] => 0
[wallpaper_preferred_height] => 0
[wallpaper_resize] => none
[wallpaper_wbmp] => false
[wallpaper_bmp] => false
[wallpaper_gif] => false
[wallpaper_jpg] => false
[wallpaper_png] => false
[wallpaper_tiff] => false
[wallpaper_greyscale] => false
[wallpaper_colors] => 2
[wallpaper_df_size_limit] => 0
[wallpaper_directdownload_size_limit] => 0
[wallpaper_inline_size_limit] => 0
[wallpaper_oma_size_limit] => 0
[screensaver] => false
[screensaver_max_width] => 0
[screensaver_max_height] => 0
[screensaver_preferred_width] => 0
[screensaver_preferred_height] => 0
[screensaver_resize] => none
[screensaver_wbmp] => false
[screensaver_bmp] => false
[screensaver_gif] => false
[screensaver_jpg] => false
[screensaver_png] => false
[screensaver_greyscale] => false
[screensaver_colors] => 2
[screensaver_df_size_limit] => 0
[screensaver_directdownload_size_limit] => 0
[screensaver_inline_size_limit] => 0
[screensaver_oma_size_limit] => 0
[picture] => false
[picture_max_width] => 0
[picture_max_height] => 0
[picture_preferred_width] => 0
[picture_preferred_height] => 0
[picture_resize] => none
[picture_wbmp] => false
[picture_bmp] => false
[picture_gif] => false
[picture_jpg] => false
[picture_png] => false
[picture_greyscale] => false
[picture_colors] => 2
[picture_df_size_limit] => 0
[picture_directdownload_size_limit] => 0
[picture_inline_size_limit] => 0
[picture_oma_size_limit] => 0
[video] => false
[oma_v_1_0_forwardlock] => false
[oma_v_1_0_combined_delivery] => false
[oma_v_1_0_separate_delivery] => false
[streaming_video] => false
[streaming_3gpp] => false
[streaming_mp4] => false
[streaming_mov] => false
[streaming_video_size_limit] => 0
[streaming_real_media] => none
[streaming_flv] => false
[streaming_3g2] => false
[streaming_vcodec_h263_0] => -1
[streaming_vcodec_h263_3] => -1
[streaming_vcodec_mpeg4_sp] => -1
[streaming_vcodec_mpeg4_asp] => -1
[streaming_vcodec_h264_bp] => -1
[streaming_acodec_amr] => none
[streaming_acodec_aac] => none
[streaming_wmv] => none
[streaming_preferred_protocol] => rtsp
[streaming_preferred_http_protocol] => none
[wap_push_support] => false
[connectionless_service_indication] => false
[connectionless_service_load] => false
[connectionless_cache_operation] => false
[connectionoriented_unconfirmed_service_indication] => false
[connectionoriented_unconfirmed_service_load] => false
[connectionoriented_unconfirmed_cache_operation] => false
[connectionoriented_confirmed_service_indication] => false
[connectionoriented_confirmed_service_load] => false
[connectionoriented_confirmed_cache_operation] => false
[utf8_support] => true
[ascii_support] => false
[iso8859_support] => false
[expiration_date] => false
[j2me_cldc_1_0] => false
[j2me_cldc_1_1] => false
[j2me_midp_1_0] => false
[j2me_midp_2_0] => false
[doja_1_0] => false
[doja_1_5] => false
[doja_2_0] => false
[doja_2_1] => false
[doja_2_2] => false
[doja_3_0] => false
[doja_3_5] => false
[doja_4_0] => false
[j2me_jtwi] => false
[j2me_mmapi_1_0] => false
[j2me_mmapi_1_1] => false
[j2me_wmapi_1_0] => false
[j2me_wmapi_1_1] => false
[j2me_wmapi_2_0] => false
[j2me_btapi] => false
[j2me_3dapi] => false
[j2me_locapi] => false
[j2me_nokia_ui] => false
[j2me_motorola_lwt] => false
[j2me_siemens_color_game] => false
[j2me_siemens_extension] => false
[j2me_heap_size] => 0
[j2me_max_jar_size] => 0
[j2me_storage_size] => 0
[j2me_max_record_store_size] => 0
[j2me_screen_width] => 0
[j2me_screen_height] => 0
[j2me_canvas_width] => 0
[j2me_canvas_height] => 0
[j2me_bits_per_pixel] => 0
[j2me_audio_capture_enabled] => false
[j2me_video_capture_enabled] => false
[j2me_photo_capture_enabled] => false
[j2me_capture_image_formats] => none
[j2me_http] => false
[j2me_https] => false
[j2me_socket] => false
[j2me_udp] => false
[j2me_serial] => false
[j2me_gif] => false
[j2me_gif89a] => false
[j2me_jpg] => false
[j2me_png] => false
[j2me_bmp] => false
[j2me_bmp3] => false
[j2me_wbmp] => false
[j2me_midi] => false
[j2me_wav] => false
[j2me_amr] => false
[j2me_mp3] => false
[j2me_mp4] => false
[j2me_imelody] => false
[j2me_rmf] => false
[j2me_au] => false
[j2me_aac] => false
[j2me_realaudio] => false
[j2me_xmf] => false
[j2me_wma] => false
[j2me_3gpp] => false
[j2me_h263] => false
[j2me_svgt] => false
[j2me_mpeg4] => false
[j2me_realvideo] => false
[j2me_real8] => false
[j2me_realmedia] => false
[j2me_left_softkey_code] => 0
[j2me_right_softkey_code] => 0
[j2me_middle_softkey_code] => 0
[j2me_select_key_code] => 0
[j2me_return_key_code] => 0
[j2me_clear_key_code] => 0
[j2me_datefield_no_accepts_null_date] => false
[j2me_datefield_broken] => false
[receiver] => false
[sender] => false
[mms_max_size] => 0
[mms_max_height] => 0
[mms_max_width] => 0
[built_in_recorder] => false
[built_in_camera] => false
[mms_jpeg_baseline] => false
[mms_jpeg_progressive] => false
[mms_gif_static] => false
[mms_gif_animated] => false
[mms_png] => false
[mms_bmp] => false
[mms_wbmp] => false
[mms_amr] => false
[mms_wav] => false
[mms_midi_monophonic] => false
[mms_midi_polyphonic] => false
[mms_midi_polyphonic_voices] => 0
[mms_spmidi] => false
[mms_mmf] => false
[mms_mp3] => false
[mms_evrc] => false
[mms_qcelp] => false
[mms_ota_bitmap] => false
[mms_nokia_wallpaper] => false
[mms_nokia_operatorlogo] => false
[mms_nokia_3dscreensaver] => false
[mms_nokia_ringingtone] => false
[mms_rmf] => false
[mms_xmf] => false
[mms_symbian_install] => false
[mms_jar] => false
[mms_jad] => false
[mms_vcard] => false
[mms_vcalendar] => false
[mms_wml] => false
[mms_wbxml] => false
[mms_wmlc] => false
[mms_video] => false
[mms_mp4] => false
[mms_3gpp] => false
[mms_3gpp2] => false
[mms_max_frame_rate] => 0
[nokiaring] => false
[picturemessage] => false
[operatorlogo] => false
[largeoperatorlogo] => false
[callericon] => false
[nokiavcard] => false
[nokiavcal] => false
[sckl_ringtone] => false
[sckl_operatorlogo] => false
[sckl_groupgraphic] => false
[sckl_vcard] => false
[sckl_vcalendar] => false
[text_imelody] => false
[ems] => false
[ems_variablesizedpictures] => false
[ems_imelody] => false
[ems_odi] => false
[ems_upi] => false
[ems_version] => 0
[siemens_ota] => false
[siemens_logo_width] => 101
[siemens_logo_height] => 29
[siemens_screensaver_width] => 101
[siemens_screensaver_height] => 50
[gprtf] => false
[sagem_v1] => false
[sagem_v2] => false
[panasonic] => false
[sms_enabled] => false
[wav] => false
[mmf] => false
[smf] => false
[mld] => false
[midi_monophonic] => false
[midi_polyphonic] => false
[sp_midi] => false
[rmf] => false
[xmf] => false
[compactmidi] => false
[digiplug] => false
[nokia_ringtone] => false
[imelody] => false
[au] => false
[amr] => false
[awb] => false
[aac] => false
[mp3] => false
[voices] => 1
[qcelp] => false
[evrc] => false
[flash_lite_version] =>
[fl_wallpaper] => false
[fl_screensaver] => false
[fl_standalone] => false
[fl_browser] => false
[fl_sub_lcd] => false
[full_flash_support] => true
[css_supports_width_as_percentage] => true
[css_border_image] => none
[css_rounded_corners] => none
[css_gradient] => none
[css_spriting] => true
[css_gradient_linear] => none
[is_transcoder] => false
[transcoder_ua_header] => user-agent
[rss_support] => false
[pdf_support] => true
[progressive_download] => true
[playback_vcodec_h263_0] => -1
[playback_vcodec_h263_3] => -1
[playback_vcodec_mpeg4_sp] => -1
[playback_vcodec_mpeg4_asp] => -1
[playback_vcodec_h264_bp] => -1
[playback_real_media] => none
[playback_3gpp] => false
[playback_3g2] => false
[playback_mp4] => false
[playback_mov] => false
[playback_acodec_amr] => none
[playback_acodec_aac] => none
[playback_df_size_limit] => 0
[playback_directdownload_size_limit] => 0
[playback_inline_size_limit] => 0
[playback_oma_size_limit] => 0
[playback_acodec_qcelp] => false
[playback_wmv] => none
[hinted_progressive_download] => false
[html_preferred_dtd] => html4
[viewport_supported] => false
[viewport_width] => width_equals_max_image_width
[viewport_userscalable] =>
[viewport_initial_scale] =>
[viewport_maximum_scale] =>
[viewport_minimum_scale] =>
[mobileoptimized] => false
[handheldfriendly] => false
[canvas_support] => none
[image_inlining] => true
[is_smarttv] => false
[is_console] => false
[nfc_support] => false
[ux_full_desktop] => true
[jqm_grade] => A
[is_sencha_touch_ok] => true
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Zsxsoft<br /><small>1.3</small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr></table>
</div>
<div class="section">
<h1 class="header center orange-text">About this comparison</h1>
<div class="row center">
<h5 class="header light">
The primary goal of this project is simple<br />
I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br />
<br />
The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br />
<br />
You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br />
<br />
The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a>
</h5>
</div>
</div>
<div class="card">
<div class="card-content">
Comparison created <i>2016-05-10 08:03:06</i> | by
<a href="https://github.com/ThaDafinser">ThaDafinser</a>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.2.0/list.min.js"></script>
<script>
$(document).ready(function(){
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
$('.modal-trigger').leanModal();
});
</script>
</body>
</html>
|
{
"content_hash": "5d0337df50f2bc5f02739b3c000c1772",
"timestamp": "",
"source": "github",
"line_count": 1020,
"max_line_length": 812,
"avg_line_length": 40.61470588235294,
"alnum_prop": 0.5220991141043281,
"repo_name": "ThaDafinser/UserAgentParserComparison",
"id": "37e5bc3b9f33d6779c9bf1d286debe918fd849cb",
"size": "41428",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "v5/user-agent-detail/95/9a/959ad852-bff8-4b5c-96d6-68b8c9b6a47d.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2060859160"
}
],
"symlink_target": ""
}
|
/* glpnpp05.c */
/***********************************************************************
* This code is part of GLPK (GNU Linear Programming Kit).
*
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied
* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights
* reserved. E-mail: <mao@gnu.org>.
*
* GLPK is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GLPK is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPK. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************/
#include "env.h"
#include "glpnpp.h"
/***********************************************************************
* NAME
*
* npp_clean_prob - perform initial LP/MIP processing
*
* SYNOPSIS
*
* #include "glpnpp.h"
* void npp_clean_prob(NPP *npp);
*
* DESCRIPTION
*
* The routine npp_clean_prob performs initial LP/MIP processing that
* currently includes:
*
* 1) removing free rows;
*
* 2) replacing double-sided constraint rows with almost identical
* bounds, by equality constraint rows;
*
* 3) removing fixed columns;
*
* 4) replacing double-bounded columns with almost identical bounds by
* fixed columns and removing those columns;
*
* 5) initial processing constraint coefficients (not implemented);
*
* 6) initial processing objective coefficients (not implemented). */
void npp_clean_prob(NPP *npp)
{ /* perform initial LP/MIP processing */
NPPROW *row, *next_row;
NPPCOL *col, *next_col;
int ret;
xassert(npp == npp);
/* process rows which originally are free */
for (row = npp->r_head; row != NULL; row = next_row)
{ next_row = row->next;
if (row->lb == -DBL_MAX && row->ub == +DBL_MAX)
{ /* process free row */
#ifdef GLP_DEBUG
xprintf("1");
#endif
npp_free_row(npp, row);
/* row was deleted */
}
}
/* process rows which originally are double-sided inequalities */
for (row = npp->r_head; row != NULL; row = next_row)
{ next_row = row->next;
if (row->lb != -DBL_MAX && row->ub != +DBL_MAX &&
row->lb < row->ub)
{ ret = npp_make_equality(npp, row);
if (ret == 0)
;
else if (ret == 1)
{ /* row was replaced by equality constraint */
#ifdef GLP_DEBUG
xprintf("2");
#endif
}
else
xassert(ret != ret);
}
}
/* process columns which are originally fixed */
for (col = npp->c_head; col != NULL; col = next_col)
{ next_col = col->next;
if (col->lb == col->ub)
{ /* process fixed column */
#ifdef GLP_DEBUG
xprintf("3");
#endif
npp_fixed_col(npp, col);
/* column was deleted */
}
}
/* process columns which are originally double-bounded */
for (col = npp->c_head; col != NULL; col = next_col)
{ next_col = col->next;
if (col->lb != -DBL_MAX && col->ub != +DBL_MAX &&
col->lb < col->ub)
{ ret = npp_make_fixed(npp, col);
if (ret == 0)
;
else if (ret == 1)
{ /* column was replaced by fixed column; process it */
#ifdef GLP_DEBUG
xprintf("4");
#endif
npp_fixed_col(npp, col);
/* column was deleted */
}
}
}
return;
}
/***********************************************************************
* NAME
*
* npp_process_row - perform basic row processing
*
* SYNOPSIS
*
* #include "glpnpp.h"
* int npp_process_row(NPP *npp, NPPROW *row, int hard);
*
* DESCRIPTION
*
* The routine npp_process_row performs basic row processing that
* currently includes:
*
* 1) removing empty row;
*
* 2) removing equality constraint row singleton and corresponding
* column;
*
* 3) removing inequality constraint row singleton and corresponding
* column if it was fixed;
*
* 4) performing general row analysis;
*
* 5) removing redundant row bounds;
*
* 6) removing forcing row and corresponding columns;
*
* 7) removing row which becomes free due to redundant bounds;
*
* 8) computing implied bounds for all columns in the row and using
* them to strengthen current column bounds (MIP only, optional,
* performed if the flag hard is on).
*
* Additionally the routine may activate affected rows and/or columns
* for further processing.
*
* RETURNS
*
* 0 success;
*
* GLP_ENOPFS primal/integer infeasibility detected;
*
* GLP_ENODFS dual infeasibility detected. */
int npp_process_row(NPP *npp, NPPROW *row, int hard)
{ /* perform basic row processing */
NPPCOL *col;
NPPAIJ *aij, *next_aij, *aaa;
int ret;
/* row must not be free */
xassert(!(row->lb == -DBL_MAX && row->ub == +DBL_MAX));
/* start processing row */
if (row->ptr == NULL)
{ /* empty row */
ret = npp_empty_row(npp, row);
if (ret == 0)
{ /* row was deleted */
#ifdef GLP_DEBUG
xprintf("A");
#endif
return 0;
}
else if (ret == 1)
{ /* primal infeasibility */
return GLP_ENOPFS;
}
else
xassert(ret != ret);
}
if (row->ptr->r_next == NULL)
{ /* row singleton */
col = row->ptr->col;
if (row->lb == row->ub)
{ /* equality constraint */
ret = npp_eq_singlet(npp, row);
if (ret == 0)
{ /* column was fixed, row was deleted */
#ifdef GLP_DEBUG
xprintf("B");
#endif
/* activate rows affected by column */
for (aij = col->ptr; aij != NULL; aij = aij->c_next)
npp_activate_row(npp, aij->row);
/* process fixed column */
npp_fixed_col(npp, col);
/* column was deleted */
return 0;
}
else if (ret == 1 || ret == 2)
{ /* primal/integer infeasibility */
return GLP_ENOPFS;
}
else
xassert(ret != ret);
}
else
{ /* inequality constraint */
ret = npp_ineq_singlet(npp, row);
if (0 <= ret && ret <= 3)
{ /* row was deleted */
#ifdef GLP_DEBUG
xprintf("C");
#endif
/* activate column, since its length was changed due to
row deletion */
npp_activate_col(npp, col);
if (ret >= 2)
{ /* column bounds changed significantly or column was
fixed */
/* activate rows affected by column */
for (aij = col->ptr; aij != NULL; aij = aij->c_next)
npp_activate_row(npp, aij->row);
}
if (ret == 3)
{ /* column was fixed; process it */
#ifdef GLP_DEBUG
xprintf("D");
#endif
npp_fixed_col(npp, col);
/* column was deleted */
}
return 0;
}
else if (ret == 4)
{ /* primal infeasibility */
return GLP_ENOPFS;
}
else
xassert(ret != ret);
}
}
#if 0
/* sometimes this causes too large round-off errors; probably
pivot coefficient should be chosen more carefully */
if (row->ptr->r_next->r_next == NULL)
{ /* row doubleton */
if (row->lb == row->ub)
{ /* equality constraint */
if (!(row->ptr->col->is_int ||
row->ptr->r_next->col->is_int))
{ /* both columns are continuous */
NPPCOL *q;
q = npp_eq_doublet(npp, row);
if (q != NULL)
{ /* column q was eliminated */
#ifdef GLP_DEBUG
xprintf("E");
#endif
/* now column q is singleton of type "implied slack
variable"; we process it here to make sure that on
recovering basic solution the row is always active
equality constraint (as required by the routine
rcv_eq_doublet) */
xassert(npp_process_col(npp, q) == 0);
/* column q was deleted; note that row p also may be
deleted */
return 0;
}
}
}
}
#endif
/* general row analysis */
ret = npp_analyze_row(npp, row);
xassert(0x00 <= ret && ret <= 0xFF);
if (ret == 0x33)
{ /* row bounds are inconsistent with column bounds */
return GLP_ENOPFS;
}
if ((ret & 0x0F) == 0x00)
{ /* row lower bound does not exist or redundant */
if (row->lb != -DBL_MAX)
{ /* remove redundant row lower bound */
#ifdef GLP_DEBUG
xprintf("F");
#endif
npp_inactive_bound(npp, row, 0);
}
}
else if ((ret & 0x0F) == 0x01)
{ /* row lower bound can be active */
/* see below */
}
else if ((ret & 0x0F) == 0x02)
{ /* row lower bound is a forcing bound */
#ifdef GLP_DEBUG
xprintf("G");
#endif
/* process forcing row */
if (npp_forcing_row(npp, row, 0) == 0)
fixup: { /* columns were fixed, row was made free */
for (aij = row->ptr; aij != NULL; aij = next_aij)
{ /* process column fixed by forcing row */
#ifdef GLP_DEBUG
xprintf("H");
#endif
col = aij->col;
next_aij = aij->r_next;
/* activate rows affected by column */
for (aaa = col->ptr; aaa != NULL; aaa = aaa->c_next)
npp_activate_row(npp, aaa->row);
/* process fixed column */
npp_fixed_col(npp, col);
/* column was deleted */
}
/* process free row (which now is empty due to deletion of
all its columns) */
npp_free_row(npp, row);
/* row was deleted */
return 0;
}
}
else
xassert(ret != ret);
if ((ret & 0xF0) == 0x00)
{ /* row upper bound does not exist or redundant */
if (row->ub != +DBL_MAX)
{ /* remove redundant row upper bound */
#ifdef GLP_DEBUG
xprintf("I");
#endif
npp_inactive_bound(npp, row, 1);
}
}
else if ((ret & 0xF0) == 0x10)
{ /* row upper bound can be active */
/* see below */
}
else if ((ret & 0xF0) == 0x20)
{ /* row upper bound is a forcing bound */
#ifdef GLP_DEBUG
xprintf("J");
#endif
/* process forcing row */
if (npp_forcing_row(npp, row, 1) == 0) goto fixup;
}
else
xassert(ret != ret);
if (row->lb == -DBL_MAX && row->ub == +DBL_MAX)
{ /* row became free due to redundant bounds removal */
#ifdef GLP_DEBUG
xprintf("K");
#endif
/* activate its columns, since their length will change due
to row deletion */
for (aij = row->ptr; aij != NULL; aij = aij->r_next)
npp_activate_col(npp, aij->col);
/* process free row */
npp_free_row(npp, row);
/* row was deleted */
return 0;
}
#if 1 /* 23/XII-2009 */
/* row lower and/or upper bounds can be active */
if (npp->sol == GLP_MIP && hard)
{ /* improve current column bounds (optional) */
if (npp_improve_bounds(npp, row, 1) < 0)
return GLP_ENOPFS;
}
#endif
return 0;
}
/***********************************************************************
* NAME
*
* npp_improve_bounds - improve current column bounds
*
* SYNOPSIS
*
* #include "glpnpp.h"
* int npp_improve_bounds(NPP *npp, NPPROW *row, int flag);
*
* DESCRIPTION
*
* The routine npp_improve_bounds analyzes specified row (inequality
* or equality constraint) to determine implied column bounds and then
* uses these bounds to improve (strengthen) current column bounds.
*
* If the flag is on and current column bounds changed significantly
* or the column was fixed, the routine activate rows affected by the
* column for further processing. (This feature is intended to be used
* in the main loop of the routine npp_process_row.)
*
* NOTE: This operation can be used for MIP problem only.
*
* RETURNS
*
* The routine npp_improve_bounds returns the number of significantly
* changed bounds plus the number of column having been fixed due to
* bound improvements. However, if the routine detects primal/integer
* infeasibility, it returns a negative value. */
int npp_improve_bounds(NPP *npp, NPPROW *row, int flag)
{ /* improve current column bounds */
NPPCOL *col;
NPPAIJ *aij, *next_aij, *aaa;
int kase, ret, count = 0;
double lb, ub;
xassert(npp->sol == GLP_MIP);
/* row must not be free */
xassert(!(row->lb == -DBL_MAX && row->ub == +DBL_MAX));
/* determine implied column bounds */
npp_implied_bounds(npp, row);
/* and use these bounds to strengthen current column bounds */
for (aij = row->ptr; aij != NULL; aij = next_aij)
{ col = aij->col;
next_aij = aij->r_next;
for (kase = 0; kase <= 1; kase++)
{ /* save current column bounds */
lb = col->lb, ub = col->ub;
if (kase == 0)
{ /* process implied column lower bound */
if (col->ll.ll == -DBL_MAX) continue;
ret = npp_implied_lower(npp, col, col->ll.ll);
}
else
{ /* process implied column upper bound */
if (col->uu.uu == +DBL_MAX) continue;
ret = npp_implied_upper(npp, col, col->uu.uu);
}
if (ret == 0 || ret == 1)
{ /* current column bounds did not change or changed, but
not significantly; restore current column bounds */
col->lb = lb, col->ub = ub;
}
else if (ret == 2 || ret == 3)
{ /* current column bounds changed significantly or column
was fixed */
#ifdef GLP_DEBUG
xprintf("L");
#endif
count++;
/* activate other rows affected by column, if required */
if (flag)
{ for (aaa = col->ptr; aaa != NULL; aaa = aaa->c_next)
{ if (aaa->row != row)
npp_activate_row(npp, aaa->row);
}
}
if (ret == 3)
{ /* process fixed column */
#ifdef GLP_DEBUG
xprintf("M");
#endif
npp_fixed_col(npp, col);
/* column was deleted */
break; /* for kase */
}
}
else if (ret == 4)
{ /* primal/integer infeasibility */
return -1;
}
else
xassert(ret != ret);
}
}
return count;
}
/***********************************************************************
* NAME
*
* npp_process_col - perform basic column processing
*
* SYNOPSIS
*
* #include "glpnpp.h"
* int npp_process_col(NPP *npp, NPPCOL *col);
*
* DESCRIPTION
*
* The routine npp_process_col performs basic column processing that
* currently includes:
*
* 1) fixing and removing empty column;
*
* 2) removing column singleton, which is implied slack variable, and
* corresponding row if it becomes free;
*
* 3) removing bounds of column, which is implied free variable, and
* replacing corresponding row by equality constraint.
*
* Additionally the routine may activate affected rows and/or columns
* for further processing.
*
* RETURNS
*
* 0 success;
*
* GLP_ENOPFS primal/integer infeasibility detected;
*
* GLP_ENODFS dual infeasibility detected. */
int npp_process_col(NPP *npp, NPPCOL *col)
{ /* perform basic column processing */
NPPROW *row;
NPPAIJ *aij;
int ret;
/* column must not be fixed */
xassert(col->lb < col->ub);
/* start processing column */
if (col->ptr == NULL)
{ /* empty column */
ret = npp_empty_col(npp, col);
if (ret == 0)
{ /* column was fixed and deleted */
#ifdef GLP_DEBUG
xprintf("N");
#endif
return 0;
}
else if (ret == 1)
{ /* dual infeasibility */
return GLP_ENODFS;
}
else
xassert(ret != ret);
}
if (col->ptr->c_next == NULL)
{ /* column singleton */
row = col->ptr->row;
if (row->lb == row->ub)
{ /* equality constraint */
if (!col->is_int)
slack: { /* implied slack variable */
#ifdef GLP_DEBUG
xprintf("O");
#endif
npp_implied_slack(npp, col);
/* column was deleted */
if (row->lb == -DBL_MAX && row->ub == +DBL_MAX)
{ /* row became free due to implied slack variable */
#ifdef GLP_DEBUG
xprintf("P");
#endif
/* activate columns affected by row */
for (aij = row->ptr; aij != NULL; aij = aij->r_next)
npp_activate_col(npp, aij->col);
/* process free row */
npp_free_row(npp, row);
/* row was deleted */
}
else
{ /* row became inequality constraint; activate it
since its length changed due to column deletion */
npp_activate_row(npp, row);
}
return 0;
}
}
else
{ /* inequality constraint */
if (!col->is_int)
{ ret = npp_implied_free(npp, col);
if (ret == 0)
{ /* implied free variable */
#ifdef GLP_DEBUG
xprintf("Q");
#endif
/* column bounds were removed, row was replaced by
equality constraint */
goto slack;
}
else if (ret == 1)
{ /* column is not implied free variable, because its
lower and/or upper bounds can be active */
}
else if (ret == 2)
{ /* dual infeasibility */
return GLP_ENODFS;
}
}
}
}
/* column still exists */
return 0;
}
/***********************************************************************
* NAME
*
* npp_process_prob - perform basic LP/MIP processing
*
* SYNOPSIS
*
* #include "glpnpp.h"
* int npp_process_prob(NPP *npp, int hard);
*
* DESCRIPTION
*
* The routine npp_process_prob performs basic LP/MIP processing that
* currently includes:
*
* 1) initial LP/MIP processing (see the routine npp_clean_prob),
*
* 2) basic row processing (see the routine npp_process_row), and
*
* 3) basic column processing (see the routine npp_process_col).
*
* If the flag hard is on, the routine attempts to improve current
* column bounds multiple times within the main processing loop, in
* which case this feature may take a time. Otherwise, if the flag hard
* is off, improving column bounds is performed only once at the end of
* the main loop. (Note that this feature is used for MIP only.)
*
* The routine uses two sets: the set of active rows and the set of
* active columns. Rows/columns are marked by a flag (the field temp in
* NPPROW/NPPCOL). If the flag is non-zero, the row/column is active,
* in which case it is placed in the beginning of the row/column list;
* otherwise, if the flag is zero, the row/column is inactive, in which
* case it is placed in the end of the row/column list. If a row/column
* being currently processed may affect other rows/columns, the latters
* are activated for further processing.
*
* RETURNS
*
* 0 success;
*
* GLP_ENOPFS primal/integer infeasibility detected;
*
* GLP_ENODFS dual infeasibility detected. */
int npp_process_prob(NPP *npp, int hard)
{ /* perform basic LP/MIP processing */
NPPROW *row;
NPPCOL *col;
int processing, ret;
/* perform initial LP/MIP processing */
npp_clean_prob(npp);
/* activate all remaining rows and columns */
for (row = npp->r_head; row != NULL; row = row->next)
row->temp = 1;
for (col = npp->c_head; col != NULL; col = col->next)
col->temp = 1;
/* main processing loop */
processing = 1;
while (processing)
{ processing = 0;
/* process all active rows */
for (;;)
{ row = npp->r_head;
if (row == NULL || !row->temp) break;
npp_deactivate_row(npp, row);
ret = npp_process_row(npp, row, hard);
if (ret != 0) goto done;
processing = 1;
}
/* process all active columns */
for (;;)
{ col = npp->c_head;
if (col == NULL || !col->temp) break;
npp_deactivate_col(npp, col);
ret = npp_process_col(npp, col);
if (ret != 0) goto done;
processing = 1;
}
}
#if 1 /* 23/XII-2009 */
if (npp->sol == GLP_MIP && !hard)
{ /* improve current column bounds (optional) */
for (row = npp->r_head; row != NULL; row = row->next)
{ if (npp_improve_bounds(npp, row, 0) < 0)
{ ret = GLP_ENOPFS;
goto done;
}
}
}
#endif
/* all seems ok */
ret = 0;
done: xassert(ret == 0 || ret == GLP_ENOPFS || ret == GLP_ENODFS);
#ifdef GLP_DEBUG
xprintf("\n");
#endif
return ret;
}
/**********************************************************************/
int npp_simplex(NPP *npp, const glp_smcp *parm)
{ /* process LP prior to applying primal/dual simplex method */
int ret;
xassert(npp->sol == GLP_SOL);
xassert(parm == parm);
ret = npp_process_prob(npp, 0);
return ret;
}
/**********************************************************************/
int npp_integer(NPP *npp, const glp_iocp *parm)
{ /* process MIP prior to applying branch-and-bound method */
NPPROW *row, *prev_row;
NPPCOL *col;
NPPAIJ *aij;
int count, ret;
xassert(npp->sol == GLP_MIP);
xassert(parm == parm);
/*==============================================================*/
/* perform basic MIP processing */
ret = npp_process_prob(npp, 1);
if (ret != 0) goto done;
/*==============================================================*/
/* binarize problem, if required */
if (parm->binarize)
npp_binarize_prob(npp);
/*==============================================================*/
/* identify hidden packing inequalities */
count = 0;
/* new rows will be added to the end of the row list, so we go
from the end to beginning of the row list */
for (row = npp->r_tail; row != NULL; row = prev_row)
{ prev_row = row->prev;
/* skip free row */
if (row->lb == -DBL_MAX && row->ub == +DBL_MAX) continue;
/* skip equality constraint */
if (row->lb == row->ub) continue;
/* skip row having less than two variables */
if (row->ptr == NULL || row->ptr->r_next == NULL) continue;
/* skip row having non-binary variables */
for (aij = row->ptr; aij != NULL; aij = aij->r_next)
{ col = aij->col;
if (!(col->is_int && col->lb == 0.0 && col->ub == 1.0))
break;
}
if (aij != NULL) continue;
count += npp_hidden_packing(npp, row);
}
if (count > 0)
xprintf("%d hidden packing inequaliti(es) were detected\n",
count);
/*==============================================================*/
/* identify hidden covering inequalities */
count = 0;
/* new rows will be added to the end of the row list, so we go
from the end to beginning of the row list */
for (row = npp->r_tail; row != NULL; row = prev_row)
{ prev_row = row->prev;
/* skip free row */
if (row->lb == -DBL_MAX && row->ub == +DBL_MAX) continue;
/* skip equality constraint */
if (row->lb == row->ub) continue;
/* skip row having less than three variables */
if (row->ptr == NULL || row->ptr->r_next == NULL ||
row->ptr->r_next->r_next == NULL) continue;
/* skip row having non-binary variables */
for (aij = row->ptr; aij != NULL; aij = aij->r_next)
{ col = aij->col;
if (!(col->is_int && col->lb == 0.0 && col->ub == 1.0))
break;
}
if (aij != NULL) continue;
count += npp_hidden_covering(npp, row);
}
if (count > 0)
xprintf("%d hidden covering inequaliti(es) were detected\n",
count);
/*==============================================================*/
/* reduce inequality constraint coefficients */
count = 0;
/* new rows will be added to the end of the row list, so we go
from the end to beginning of the row list */
for (row = npp->r_tail; row != NULL; row = prev_row)
{ prev_row = row->prev;
/* skip equality constraint */
if (row->lb == row->ub) continue;
count += npp_reduce_ineq_coef(npp, row);
}
if (count > 0)
xprintf("%d constraint coefficient(s) were reduced\n", count);
/*==============================================================*/
#ifdef GLP_DEBUG
routine(npp);
#endif
/*==============================================================*/
/* all seems ok */
ret = 0;
done: return ret;
}
/* eof */
|
{
"content_hash": "56eb724db0b1c0cc497ba849c98144b0",
"timestamp": "",
"source": "github",
"line_count": 810,
"max_line_length": 72,
"avg_line_length": 32.901234567901234,
"alnum_prop": 0.5012757973733584,
"repo_name": "MarhesLab/NeeleyThesisCode",
"id": "8c88185080ab16029275ab3c5c20725142980e0a",
"size": "26650",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "lib/glpk-4.55/src/glpnpp05.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "2712"
},
{
"name": "C",
"bytes": "4287379"
},
{
"name": "C#",
"bytes": "3511"
},
{
"name": "C++",
"bytes": "12588710"
},
{
"name": "Makefile",
"bytes": "389292"
},
{
"name": "QML",
"bytes": "145952"
},
{
"name": "QMake",
"bytes": "2304"
},
{
"name": "Shell",
"bytes": "696928"
},
{
"name": "TeX",
"bytes": "845262"
}
],
"symlink_target": ""
}
|
using System;
using Telerik.Web.UI;
#endregion
namespace DotNetNuke.Web.UI.WebControls
{
public class DnnTreeView : RadTreeView
{
//public DnnTreeView()
//{
// Utilities.ApplySkin(this);
//}
}
}
|
{
"content_hash": "cbe24072a9f6ad2ca7fb9fddc1ae5c5b",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 42,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.5853658536585366,
"repo_name": "wael101/Dnn.Platform",
"id": "892c3bd6b96c110ad00db8369fe258e8d103d32b",
"size": "1468",
"binary": false,
"copies": "2",
"ref": "refs/heads/development",
"path": "DNN Platform/DotNetNuke.Web.Deprecated/UI/WebControls/DnnTreeView.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "570479"
},
{
"name": "Batchfile",
"bytes": "43"
},
{
"name": "C#",
"bytes": "19620572"
},
{
"name": "CSS",
"bytes": "911558"
},
{
"name": "HTML",
"bytes": "480831"
},
{
"name": "JavaScript",
"bytes": "3821179"
},
{
"name": "PLpgSQL",
"bytes": "53478"
},
{
"name": "PowerShell",
"bytes": "10521"
},
{
"name": "Smalltalk",
"bytes": "2410"
},
{
"name": "TSQL",
"bytes": "56032"
},
{
"name": "Visual Basic",
"bytes": "139153"
},
{
"name": "XSLT",
"bytes": "10488"
}
],
"symlink_target": ""
}
|
<?php
namespace WorkActivityBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/');
$this->assertContains('Hello World', $client->getResponse()->getContent());
}
}
|
{
"content_hash": "ad1e5747f9a14c663ebe4c268311d644",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 83,
"avg_line_length": 22.470588235294116,
"alnum_prop": 0.680628272251309,
"repo_name": "VKiril/test-test-test-",
"id": "39299b761fe7f9d8d63158c70b407cd5bac405da",
"size": "382",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/WorkActivityBundle/Tests/Controller/DefaultControllerTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3605"
},
{
"name": "CSS",
"bytes": "3282"
},
{
"name": "HTML",
"bytes": "15810"
},
{
"name": "JavaScript",
"bytes": "1346"
},
{
"name": "PHP",
"bytes": "100641"
}
],
"symlink_target": ""
}
|
import React from "react"
const SecondPage = () => (
<div>
<h1>Hi from the second page</h1>
<p>Welcome to page 2</p>
</div>
)
export default SecondPage
|
{
"content_hash": "c851a985c6f94ca695331e6af4fb9f02",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 36,
"avg_line_length": 16.6,
"alnum_prop": 0.6204819277108434,
"repo_name": "cheetahM/cheetahM.github.io",
"id": "3d042628c493a66ab40ecc41c1f56522b90dc5ea",
"size": "166",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "portfolio/src/pages/page-2.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "353"
},
{
"name": "JavaScript",
"bytes": "74"
}
],
"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_45) on Mon Mar 03 10:44:39 EST 2014 -->
<title>Uses of Class org.hibernate.service.internal.JaxbProcessor (Hibernate JavaDocs)</title>
<meta name="date" content="2014-03-03">
<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.hibernate.service.internal.JaxbProcessor (Hibernate JavaDocs)";
}
//-->
</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/hibernate/service/internal/JaxbProcessor.html" title="class in org.hibernate.service.internal">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/hibernate/service/internal/class-use/JaxbProcessor.html" target="_top">Frames</a></li>
<li><a href="JaxbProcessor.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.hibernate.service.internal.JaxbProcessor" class="title">Uses of Class<br>org.hibernate.service.internal.JaxbProcessor</h2>
</div>
<div class="classUseContainer">No usage of org.hibernate.service.internal.JaxbProcessor</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/hibernate/service/internal/JaxbProcessor.html" title="class in org.hibernate.service.internal">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/hibernate/service/internal/class-use/JaxbProcessor.html" target="_top">Frames</a></li>
<li><a href="JaxbProcessor.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 © 2001-2014 <a href="http://redhat.com">Red Hat, Inc.</a> All Rights Reserved.</small></p>
</body>
</html>
|
{
"content_hash": "08b3052d44b2829ec2daa8952fb68e60",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 151,
"avg_line_length": 38.03448275862069,
"alnum_prop": 0.6194469628286491,
"repo_name": "serious6/HibernateSimpleProject",
"id": "1a272960dd51138d0392a9f2c60bf0a46ff82b54",
"size": "4412",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "javadoc/hibernate_Doc/org/hibernate/service/internal/class-use/JaxbProcessor.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "12560"
},
{
"name": "Java",
"bytes": "15329"
}
],
"symlink_target": ""
}
|
namespace _01.Konspiration
{
using System;
using System.Linq;
using System.Collections.Generic;
public class Konspiration
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
string[] lines = new string[n];
for (int i = 0; i < n; i++)
{
lines[i] = Console.ReadLine();
}
for (int i = 0; i < n; i++)
{
if (lines[i].Contains(" static "))
{
var name = lines[i].Split(new[] { ' ', '(' }, StringSplitOptions.RemoveEmptyEntries)[2];
i += 2;
int openBrackets = 1;
var methodCalls = new List<string>();
while (openBrackets > 0)
{
var splitByRoundBracket = lines[i].Split('(');
if (splitByRoundBracket.Length > 1)
{
for (int k = 0; k < splitByRoundBracket.Length - 1; k++)
{
var methodName = ExtractMethodName(splitByRoundBracket[k]);
if (methodName != null)
{
methodCalls.Add(methodName);
}
}
}
foreach (var item in lines[i])
{
if (item == '{')
{
openBrackets++;
}
else if (item == '}')
{
openBrackets--;
}
}
i++;
}
if (methodCalls.Count > 0)
{
Console.WriteLine(name + " -> " + methodCalls.Count + " -> " + string.Join(", ", methodCalls));
}
else
{
Console.WriteLine(name + " -> None");
}
}
}
}
static string ExtractMethodName(string codePiece)
{
var beforeBracket = codePiece.Split(new[] { ' ', '.' }, StringSplitOptions.RemoveEmptyEntries);
var methodName = beforeBracket[beforeBracket.Length - 1];
if (char.IsUpper(methodName[0]) && !beforeBracket.Contains("new"))
{
return methodName;
}
return null;
}
}
}
|
{
"content_hash": "e8780da7e9c8b65275aea6e4c4587081",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 119,
"avg_line_length": 30.651685393258425,
"alnum_prop": 0.34310850439882695,
"repo_name": "tpopov94/Telerik-Academy-2016",
"id": "336d22eb5744e9f5bf61c7a56440e6c34596857d",
"size": "2730",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CSharp Part II/08. Exam Preparation/4.01. Konspiration/Konspiration.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "818292"
},
{
"name": "CSS",
"bytes": "50007"
},
{
"name": "CoffeeScript",
"bytes": "3700"
},
{
"name": "HTML",
"bytes": "155645"
},
{
"name": "JavaScript",
"bytes": "415483"
},
{
"name": "XSLT",
"bytes": "2181"
}
],
"symlink_target": ""
}
|
package co.cask.tigon.sql.internal;
import co.cask.tigon.sql.flowlet.GDATField;
import co.cask.tigon.sql.flowlet.StreamSchema;
import java.util.List;
/**
* Default StreamSchema.
*/
public class DefaultStreamSchema implements StreamSchema {
private List<GDATField> fields;
private String name;
public DefaultStreamSchema(String name, List<GDATField> fields) {
this.name = name;
this.fields = fields;
}
@Override
public List<GDATField> getFields() {
return fields;
}
@Override
public String getName() {
return name;
}
}
|
{
"content_hash": "c20a0dc78e4e1d68b5d84f8588a7104e",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 67,
"avg_line_length": 18.193548387096776,
"alnum_prop": 0.7145390070921985,
"repo_name": "caskdata/tigon",
"id": "e95680e16b3c7236c3ee5fc5a079c0a48d238b3b",
"size": "1161",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "tigon-sql/src/main/java/co/cask/tigon/sql/internal/DefaultStreamSchema.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Bison",
"bytes": "47006"
},
{
"name": "C",
"bytes": "430382"
},
{
"name": "C++",
"bytes": "3798052"
},
{
"name": "CSS",
"bytes": "8793"
},
{
"name": "HTML",
"bytes": "8173"
},
{
"name": "Java",
"bytes": "1814440"
},
{
"name": "JavaScript",
"bytes": "8170"
},
{
"name": "Makefile",
"bytes": "30108"
},
{
"name": "Objective-C",
"bytes": "1368"
},
{
"name": "Perl",
"bytes": "98946"
},
{
"name": "Python",
"bytes": "24891"
},
{
"name": "Shell",
"bytes": "20554"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_33) on Fri Jun 22 11:01:54 IST 2012 -->
<TITLE>
de.fuberlin.wiwiss.d2rq.map (D2RQ)
</TITLE>
<META NAME="date" CONTENT="2012-06-22">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="de.fuberlin.wiwiss.d2rq.map (D2RQ)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../de/fuberlin/wiwiss/d2rq/jena/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../../de/fuberlin/wiwiss/d2rq/mapgen/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?de/fuberlin/wiwiss/d2rq/map/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<H2>
Package de.fuberlin.wiwiss.d2rq.map
</H2>
Classes that represent the components of a mapping file.
<P>
<B>See:</B>
<BR>
<A HREF="#package_description"><B>Description</B></A>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Class Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/ClassMap.html" title="class in de.fuberlin.wiwiss.d2rq.map">ClassMap</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/Configuration.html" title="class in de.fuberlin.wiwiss.d2rq.map">Configuration</A></B></TD>
<TD>Representation of a d2rq:Configuration from the mapping file.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/Database.html" title="class in de.fuberlin.wiwiss.d2rq.map">Database</A></B></TD>
<TD>Representation of a d2rq:Database from the mapping file.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/DownloadMap.html" title="class in de.fuberlin.wiwiss.d2rq.map">DownloadMap</A></B></TD>
<TD>A d2rq:DownloadMap instance.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/MapObject.html" title="class in de.fuberlin.wiwiss.d2rq.map">MapObject</A></B></TD>
<TD>Abstract base class for classes that represent things in
the mapping file.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/Mapping.html" title="class in de.fuberlin.wiwiss.d2rq.map">Mapping</A></B></TD>
<TD>A D2RQ mapping.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/PropertyBridge.html" title="class in de.fuberlin.wiwiss.d2rq.map">PropertyBridge</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/PropertyMap.html" title="class in de.fuberlin.wiwiss.d2rq.map">PropertyMap</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/ResourceMap.html" title="class in de.fuberlin.wiwiss.d2rq.map">ResourceMap</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/TranslationTable.html" title="class in de.fuberlin.wiwiss.d2rq.map">TranslationTable</A></B></TD>
<TD>Represents a d2rq:TranslationTable.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../de/fuberlin/wiwiss/d2rq/map/TranslationTable.Translation.html" title="class in de.fuberlin.wiwiss.d2rq.map">TranslationTable.Translation</A></B></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="package_description"><!-- --></A><H2>
Package de.fuberlin.wiwiss.d2rq.map Description
</H2>
<P>
<p>Classes that represent the components of a mapping file.</p>
<P>
<P>
<DL>
</DL>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../de/fuberlin/wiwiss/d2rq/jena/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../../de/fuberlin/wiwiss/d2rq/mapgen/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?de/fuberlin/wiwiss/d2rq/map/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
|
{
"content_hash": "e0ac34a6943458bfc0bb5ec9ad8eeb11",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 192,
"avg_line_length": 43.394366197183096,
"alnum_prop": 0.6299902629016553,
"repo_name": "vishalkpp/VirtualSPARQLer",
"id": "3c6570d970762b874b8d720723068adb62e958b2",
"size": "9243",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "d2rq-0.8.1/doc/javadoc/de/fuberlin/wiwiss/d2rq/map/package-summary.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1580"
},
{
"name": "CSS",
"bytes": "4783"
},
{
"name": "HTML",
"bytes": "167862"
},
{
"name": "Java",
"bytes": "1083721"
},
{
"name": "JavaScript",
"bytes": "78293"
},
{
"name": "Shell",
"bytes": "1826"
},
{
"name": "XSLT",
"bytes": "4575"
}
],
"symlink_target": ""
}
|
package tudarmstadt.lt.ABSentiment;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tudarmstadt.lt.ABSentiment.type.AspectExpression;
import tudarmstadt.lt.ABSentiment.type.Result;
import java.text.DecimalFormat;
import java.text.NumberFormat;
/**
* The web-based classifier of documents. Can run standalone and analyze input documents.
*/
@RestController
@EnableAutoConfiguration
public class ApplicationController {
/**
* Output StringBuilder
*/
private StringBuilder output;
/**
* Formatter for confidence scores
*/
private NumberFormat formatter = new DecimalFormat("#0.000");
private AbSentiment analyzer = new AbSentiment("configuration.txt");
/**
* Processes input text and outputs the classification results.
* @param text the input text
* @return returns a HTML document with the analysis of the input
*/
@RequestMapping("/")
String home(@RequestParam(value = "text", defaultValue = "") String text, @RequestParam(value="format", defaultValue ="html") String format) {
Result result = analyzer.analyzeText(text);
if (format.compareTo("json") == 0) {
return generateJSONResponse(result);
} else {
return generateHTMLResponse(result);
}
}
private String generateJSONResponse(Result result) {
JSONObject out = new JSONObject();
out.put("input", result.getText());
JSONObject sent = new JSONObject();
sent.put("label", result.getSentiment());
sent.put("score", result.getSentimentScore());
out.put("sentiment", sent);
JSONObject rel = new JSONObject();
rel.put("label", result.getRelevance());
rel.put("score", result.getRelevanceScore());
out.put("relevance", rel);
JSONObject asp = new JSONObject();
asp.put("label", result.getAspect());
asp.put("score", result.getAspectScore());
out.put("aspect", asp);
JSONObject aspCoarse = new JSONObject();
aspCoarse.put("label", result.getAspectCoarse());
aspCoarse.put("score", result.getAspectCoarseScore());
out.put("aspect_coarse", aspCoarse);
JSONArray targets = new JSONArray();
for (AspectExpression a : result.getAspectExpressions()) {
targets.add(a.getAspectExpression());
}
out.put("targets", targets);
return out.toString();
}
private String generateHTMLResponse(Result result) {
output = new StringBuilder();
addHeader();
addHeading("Input");
openInput(result.getSentiment());
addText(result);
closeInput();
addHeading("Relevance");
addResult(result.getRelevance(), result.getRelevanceScore());
addHeading("Sentiment");
addResult(result.getSentiment(), result.getSentimentScore());
addHeading("Aspect");
addResult(result.getAspect(), result.getAspectScore());
addHeading("Coarse Aspect");
addResult(result.getAspectCoarse(), result.getAspectCoarseScore());
addHeading("Aspect Targets");
addTargets(result);
addExamples();
addFooter();
return output.toString();
}
private void addTargets(Result result) {
output.append("<ul>");
for (AspectExpression a : result.getAspectExpressions()) {
output.append("<li>").append(a.getAspectExpression()).append("</li>");
}
output.append("</ul>");
}
/**
* Runs the RESTful server.
* @param args execution arguments
*/
public static void main(String[] args) {
SpringApplication.run(ApplicationController.class, args);
}
/**
* Adds a Heading to the output.
* @param text the heading
*/
private void addHeading(String text) {
output.append("<h3>").append(text).append("</h3>");
}
/**
* Adds a label with a confidence score to the output.
* @param label the label
* @param score the confidence score for the label
*/
private void addResult(String label, double score) {
output.append("Label: ").append(label);
output.append("  Confidence: ").append(formatter.format(score));
}
/**
* Adds a paragraph tag with a provided class (e.g. sentiment).
* @param cssClass the CSS class of the paragraph
*/
private void openInput(String cssClass) {
output.append("<p class='").append(cssClass).append("'>");
}
/**
* Closes the paragraph tag.
*/
private void closeInput() {
output.append("</p>");
}
/**
* Adds text from a given {@link Result}. Annotates {@link AspectExpression}s
* @param result the {@link Result} object
*/
private void addText(Result result) {
String text = result.getText();
for (AspectExpression e: result.getAspectExpressions()) {
text = text.replaceFirst(e.getAspectExpression(), "<b>"+e.getAspectExpression()+"</b>");
}
output.append(text);
}
/**
* Adds a HTML header with CSS
*/
private void addHeader() {
output.append("<html><header><title>Analysis</title>");
output.append("<style>* {margin-bottom:0;}.pos {background:green;}.neg {background:red;}</style>");
output.append("</header><body>");
}
/**
* Closes the HTML page
*/
private void addFooter() {
output.append("</body></html>");
}
/**
* Adds a list of example items that are active for testing.
*/
private void addExamples() {
addHeading("Examples");
output.append("<div><ul>");
addExample("Hast du schon Deutsche Bahn #Jobs in #Augsburg auf unserer Homepage gesehen ? http://t.co/lAnyuN6WUq http://t.co/IvnaO2OAh7 ");
addExample("\" Ja geil .. 1 Stunde später zuhause weil sich \"\" \"\" Unbefugte \"\" \"\" in der Bahn aufhielten . :/ \"");
addExample("Re : MDR Sachsen-Anhalt Zum Glück fahr ich nicht mit der bahn bin immer 100 Prozent pünktlich und das seit Jahren . Komisch das es nie bei der Bahn geht obwohl die fette Kohle bekommen ");
addExample("Re : Rheinbahn Das kann doch nicht wahr sein . Diese Woche ist die Bahn jedesmal ein paar minuten zu früh dran , weshalb ich sie dann verpasse und meinen Anschlusszug nur mit , Hetzen und Leute beiseite schieben , schaffe . Das Nervt gewaltig . ");
addExample("Geld für den Nahverkehr wird knapp, und schon steht eine Bahnverbindung auf der Kippe");
addExample("schlechte Luft am Bahnsteig");
addExample("Manche Fahrgäste fühlen sich vom Qualm der Mitreisenden belästigt");
addExample("RT @phornic : Nette Mitarbeiter der Bahn sind nett");
addExample("Die App funktioniert nicht , sieht aber gut aus");
addExample("Der neue ICE sieht schön aus und hat ein gutes Design");
output.append("</ul></div>");
}
/**
* Adds an clickable example item for convenient testing.
* @param text the input string
*/
private void addExample(String text) {
output.append("<li>");
output.append("<a href='?text=").append(text).append("'>").append(text).append("</a>");
output.append("</li>");
}
}
|
{
"content_hash": "d819e78f4369962b5db0a4ae088a4557",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 268,
"avg_line_length": 34.20627802690583,
"alnum_prop": 0.6367330886208705,
"repo_name": "tudarmstadt-lt/AB-Sentiment",
"id": "6d5dd893956a43641babf01be54ef1472e7724ab",
"size": "8446",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/tudarmstadt/lt/ABSentiment/ApplicationController.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "407273"
}
],
"symlink_target": ""
}
|
@class OFRequestHandle;
@protocol OFLeaderboardDelegate;
//////////////////////////////////////////////////////////////////////////////////////////
/// The public interface for OFLeaderboard allows you to query leaderboars and submit
/// new scores to a leaderboard.
//////////////////////////////////////////////////////////////////////////////////////////
@interface OFLeaderboard : OFResource <OFCallbackable>
{
NSString* name;
OFHighScore* currentUserScore;
OFHighScore* comparedUserScore;
BOOL descendingScoreOrder;
OFScoreFilter filter;
}
//////////////////////////////////////////////////////////////////////////////////////////
/// Set a delegate for all OFLeaderboard related actions. Must adopt the
/// OFLeaderboardDelegate protocol.
///
/// @note Defaults to nil. Weak reference
//////////////////////////////////////////////////////////////////////////////////////////
+ (void)setDelegate:(id<OFLeaderboardDelegate>)delegate;
//////////////////////////////////////////////////////////////////////////////////////////
/// Retrieves the application's leaderboard list
///
/// @return NSArray of OFLeaderboard objects
//////////////////////////////////////////////////////////////////////////////////////////
+ (NSArray*)leaderboards;
//////////////////////////////////////////////////////////////////////////////////////////
/// Retrieves a leaderboard based on the leaderboard id on the developer dashboard
///
/// @param leaderboardID The leaderboard id
///
/// @return OFLeaderboard corrisponding to the leaderboard id
//////////////////////////////////////////////////////////////////////////////////////////
+ (OFLeaderboard*)leaderboard:(NSString*)leaderboardID;
//////////////////////////////////////////////////////////////////////////////////////////
/// Retrieves the current user's high score for a given leaderboard.
///
/// @note The rank property on the OFHighScore object returned from this method will not
/// be set.
///
/// @return OFHighScore objects containing the local user's high score for a given
/// leaderboard.
//////////////////////////////////////////////////////////////////////////////////////////
- (OFHighScore*)highScoreForCurrentUser;
//////////////////////////////////////////////////////////////////////////////////////////
/// Retrieves the locally submitted high score list for the given leaderboard. These scores
/// are the 10 best scores (for leaderboards with Allow Worse Scores unchecked) or 10 most
/// recent scores (for leaderboards with Allow Worse Scores checked) for the local user.
///
/// @return NSArray of OFHighScore objects representing the local top 10 scores for the
/// local user
//////////////////////////////////////////////////////////////////////////////////////////
- (NSArray*)locallySubmittedScores;
//////////////////////////////////////////////////////////////////////////////////////////
/// Retrieves, at most, the highest scores for a given leaderboard. If you need more than
/// the top 25 scores you should use an OFScoreEnumerator object.
///
/// @param downloadFilter Set the filter for the leaderboard to download for. This filter
/// type will be preserved on the leaderboard.
///
/// @return OFRequestHandle for the server request. Use this to cancel the request
///
/// @note Invokes -(void)didDownloadHighScores:(NSArray*)highScores forOFLeaderboard:(OFLeaderboard*)leaderboard on success
/// -(void)didFailDownloadHighScoresForOFLeaderboard:(OFLeaderboard*)leaderboard on failure.
///
/// @see OFScoreEnumerator
/// @see OFRequestHandle
////////////////////////////////////F//////////////////////////////////////////////////////
- (OFRequestHandle*)downloadHighScoresWithFilter:(OFScoreFilter)downloadFilter;
//////////////////////////////////////////////////////////////////////////////////////////
/// Name of this leaderboard
//////////////////////////////////////////////////////////////////////////////////////////
@property (nonatomic, readonly) NSString* name;
//////////////////////////////////////////////////////////////////////////////////////////
/// Leaderboard ID
//////////////////////////////////////////////////////////////////////////////////////////
@property (nonatomic, readonly) NSString* leaderboardId;
//////////////////////////////////////////////////////////////////////////////////////////
/// High score of the current user on this leaderboard
///
/// @note A value of nil means the local user has not submitted a score for this
/// leaderboard
//////////////////////////////////////////////////////////////////////////////////////////
@property (nonatomic, readonly) OFHighScore* currentUserScore;
//////////////////////////////////////////////////////////////////////////////////////////
/// If @c YES then the highest score value is ranked #1, if @c NO then the lowest score
/// value is ranked #1.
//////////////////////////////////////////////////////////////////////////////////////////
@property (nonatomic, readonly) BOOL descendingScoreOrder;
///////////////////////////////////D///////////////////////////////////////////////////////
/// Determines which set of scores will be chosen from when downloading scores.
///
/// @note Defaults to OFScoreFilter_Everyone
//////////////////////////////////////////////////////////////////////////////////////////
@property (nonatomic, readonly) OFScoreFilter filter;
//////////////////////////////////////////////////////////////////////////////////////////
///@internal
//////////////////////////////////////////////////////////////////////////////////////////
- (id)initWithLocalSQL:(OFSqlQuery*)queryRow localUserScore:(OFHighScore*) locUserScore comparedUserScore:(OFHighScore*) compUserScore;
- (bool)isComparison;
- (OFUser*)comparedToUser;
+ (NSString*)getResourceName;
@end
//////////////////////////////////////////////////////////////////////////////////////////
/// Adopt the OFLeaderboardDelegate Protocol to receive information regarding
/// OFLeaderboards. You must call OFLeaderboard's +(void)setDelegate: method to receive
/// information.
//////////////////////////////////////////////////////////////////////////////////////////
@protocol OFLeaderboardDelegate
@optional
//////////////////////////////////////////////////////////////////////////////////////////
/// Invoked when -(void)downloadHighScoresForLeaderboard: successfully completes.
///
/// @param leaderboard The leaderboard which the OFHighScores belong to
/// @param highScores An NSArray of OFHighScore objects
//////////////////////////////////////////////////////////////////////////////////////////
- (void)didDownloadHighScores:(NSArray*)highScores OFLeaderboard:(OFLeaderboard*)leaderboard;
//////////////////////////////////////////////////////////////////////////////////////////
/// Invoked when -(void)downloadHighScoresForLeaderboard: fails to download.
///
/// @param leaderboard The leaderboard in which we were trying to get high scores for
//////////////////////////////////////////////////////////////////////////////////////////
- (void)didFailDownloadHighScoresOFLeaderboard:(OFLeaderboard*)leaderboard;
@end
|
{
"content_hash": "c4a8074769f99da7253c95da23460ae7",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 135,
"avg_line_length": 49.33103448275862,
"alnum_prop": 0.454494617642947,
"repo_name": "rauluranga/TotemBalance",
"id": "c6384806d606ba15f8ef8f81feb27e5c288ef74d",
"size": "7829",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "OpenFeint/include/OFLeaderboard.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1002727"
},
{
"name": "C++",
"bytes": "103426"
},
{
"name": "Objective-C",
"bytes": "4827533"
}
],
"symlink_target": ""
}
|
namespace StockSharp.Algo.Import
{
using System;
using System.Collections.Generic;
using System.Linq;
using Ecng.Collections;
using Ecng.Common;
using Ecng.ComponentModel;
using Ecng.Serialization;
/// <summary>
/// Importing field description.
/// </summary>
public abstract class FieldMapping : NotifiableObject, IPersistable, ICloneable
{
private FastDateTimeParser _dateParser;
private FastTimeSpanParser _timeParser;
private Func<string, object> _dateConverter;
private readonly HashSet<string> _enumNames = new(StringComparer.InvariantCultureIgnoreCase);
/// <summary>
/// Initializes a new instance of the <see cref="FieldMapping"/>.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="displayName">Display name.</param>
/// <param name="description">Description.</param>
/// <param name="type">Field type.</param>
protected FieldMapping(string name, string displayName, string description, Type type)
{
//if (settings == null)
// throw new ArgumentNullException(nameof(settings));
if (name.IsEmpty())
throw new ArgumentNullException(nameof(name));
if (displayName.IsEmpty())
throw new ArgumentNullException(nameof(displayName));
if (description.IsEmpty())
description = displayName;
Type = type ?? throw new ArgumentNullException(nameof(type));
Name = name;
DisplayName = displayName;
Description = description;
IsEnabled = true;
//Number = -1;
if (Type.IsDateTime())
Format = "yyyyMMdd";
else if (Type == typeof(TimeSpan))
Format = "hh:mm:ss";
if (Type.IsEnum)
_enumNames.AddRange(Type.GetNames());
}
/// <summary>
/// Name.
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Is field extended.
/// </summary>
public bool IsExtended { get; set; }
/// <summary>
/// Display name.
/// </summary>
public string DisplayName { get; }
/// <summary>
/// Description.
/// </summary>
public string Description { get; }
/// <summary>
/// Date format.
/// </summary>
public string Format { get; set; }
/// <summary>
/// Field type.
/// </summary>
public Type Type { get; }
/// <summary>
/// Is field required.
/// </summary>
public bool IsRequired { get; set; }
/// <summary>
/// Is field enabled.
/// </summary>
public bool IsEnabled
{
get => Order != null;
set
{
if (IsEnabled == value)
return;
if (value)
{
if (Order == null)
Order = 0;
}
else
Order = null;
NotifyChanged(nameof(IsEnabled));
NotifyChanged(nameof(Order));
}
}
private int? _order;
/// <summary>
/// Field order.
/// </summary>
public int? Order
{
get => _order;
set
{
if (Order == value)
return;
if (value < 0)
throw new ArgumentOutOfRangeException(nameof(value));
_order = value;
IsEnabled = value != null;
NotifyChanged(nameof(IsEnabled));
NotifyChanged(nameof(Order));
}
}
private IEnumerable<FieldMappingValue> _values = Enumerable.Empty<FieldMappingValue>();
/// <summary>
/// Mapping values.
/// </summary>
public IEnumerable<FieldMappingValue> Values
{
get => _values;
set => _values = value ?? throw new ArgumentNullException(nameof(value));
}
/// <summary>
/// Default value.
/// </summary>
public string DefaultValue { get; set; }
/// <summary>
/// Zero as <see langword="null"/>.
/// </summary>
public bool ZeroAsNull { get; set; }
/// <summary>
/// Multiple field's instancies allowed.
/// </summary>
public bool IsMultiple => IsAdapter;
/// <summary>
/// <see cref="AdapterType"/> required.
/// </summary>
public bool IsAdapter { get; set; }
/// <summary>
/// Adapter.
/// </summary>
public Type AdapterType { get; set; }
/// <summary>
/// Load settings.
/// </summary>
/// <param name="storage">Settings storage.</param>
public void Load(SettingsStorage storage)
{
Name = storage.GetValue<string>(nameof(Name));
IsExtended = storage.GetValue<bool>(nameof(IsExtended));
Values = storage.GetValue<SettingsStorage[]>(nameof(Values)).Select(s => s.Load<FieldMappingValue>()).ToArray();
DefaultValue = storage.GetValue<string>(nameof(DefaultValue));
Format = storage.GetValue<string>(nameof(Format));
ZeroAsNull = storage.GetValue<bool>(nameof(ZeroAsNull));
//IsEnabled = storage.GetValue(nameof(IsEnabled), IsEnabled);
if (storage.ContainsKey(nameof(IsEnabled)))
IsEnabled = storage.GetValue<bool>(nameof(IsEnabled));
else
Order = storage.GetValue<int?>(nameof(Order));
IsAdapter = storage.GetValue(nameof(IsAdapter), IsAdapter);
AdapterType = storage.GetValue<string>(nameof(AdapterType)).To<Type>();
}
void IPersistable.Save(SettingsStorage storage)
{
storage.SetValue(nameof(Name), Name);
storage.SetValue(nameof(IsExtended), IsExtended);
storage.SetValue(nameof(Values), Values.Select(v => v.Save()).ToArray());
storage.SetValue(nameof(DefaultValue), DefaultValue);
storage.SetValue(nameof(Format), Format);
//storage.SetValue(nameof(IsEnabled), IsEnabled);
storage.SetValue(nameof(Order), Order);
storage.SetValue(nameof(ZeroAsNull), ZeroAsNull);
storage.SetValue(nameof(IsAdapter), IsAdapter);
storage.SetValue(nameof(AdapterType), AdapterType.To<string>());
}
/// <summary>
/// Apply value.
/// </summary>
/// <param name="instance">Instance.</param>
/// <param name="value">Field value.</param>
public void ApplyFileValue(object instance, string value)
{
if (value.IsEmpty())
{
ApplyDefaultValue(instance);
return;
}
if (Values.Any())
{
var v = Values.FirstOrDefault(vl => vl.ValueFile.EqualsIgnoreCase(value));
if (v != null)
{
ApplyValue(instance, v.ValueStockSharp);
return;
}
}
if (_enumNames.Contains(value))
{
ApplyValue(instance, value.To(Type));
return;
}
ApplyValue(instance, value);
}
/// <summary>
/// Apply default value.
/// </summary>
/// <param name="instance">Instance.</param>
public void ApplyDefaultValue(object instance)
{
ApplyValue(instance, DefaultValue);
}
private void EnsureDateConverter()
{
if(_dateConverter != null)
return;
object fastParserConverter(string str)
{
if (Type == typeof(DateTimeOffset))
{
var dto = _dateParser.ParseDto(str);
if (dto.Offset.IsDefault())
{
var tz = Scope<TimeZoneInfo>.Current?.Value;
if (tz != null)
dto = dto.UtcDateTime.ApplyTimeZone(tz);
}
return dto;
}
return _dateParser.Parse(str);
}
Func<DateTimeOffset, object> toObj = Type == typeof(DateTimeOffset) ? dto => dto : dto => dto.DateTime;
switch (Format.ToLowerInvariant())
{
case "timestamp":
_dateConverter = str => toObj(DateTimeOffset.FromUnixTimeSeconds(long.Parse(str)));
break;
case "timestamp_milli":
_dateConverter = str => toObj(DateTimeOffset.FromUnixTimeMilliseconds(long.Parse(str)));
break;
case "timestamp_micro":
_dateConverter = str => toObj(new DateTimeOffset(long.Parse(str).MicrosecondsToTicks(), TimeSpan.Zero));
break;
case "timestamp_nano":
_dateConverter = str => toObj(new DateTimeOffset(long.Parse(str).NanosecondsToTicks(), TimeSpan.Zero));
break;
default:
_dateParser = new FastDateTimeParser(Format);
_dateConverter = fastParserConverter;
break;
}
}
private void ApplyValue(object instance, object value)
{
if (Type == typeof(decimal))
{
if (value is string str)
{
if (str.ContainsIgnoreCase("e")) // exponential notation
value = str.To<double>();
else
{
str = str.Replace(',', '.').RemoveSpaces().ReplaceWhiteSpaces().Trim();
if (str.IsEmpty())
return;
value = str;
}
}
}
else if (Type.IsDateTime())
{
if (value is string str)
{
EnsureDateConverter();
value = _dateConverter(str);
}
}
else if (Type == typeof(TimeSpan))
{
if (value is string str)
{
if (_timeParser == null)
_timeParser = new FastTimeSpanParser(Format);
value = _timeParser.Parse(str);
}
}
if (value != null)
{
value = value.To(Type);
if (ZeroAsNull && Type.IsNumeric() && value.To<decimal>() == 0)
return;
OnApply(instance, value);
}
}
/// <summary>
/// Apply value.
/// </summary>
/// <param name="instance">Instance.</param>
/// <param name="value">Field value.</param>
protected abstract void OnApply(object instance, object value);
/// <inheritdoc />
public override string ToString() => Name;
/// <inheritdoc />
public abstract object Clone();
/// <summary>
/// Reset state.
/// </summary>
public void Reset()
{
_dateParser = null;
_timeParser = null;
_dateConverter = null;
}
/// <summary>
/// Get <see cref="FieldMapping"/> instance or clone dependent on <see cref="IsMultiple"/>.
/// </summary>
/// <returns>Field.</returns>
public FieldMapping GetOrClone()
{
return IsMultiple ? (FieldMapping)Clone() : this;
}
}
/// <summary>
/// Importing field description.
/// </summary>
/// <typeparam name="TInstance">Type, containing the field.</typeparam>
/// <typeparam name="TValue">Field value type.</typeparam>
public class FieldMapping<TInstance, TValue> : FieldMapping
{
private readonly Action<TInstance, TValue> _apply;
/// <summary>
/// Initializes a new instance of the <see cref="FieldMapping{TInstance,TValue}"/>.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="displayName">Display name.</param>
/// <param name="description">Description.</param>
/// <param name="apply">Apply field value action.</param>
public FieldMapping(string name, string displayName, string description, Action<TInstance, TValue> apply)
: this(name, displayName, description, typeof(TValue), apply)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FieldMapping{TInstance,TValue}"/>.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="displayName">Display name.</param>
/// <param name="description">Description.</param>
/// <param name="type">Field type.</param>
/// <param name="apply">Apply field value action.</param>
public FieldMapping(string name, string displayName, string description, Type type, Action<TInstance, TValue> apply)
: base(name, displayName, description, type)
{
_apply = apply ?? throw new ArgumentNullException(nameof(apply));
}
/// <inheritdoc />
protected override void OnApply(object instance, object value)
{
_apply((TInstance)instance, (TValue)value);
}
/// <inheritdoc />
public override object Clone()
{
var clone = new FieldMapping<TInstance, TValue>(Name, DisplayName, Description, _apply);
clone.Load(this.Save());
return clone;
}
}
}
|
{
"content_hash": "7923f84d6f248cc85232271d5f15ea55",
"timestamp": "",
"source": "github",
"line_count": 440,
"max_line_length": 118,
"avg_line_length": 24.90909090909091,
"alnum_prop": 0.641514598540146,
"repo_name": "StockSharp/StockSharp",
"id": "73294a1cae9155eab5173c387b485737cd757bda",
"size": "10960",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Algo/Import/FieldMapping.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "4194571"
}
],
"symlink_target": ""
}
|
'''
Created on Apr 06, 2016
@author: Hisham
'''
from django.conf.urls import patterns, url, include
from messageboard.api import MessageBoardResource
message_board_resource = MessageBoardResource()
urlpatterns = patterns('',
url(r'^api/v1/', include(message_board_resource.urls)),
);
|
{
"content_hash": "243343f416ff1ede45eb266cc79aa599",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 61,
"avg_line_length": 22.46153846153846,
"alnum_prop": 0.7397260273972602,
"repo_name": "veerandev/demo",
"id": "bcbfdeeff05c19879f26c823d3859d4c905087b5",
"size": "292",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "messageboard/urls.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "83"
},
{
"name": "HTML",
"bytes": "3487"
},
{
"name": "JavaScript",
"bytes": "2021"
},
{
"name": "Python",
"bytes": "13327"
},
{
"name": "Shell",
"bytes": "696"
}
],
"symlink_target": ""
}
|
angular.module('lotteryApp', []).controller('lotteryCtrl', function($scope, $http){
$scope.lottery_list = [];
return $http.get('http://192.168.199.239:3001/lottery').success(function(response){
var i$, ref$, len$, list;
$scope.lottery_list = response.result.lottery_list;
console.log($scope.lottery_list);
for (i$ = 0, len$ = (ref$ = response.result.lottery_list).length; i$ < len$; ++i$) {
list = ref$[i$];
/*console.log list.lottery_name + '</a>'*/
list.lottery_url = '<a href="http://127.0.0.1:8080/family_op_tools/borad_rank.html' + '?deduplication=true' + '&lottery_id=' + list.lottery_id + '&fpage=1' + '"target="_self">' + list.lottery_name + '</a>';
console.log(list.lottery_url);
}
return $('#keywords').dynatable({
dataset: {
records: $scope.lottery_list
}
});
});
});
|
{
"content_hash": "576eb02ea86e29cc5c896f4e4cf799f8",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 212,
"avg_line_length": 45.05263157894737,
"alnum_prop": 0.594626168224299,
"repo_name": "zlq32326/ZLQ",
"id": "d437240d03f20aca1057f3c219e01026a2a35423",
"size": "856",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "www/js/lottery_list.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8185"
},
{
"name": "HTML",
"bytes": "10857"
},
{
"name": "JavaScript",
"bytes": "66662"
},
{
"name": "LiveScript",
"bytes": "5702"
}
],
"symlink_target": ""
}
|
#region Copyright (c) 2015 KEngine / Kelly <http://github.com/mr-kelly>, All rights reserved.
// KEngine - Toolset and framework for Unity3D
// ===================================
//
// Filename: SpriteLoader.cs
// Date: 2015/12/03
// Author: Kelly
// Email: 23110388@qq.com
// Github: https://github.com/mr-kelly/KEngine
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3.0 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library.
#endregion
using UnityEngine;
namespace KEngine
{
public class SpriteLoader : AbstractResourceLoader
{
public Sprite Asset
{
get { return ResultObject as Sprite; }
}
public delegate void CSpriteLoaderDelegate(bool isOk, Sprite tex);
private AssetFileLoader AssetFileBridge;
public override float Progress
{
get { return AssetFileBridge.Progress; }
}
public string Path { get; private set; }
public static SpriteLoader Load(string path, CSpriteLoaderDelegate callback = null)
{
LoaderDelgate newCallback = null;
if (callback != null)
{
newCallback = (isOk, obj) => callback(isOk, obj as Sprite);
}
return AutoNew<SpriteLoader>(path, newCallback);
}
protected override void Init(string url, params object[] args)
{
base.Init(url, args);
Path = url;
AssetFileBridge = AssetFileLoader.Load(Path, OnAssetLoaded);
}
private void OnAssetLoaded(bool isOk, UnityEngine.Object obj)
{
OnFinish(obj);
}
protected override void DoDispose()
{
base.DoDispose();
AssetFileBridge.Release(); // all, Texture is singleton!
}
}
}
|
{
"content_hash": "cdd082d7a37318845840f22e8b0b7343",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 94,
"avg_line_length": 29.91025641025641,
"alnum_prop": 0.6245177882554651,
"repo_name": "panshengneng/KXFramework",
"id": "cd6f3aee3bc7a06dcd0e2a1d88a9f73775e61312",
"size": "2335",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/Plugins/KEngine/KEngine/CoreModules/ResourceModule/KSpriteLoader.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "3513563"
},
{
"name": "C++",
"bytes": "959"
},
{
"name": "Lua",
"bytes": "7615"
}
],
"symlink_target": ""
}
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Character Multiplier")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Character Multiplier")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8b01e8eb-f71b-4f7c-b3b5-05dd28e1bf81")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
{
"content_hash": "4154d7d401e3adb544b3b8197580ccd0",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.25,
"alnum_prop": 0.7466383581033262,
"repo_name": "RAstardzhiev/Software-University-SoftUni",
"id": "6bd22998aedc3d955a312af0b1ecdc7864d8c666",
"size": "1416",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "Programming Fundamentals/Strings - Exercise/Character Multiplier/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "203"
},
{
"name": "C#",
"bytes": "3137103"
},
{
"name": "CSS",
"bytes": "159749"
},
{
"name": "HTML",
"bytes": "55667"
},
{
"name": "Hack",
"bytes": "2199"
},
{
"name": "Java",
"bytes": "60095"
},
{
"name": "JavaScript",
"bytes": "405592"
},
{
"name": "PHP",
"bytes": "18260"
},
{
"name": "PLpgSQL",
"bytes": "61231"
},
{
"name": "SQLPL",
"bytes": "183"
},
{
"name": "TypeScript",
"bytes": "16282"
}
],
"symlink_target": ""
}
|
FactoryBot.define do
factory :e_way_client_province, class: "EWayClient::Province" do
sequence(:province_id) {|n| n}
sequence(:province_name_eng) {|n| "Eng province #{n}"}
sequence(:province_name_viet) {|n| "Viet province #{n}"}
response_code { "0000" }
end
end
|
{
"content_hash": "98e884ccc08d693ab218dc2df968eaf9",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 66,
"avg_line_length": 28.4,
"alnum_prop": 0.647887323943662,
"repo_name": "imacchiato/e_way_client-ruby",
"id": "9fbed503551107307f6f7656067e135dcff4eed3",
"size": "284",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/e_way_client/factories/province.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "35083"
},
{
"name": "Shell",
"bytes": "131"
}
],
"symlink_target": ""
}
|
$ps3Installed = $false
$PSVersion,$CLRVersion = powershell -NoProfile -NonInteractive -Command { $PSVersionTable.PSVersion ; $PSVersionTable.CLRVersion }
function Start-TestFixture
{
& (Join-Path -Path $PSScriptRoot -ChildPath '..\Import-CarbonForTest.ps1' -Resolve)
}
function Start-Test
{
$ps3Installed = Test-Path -Path HKLM:\SOFTWARE\Microsoft\PowerShell\3
}
function Test-ShouldInvokePowerShell
{
$command = {
param(
$Argument
)
$Argument
}
$result = Invoke-PowerShell -ScriptBlock $command -Args 'Hello World!'
Assert-Equal 'Hello world!' $result
}
function Test-ShouldInvokePowerShellx86
{
$command = {
$env:PROCESSOR_ARCHITECTURE
}
$result = Invoke-PowerShell -ScriptBlock $command -x86
Assert-Equal 'x86' $result
}
if( Test-Path -Path HKLM:\SOFTWARE\Microsoft\PowerShell\3 )
{
if( $Host.Name -eq 'Windows PowerShell ISE Host' )
{
function Test-ShouldNotRunScriptBlockUnderV2ISEClr2
{
$command = {
$PSVersionTable.CLRVersion
}
$error.Clear()
$result = Invoke-PowerShell -ScriptBlock $command -Runtime v2.0 -ErrorAction SilentlyContinue
Assert-Equal 1 $error.Count
Assert-Null $result
Assert-Null ([Environment]::GetEnvironmentVariable('COMPLUS_ApplicationMigrationRuntimeActivationConfigPath'))
}
}
else
{
function Test-ShouldRunScriptBlockUnderV3ConsoleClr2
{
Assert-True (Test-DotNet -V2) '.NET v2 isn''t installed'
$command = {
$PSVersionTable.CLRVersion
}
$error.Clear()
$result = Invoke-PowerShell -ScriptBlock $command -Runtime v2.0
Assert-Equal 0 $error.Count
Assert-NotNull $result
Assert-Equal 2 $result.Major
Assert-Null ([Environment]::GetEnvironmentVariable('COMPLUS_ApplicationMigrationRuntimeActivationConfigPath'))
}
}
}
else
{
function Test-ShouldRunScriptBlockUnderV2ConsoleClr2
{
$command = {
$PSVersionTable.CLRVersion
}
$result = Invoke-PowerShell -ScriptBlock $command
$expectedClr = 2
Assert-Equal 2 $result.Major
Assert-Null ([Environment]::GetEnvironmentVariable('COMPLUS_ApplicationMigrationRuntimeActivationConfigPath'))
}
}
function Test-ShouldRunPowerShellUnderCLR4
{
$command = {
$PSVersionTable.CLRVersion
}
$result = Invoke-PowerShell -Command $command -Runtime v4.0
Assert-Equal 4 $result.Major
Assert-Null ([Environment]::GetEnvironmentVariable('COMPLUS_ApplicationMigrationRuntimeActivationConfigPath'))
}
function Test-ShouldRunx64PowerShellFromx86PowerShell
{
if( (Test-OsIs64Bit) -and (Test-PowerShellIs32Bit) )
{
$error.Clear()
$result = Invoke-PowerShell -ScriptBlock { $env:PROCESSOR_ARCHITECTURE } -ErrorAction SilentlyContinue
Assert-Equal 0 $error.Count
Assert-Equal 'AMD64' $result
}
else
{
Write-Warning "This test is only valid if running 32-bit PowerShell on a 64-bit operating system."
}
}
function Test-ShouldRunx86PowerShellFromx86PowerShell
{
if( (Test-OsIs64Bit) -and (Test-PowerShellIs32Bit) )
{
$error.Clear()
$result = Invoke-PowerShell -ScriptBlock { $env:ProgramFiles } -x86
Assert-Equal 0 $error.Count
Assert-True ($result -like '*Program Files (x86)*')
}
else
{
Write-Warning "This test is only valid if running 32-bit PowerShell on a 64-bit operating system."
}
}
function Test-ShouldRunScript
{
$result = Invoke-PowerShell -FilePath (Join-Path $TestDir Get-PSVersionTable.ps1) `
-OutputFormat XML `
-ExecutionPolicy RemoteSigned `
-ErrorAction SilentlyContinue 2> $null
Assert-Equal 3 $result.Length
Assert-Equal '' $result[0]
Assert-NotNull $result[1]
Assert-Equal $PSVersion $result[1].PSVersion
Assert-Equal $CLRVersion $result[1].CLRVersion
Assert-NotNull $result[2]
$architecture = 'AMD64'
if( Test-OSIs32Bit )
{
$architecture = 'x86'
}
Assert-Equal $architecture $result[2]
}
function Test-ShouldRunScriptWithArguments
{
$result = Invoke-PowerShell -FilePath (Join-Path $TestDir Get-PSVersionTable.ps1) `
-OutputFormat XML `
-ArgumentList '-Message',"'Hello World'" `
-ExecutionPolicy RemoteSigned `
-ErrorAction SilentlyContinue 2> $null
Assert-Equal 3 $result.Length
Assert-Equal "'Hello World'" $result[0]
Assert-NotNull $result[1]
Assert-Equal $PSVersion $result[1].PSVersion
Assert-Equal $CLRVersion $result[1].CLRVersion
}
function Test-ShouldRunScriptUnderPowerShell2
{
$result = Invoke-PowerShell -FilePath (Join-Path $TestDir Get-PSVersionTable.ps1) `
-OutputFormat XML `
-x86 `
-ExecutionPolicy RemoteSigned `
-ErrorAction SilentlyContinue 2> $null
Assert-Equal 'x86' $result[2]
}
function Test-ShouldRunUnderClr4
{
$result = Invoke-PowerShell -FilePath (Join-Path $TestDir Get-PSVersionTable.ps1) `
-OutputFormat XML `
-Runtime 'v4.0' `
-ExecutionPolicy RemoteSigned `
-ErrorAction SilentlyContinue 2> $null
Assert-Like $result[1].CLRVersion '4.0.*'
}
function Test-ShouldRunUnderClr2
{
Assert-True (Test-DotNet -V2) '.NET v2 is not installed'
$result = Invoke-PowerShell -FilePath (Join-Path $TestDir Get-PSVersionTable.ps1) `
-OutputFormat XML `
-Runtime 'v2.0' `
-ExecutionPolicy RemoteSigned `
-ErrorAction SilentlyContinue 2> $null
Assert-NotNull $result
Assert-Like $result[1].CLRVersion '2.0.*'
}
function Test-ShouldUseExecutionPolicy
{
$Error.Clear()
$result = Invoke-PowerShell -FilePath (Join-Path $TestDir Get-PsVersionTable.ps1) `
-ExecutionPolicy Restricted `
-ErrorAction SilentlyContinue 2> $null
#Assert-LastProcessFailed
if( $result )
{
Assert-Like $result[0] '*disabled*'
}
# For some reason, when run under CCNet, $Error doesn't get populated.
if( $Error )
{
Assert-ContainsLike $Error '*disabled*'
}
}
|
{
"content_hash": "ed1647b2e0e2a744cd663733a6f33b0e",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 130,
"avg_line_length": 32.70232558139535,
"alnum_prop": 0.5873986630635756,
"repo_name": "MattHubble/carbon",
"id": "3cad5ab9c746a4caa96313761a7bf5b123cc21dd",
"size": "7623",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Test/PowerShell/Test-InvokePowerShell.ps1",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "120589"
},
{
"name": "CSS",
"bytes": "3345"
},
{
"name": "HTML",
"bytes": "3922524"
},
{
"name": "PowerShell",
"bytes": "1645017"
}
],
"symlink_target": ""
}
|
layout: post
title: WooCommerce – Remove product category count
color: ''
image:
excerpt: Remove product count from category listings
tag: WooCommerce
redirect_from: /2015/10/remove-product-category-count/
---
Remove product count from category listings
add_filter( 'woocommerce_subcategory_count_html', '__return_false' );
|
{
"content_hash": "c0cb25416ff1b178b33e384a30dab949",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 73,
"avg_line_length": 23.714285714285715,
"alnum_prop": 0.7650602409638554,
"repo_name": "mikaelmattsson/mikaelmattsson.github.io",
"id": "aec38c20ae981b8ee1a876b4cb39c7fd0021bc4a",
"size": "338",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2015-10-01-remove-product-category-count.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1579"
},
{
"name": "HTML",
"bytes": "10805"
},
{
"name": "JavaScript",
"bytes": "171"
},
{
"name": "Ruby",
"bytes": "49"
}
],
"symlink_target": ""
}
|
declare namespace uevent {
interface Event {
readonly target: any;
readonly type: string;
readonly args: any[];
isDefaultPrevented(): boolean;
isPropagationStopped(): boolean;
preventDefault();
stopPropagation();
}
interface ValueEvent<T> extends Event {
readonly value: T;
}
interface EventListener {
handleEvent(e: Event): void;
handleEvent<T>(e: ValueEvent<T>): T;
}
type Callback = (e: Event, ...args: any[]) => void;
type Callbacks = { [event: string]: Callback | EventListener };
type ValueCallback<T> = (e: ValueEvent<T>, value: T, ...args: any[]) => T;
type ValueCallbacks<T> = { [event: string]: ValueCallback<T> | EventListener };
interface EventEmitter {
on(events: string | Callbacks, callback?: Callback | EventListener): this;
on<T>(events: string | ValueCallbacks<T>, callback?: ValueCallback<T> | EventListener): this;
off(events?: string | Callbacks, callback?: Callback | EventListener): this;
off<T>(events?: string | ValueCallbacks<T>, callback?: ValueCallback<T> | EventListener): this;
once(events: string | Callbacks, callback?: Callback | EventListener): this;
trigger(event: string, ...args: any[]): Event;
change<T>(event: string, value: T, ...args: any[]): T;
}
}
declare const uevent: {
EventEmitter: {
new(): uevent.EventEmitter;
};
Event: Event,
mixin: <T>(target: T) => T;
};
export = uevent;
export as namespace uevent;
|
{
"content_hash": "ffe5dcb0af6cb0f3cb55c9dd9e7e4907",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 103,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.6069620253164557,
"repo_name": "mistic100/microevent.js",
"id": "76bfa80aee4e3c3730e91e704ee9ca9aaa1d53ae",
"size": "1580",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "types.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "16468"
}
],
"symlink_target": ""
}
|
package org.ansj.splitWord;
import java.io.IOException;
import java.io.Reader;
import java.util.LinkedList;
import java.util.List;
import org.ansj.domain.Term;
import org.ansj.domain.TermNature;
import org.ansj.domain.TermNatures;
import static org.ansj.library.DATDictionary.*;
import org.ansj.library.UserDefineLibrary;
import org.ansj.splitWord.impl.GetWordsImpl;
import org.ansj.util.AnsjReader;
import org.ansj.util.Graph;
import org.ansj.util.MyStaticValue;
import org.ansj.util.WordAlert;
import org.nlpcn.commons.lang.tire.GetWord;
import org.nlpcn.commons.lang.tire.domain.Forest;
import org.nlpcn.commons.lang.util.StringUtil;
/**
* 基本分词+人名识别
*
* @author ansj
*
*/
public abstract class Analysis {
/**
* 用来记录偏移量
*/
public int offe;
/**
* 分词的类
*/
private GetWordsImpl gwi = new GetWordsImpl();
protected Forest[] forests = null;
private Forest ambiguityForest = UserDefineLibrary.ambiguityForest;
/**
* 文档读取流
*/
private AnsjReader br;
protected Analysis() {
};
private LinkedList<Term> terms = new LinkedList<Term>();
/**
* while 循环调用.直到返回为null则分词结束
*
* @return
* @throws IOException
*/
public Term next() throws IOException {
Term term = null;
if (!terms.isEmpty()) {
term = terms.poll();
term.updateOffe(offe);
return term;
}
String temp = br.readLine();
offe = br.getStart();
while (StringUtil.isBlank(temp)) {
if (temp == null) {
return null;
} else {
temp = br.readLine();
}
}
// 歧异处理字符串
analysisStr(temp);
if (!terms.isEmpty()) {
term = terms.poll();
term.updateOffe(offe);
return term;
}
return null;
}
/**
* 一整句话分词,用户设置的歧异优先
*
* @param temp
*/
private void analysisStr(String temp) {
Graph gp = new Graph(temp);
int startOffe = 0;
if (this.ambiguityForest != null) {
GetWord gw = new GetWord(this.ambiguityForest, gp.chars);
String[] params = null;
while ((gw.getFrontWords()) != null) {
if (gw.offe > startOffe) {
analysis(gp, startOffe, gw.offe);
}
params = gw.getParams();
startOffe = gw.offe;
for (int i = 0; i < params.length; i += 2) {
gp.addTerm(new Term(params[i], startOffe, new TermNatures(new TermNature(params[i + 1], 1))));
startOffe += params[i].length();
}
}
}
if (startOffe < gp.chars.length - 1) {
analysis(gp, startOffe, gp.chars.length);
}
List<Term> result = this.getResult(gp);
terms.addAll(result);
}
private void analysis(Graph gp, int startOffe, int endOffe) {
int start = 0;
int end = 0;
char[] chars = gp.chars;
String str = null;
char c = 0;
for (int i = startOffe; i < endOffe; i++) {
switch (status(chars[i])) {
case 0:
gp.addTerm(new Term(String.valueOf(chars[i]), i, TermNatures.NULL));
break;
case 4:
start = i;
end = 1;
while (++i < endOffe && status(chars[i]) == 4) {
end++;
}
str = WordAlert.alertEnglish(chars, start, end);
gp.addTerm(new Term(str, start, TermNatures.EN));
i--;
break;
case 5:
start = i;
end = 1;
while (++i < endOffe && status(chars[i]) == 5) {
end++;
}
str = WordAlert.alertNumber(chars, start, end);
gp.addTerm(new Term(str, start, TermNatures.M));
i--;
break;
default:
start = i;
end = i;
c = chars[start];
while (IN_SYSTEM[c] > 0) {
end++;
if (++i >= endOffe)
break;
c = chars[i];
}
if (start == end) {
gp.addTerm(new Term(String.valueOf(c), i, TermNatures.NULL));
continue;
}
gwi.setChars(chars, start, end);
while ((str = gwi.allWords()) != null) {
gp.addTerm(new Term(str, gwi.offe, gwi.getItem()));
}
/**
* 如果未分出词.以未知字符加入到gp中
*/
if (IN_SYSTEM[c] > 0 || status(c) > 3) {
i -= 1;
} else {
gp.addTerm(new Term(String.valueOf(c), i, TermNatures.NULL));
}
break;
}
}
}
/**
* 将为标准化的词语设置到分词中
*
* @param gp
* @param result
*/
protected void setRealName(Graph graph, List<Term> result) {
if (!MyStaticValue.isRealName) {
return;
}
String str = graph.realStr;
for (Term term : result) {
term.setRealName(str.substring(term.getOffe(), term.getOffe() + term.getName().length()));
}
}
protected List<Term> parseStr(String temp) {
// TODO Auto-generated method stub
analysisStr(temp);
return terms;
}
protected abstract List<Term> getResult(Graph graph);
public abstract class Merger {
public abstract List<Term> merger();
}
/**
* 重置分词器
*
* @param br
*/
public void resetContent(AnsjReader br) {
this.offe = 0;
this.br = br;
}
public void resetContent(Reader reader) {
this.offe = 0;
this.br = new AnsjReader(reader);
}
public void resetContent(Reader reader, int buffer) {
this.offe = 0;
this.br = new AnsjReader(reader, buffer);
}
public Forest getAmbiguityForest() {
return ambiguityForest;
}
public void setAmbiguityForest(Forest ambiguityForest) {
this.ambiguityForest = ambiguityForest;
}
}
|
{
"content_hash": "d4803b6c11423c28df14cc6dfa7f79c4",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 99,
"avg_line_length": 19.988,
"alnum_prop": 0.6247748649189514,
"repo_name": "keyeqing/KBExtraction",
"id": "7dd90ab226c31c830c65e73f15ada54c81f5e779",
"size": "5185",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/ansj/splitWord/Analysis.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "297366"
}
],
"symlink_target": ""
}
|
namespace DataSpec::DNAMP3 {
struct ANIM : BigDNA {
AT_DECL_EXPLICIT_DNA
struct IANIM : BigDNAV {
Delete expl;
atUint32 m_version;
IANIM(atUint32 version) : m_version(version) {}
std::vector<std::pair<atUint32, std::tuple<bool, bool, bool>>> bones;
std::vector<atUint32> frames;
std::vector<DNAANIM::Channel> channels;
std::vector<std::vector<DNAANIM::Value>> chanKeys;
float mainInterval = 0.0;
bool looping = false;
void sendANIMToBlender(hecl::blender::PyOutStream&, const DNAANIM::RigInverter<CINF>& rig, bool additive) const;
};
struct ANIM0 : IANIM {
AT_DECL_EXPLICIT_DNAV
ANIM0() : IANIM(0) {}
struct Header : BigDNA {
AT_DECL_DNA
Value<atUint16> unkS;
Value<float> duration;
Value<atUint32> unk0;
Value<float> interval;
Value<atUint32> unk1;
Value<atUint32> keyCount;
Value<atUint32> unk2;
Value<atUint32> boneSlotCount;
};
};
struct ANIM1 : IANIM {
AT_DECL_EXPLICIT_DNAV
ANIM1() : IANIM(1) {}
struct Header : BigDNA {
AT_DECL_DNA
Value<atUint16> unk1;
Value<atUint8> unk2;
Value<atUint32> unk3;
Value<atUint8> unk4[3];
Value<float> translationMult;
Value<float> scaleMult;
Value<atUint32> unk7;
Value<float> unk8;
Value<float> unk9;
Value<float> duration;
Value<atUint16> keyCount;
Value<atUint32> blobSize;
Value<atUint8> unk10;
Value<atUint32> floatsSize;
Value<atUint32> flagsSize;
Value<atUint32> initBlockSize;
Value<atUint32> streamSize;
Value<atUint32> unk11;
Value<atUint32> boneCount;
};
};
std::unique_ptr<IANIM> m_anim;
void sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig, bool additive) const {
m_anim->sendANIMToBlender(os, rig, additive);
}
void extractEVNT(const DNAANCS::AnimationResInfo<UniqueID64>& animInfo, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, bool force) const {}
};
} // namespace DataSpec::DNAMP3
|
{
"content_hash": "42272a957cddf55555e7bbbb8ffedfb7",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 118,
"avg_line_length": 27.67105263157895,
"alnum_prop": 0.6485972420351879,
"repo_name": "AxioDL/PathShagged",
"id": "d7cd97abaed10ef0221f985f68591db8452d20a8",
"size": "2284",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "DataSpec/DNAMP3/ANIM.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "30964"
},
{
"name": "C++",
"bytes": "1853098"
},
{
"name": "CMake",
"bytes": "25640"
},
{
"name": "Python",
"bytes": "29052"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (16) on Thu Nov 03 10:43:13 MDT 2022 -->
<title>com.easypost.exception.General (com.easypost:easypost-api-client 5.10.0 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2022-11-03">
<meta name="description" content="declaration: package: com.easypost.exception.General">
<meta name="generator" content="javadoc/PackageWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="package-declaration-page">
<script type="text/javascript">var pathtoroot = "../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar.top">
<div class="skip-nav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar.top.firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li class="nav-bar-cell1-rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></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="sub-nav">
<div class="nav-list-search"><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip.navbar.top">
<!-- -->
</span></nav>
</header>
<div class="flex-content">
<main role="main">
<div class="header">
<h1 title="Package" class="title">Package com.easypost.exception.General</h1>
</div>
<hr>
<div class="package-signature">package <span class="element-name">com.easypost.exception.General</span></div>
<section class="package-description" id="package.description">
<div class="block">Custom general exception classes for the EasyPost API.</div>
<dl class="notes">
<dt>Since:</dt>
<dd>6.0</dd>
<dt>Version:</dt>
<dd>6.0</dd>
<dt>Author:</dt>
<dd>EasyPost developers</dd>
<dt>See Also:</dt>
<dd><a href="https://www.easypost.com/docs">EasyPost API documentation</a></dd>
</dl>
</section>
<section class="summary">
<ul class="summary-list">
<li>
<div class="caption"><span>Exception Summary</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Exception</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><a href="ExternalApiError.html" title="class in com.easypost.exception.General">ExternalApiError</a></div>
<div class="col-last even-row-color"> </div>
<div class="col-first odd-row-color"><a href="FilteringError.html" title="class in com.easypost.exception.General">FilteringError</a></div>
<div class="col-last odd-row-color"> </div>
<div class="col-first even-row-color"><a href="InvalidObjectError.html" title="class in com.easypost.exception.General">InvalidObjectError</a></div>
<div class="col-last even-row-color"> </div>
<div class="col-first odd-row-color"><a href="InvalidParameterError.html" title="class in com.easypost.exception.General">InvalidParameterError</a></div>
<div class="col-last odd-row-color"> </div>
<div class="col-first even-row-color"><a href="MissingParameterError.html" title="class in com.easypost.exception.General">MissingParameterError</a></div>
<div class="col-last even-row-color"> </div>
<div class="col-first odd-row-color"><a href="SignatureVerificationError.html" title="class in com.easypost.exception.General">SignatureVerificationError</a></div>
<div class="col-last odd-row-color"> </div>
</div>
</li>
</ul>
</section>
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright © 2022 <a href="https://easypost.com">EasyPost</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>
|
{
"content_hash": "5491390ceafe4164e7d361c513f62469",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 163,
"avg_line_length": 45.98076923076923,
"alnum_prop": 0.6859054788791301,
"repo_name": "EasyPost/easypost-java",
"id": "09d058f168f8d2eb47925c9d34a20073de377700",
"size": "4782",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/com/easypost/exception/General/package-summary.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "338893"
},
{
"name": "Makefile",
"bytes": "2374"
}
],
"symlink_target": ""
}
|
<?php
use Illuminate\Database\Eloquent\Model;
/**
* Class PostNotSluggable
*
* A test model that doesn't use the Sluggable package.
*/
class PostNotSluggable extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'posts';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['title', 'subtitle'];
}
|
{
"content_hash": "5951cb4017a9cf202fa3395cf5c4c905",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 55,
"avg_line_length": 17.65625,
"alnum_prop": 0.5823008849557522,
"repo_name": "EspadaV8/eloquent-sluggable",
"id": "1fa916a030d3d36071e42eb1005cc61930753fd1",
"size": "565",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tests/models/PostNotSluggable.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "48558"
}
],
"symlink_target": ""
}
|
import { Injectable } from '@angular/core';
import { GlobalState } from '../../../../global.state';
import { Http } from '@angular/http';
@Injectable()
export class CaseDetailModalService {
private demandListMatchStrUrl = this.Global.baseURL + '/api/project/demand';
private caseUrl = this.Global.baseURL + '/api/project/case';
private caseDetailUrl = this.Global.baseURL + '/api/project/case/detail';
constructor(private Global: GlobalState, private http: Http) {
}
newCase(caseInfo): Promise<any> {
return this.http.post(this.caseUrl, JSON.stringify(caseInfo), this.Global.options)
.toPromise()
.then(this.Global.extractData)
.catch(this.Global.handleError);
}
updateCase(caseInfo): Promise<any> {
return this.http.put(this.caseUrl, JSON.stringify(caseInfo), this.Global.options)
.toPromise()
.then(this.Global.extractData)
.catch(this.Global.handleError);
}
searchDemandList(title, projectId): Promise<any> {
return this.http.get(`${this.demandListMatchStrUrl}?title=${title}&projectId=${projectId}`)
.toPromise()
.then(this.Global.extractData)
.catch(this.Global.handleError);
}
reviewDetail(id): Promise<any> {
return this.http.get(`${this.caseDetailUrl}/${id}`)
.toPromise()
.then(this.Global.extractData)
.catch(this.Global.handleError);
}
}
|
{
"content_hash": "cd54a591e5c04686e818761ea393acc0",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 95,
"avg_line_length": 32.61904761904762,
"alnum_prop": 0.6861313868613139,
"repo_name": "DXCChina/pms",
"id": "3c6645932f5476ce570754aa6b9a74177520ab4d",
"size": "1370",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/src/app/pages/project/test-manage/test-case-detail/case-detail-modal.service.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1027"
},
{
"name": "CSS",
"bytes": "149633"
},
{
"name": "HTML",
"bytes": "93419"
},
{
"name": "JavaScript",
"bytes": "1645"
},
{
"name": "Python",
"bytes": "66976"
},
{
"name": "TypeScript",
"bytes": "224878"
}
],
"symlink_target": ""
}
|
namespace MyStik.TimeTable.Data
{
public class SemesterSubscription : Subscription
{
public virtual SemesterGroup SemesterGroup { get; set; }
}
}
|
{
"content_hash": "b87dd0040d719c234d0215fbbecc2c48",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 64,
"avg_line_length": 23.857142857142858,
"alnum_prop": 0.6946107784431138,
"repo_name": "AccelerateX-org/NINE",
"id": "65df0135a214ed0109f8ccedc524b9628ae49fc4",
"size": "169",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Sources/TimeTable/MyStik.TimeTable.Data/SemesterSubscription.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "560"
},
{
"name": "C#",
"bytes": "3347387"
},
{
"name": "CSS",
"bytes": "121275"
},
{
"name": "HTML",
"bytes": "3990511"
},
{
"name": "JavaScript",
"bytes": "5598125"
},
{
"name": "PowerShell",
"bytes": "6151"
}
],
"symlink_target": ""
}
|
#import "UIImageView+WebCache.h"
#import "objc/runtime.h"
#import "UIView+WebCacheOperation.h"
static char imageURLKey;
static char TAG_ACTIVITY_INDICATOR;
static char TAG_ACTIVITY_STYLE;
static char TAG_ACTIVITY_SHOW;
@implementation UIImageView (WebCache)
- (void)sd_setImageWithURL:(NSURL *)url {
[self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil];
}
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder {
[self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil];
}
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder defaultImage:(UIImage *)defaultImage {
[self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
if (image == nil) {
self.image = defaultImage;
}
}];
}
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options {
[self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil];
}
- (void)sd_setImageWithURL:(NSURL *)url completed:(SDWebImageCompletionBlock)completedBlock {
[self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock];
}
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletionBlock)completedBlock {
[self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock];
}
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock {
[self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock];
}
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock {
[self sd_cancelCurrentImageLoad];
objc_setAssociatedObject(self, &imageURLKey, url, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
if (!(options & SDWebImageDelayPlaceholder)) {
dispatch_main_async_safe(^{
self.image = placeholder;
});
}
if (url) {
// check if activityView is enabled or not
if ([self showActivityIndicatorView]) {
[self addActivityIndicator];
}
__weak __typeof(self)wself = self;
id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadImageWithURL:url options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
[wself removeActivityIndicator];
if (!wself) return;
dispatch_main_sync_safe(^{
if (!wself) return;
if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock)
{
completedBlock(image, error, cacheType, url);
return;
}
else if (image) {
wself.image = image;
[wself setNeedsLayout];
} else {
if ((options & SDWebImageDelayPlaceholder)) {
wself.image = placeholder;
[wself setNeedsLayout];
}
}
if (completedBlock && finished) {
completedBlock(image, error, cacheType, url);
}
});
}];
[self sd_setImageLoadOperation:operation forKey:@"UIImageViewImageLoad"];
} else {
dispatch_main_async_safe(^{
[self removeActivityIndicator];
NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey : @"Trying to load a nil url"}];
if (completedBlock) {
completedBlock(nil, error, SDImageCacheTypeNone, url);
}
});
}
}
- (void)sd_setImageWithPreviousCachedImageWithURL:(NSURL *)url andPlaceholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletionBlock)completedBlock {
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url];
UIImage *lastPreviousCachedImage = [[SDImageCache sharedImageCache] imageFromDiskCacheForKey:key];
[self sd_setImageWithURL:url placeholderImage:lastPreviousCachedImage ?: placeholder options:options progress:progressBlock completed:completedBlock];
}
- (NSURL *)sd_imageURL {
return objc_getAssociatedObject(self, &imageURLKey);
}
- (void)sd_setAnimationImagesWithURLs:(NSArray *)arrayOfURLs {
[self sd_cancelCurrentAnimationImagesLoad];
__weak __typeof(self)wself = self;
NSMutableArray *operationsArray = [[NSMutableArray alloc] init];
for (NSURL *logoImageURL in arrayOfURLs) {
id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadImageWithURL:logoImageURL options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
if (!wself) return;
dispatch_main_sync_safe(^{
__strong UIImageView *sself = wself;
[sself stopAnimating];
if (sself && image) {
NSMutableArray *currentImages = [[sself animationImages] mutableCopy];
if (!currentImages) {
currentImages = [[NSMutableArray alloc] init];
}
[currentImages addObject:image];
sself.animationImages = currentImages;
[sself setNeedsLayout];
}
[sself startAnimating];
});
}];
[operationsArray addObject:operation];
}
[self sd_setImageLoadOperation:[NSArray arrayWithArray:operationsArray] forKey:@"UIImageViewAnimationImages"];
}
- (void)sd_cancelCurrentImageLoad {
[self sd_cancelImageLoadOperationWithKey:@"UIImageViewImageLoad"];
}
- (void)sd_cancelCurrentAnimationImagesLoad {
[self sd_cancelImageLoadOperationWithKey:@"UIImageViewAnimationImages"];
}
#pragma mark -
- (UIActivityIndicatorView *)activityIndicator {
return (UIActivityIndicatorView *)objc_getAssociatedObject(self, &TAG_ACTIVITY_INDICATOR);
}
- (void)setActivityIndicator:(UIActivityIndicatorView *)activityIndicator {
objc_setAssociatedObject(self, &TAG_ACTIVITY_INDICATOR, activityIndicator, OBJC_ASSOCIATION_RETAIN);
}
- (void)setShowActivityIndicatorView:(BOOL)show{
objc_setAssociatedObject(self, &TAG_ACTIVITY_SHOW, [NSNumber numberWithBool:show], OBJC_ASSOCIATION_RETAIN);
}
- (BOOL)showActivityIndicatorView{
return [objc_getAssociatedObject(self, &TAG_ACTIVITY_SHOW) boolValue];
}
- (void)setIndicatorStyle:(UIActivityIndicatorViewStyle)style{
objc_setAssociatedObject(self, &TAG_ACTIVITY_STYLE, [NSNumber numberWithInt:style], OBJC_ASSOCIATION_RETAIN);
}
- (int)getIndicatorStyle{
return [objc_getAssociatedObject(self, &TAG_ACTIVITY_STYLE) intValue];
}
- (void)addActivityIndicator {
if (!self.activityIndicator) {
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self getIndicatorStyle]];
self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
dispatch_main_async_safe(^{
[self addSubview:self.activityIndicator];
[self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0.0]];
[self addConstraint:[NSLayoutConstraint constraintWithItem:self.activityIndicator
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterY
multiplier:1.0
constant:0.0]];
});
}
dispatch_main_async_safe(^{
[self.activityIndicator startAnimating];
});
}
- (void)removeActivityIndicator {
if (self.activityIndicator) {
[self.activityIndicator removeFromSuperview];
self.activityIndicator = nil;
}
}
@end
@implementation UIImageView (WebCacheDeprecated)
- (NSURL *)imageURL {
return [self sd_imageURL];
}
- (void)setImageWithURL:(NSURL *)url {
[self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil];
}
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder {
[self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil];
}
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options {
[self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil];
}
- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock {
[self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
if (completedBlock) {
completedBlock(image, error, cacheType);
}
}];
}
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock {
[self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
if (completedBlock) {
completedBlock(image, error, cacheType);
}
}];
}
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock {
[self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
if (completedBlock) {
completedBlock(image, error, cacheType);
}
}];
}
- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock {
[self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:progressBlock completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
if (completedBlock) {
completedBlock(image, error, cacheType);
}
}];
}
- (void)cancelCurrentArrayLoad {
[self sd_cancelCurrentAnimationImagesLoad];
}
- (void)cancelCurrentImageLoad {
[self sd_cancelCurrentImageLoad];
}
- (void)setAnimationImagesWithURLs:(NSArray *)arrayOfURLs {
[self sd_setAnimationImagesWithURLs:arrayOfURLs];
}
@end
|
{
"content_hash": "4d0eb4c1e24a90c246a13c13251a1a37",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 252,
"avg_line_length": 42.88172043010753,
"alnum_prop": 0.6648278167836844,
"repo_name": "AzenXu/SDWebImage",
"id": "93e3bbc47699e5aba2584cc36d636b71671b8703",
"size": "12192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SDWebImage/UIImageView+WebCache.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "254816"
},
{
"name": "Ruby",
"bytes": "2019"
}
],
"symlink_target": ""
}
|
#ifndef _JEMALLOC_JEMALLOC_TESTER_H_
#define _JEMALLOC_JEMALLOC_TESTER_H_
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
#include "jemalloc_test.h"
#include "mempool_tester.h"
#include "lang_def.h"
#include "jemalloc/jemalloc.h"
#include <stdio.h>
#include <stdint.h>
////////////////////////////////////////////////////
// class jemalloc_tester
////////////////////////////////////////////////////
class jemalloc_tester : public mempool_tester<jemalloc_tester>
{
public:
jemalloc_tester();
jemalloc_tester(size_types size_type, alloc_ways alloc_way,
int min_alloc_size, int max_alloc_size,
int loop_count1, int loop_count2 = 0, int loop_count3 = 0);
~jemalloc_tester();
public:
char *GetFuncName(void) {
//printf("jemalloc_tester<T>::GetFuncName();\n");
//return "class jemalloc_tester()";
if (g_lang_id == LANG_ZH_CN)
return "je_malloc() º¯Êý";
else
return "je_malloc() Function";
}
void *Malloc(size_t size) {
//printf("jemalloc_tester<T>::Malloc();\n");
return je_malloc(size);
}
void *Realloc(void *p, size_t new_size) {
//printf("jemalloc_tester<T>::Realloc();\n");
return je_realloc(p, new_size);
}
void Free(void *p) {
//printf("jemalloc_tester<T>::Clear();\n");
je_free(p);
}
void Clear(void *p) {
//printf("jemalloc_tester<T>::Clear();\n");
// Do nothing!
}
void Run(void) {
//printf("jemalloc_tester<T>::Run();\n");
mempool_tester<jemalloc_tester> *pThis = static_cast<mempool_tester<jemalloc_tester> *>(this);
if (pThis) {
pThis->Run();
}
}
};
#endif /* _JEMALLOC_JEMALLOC_TESTER_H_ */
|
{
"content_hash": "04eeec1c3d19b8382aa32bfd4b87302f",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 102,
"avg_line_length": 25.285714285714285,
"alnum_prop": 0.5457627118644067,
"repo_name": "shines77/jemalloc-win32",
"id": "1c327197a8de2f5eccdc74dc531e8b86c5fddc98",
"size": "1770",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/jemalloc_test/src/jemalloc_tester.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "941658"
},
{
"name": "C++",
"bytes": "139052"
},
{
"name": "Makefile",
"bytes": "17466"
},
{
"name": "Perl",
"bytes": "171375"
},
{
"name": "Shell",
"bytes": "14474"
}
],
"symlink_target": ""
}
|
//===- ObjCARCContract.cpp - ObjC ARC Optimization ------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
/// This file defines late ObjC ARC optimizations. ARC stands for Automatic
/// Reference Counting and is a system for managing reference counts for objects
/// in Objective C.
///
/// This specific file mainly deals with ``contracting'' multiple lower level
/// operations into singular higher level operations through pattern matching.
///
/// WARNING: This file knows about certain library functions. It recognizes them
/// by name, and hardwires knowledge of their semantics.
///
/// WARNING: This file knows about how certain Objective-C library functions are
/// used. Naive LLVM IR transformations which would otherwise be
/// behavior-preserving may break these assumptions.
///
//===----------------------------------------------------------------------===//
// TODO: ObjCARCContract could insert PHI nodes when uses aren't
// dominated by single calls.
#include "ARCRuntimeEntryPoints.h"
#include "DependencyAnalysis.h"
#include "ObjCARC.h"
#include "ProvenanceAnalysis.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Operator.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
using namespace llvm::objcarc;
#define DEBUG_TYPE "objc-arc-contract"
STATISTIC(NumPeeps, "Number of calls peephole-optimized");
STATISTIC(NumStoreStrongs, "Number objc_storeStrong calls formed");
//===----------------------------------------------------------------------===//
// Declarations
//===----------------------------------------------------------------------===//
namespace {
/// Late ARC optimizations
///
/// These change the IR in a way that makes it difficult to be analyzed by
/// ObjCARCOpt, so it's run late.
class ObjCARCContract : public FunctionPass {
bool Changed;
AliasAnalysis *AA;
DominatorTree *DT;
ProvenanceAnalysis PA;
ARCRuntimeEntryPoints EP;
/// A flag indicating whether this optimization pass should run.
bool Run;
/// The inline asm string to insert between calls and RetainRV calls to make
/// the optimization work on targets which need it.
const MDString *RVInstMarker;
/// The set of inserted objc_storeStrong calls. If at the end of walking the
/// function we have found no alloca instructions, these calls can be marked
/// "tail".
SmallPtrSet<CallInst *, 8> StoreStrongCalls;
/// Returns true if we eliminated Inst.
bool tryToPeepholeInstruction(
Function &F, Instruction *Inst, inst_iterator &Iter,
SmallPtrSetImpl<Instruction *> &DepInsts,
SmallPtrSetImpl<const BasicBlock *> &Visited,
bool &TailOkForStoreStrong,
const DenseMap<BasicBlock *, ColorVector> &BlockColors);
bool optimizeRetainCall(Function &F, Instruction *Retain);
bool
contractAutorelease(Function &F, Instruction *Autorelease,
ARCInstKind Class,
SmallPtrSetImpl<Instruction *> &DependingInstructions,
SmallPtrSetImpl<const BasicBlock *> &Visited);
void tryToContractReleaseIntoStoreStrong(
Instruction *Release, inst_iterator &Iter,
const DenseMap<BasicBlock *, ColorVector> &BlockColors);
void getAnalysisUsage(AnalysisUsage &AU) const override;
bool doInitialization(Module &M) override;
bool runOnFunction(Function &F) override;
public:
static char ID;
ObjCARCContract() : FunctionPass(ID) {
initializeObjCARCContractPass(*PassRegistry::getPassRegistry());
}
};
}
//===----------------------------------------------------------------------===//
// Implementation
//===----------------------------------------------------------------------===//
/// Turn objc_retain into objc_retainAutoreleasedReturnValue if the operand is a
/// return value. We do this late so we do not disrupt the dataflow analysis in
/// ObjCARCOpt.
bool ObjCARCContract::optimizeRetainCall(Function &F, Instruction *Retain) {
const auto *Call = dyn_cast<CallBase>(GetArgRCIdentityRoot(Retain));
if (!Call)
return false;
if (Call->getParent() != Retain->getParent())
return false;
// Check that the call is next to the retain.
BasicBlock::const_iterator I = ++Call->getIterator();
while (IsNoopInstruction(&*I))
++I;
if (&*I != Retain)
return false;
// Turn it to an objc_retainAutoreleasedReturnValue.
Changed = true;
++NumPeeps;
LLVM_DEBUG(
dbgs() << "Transforming objc_retain => "
"objc_retainAutoreleasedReturnValue since the operand is a "
"return value.\nOld: "
<< *Retain << "\n");
// We do not have to worry about tail calls/does not throw since
// retain/retainRV have the same properties.
Function *Decl = EP.get(ARCRuntimeEntryPointKind::RetainRV);
cast<CallInst>(Retain)->setCalledFunction(Decl);
LLVM_DEBUG(dbgs() << "New: " << *Retain << "\n");
return true;
}
/// Merge an autorelease with a retain into a fused call.
bool ObjCARCContract::contractAutorelease(
Function &F, Instruction *Autorelease, ARCInstKind Class,
SmallPtrSetImpl<Instruction *> &DependingInstructions,
SmallPtrSetImpl<const BasicBlock *> &Visited) {
const Value *Arg = GetArgRCIdentityRoot(Autorelease);
// Check that there are no instructions between the retain and the autorelease
// (such as an autorelease_pop) which may change the count.
CallInst *Retain = nullptr;
if (Class == ARCInstKind::AutoreleaseRV)
FindDependencies(RetainAutoreleaseRVDep, Arg,
Autorelease->getParent(), Autorelease,
DependingInstructions, Visited, PA);
else
FindDependencies(RetainAutoreleaseDep, Arg,
Autorelease->getParent(), Autorelease,
DependingInstructions, Visited, PA);
Visited.clear();
if (DependingInstructions.size() != 1) {
DependingInstructions.clear();
return false;
}
Retain = dyn_cast_or_null<CallInst>(*DependingInstructions.begin());
DependingInstructions.clear();
if (!Retain || GetBasicARCInstKind(Retain) != ARCInstKind::Retain ||
GetArgRCIdentityRoot(Retain) != Arg)
return false;
Changed = true;
++NumPeeps;
LLVM_DEBUG(dbgs() << " Fusing retain/autorelease!\n"
" Autorelease:"
<< *Autorelease
<< "\n"
" Retain: "
<< *Retain << "\n");
Function *Decl = EP.get(Class == ARCInstKind::AutoreleaseRV
? ARCRuntimeEntryPointKind::RetainAutoreleaseRV
: ARCRuntimeEntryPointKind::RetainAutorelease);
Retain->setCalledFunction(Decl);
LLVM_DEBUG(dbgs() << " New RetainAutorelease: " << *Retain << "\n");
EraseInstruction(Autorelease);
return true;
}
static StoreInst *findSafeStoreForStoreStrongContraction(LoadInst *Load,
Instruction *Release,
ProvenanceAnalysis &PA,
AliasAnalysis *AA) {
StoreInst *Store = nullptr;
bool SawRelease = false;
// Get the location associated with Load.
MemoryLocation Loc = MemoryLocation::get(Load);
auto *LocPtr = Loc.Ptr->stripPointerCasts();
// Walk down to find the store and the release, which may be in either order.
for (auto I = std::next(BasicBlock::iterator(Load)),
E = Load->getParent()->end();
I != E; ++I) {
// If we found the store we were looking for and saw the release,
// break. There is no more work to be done.
if (Store && SawRelease)
break;
// Now we know that we have not seen either the store or the release. If I
// is the release, mark that we saw the release and continue.
Instruction *Inst = &*I;
if (Inst == Release) {
SawRelease = true;
continue;
}
// Otherwise, we check if Inst is a "good" store. Grab the instruction class
// of Inst.
ARCInstKind Class = GetBasicARCInstKind(Inst);
// If Inst is an unrelated retain, we don't care about it.
//
// TODO: This is one area where the optimization could be made more
// aggressive.
if (IsRetain(Class))
continue;
// If we have seen the store, but not the release...
if (Store) {
// We need to make sure that it is safe to move the release from its
// current position to the store. This implies proving that any
// instruction in between Store and the Release conservatively can not use
// the RCIdentityRoot of Release. If we can prove we can ignore Inst, so
// continue...
if (!CanUse(Inst, Load, PA, Class)) {
continue;
}
// Otherwise, be conservative and return nullptr.
return nullptr;
}
// Ok, now we know we have not seen a store yet. See if Inst can write to
// our load location, if it can not, just ignore the instruction.
if (!isModSet(AA->getModRefInfo(Inst, Loc)))
continue;
Store = dyn_cast<StoreInst>(Inst);
// If Inst can, then check if Inst is a simple store. If Inst is not a
// store or a store that is not simple, then we have some we do not
// understand writing to this memory implying we can not move the load
// over the write to any subsequent store that we may find.
if (!Store || !Store->isSimple())
return nullptr;
// Then make sure that the pointer we are storing to is Ptr. If so, we
// found our Store!
if (Store->getPointerOperand()->stripPointerCasts() == LocPtr)
continue;
// Otherwise, we have an unknown store to some other ptr that clobbers
// Loc.Ptr. Bail!
return nullptr;
}
// If we did not find the store or did not see the release, fail.
if (!Store || !SawRelease)
return nullptr;
// We succeeded!
return Store;
}
static Instruction *
findRetainForStoreStrongContraction(Value *New, StoreInst *Store,
Instruction *Release,
ProvenanceAnalysis &PA) {
// Walk up from the Store to find the retain.
BasicBlock::iterator I = Store->getIterator();
BasicBlock::iterator Begin = Store->getParent()->begin();
while (I != Begin && GetBasicARCInstKind(&*I) != ARCInstKind::Retain) {
Instruction *Inst = &*I;
// It is only safe to move the retain to the store if we can prove
// conservatively that nothing besides the release can decrement reference
// counts in between the retain and the store.
if (CanDecrementRefCount(Inst, New, PA) && Inst != Release)
return nullptr;
--I;
}
Instruction *Retain = &*I;
if (GetBasicARCInstKind(Retain) != ARCInstKind::Retain)
return nullptr;
if (GetArgRCIdentityRoot(Retain) != New)
return nullptr;
return Retain;
}
/// Create a call instruction with the correct funclet token. Should be used
/// instead of calling CallInst::Create directly.
static CallInst *
createCallInst(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args,
const Twine &NameStr, Instruction *InsertBefore,
const DenseMap<BasicBlock *, ColorVector> &BlockColors) {
SmallVector<OperandBundleDef, 1> OpBundles;
if (!BlockColors.empty()) {
const ColorVector &CV = BlockColors.find(InsertBefore->getParent())->second;
assert(CV.size() == 1 && "non-unique color for block!");
Instruction *EHPad = CV.front()->getFirstNonPHI();
if (EHPad->isEHPad())
OpBundles.emplace_back("funclet", EHPad);
}
return CallInst::Create(FTy, Func, Args, OpBundles, NameStr, InsertBefore);
}
static CallInst *
createCallInst(FunctionCallee Func, ArrayRef<Value *> Args, const Twine &NameStr,
Instruction *InsertBefore,
const DenseMap<BasicBlock *, ColorVector> &BlockColors) {
return createCallInst(Func.getFunctionType(), Func.getCallee(), Args, NameStr,
InsertBefore, BlockColors);
}
/// Attempt to merge an objc_release with a store, load, and objc_retain to form
/// an objc_storeStrong. An objc_storeStrong:
///
/// objc_storeStrong(i8** %old_ptr, i8* new_value)
///
/// is equivalent to the following IR sequence:
///
/// ; Load old value.
/// %old_value = load i8** %old_ptr (1)
///
/// ; Increment the new value and then release the old value. This must occur
/// ; in order in case old_value releases new_value in its destructor causing
/// ; us to potentially have a dangling ptr.
/// tail call i8* @objc_retain(i8* %new_value) (2)
/// tail call void @objc_release(i8* %old_value) (3)
///
/// ; Store the new_value into old_ptr
/// store i8* %new_value, i8** %old_ptr (4)
///
/// The safety of this optimization is based around the following
/// considerations:
///
/// 1. We are forming the store strong at the store. Thus to perform this
/// optimization it must be safe to move the retain, load, and release to
/// (4).
/// 2. We need to make sure that any re-orderings of (1), (2), (3), (4) are
/// safe.
void ObjCARCContract::tryToContractReleaseIntoStoreStrong(
Instruction *Release, inst_iterator &Iter,
const DenseMap<BasicBlock *, ColorVector> &BlockColors) {
// See if we are releasing something that we just loaded.
auto *Load = dyn_cast<LoadInst>(GetArgRCIdentityRoot(Release));
if (!Load || !Load->isSimple())
return;
// For now, require everything to be in one basic block.
BasicBlock *BB = Release->getParent();
if (Load->getParent() != BB)
return;
// First scan down the BB from Load, looking for a store of the RCIdentityRoot
// of Load's
StoreInst *Store =
findSafeStoreForStoreStrongContraction(Load, Release, PA, AA);
// If we fail, bail.
if (!Store)
return;
// Then find what new_value's RCIdentity Root is.
Value *New = GetRCIdentityRoot(Store->getValueOperand());
// Then walk up the BB and look for a retain on New without any intervening
// instructions which conservatively might decrement ref counts.
Instruction *Retain =
findRetainForStoreStrongContraction(New, Store, Release, PA);
// If we fail, bail.
if (!Retain)
return;
Changed = true;
++NumStoreStrongs;
LLVM_DEBUG(
llvm::dbgs() << " Contracting retain, release into objc_storeStrong.\n"
<< " Old:\n"
<< " Store: " << *Store << "\n"
<< " Release: " << *Release << "\n"
<< " Retain: " << *Retain << "\n"
<< " Load: " << *Load << "\n");
LLVMContext &C = Release->getContext();
Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C));
Type *I8XX = PointerType::getUnqual(I8X);
Value *Args[] = { Load->getPointerOperand(), New };
if (Args[0]->getType() != I8XX)
Args[0] = new BitCastInst(Args[0], I8XX, "", Store);
if (Args[1]->getType() != I8X)
Args[1] = new BitCastInst(Args[1], I8X, "", Store);
Function *Decl = EP.get(ARCRuntimeEntryPointKind::StoreStrong);
CallInst *StoreStrong = createCallInst(Decl, Args, "", Store, BlockColors);
StoreStrong->setDoesNotThrow();
StoreStrong->setDebugLoc(Store->getDebugLoc());
// We can't set the tail flag yet, because we haven't yet determined
// whether there are any escaping allocas. Remember this call, so that
// we can set the tail flag once we know it's safe.
StoreStrongCalls.insert(StoreStrong);
LLVM_DEBUG(llvm::dbgs() << " New Store Strong: " << *StoreStrong
<< "\n");
if (&*Iter == Retain) ++Iter;
if (&*Iter == Store) ++Iter;
Store->eraseFromParent();
Release->eraseFromParent();
EraseInstruction(Retain);
if (Load->use_empty())
Load->eraseFromParent();
}
bool ObjCARCContract::tryToPeepholeInstruction(
Function &F, Instruction *Inst, inst_iterator &Iter,
SmallPtrSetImpl<Instruction *> &DependingInsts,
SmallPtrSetImpl<const BasicBlock *> &Visited, bool &TailOkForStoreStrongs,
const DenseMap<BasicBlock *, ColorVector> &BlockColors) {
// Only these library routines return their argument. In particular,
// objc_retainBlock does not necessarily return its argument.
ARCInstKind Class = GetBasicARCInstKind(Inst);
switch (Class) {
case ARCInstKind::FusedRetainAutorelease:
case ARCInstKind::FusedRetainAutoreleaseRV:
return false;
case ARCInstKind::Autorelease:
case ARCInstKind::AutoreleaseRV:
return contractAutorelease(F, Inst, Class, DependingInsts, Visited);
case ARCInstKind::Retain:
// Attempt to convert retains to retainrvs if they are next to function
// calls.
if (!optimizeRetainCall(F, Inst))
return false;
// If we succeed in our optimization, fall through.
LLVM_FALLTHROUGH;
case ARCInstKind::RetainRV:
case ARCInstKind::ClaimRV: {
// If we're compiling for a target which needs a special inline-asm
// marker to do the return value optimization, insert it now.
if (!RVInstMarker)
return false;
BasicBlock::iterator BBI = Inst->getIterator();
BasicBlock *InstParent = Inst->getParent();
// Step up to see if the call immediately precedes the RV call.
// If it's an invoke, we have to cross a block boundary. And we have
// to carefully dodge no-op instructions.
do {
if (BBI == InstParent->begin()) {
BasicBlock *Pred = InstParent->getSinglePredecessor();
if (!Pred)
goto decline_rv_optimization;
BBI = Pred->getTerminator()->getIterator();
break;
}
--BBI;
} while (IsNoopInstruction(&*BBI));
if (&*BBI == GetArgRCIdentityRoot(Inst)) {
LLVM_DEBUG(dbgs() << "Adding inline asm marker for the return value "
"optimization.\n");
Changed = true;
InlineAsm *IA =
InlineAsm::get(FunctionType::get(Type::getVoidTy(Inst->getContext()),
/*isVarArg=*/false),
RVInstMarker->getString(),
/*Constraints=*/"", /*hasSideEffects=*/true);
createCallInst(IA, None, "", Inst, BlockColors);
}
decline_rv_optimization:
return false;
}
case ARCInstKind::InitWeak: {
// objc_initWeak(p, null) => *p = null
CallInst *CI = cast<CallInst>(Inst);
if (IsNullOrUndef(CI->getArgOperand(1))) {
Value *Null = ConstantPointerNull::get(cast<PointerType>(CI->getType()));
Changed = true;
new StoreInst(Null, CI->getArgOperand(0), CI);
LLVM_DEBUG(dbgs() << "OBJCARCContract: Old = " << *CI << "\n"
<< " New = " << *Null << "\n");
CI->replaceAllUsesWith(Null);
CI->eraseFromParent();
}
return true;
}
case ARCInstKind::Release:
// Try to form an objc store strong from our release. If we fail, there is
// nothing further to do below, so continue.
tryToContractReleaseIntoStoreStrong(Inst, Iter, BlockColors);
return true;
case ARCInstKind::User:
// Be conservative if the function has any alloca instructions.
// Technically we only care about escaping alloca instructions,
// but this is sufficient to handle some interesting cases.
if (isa<AllocaInst>(Inst))
TailOkForStoreStrongs = false;
return true;
case ARCInstKind::IntrinsicUser:
// Remove calls to @llvm.objc.clang.arc.use(...).
Inst->eraseFromParent();
return true;
default:
return true;
}
}
//===----------------------------------------------------------------------===//
// Top Level Driver
//===----------------------------------------------------------------------===//
bool ObjCARCContract::runOnFunction(Function &F) {
if (!EnableARCOpts)
return false;
// If nothing in the Module uses ARC, don't do anything.
if (!Run)
return false;
Changed = false;
AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
PA.setAA(&getAnalysis<AAResultsWrapperPass>().getAAResults());
DenseMap<BasicBlock *, ColorVector> BlockColors;
if (F.hasPersonalityFn() &&
isScopedEHPersonality(classifyEHPersonality(F.getPersonalityFn())))
BlockColors = colorEHFunclets(F);
LLVM_DEBUG(llvm::dbgs() << "**** ObjCARC Contract ****\n");
// Track whether it's ok to mark objc_storeStrong calls with the "tail"
// keyword. Be conservative if the function has variadic arguments.
// It seems that functions which "return twice" are also unsafe for the
// "tail" argument, because they are setjmp, which could need to
// return to an earlier stack state.
bool TailOkForStoreStrongs =
!F.isVarArg() && !F.callsFunctionThatReturnsTwice();
// For ObjC library calls which return their argument, replace uses of the
// argument with uses of the call return value, if it dominates the use. This
// reduces register pressure.
SmallPtrSet<Instruction *, 4> DependingInstructions;
SmallPtrSet<const BasicBlock *, 4> Visited;
for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E;) {
Instruction *Inst = &*I++;
LLVM_DEBUG(dbgs() << "Visiting: " << *Inst << "\n");
// First try to peephole Inst. If there is nothing further we can do in
// terms of undoing objc-arc-expand, process the next inst.
if (tryToPeepholeInstruction(F, Inst, I, DependingInstructions, Visited,
TailOkForStoreStrongs, BlockColors))
continue;
// Otherwise, try to undo objc-arc-expand.
// Don't use GetArgRCIdentityRoot because we don't want to look through bitcasts
// and such; to do the replacement, the argument must have type i8*.
// Function for replacing uses of Arg dominated by Inst.
auto ReplaceArgUses = [Inst, this](Value *Arg) {
// If we're compiling bugpointed code, don't get in trouble.
if (!isa<Instruction>(Arg) && !isa<Argument>(Arg))
return;
// Look through the uses of the pointer.
for (Value::use_iterator UI = Arg->use_begin(), UE = Arg->use_end();
UI != UE; ) {
// Increment UI now, because we may unlink its element.
Use &U = *UI++;
unsigned OperandNo = U.getOperandNo();
// If the call's return value dominates a use of the call's argument
// value, rewrite the use to use the return value. We check for
// reachability here because an unreachable call is considered to
// trivially dominate itself, which would lead us to rewriting its
// argument in terms of its return value, which would lead to
// infinite loops in GetArgRCIdentityRoot.
if (!DT->isReachableFromEntry(U) || !DT->dominates(Inst, U))
continue;
Changed = true;
Instruction *Replacement = Inst;
Type *UseTy = U.get()->getType();
if (PHINode *PHI = dyn_cast<PHINode>(U.getUser())) {
// For PHI nodes, insert the bitcast in the predecessor block.
unsigned ValNo = PHINode::getIncomingValueNumForOperand(OperandNo);
BasicBlock *IncomingBB = PHI->getIncomingBlock(ValNo);
if (Replacement->getType() != UseTy) {
// A catchswitch is both a pad and a terminator, meaning a basic
// block with a catchswitch has no insertion point. Keep going up
// the dominator tree until we find a non-catchswitch.
BasicBlock *InsertBB = IncomingBB;
while (isa<CatchSwitchInst>(InsertBB->getFirstNonPHI())) {
InsertBB = DT->getNode(InsertBB)->getIDom()->getBlock();
}
assert(DT->dominates(Inst, &InsertBB->back()) &&
"Invalid insertion point for bitcast");
Replacement =
new BitCastInst(Replacement, UseTy, "", &InsertBB->back());
}
// While we're here, rewrite all edges for this PHI, rather
// than just one use at a time, to minimize the number of
// bitcasts we emit.
for (unsigned i = 0, e = PHI->getNumIncomingValues(); i != e; ++i)
if (PHI->getIncomingBlock(i) == IncomingBB) {
// Keep the UI iterator valid.
if (UI != UE &&
&PHI->getOperandUse(
PHINode::getOperandNumForIncomingValue(i)) == &*UI)
++UI;
PHI->setIncomingValue(i, Replacement);
}
} else {
if (Replacement->getType() != UseTy)
Replacement = new BitCastInst(Replacement, UseTy, "",
cast<Instruction>(U.getUser()));
U.set(Replacement);
}
}
};
Value *Arg = cast<CallInst>(Inst)->getArgOperand(0);
Value *OrigArg = Arg;
// TODO: Change this to a do-while.
for (;;) {
ReplaceArgUses(Arg);
// If Arg is a no-op casted pointer, strip one level of casts and iterate.
if (const BitCastInst *BI = dyn_cast<BitCastInst>(Arg))
Arg = BI->getOperand(0);
else if (isa<GEPOperator>(Arg) &&
cast<GEPOperator>(Arg)->hasAllZeroIndices())
Arg = cast<GEPOperator>(Arg)->getPointerOperand();
else if (isa<GlobalAlias>(Arg) &&
!cast<GlobalAlias>(Arg)->isInterposable())
Arg = cast<GlobalAlias>(Arg)->getAliasee();
else {
// If Arg is a PHI node, get PHIs that are equivalent to it and replace
// their uses.
if (PHINode *PN = dyn_cast<PHINode>(Arg)) {
SmallVector<Value *, 1> PHIList;
getEquivalentPHIs(*PN, PHIList);
for (Value *PHI : PHIList)
ReplaceArgUses(PHI);
}
break;
}
}
// Replace bitcast users of Arg that are dominated by Inst.
SmallVector<BitCastInst *, 2> BitCastUsers;
// Add all bitcast users of the function argument first.
for (User *U : OrigArg->users())
if (auto *BC = dyn_cast<BitCastInst>(U))
BitCastUsers.push_back(BC);
// Replace the bitcasts with the call return. Iterate until list is empty.
while (!BitCastUsers.empty()) {
auto *BC = BitCastUsers.pop_back_val();
for (User *U : BC->users())
if (auto *B = dyn_cast<BitCastInst>(U))
BitCastUsers.push_back(B);
ReplaceArgUses(BC);
}
}
// If this function has no escaping allocas or suspicious vararg usage,
// objc_storeStrong calls can be marked with the "tail" keyword.
if (TailOkForStoreStrongs)
for (CallInst *CI : StoreStrongCalls)
CI->setTailCall();
StoreStrongCalls.clear();
return Changed;
}
//===----------------------------------------------------------------------===//
// Misc Pass Manager
//===----------------------------------------------------------------------===//
char ObjCARCContract::ID = 0;
INITIALIZE_PASS_BEGIN(ObjCARCContract, "objc-arc-contract",
"ObjC ARC contraction", false, false)
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_END(ObjCARCContract, "objc-arc-contract",
"ObjC ARC contraction", false, false)
void ObjCARCContract::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<AAResultsWrapperPass>();
AU.addRequired<DominatorTreeWrapperPass>();
AU.setPreservesCFG();
}
Pass *llvm::createObjCARCContractPass() { return new ObjCARCContract(); }
bool ObjCARCContract::doInitialization(Module &M) {
// If nothing in the Module uses ARC, don't do anything.
Run = ModuleHasARC(M);
if (!Run)
return false;
EP.init(&M);
// Initialize RVInstMarker.
const char *MarkerKey = "clang.arc.retainAutoreleasedReturnValueMarker";
RVInstMarker = dyn_cast_or_null<MDString>(M.getModuleFlag(MarkerKey));
return false;
}
|
{
"content_hash": "c38e6ee96277bdcb677c13387ae28c0d",
"timestamp": "",
"source": "github",
"line_count": 750,
"max_line_length": 84,
"avg_line_length": 37.95733333333333,
"alnum_prop": 0.6231206969228608,
"repo_name": "endlessm/chromium-browser",
"id": "161bbde50ed6b29f6fc8351675ce64f618ed37e3",
"size": "28468",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "third_party/llvm/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
}
|
package ch.rasc.downloadchart;
public class JpegOptions {
public Integer quality;
}
|
{
"content_hash": "56c613f54b684b021977e88c5e25ce71",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 30,
"avg_line_length": 14.5,
"alnum_prop": 0.7816091954022989,
"repo_name": "ralscha/downloadchart",
"id": "c54fb97f4ad40095f7494b7743c8644f754372ad",
"size": "705",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/ch/rasc/downloadchart/JpegOptions.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "1344"
},
{
"name": "HTML",
"bytes": "791"
},
{
"name": "Java",
"bytes": "15563"
},
{
"name": "JavaScript",
"bytes": "8983"
}
],
"symlink_target": ""
}
|
@interface MRAnimation : NSObject
+ (MRAnimation *)manager;
- (void)makeShakeWith:(UIView *)view duration:(CFTimeInterval)duration spacing:(NSTimeInterval)spacing;
- (void)makeRotateWith:(UIView *)view duration:(CFTimeInterval)duration repeatCount:(CGFloat)count axis:(NSString *)axis spacing:(NSTimeInterval)spacing;
- (void)shake:(UIView *)view duration:(CFTimeInterval)duration;
- (void)rotate:(UIView *)view duration:(CFTimeInterval)duration repeatCount:(CGFloat)count axis:(NSString *)axis;
+ (void)setPrompt:(NSString *)prompt viewController:(UIViewController *)vc;
+ (void)showText:(NSString *)text onTheView:(UIView *)parentView;
@end
|
{
"content_hash": "0eb125b8c5017de0ea3e0756abba7c09",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 153,
"avg_line_length": 38.294117647058826,
"alnum_prop": 0.7757296466973886,
"repo_name": "liguotal/Guild",
"id": "8ecf2e24e28493ed194f0284311aca64386d586a",
"size": "878",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ABCIntroView/animation/MRAnimation.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "2643"
},
{
"name": "Objective-C",
"bytes": "41338"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_45) on Thu Oct 13 19:29:17 UTC 2016 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Class liquibase.diff.ObjectDifferences.OrderedCollectionCompareFunction (Liquibase Core 3.5.3 API)
</TITLE>
<META NAME="date" CONTENT="2016-10-13">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class liquibase.diff.ObjectDifferences.OrderedCollectionCompareFunction (Liquibase Core 3.5.3 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../liquibase/diff/ObjectDifferences.OrderedCollectionCompareFunction.html" title="class in liquibase.diff"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?liquibase/diff//class-useObjectDifferences.OrderedCollectionCompareFunction.html" target="_top"><B>FRAMES</B></A>
<A HREF="ObjectDifferences.OrderedCollectionCompareFunction.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>liquibase.diff.ObjectDifferences.OrderedCollectionCompareFunction</B></H2>
</CENTER>
No usage of liquibase.diff.ObjectDifferences.OrderedCollectionCompareFunction
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../liquibase/diff/ObjectDifferences.OrderedCollectionCompareFunction.html" title="class in liquibase.diff"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?liquibase/diff//class-useObjectDifferences.OrderedCollectionCompareFunction.html" target="_top"><B>FRAMES</B></A>
<A HREF="ObjectDifferences.OrderedCollectionCompareFunction.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2016 <a href="http://www.liquibase.org">Liquibase.org</a>. All rights reserved.
</BODY>
</HTML>
|
{
"content_hash": "8e3400244cd0baca95e5eb9c726cd4b3",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 230,
"avg_line_length": 43.47586206896552,
"alnum_prop": 0.6451459390862944,
"repo_name": "ErpMicroServices/party-database",
"id": "078eaf10774407ab01cbd471a985b2882aeb4937",
"size": "6304",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "liquibase-3.5.3-bin/sdk/javadoc/liquibase/diff/class-use/ObjectDifferences.OrderedCollectionCompareFunction.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "21542"
}
],
"symlink_target": ""
}
|
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
crypto = require('crypto');
/**
* A Validation function for local strategy properties
*/
var validateLocalStrategyProperty = function(property) {
return ((this.provider !== 'local' && !this.updated) || property.length);
};
/**
* A Validation function for local strategy password
*/
var validateLocalStrategyPassword = function(password) {
return (this.provider !== 'local' || (password && password.length > 6));
};
/**
* User Schema
*/
var UserSchema = new Schema({
userId : {
type : String
},
firstName: {
type: String,
trim: true,
default: ''
},
lastName: {
type: String,
trim: true,
default: ''
},
displayName: {
type: String,
trim: true
},
email: {
type: String,
trim: true,
default: ''
},
username: {
type: String,
unique: 'testing error message',
required: 'Please fill in a username',
trim: true
},
password: {
type: String,
default: '',
validate: [validateLocalStrategyPassword, 'Password should be longer']
},
salt: {
type: String
},
provider: {
type: String,
required: 'Provider is required'
},
providerData: {},
additionalProvidersData: {},
updated: {
type: Date
},
created: {
type: Date,
default: Date.now
},
/* For reset password */
resetPasswordToken: {
type: String
},
resetPasswordExpires: {
type: Date
},
location:{
lat:{
type: Number,
default: 0
},
lng:{
type: Number,
default: 0
}
},
professionalServices:
[
{
categoryName:
{
type: String,
trim: true,
default: ''
},
subCategories:
[{
name:
{
type: String,
trim: true,
default: ''
},
price:
{
type: Number,
default: 0
},
priceType:
{
type: String,
trim: true,
default: 'PerHour'
},
description:
{
type: String,
trim: true,
default: ''
},
icon :
{
type : String,
trim : true,
default : ''
}
}]
}
]
});
/**
* Hook a pre save method to hash the password
*/
UserSchema.pre('save', function(next) {
if (this.password && this.password.length > 6) {
this.salt = new Buffer(crypto.randomBytes(16).toString('base64'), 'base64');
this.password = this.hashPassword(this.password);
}
next();
});
/**
* Create instance method for hashing a password
*/
UserSchema.methods.hashPassword = function(password) {
if (this.salt && password) {
return crypto.pbkdf2Sync(password, this.salt, 10000, 64).toString('base64');
} else {
return password;
}
};
/**
* Create instance method for authenticating user
*/
UserSchema.methods.authenticate = function(password) {
return this.password === this.hashPassword(password);
};
/**
* Find possible not used username
*/
UserSchema.statics.findUniqueUsername = function(username, suffix, callback) {
var _this = this;
var possibleUsername = username + (suffix || '');
_this.findOne({
username: possibleUsername
}, function(err, user) {
if (!err) {
if (!user) {
callback(possibleUsername);
} else {
return _this.findUniqueUsername(username, (suffix || 0) + 1, callback);
}
} else {
callback(null);
}
});
};
mongoose.model('User', UserSchema);
|
{
"content_hash": "f39ae39338ea004a1bde5d54f2bcc701",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 78,
"avg_line_length": 17.364583333333332,
"alnum_prop": 0.6055788842231554,
"repo_name": "kalo09/DoorStep",
"id": "53e5db5b86c0d7199f2eb87f0f54c3fdfb3a5c1f",
"size": "3334",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/user.server.model.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1655"
},
{
"name": "JavaScript",
"bytes": "153580"
},
{
"name": "Perl",
"bytes": "48"
},
{
"name": "Shell",
"bytes": "1083"
}
],
"symlink_target": ""
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_fscanf_81.h
Label Definition File: CWE789_Uncontrolled_Mem_Alloc__new.label.xml
Template File: sources-sinks-81.tmpl.h
*/
/*
* @description
* CWE: 789 Uncontrolled Memory Allocation
* BadSource: fscanf Read data from the console using fscanf()
* GoodSource: Small number greater than zero
* Sinks:
* GoodSink: Allocate memory with new [] and check the size of the memory to be allocated
* BadSink : Allocate memory with new [], but incorrectly check the size of the memory to be allocated
* Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
namespace CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_fscanf_81
{
class CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_fscanf_81_base
{
public:
/* pure virtual function */
virtual void action(size_t data) const = 0;
};
#ifndef OMITBAD
class CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_fscanf_81_bad : public CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_fscanf_81_base
{
public:
void action(size_t data) const;
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_fscanf_81_goodG2B : public CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_fscanf_81_base
{
public:
void action(size_t data) const;
};
class CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_fscanf_81_goodB2G : public CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_fscanf_81_base
{
public:
void action(size_t data) const;
};
#endif /* OMITGOOD */
}
|
{
"content_hash": "f1806b041d4dd43279a799969dcf7ceb",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 133,
"avg_line_length": 28.1,
"alnum_prop": 0.7105575326215896,
"repo_name": "JianpingZeng/xcc",
"id": "800e2c5a62dfa2b92bffe2b3dba113c6f69047af",
"size": "1686",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "xcc/test/juliet/testcases/CWE789_Uncontrolled_Mem_Alloc/s02/CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_fscanf_81.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
}
|
typedef BOOL (WINAPI* LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
typedef const char* (CDECL* LPFN_WINE_GET_VERSION)(void);
static LPFN_ISWOW64PROCESS fnIsWow64Process = NULL;
static LPFN_WINE_GET_VERSION fnWineGetVersion = NULL;
namespace base {
bool is_wow64()
{
if (!fnIsWow64Process) {
fnIsWow64Process = (LPFN_ISWOW64PROCESS)
GetProcAddress(GetModuleHandle(L"kernel32"),
"IsWow64Process");
}
BOOL isWow64 = FALSE;
if (fnIsWow64Process)
fnIsWow64Process(GetCurrentProcess(), &isWow64);
return isWow64 ? true: false;
}
const char* get_wine_version()
{
if (!fnWineGetVersion) {
fnWineGetVersion = (LPFN_WINE_GET_VERSION)
GetProcAddress(GetModuleHandle(L"ntdll.dll"),
"wine_get_version");
}
if (fnWineGetVersion)
return fnWineGetVersion();
else
return nullptr;
}
} // namespace base
|
{
"content_hash": "9f9bc8fa692b9e7c39e7b9e48527bf85",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 58,
"avg_line_length": 24.305555555555557,
"alnum_prop": 0.6834285714285714,
"repo_name": "aseprite/laf",
"id": "678bb38ce89d04b4dddad97ee298782a86e4481a",
"size": "1114",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "base/platform_win.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "16006"
},
{
"name": "C++",
"bytes": "746395"
},
{
"name": "CMake",
"bytes": "21823"
},
{
"name": "Objective-C",
"bytes": "9429"
},
{
"name": "Objective-C++",
"bytes": "86316"
}
],
"symlink_target": ""
}
|
package edu.ucdenver.ccp.datasource.identifiers.impl.bio;
import java.util.regex.Pattern;
import edu.ucdenver.ccp.datasource.fileparsers.CcpExtensionOntology;
import edu.ucdenver.ccp.datasource.identifiers.DataSource;
import edu.ucdenver.ccp.datasource.identifiers.Identifier;
import edu.ucdenver.ccp.datasource.identifiers.StringDataSourceIdentifier;
@Identifier(ontClass=CcpExtensionOntology.REACTOMEREACTION_IDENTIFIER)
public class ReactomeReactionID
extends StringDataSourceIdentifier
{
/**
* The Reactome pathway stable identifiers are strings of the form
* "R-DME-2173788".
*/
private static final Pattern REACTOME_STABLE_ID =
Pattern.compile("R-([A-Z]{3})-(\\d+)");
public ReactomeReactionID(String resourceID) {
super(resourceID, DataSource.REACTOME);
}
@Override
public String validate(final String resourceID)
throws IllegalArgumentException
{
super.validate(resourceID);
if (! REACTOME_STABLE_ID.matcher(resourceID).matches()) {
throw new IllegalArgumentException(
String.format(
"Detected invalid Reactome Reaction ID %s; expected an ID of the form: %s",
resourceID,
REACTOME_STABLE_ID.pattern()));
}
return resourceID;
}
}
|
{
"content_hash": "6d9a23e47a7e2038bcaca33f80357e85",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 95,
"avg_line_length": 30.727272727272727,
"alnum_prop": 0.6878698224852071,
"repo_name": "UCDenver-ccp/datasource",
"id": "9b145fb2ad58eb8412d08e7a10a6236d7298551b",
"size": "3042",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "datasource-fileparsers/src/main/java/edu/ucdenver/ccp/datasource/identifiers/impl/bio/ReactomeReactionID.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "3558839"
},
{
"name": "Shell",
"bytes": "10035"
}
],
"symlink_target": ""
}
|
import serial
import time
import random
from contextlib import contextmanager
class Gaugediuno(object):
def __init__(self, device=None, baudrate=None):
self.device = device or "/dev/tty.usbmodem1d11"
self.baudrate = baudrate or 28800
@contextmanager
def connect(self):
conn = Serial.init(self.device, self.baudrate)
try:
yield conn
finally:
conn.close()
class Serial(object):
delay = 0.2
@classmethod
def init(cls, device, baudrate):
return cls(serial.Serial(device, baudrate))
def __init__(self, ser):
self.ser = ser
def write(self, value):
formatted = self._format(value)
self.ser.write(formatted)
time.sleep(self.delay)
def close(self):
self.ser.close()
def _format(self, value):
return "{0:02}".format(value)
def main():
baudrate = 28800
device = "/dev/tty.usbmodem1d11"
gauge = Gaugediuno(device, baudrate)
with gauge.connect() as conn:
while True:
val = random.randint(0, 99)
print val
conn.write(val)
if __name__ == '__main__':
main()
|
{
"content_hash": "f1473fba3b088fd812a7879f09829fea",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 49,
"avg_line_length": 19.764705882352942,
"alnum_prop": 0.6884920634920635,
"repo_name": "clofresh/gaugeduino",
"id": "6332d4875bd37d13648b7e1e462bb6237d908cc1",
"size": "1008",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/gaugeduino.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Arduino",
"bytes": "1675"
},
{
"name": "Python",
"bytes": "1008"
}
],
"symlink_target": ""
}
|
<div>
<h1>{{name}}</h1>
<p><strong>Email:</strong> {{email}}</p>
<p>
<strong>Address:</strong>
{{address.street}}, {{address.city}}, {{address.state}}
</p>
<button class="btn btn-default" (click)="toggleHobbies()">{{showHobbies ? "Hide":"Show"}}</button>
<div *ngIf="showHobbies">
<h3>Hoobies</h3>
<ol class="list-group">
<li class="list-group-item" *ngFor="let hobby of hobbies; let i = index">
{{hobby}} <button class="btn btn-danger" (click)="deleteHobby(i)">Delete</button>
</li>
</ol>
<form class="form-inline" (submit)="addHobby(hobby.value)">
<div class="form-group">
<label>Add hobby: </label>
<input class="form-control" type="text" #hobby />
</div>
</form>
</div>
<hr>
<div class="well">
<form>
<legend>Edit user info</legend>
<div class="form-group">
<label class="control-label">Name: </label>
<input class="form-control" type="text" name="name" [(ngModel)]="name" />
</div>
<div class="form-group">
<label class="control-label">Email: </label>
<input class="form-control" type="email" name="email" [(ngModel)]="email" />
</div>
<div class="form-group">
<label class="control-label">Street: </label>
<input class="form-control" type="text" name="address.street" [(ngModel)]="address.street" />
</div>
<div class="form-group">
<label class="control-label">City: </label>
<input class="form-control" type="text" name="address.city" [(ngModel)]="address.city" />
</div>
<div class="form-group">
<label class="control-label">State: </label>
<input class="form-control" type="text" name="address.state" [(ngModel)]="address.state" />
</div>
</form>
</div>
</div>
<h2>Posts:</h2>
<div *ngFor="let post of posts">
<h3>{{ post.title }}</h3>
<p>{{ post.body }}</p>
</div>
|
{
"content_hash": "11113fe6d05497e3c5332594c3352160",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 101,
"avg_line_length": 18.10909090909091,
"alnum_prop": 0.552710843373494,
"repo_name": "dexterns88/angular2-practice",
"id": "3d991865ba9c9af31087e7553ef8e54ffb7ca888",
"size": "1992",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/components/user.components.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "172"
},
{
"name": "HTML",
"bytes": "14425"
},
{
"name": "JavaScript",
"bytes": "15034"
},
{
"name": "TypeScript",
"bytes": "29888"
}
],
"symlink_target": ""
}
|
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Notifications">
<CheckBoxPreference
android:defaultValue="true"
android:key="dailyNotification"
android:summary="Allow WatBalance to display Balance Information in the Notification Tray"
android:title="Daily Notifications" />
</PreferenceCategory>
<PreferenceCategory android:title="Daily Balance">
<com.cg.watbalance.preferences.DatePreference
android:key="termEnd"
android:summary="Date on which current Term ends"
android:title="Term End" />
<ListPreference
android:defaultValue="1"
android:entries="@array/dailyBalanceChoice"
android:entryValues="@array/dailyBalanceChoiceValues"
android:key="dailyBalanceChoice"
android:summary="Balance used for Daily Balance calculation"
android:title="Balance Choice" />
<CheckBoxPreference
android:defaultValue="false"
android:enabled="false"
android:key="customDailyBalance"
android:summary="Feature coming soon"
android:title="Custom Daily Balance" />
<EditTextPreference
android:dependency="customDailyBalance"
android:key="customLimit"
android:title="Custom Limit" />
</PreferenceCategory>
<PreferenceCategory android:title="Credentials">
<Preference
android:key="logout"
android:title="Logout from WatBalance" />
</PreferenceCategory>
<PreferenceCategory android:title="About">
<Preference
android:summary="Developed by Xyan Bhatnagar"
android:title="WatBalance"></Preference>
</PreferenceCategory>
</PreferenceScreen>
|
{
"content_hash": "fa8f19e077da9ab5d6fd493653e732ab",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 102,
"avg_line_length": 44.30232558139535,
"alnum_prop": 0.647244094488189,
"repo_name": "xbhatnag/WatBalance",
"id": "933d02af7c2ab433678dde06ca1722d416ded9bc",
"size": "1905",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/xml/preferences.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "80422"
}
],
"symlink_target": ""
}
|
# ----------------------------------------
# DSGN 01: VIEW ENTERPRISE BRANDING AND DESIGN
# ----------------------------------------
param([string]$LogFolderPath)
$UserStory = "DSGN01"
$0 = $myInvocation.MyCommand.Definition
$CommandDirectory = [System.IO.Path]::GetDirectoryName($0)
$values = @{"User Story: " = $UserStory}
New-HeaderDrawing -Values $Values
# ==================================== #
# ========= MASTER PAGE ========== #
# ==================================== #
$values = @{"Step: " = "#1 MasterPage"}
New-HeaderDrawing -Values $Values
$Script = $CommandDirectory + '\Setup-MasterPage.ps1'
& $Script
# =============================== #
# ========= THEMES ========== #
# =============================== #
$values = @{"Step: " = "#2 Theme and Logo"}
New-HeaderDrawing -Values $Values
$Script = $CommandDirectory + '\Setup-Theme.ps1'
& $Script
# =================================== #
# ========= HOME PAGES ========== #
# =================================== #
$values = @{"Step: " = "#3 Home pages"}
New-HeaderDrawing -Values $Values
$Script = $CommandDirectory + '\Setup-HomePages.ps1'
& $Script
# =========================================== #
# ========= Javascript Imports ========== #
# =========================================== #
$values = @{"Step: " = "#3 Home pages"}
New-HeaderDrawing -Values $Values
$Script = $CommandDirectory + '\Setup-JavascriptImports.ps1'
& $Script
|
{
"content_hash": "bf84152ae00077ad988223ffaabdfebe",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 60,
"avg_line_length": 26.92452830188679,
"alnum_prop": 0.4400840925017519,
"repo_name": "GSoft-SharePoint/Dynamite-Components",
"id": "bc44b567c2ab3368a3c3f16f2e6577548eed9163",
"size": "1429",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "Libraries/GSoft.Dynamite.StandardPublishingCMS.2.2.2-pre10639/tools/Modules/Design/DSGN_01/Install-DSGN01.ps1",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "72275"
},
{
"name": "C#",
"bytes": "814274"
},
{
"name": "CSS",
"bytes": "8967"
},
{
"name": "Cucumber",
"bytes": "59480"
},
{
"name": "HTML",
"bytes": "77894"
},
{
"name": "JavaScript",
"bytes": "23958"
},
{
"name": "PowerShell",
"bytes": "1282356"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<!--
Copyright (c) 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/ui/tracks/container_track.html">
<link rel="import" href="/base/sorted_array_utils.html">
<link rel="import" href="/model/model_settings.html">
<link rel="import" href="/ui/base/ui.html">
<script>
'use strict';
tr.exportTo('tr.ui.tracks', function() {
/**
* A track that displays a group of objects in multiple rows.
* @constructor
* @extends {ContainerTrack}
*/
var MultiRowTrack = tr.ui.b.define(
'multi-row-track', tr.ui.tracks.ContainerTrack);
MultiRowTrack.prototype = {
__proto__: tr.ui.tracks.ContainerTrack.prototype,
decorate: function(viewport) {
tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
this.tooltip_ = '';
this.heading_ = '';
this.groupingSource_ = undefined;
this.itemsToGroup_ = undefined;
this.defaultToCollapsedWhenSubRowCountMoreThan = 1;
this.itemsGroupedOnLastUpdateContents_ = undefined;
this.currentSubRows_ = [];
this.expanded_ = true;
},
get itemsToGroup() {
return this.itemsToGroup_;
},
setItemsToGroup: function(itemsToGroup, opt_groupingSource) {
this.itemsToGroup_ = itemsToGroup;
this.groupingSource_ = opt_groupingSource;
this.updateContents_();
this.updateExpandedStateFromGroupingSource_();
},
get heading() {
return this.heading_;
},
set heading(h) {
this.heading_ = h;
this.updateContents_();
},
get tooltip() {
return this.tooltip_;
},
set tooltip(t) {
this.tooltip_ = t;
this.updateContents_();
},
get subRows() {
return this.currentSubRows_;
},
get hasVisibleContent() {
return this.children.length > 0;
},
get expanded() {
return this.expanded_;
},
set expanded(expanded) {
if (this.expanded_ == expanded)
return;
this.expanded_ = expanded;
this.expandedStateChanged_();
},
onHeadingClicked_: function(e) {
if (this.subRows.length <= 1)
return;
this.expanded = !this.expanded;
if (this.groupingSource_) {
var modelSettings = new tr.model.ModelSettings(
this.groupingSource_.model);
modelSettings.setSettingFor(this.groupingSource_, 'expanded',
this.expanded);
}
e.stopPropagation();
},
updateExpandedStateFromGroupingSource_: function() {
if (this.groupingSource_) {
var numSubRows = this.subRows.length;
var modelSettings = new tr.model.ModelSettings(
this.groupingSource_.model);
if (numSubRows > 1) {
var defaultExpanded;
if (numSubRows > this.defaultToCollapsedWhenSubRowCountMoreThan) {
defaultExpanded = false;
} else {
defaultExpanded = true;
}
this.expanded = modelSettings.getSettingFor(
this.groupingSource_, 'expanded', defaultExpanded);
} else {
this.expanded = undefined;
}
}
},
expandedStateChanged_: function() {
var minH = Math.max(2, Math.ceil(18 / this.children.length));
var h = (this.expanded_ ? 18 : minH) + 'px';
for (var i = 0; i < this.children.length; i++) {
this.children[i].height = h;
if (i === 0)
this.children[i].arrowVisible = true;
this.children[i].expanded = this.expanded;
}
if (this.children.length === 1) {
this.children[0].expanded = true;
this.children[0].arrowVisible = false;
}
},
updateContents_: function() {
tr.ui.tracks.ContainerTrack.prototype.updateContents_.call(this);
if (!this.itemsToGroup_) {
this.updateHeadingAndTooltip_();
this.currentSubRows_ = [];
return;
}
if (this.areArrayContentsSame_(this.itemsGroupedOnLastUpdateContents_,
this.itemsToGroup_)) {
this.updateHeadingAndTooltip_();
return;
}
this.itemsGroupedOnLastUpdateContents_ = this.itemsToGroup_;
this.detach();
if (!this.itemsToGroup_.length) {
this.currentSubRows_ = [];
return;
}
var subRows = this.buildSubRows_(this.itemsToGroup_);
this.currentSubRows_ = subRows;
for (var srI = 0; srI < subRows.length; srI++) {
var subRow = subRows[srI];
if (!subRow.length)
continue;
var track = this.addSubTrack_(subRow);
track.addEventListener(
'heading-clicked', this.onHeadingClicked_.bind(this));
}
this.updateHeadingAndTooltip_();
this.expandedStateChanged_();
},
updateHeadingAndTooltip_: function() {
if (!this.firstChild)
return;
this.firstChild.heading = this.heading_;
this.firstChild.tooltip = this.tooltip_;
},
/**
* Breaks up the list of slices into N rows, each of which is a list of
* slices that are non overlapping.
*/
buildSubRows_: function(itemsToGroup) {
throw new Error('Not implemented');
},
addSubTrack_: function(subRowItems) {
throw new Error('Not implemented');
},
areArrayContentsSame_: function(a, b) {
if (!a || !b)
return false;
if (!a.length || !b.length)
return false;
if (a.length != b.length)
return false;
for (var i = 0; i < a.length; ++i) {
if (a[i] != b[i])
return false;
}
return true;
}
};
return {
MultiRowTrack: MultiRowTrack
};
});
</script>
|
{
"content_hash": "0c68cb99b96257d57878302f385cd99f",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 76,
"avg_line_length": 26.513761467889907,
"alnum_prop": 0.5908304498269896,
"repo_name": "dstockwell/catapult",
"id": "dbb2707ed66933570306350347591e59ffee3a0e",
"size": "5780",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tracing/tracing/ui/tracks/multi_row_track.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "20830"
},
{
"name": "HTML",
"bytes": "7818816"
},
{
"name": "JavaScript",
"bytes": "35437"
},
{
"name": "Python",
"bytes": "661836"
},
{
"name": "Shell",
"bytes": "809"
}
],
"symlink_target": ""
}
|
from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
return obj.owner == request.user
|
{
"content_hash": "dc6631a3632fe76b2138a9b7750d88fc",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 56,
"avg_line_length": 33.875,
"alnum_prop": 0.7195571955719557,
"repo_name": "aginzberg/crowdsource-platform",
"id": "03a2362bf1efba265c40adc606db8d3eca7b2975",
"size": "271",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop2",
"path": "crowdsourcing/permissions/util.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "328687"
},
{
"name": "HTML",
"bytes": "178994"
},
{
"name": "JavaScript",
"bytes": "168588"
},
{
"name": "Python",
"bytes": "339941"
},
{
"name": "Shell",
"bytes": "838"
}
],
"symlink_target": ""
}
|
module.exports = function(app) {
var express = require('express');
var zuoraRouter = express.Router();
zuoraRouter.post('/rest/v1/payment-methods/credit-cards', function(req, res) {
if (req.headers.signature && req.headers.token) {
res.status(200).send({
paymentMethodId: '2c92c8f83dcbd8b1013dcce1d6a60',
success: true
});
} else {
res.status(400).send({
success: false,
reasons: [{ message: 'token or signature missing', code: 90000011 }]
});
}
});
app.use('/zuora', zuoraRouter);
};
|
{
"content_hash": "1347e8267eaa3a649c05d0f3f32dfc37",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 80,
"avg_line_length": 28.85,
"alnum_prop": 0.5979202772963604,
"repo_name": "CampusColiving/auth-blueprint-ember-cli",
"id": "2713a4d853677323f1e1585e157b3ec36b4da41b",
"size": "577",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/mocks/zuora.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1580"
},
{
"name": "Handlebars",
"bytes": "747"
},
{
"name": "JavaScript",
"bytes": "22653"
}
],
"symlink_target": ""
}
|
CONFIG=${1:-config}
CONFIG_FILE="config/$CONFIG.sh"
function prepare_venv() {
python3 -m venv venv && source venv/bin/activate && python3 "$(which pip3)" install -r requirements.txt
}
[ "$NOVENV" == "1" ] || prepare_venv || exit 1
echo "Reading configuration from: $CONFIG_FILE"
# shellcheck source=config/config.sh
source "$CONFIG_FILE"
echo "SCENARIO=$SCENARIO"
echo "SERVER_ADDRESS=$SERVER_ADDRESS"
echo "FORGE_API=$FORGE_API"
echo "WIT_API=$WIT_API"
echo "AUTH_API=$AUTH_API"
echo "OSIO_USERNAME=$OSIO_USERNAME"
echo "OSIO_PASSWORD=$OSIO_PASSWORD"
echo "OSIO_DANGER_ZONE=$OSIO_DANGER_ZONE"
echo "PIPELINE=$PIPELINE"
echo "BOOSTER_MISSION=$BOOSTER_MISSION"
echo "BOOSTER_RUNTIME=$BOOSTER_RUNTIME"
echo "BLANK_BOOSTER=$BLANK_BOOSTER"
echo "GIT_REPO=$GIT_REPO"
echo "PROJECT_NAME=$PROJECT_NAME"
echo "AUTH_CLIENT_ID=$AUTH_CLIENT_ID"
echo "REPORT_DIR=$REPORT_DIR"
echo "UI_HEADLESS=$UI_HEADLESS"
echo "BEHAVE_DANGER_TAG=$BEHAVE_DANGER_TAG"
echo "OSO_USERNAME=$OSO_USERNAME"
echo "GITHUB_USERNAME=$GITHUB_USERNAME"
echo "GITHUB_PASSWORD=$GITHUB_PASSWORD"
echo "ZABBIX_ENABLED=$ZABBIX_ENABLED"
echo "ZABBIX_SERVER=$ZABBIX_SERVER"
echo "ZABBIX_HOST=$ZABBIX_HOST"
echo "ZABBIX_METRIC_PREFIX=$ZABBIX_METRIC_PREFIX"
if [ -z "$SCENARIO" ]; then
echo "Running all tests ..."
export feature_list=test-scenarios/feature_list
cat test-scenarios/*.test >$feature_list
else
echo "Running test: $SCENARIO ..."
export feature_list=test-scenarios/$SCENARIO.test
fi
#If you want the output in Allure format
CMD="PYTHONDONTWRITEBYTECODE=1 python3 \"$(which behave)\" -v -f allure_behave.formatter:AllureFormatter -o \"$REPORT_DIR\" --tags=\"@osio.regular,${BEHAVE_DANGER_TAG:-~@osio.danger-zone}\" --no-capture --no-capture-stderr @$feature_list"
#If you want the output in default format
#CMD="PYTHONDONTWRITEBYTECODE=1 python3 \"$(which behave)\" -v --tags=\"@osio.regular,${BEHAVE_DANGER_TAG:-~@osio.danger-zone}\" --no-capture --no-capture-stderr @$feature_list"
ZABBIX_TIMESTAMP="$(date +%s)"
export ZABBIX_TIMESTAMP
bash -v -c "$CMD"
TEST_EXIT_CODE=$?
echo "All tests are done!"
echo "Generating allure HTML report"
allure generate --clean -o "$REPORT_DIR/allure-report" "$REPORT_DIR"
./allure-to-zabbix.sh "$REPORT_DIR/allure-report" > "$REPORT_DIR/zabbix-report.txt"
echo "Zabbix report:"
cat "$REPORT_DIR/zabbix-report.txt"
if [ -z "$SCENARIO" ]; then
rm -rvf "$feature_list"
fi
exit $TEST_EXIT_CODE
|
{
"content_hash": "25e5cdd7363b90979358a84b639b7811",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 238,
"avg_line_length": 31.763157894736842,
"alnum_prop": 0.7290803645401823,
"repo_name": "ldimaggi/fabric8-test",
"id": "629765bca45be0f3e4a6bc1e6e3f875074b90de8",
"size": "2427",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "booster_bdd/local_run.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "1493"
},
{
"name": "Gherkin",
"bytes": "3938"
},
{
"name": "Go",
"bytes": "27601"
},
{
"name": "Java",
"bytes": "6903"
},
{
"name": "Python",
"bytes": "283379"
},
{
"name": "Ruby",
"bytes": "8233"
},
{
"name": "Shell",
"bytes": "153894"
},
{
"name": "TypeScript",
"bytes": "172729"
}
],
"symlink_target": ""
}
|
package de.danoeh.antennapod.adapter;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
import java.lang.ref.WeakReference;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.core.glide.ApGlideSettings;
class CoverTarget extends GlideDrawableImageViewTarget {
private final WeakReference<String> fallback;
private final WeakReference<TextView> placeholder;
private final WeakReference<ImageView> cover;
private final WeakReference<MainActivity> mainActivity;
public CoverTarget(String fallbackUri, TextView txtvPlaceholder, ImageView imgvCover, MainActivity activity) {
super(imgvCover);
fallback = new WeakReference<>(fallbackUri);
placeholder = new WeakReference<>(txtvPlaceholder);
cover = new WeakReference<>(imgvCover);
mainActivity = new WeakReference<>(activity);
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
String fallbackUri = fallback.get();
TextView txtvPlaceholder = placeholder.get();
ImageView imgvCover = cover.get();
if (fallbackUri != null && txtvPlaceholder != null && imgvCover != null) {
MainActivity activity = mainActivity.get();
Glide.with(activity)
.load(fallbackUri)
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
.fitCenter()
.dontAnimate()
.into(new CoverTarget(null, txtvPlaceholder, imgvCover, activity));
}
}
@Override
public void onResourceReady(GlideDrawable drawable, GlideAnimation<? super GlideDrawable> anim) {
super.onResourceReady(drawable, anim);
TextView txtvPlaceholder = placeholder.get();
if (txtvPlaceholder != null) {
txtvPlaceholder.setVisibility(View.INVISIBLE);
}
}
}
|
{
"content_hash": "fc1589495ce06010ffe156b78eaee726",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 114,
"avg_line_length": 38.68421052631579,
"alnum_prop": 0.7038548752834467,
"repo_name": "mfietz/AntennaPod",
"id": "ba6e7b25d248c8e6b2e651ab579dfea822c6b7be",
"size": "2205",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "app/src/main/java/de/danoeh/antennapod/adapter/CoverTarget.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "5616"
},
{
"name": "Java",
"bytes": "2321728"
},
{
"name": "Python",
"bytes": "14394"
},
{
"name": "Shell",
"bytes": "508"
}
],
"symlink_target": ""
}
|
<?php
/**
* @file
* Contains \Drupal\Core\Template\TwigExtension.
*
* This provides a Twig extension that registers various Drupal specific
* extensions to Twig.
*
* @see \Drupal\Core\CoreServiceProvider
*/
namespace Drupal\Core\Template;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Drupal\Core\Url;
use Drupal\Core\Utility\LinkGeneratorInterface;
/**
* A class providing Drupal Twig extensions.
*
* Specifically Twig functions, filter and node visitors.
*
* @see \Drupal\Core\CoreServiceProvider
*/
class TwigExtension extends \Twig_Extension {
/**
* The URL generator.
*
* @var \Drupal\Core\Routing\UrlGeneratorInterface
*/
protected $urlGenerator;
/**
* The link generator.
*
* @var \Drupal\Core\Utility\LinkGeneratorInterface
*/
protected $linkGenerator;
/**
* Constructs \Drupal\Core\Template\TwigExtension.
*
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
* The URL generator.
*/
public function setGenerators(UrlGeneratorInterface $url_generator) {
$this->urlGenerator = $url_generator;
return $this;
}
/**
* Sets the link generator.
*
* @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator
* The link generator.
*
* @return $this
*/
public function setLinkGenerator(LinkGeneratorInterface $link_generator) {
$this->linkGenerator = $link_generator;
return $this;
}
/**
* {@inheritdoc}
*/
public function getFunctions() {
return array(
// This function will receive a renderable array, if an array is detected.
new \Twig_SimpleFunction('render_var', 'twig_render_var'),
// The url and path function are defined in close parallel to those found
// in \Symfony\Bridge\Twig\Extension\RoutingExtension
new \Twig_SimpleFunction('url', array($this, 'getUrl'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))),
new \Twig_SimpleFunction('path', array($this, 'getPath'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))),
new \Twig_SimpleFunction('url_from_path', array($this, 'getUrlFromPath'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))),
new \Twig_SimpleFunction('link', array($this, 'getLink')),
);
}
/**
* {@inheritdoc}
*/
public function getFilters() {
return array(
// Translation filters.
new \Twig_SimpleFilter('t', 't', array('is_safe' => array('html'))),
new \Twig_SimpleFilter('trans', 't', array('is_safe' => array('html'))),
// The "raw" filter is not detectable when parsing "trans" tags. To detect
// which prefix must be used for translation (@, !, %), we must clone the
// "raw" filter and give it identifiable names. These filters should only
// be used in "trans" tags.
// @see TwigNodeTrans::compileString()
new \Twig_SimpleFilter('passthrough', 'twig_raw_filter', array('is_safe' => array('html'))),
new \Twig_SimpleFilter('placeholder', 'twig_raw_filter', array('is_safe' => array('html'))),
// Replace twig's escape filter with our own.
new \Twig_SimpleFilter('drupal_escape', 'twig_drupal_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')),
// Implements safe joining.
// @todo Make that the default for |join? Upstream issue:
// https://github.com/fabpot/Twig/issues/1420
new \Twig_SimpleFilter('safe_join', 'twig_drupal_join_filter', array('is_safe' => array('html'))),
// Array filters.
new \Twig_SimpleFilter('without', 'twig_without'),
// CSS class and ID filters.
new \Twig_SimpleFilter('clean_class', '\Drupal\Component\Utility\Html::getClass'),
new \Twig_SimpleFilter('clean_id', 'drupal_clean_id_identifier'),
);
}
/**
* {@inheritdoc}
*/
public function getNodeVisitors() {
// The node visitor is needed to wrap all variables with
// render_var -> twig_render_var() function.
return array(
new TwigNodeVisitor(),
);
}
/**
* {@inheritdoc}
*/
public function getTokenParsers() {
return array(
new TwigTransTokenParser(),
);
}
/**
* {@inheritdoc}
*/
public function getName() {
return 'drupal_core';
}
/**
* Generates a URL path given a route name and parameters.
*
* @param $name
* The name of the route.
* @param array $parameters
* An associative array of route parameters names and values.
* @param array $options
* (optional) An associative array of additional options. The 'absolute'
* option is forced to be FALSE.
* @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute().
*
* @return string
* The generated URL path (relative URL) for the given route.
*/
public function getPath($name, $parameters = array(), $options = array()) {
$options['absolute'] = FALSE;
return $this->urlGenerator->generateFromRoute($name, $parameters, $options);
}
/**
* Generates an absolute URL given a route name and parameters.
*
* @param $name
* The name of the route.
* @param array $parameters
* An associative array of route parameter names and values.
* @param array $options
* (optional) An associative array of additional options. The 'absolute'
* option is forced to be TRUE.
*
* @return string
* The generated absolute URL for the given route.
*
* @todo Add an option for scheme-relative URLs.
*/
public function getUrl($name, $parameters = array(), $options = array()) {
$options['absolute'] = TRUE;
return $this->urlGenerator->generateFromRoute($name, $parameters, $options);
}
/**
* Generates an absolute URL given a path.
*
* @param string $path
* The path.
* @param array $options
* (optional) An associative array of additional options. The 'absolute'
* option is forced to be TRUE.
*
* @return string
* The generated absolute URL for the given path.
*/
public function getUrlFromPath($path, $options = array()) {
$options['absolute'] = TRUE;
return $this->urlGenerator->generateFromPath($path, $options);
}
/**
* Gets a rendered link from an url object.
*
* @param string $text
* The link text for the anchor tag as a translated string.
* @param \Drupal\Core\Url|string $url
* The URL object or string used for the link.
*
* @return string
* An HTML string containing a link to the given url.
*/
public function getLink($text, $url) {
if (!$url instanceof Url) {
$url = Url::fromUri($url);
}
return $this->linkGenerator->generate($text, $url);
}
/**
* Determines at compile time whether the generated URL will be safe.
*
* Saves the unneeded automatic escaping for performance reasons.
*
* The URL generation process percent encodes non-alphanumeric characters.
* Thus, the only character within an URL that must be escaped in HTML is the
* ampersand ("&") which separates query params. Thus we cannot mark
* the generated URL as always safe, but only when we are sure there won't be
* multiple query params. This is the case when there are none or only one
* constant parameter given. E.g. we know beforehand this will not need to
* be escaped:
* - path('route')
* - path('route', {'param': 'value'})
* But the following may need to be escaped:
* - path('route', var)
* - path('route', {'param': ['val1', 'val2'] }) // a sub-array
* - path('route', {'param1': 'value1', 'param2': 'value2'})
* If param1 and param2 reference placeholders in the route, it would not
* need to be escaped, but we don't know that in advance.
*
* @param \Twig_Node $args_node
* The arguments of the path/url functions.
*
* @return array
* An array with the contexts the URL is safe
*/
public function isUrlGenerationSafe(\Twig_Node $args_node) {
// Support named arguments.
$parameter_node = $args_node->hasNode('parameters') ? $args_node->getNode('parameters') : ($args_node->hasNode(1) ? $args_node->getNode(1) : NULL);
if (!isset($parameter_node) || $parameter_node instanceof \Twig_Node_Expression_Array && count($parameter_node) <= 2 &&
(!$parameter_node->hasNode(1) || $parameter_node->getNode(1) instanceof \Twig_Node_Expression_Constant)) {
return array('html');
}
return array();
}
}
|
{
"content_hash": "20ff6a1b6393d87299e088c12b79ba7d",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 163,
"avg_line_length": 32.961089494163424,
"alnum_prop": 0.6515169401487427,
"repo_name": "ital-lion/Drupal4Lions",
"id": "511cefb9327c5c35c131263d7013074dd0e49370",
"size": "8471",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "core/lib/Drupal/Core/Template/TwigExtension.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "280823"
},
{
"name": "JavaScript",
"bytes": "742500"
},
{
"name": "PHP",
"bytes": "20371861"
},
{
"name": "Shell",
"bytes": "70992"
}
],
"symlink_target": ""
}
|
package io.futuristic.function;
/**
* @autor: julio
*/
public interface FunctionWithException<T, R> {
/**
* Applies this function to the given argument.
*
* @param t the function argument
* @return the function result
*/
R apply(T t) throws Exception;
}
|
{
"content_hash": "f95a4720f8bfcb22ffbf6ecd8f7c5f4d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 51,
"avg_line_length": 19.4,
"alnum_prop": 0.6288659793814433,
"repo_name": "julman99/futuristic",
"id": "9a086c7efaf37a04674adb4bc4074992067adfe1",
"size": "291",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "futuristic-core/src/main/java/io/futuristic/function/FunctionWithException.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "84445"
}
],
"symlink_target": ""
}
|
using System.Linq;
using RimWorld;
using UnityEngine;
using Verse;
namespace RWP
{
public class Designator_ForcedRepair : Designator
{
public Designator_ForcedRepair()
{
this.defaultLabel = "Designator_ForcedRepair".Translate();
this.defaultDesc = "Designator_ForcedRepairDesc".Translate();
this.icon = ContentFinder<Texture2D>.Get("Designations/ForcedRepair", true);
this.soundDragSustain = SoundDefOf.DesignateDragStandard;
this.soundDragChanged = SoundDefOf.DesignateDragStandardChanged;
this.useMouseIcon = true;
this.soundSucceeded = SoundDefOf.DesignateDeconstruct; //Test for appropriate sound
this.hotKey = KeyBindingDef.Named("DesignatorForcedRepair");
}
public override AcceptanceReport CanDesignateCell(IntVec3 c)
{
if (!c.InBounds(base.Map))
{
return false;
}
if (c.Fogged(base.Map))
{
return false;
}
var thingList = base.Map.thingGrid.ThingsAt(c);
if (!(thingList.Any(t => CanDesignateThing(t).Accepted)))
{
return false;
}
return true;
}
public override void DesignateSingleCell(IntVec3 loc)
{
foreach (Thing building in base.Map.thingGrid.ThingsAt(loc))
{
if (this.CanDesignateThing(building).Accepted)
{
this.DesignateThing(building);
}
}
}
public override void DesignateThing(Thing t)
{
base.Map.designationManager.AddDesignation(new Designation(t, Settings.DefOf_RWP_ForcedRepair));
}
public override AcceptanceReport CanDesignateThing(Thing t)
{
if (!(base.Map.listerBuildingsRepairable.RepairableBuildings(Faction.OfPlayer).Contains(t)))
{
return false;
}
if (!(t.HitPoints < t.MaxHitPoints))
{
return false;
}
if (base.Map.designationManager.DesignationOn(t, DesignationDefOf.Deconstruct) != null)
{
return false;
}
if (base.Map.designationManager.DesignationOn(t, DesignationDefOf.Uninstall) != null)
{
return false;
}
if (base.Map.designationManager.DesignationOn(t, Settings.DefOf_RWP_ForcedRepair) != null)
{
return false;
}
return true;
}
public override int DraggableDimensions
{
get
{
return 2;
}
}
public override void SelectedUpdate()
{
GenUI.RenderMouseoverBracket();
}
}
}
|
{
"content_hash": "e77aeaad6a7ec8af2c390f68ab3305ef",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 99,
"avg_line_length": 21.844660194174757,
"alnum_prop": 0.7,
"repo_name": "DingoDjango/RefactoredWorkPriorities",
"id": "1105e6bcadf121a587c86951a00c51381a1646dc",
"size": "2252",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Designator_ForcedRepair.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "14599"
}
],
"symlink_target": ""
}
|
#include "OpDumper.h"
#include "RecordedOp.h"
namespace android {
namespace uirenderer {
#define STRINGIFY(n) #n,
static const char* sOpNameLut[] = BUILD_FULL_OP_LUT(STRINGIFY);
void OpDumper::dump(const RecordedOp& op, std::ostream& output, int level) {
for (int i = 0; i < level; i++) {
output << " ";
}
Rect localBounds(op.unmappedBounds);
op.localMatrix.mapRect(localBounds);
output << sOpNameLut[op.opId] << " " << localBounds;
if (op.localClip
&& (!op.localClip->rect.contains(localBounds) || op.localClip->intersectWithRoot)) {
output << std::fixed << std::setprecision(0)
<< " clip=" << op.localClip->rect
<< " mode=" << (int)op.localClip->mode;
if (op.localClip->intersectWithRoot) {
output << " iwr";
}
}
}
const char* OpDumper::opName(const RecordedOp& op) {
return sOpNameLut[op.opId];
}
} // namespace uirenderer
} // namespace android
|
{
"content_hash": "e329f4859dc17400a8abf0c75ab60074",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 96,
"avg_line_length": 25.025641025641026,
"alnum_prop": 0.6034836065573771,
"repo_name": "xorware/android_frameworks_base",
"id": "ec9ffdeebb4c766a260aed1399f47012d48ce5ba",
"size": "1595",
"binary": false,
"copies": "1",
"ref": "refs/heads/n",
"path": "libs/hwui/OpDumper.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "167132"
},
{
"name": "C++",
"bytes": "7092455"
},
{
"name": "GLSL",
"bytes": "20654"
},
{
"name": "HTML",
"bytes": "224185"
},
{
"name": "Java",
"bytes": "78926513"
},
{
"name": "Makefile",
"bytes": "420231"
},
{
"name": "Python",
"bytes": "42309"
},
{
"name": "RenderScript",
"bytes": "153826"
},
{
"name": "Shell",
"bytes": "21079"
}
],
"symlink_target": ""
}
|
using content::SiteInstance;
static const int kReadFilePermissions =
base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_EXCLUSIVE_READ |
base::PLATFORM_FILE_ASYNC;
static const int kEnumerateDirectoryPermissions =
kReadFilePermissions |
base::PLATFORM_FILE_ENUMERATE;
// The SecurityState class is used to maintain per-child process security state
// information.
class ChildProcessSecurityPolicy::SecurityState {
public:
SecurityState()
: enabled_bindings_(0),
can_read_raw_cookies_(false) { }
~SecurityState() {
scheme_policy_.clear();
UMA_HISTOGRAM_COUNTS("ChildProcessSecurityPolicy.PerChildFilePermissions",
file_permissions_.size());
}
// Grant permission to request URLs with the specified scheme.
void GrantScheme(const std::string& scheme) {
scheme_policy_[scheme] = true;
}
// Revoke permission to request URLs with the specified scheme.
void RevokeScheme(const std::string& scheme) {
scheme_policy_[scheme] = false;
}
// Grant certain permissions to a file.
void GrantPermissionsForFile(const FilePath& file, int permissions) {
FilePath stripped = file.StripTrailingSeparators();
file_permissions_[stripped] |= permissions;
UMA_HISTOGRAM_COUNTS("ChildProcessSecurityPolicy.FilePermissionPathLength",
stripped.value().size());
}
// Revokes all permissions granted to a file.
void RevokeAllPermissionsForFile(const FilePath& file) {
file_permissions_.erase(file.StripTrailingSeparators());
}
void GrantBindings(int bindings) {
enabled_bindings_ |= bindings;
}
void GrantReadRawCookies() {
can_read_raw_cookies_ = true;
}
void RevokeReadRawCookies() {
can_read_raw_cookies_ = false;
}
// Determine whether permission has been granted to request url.
// Schemes that have not been granted default to being denied.
bool CanRequestURL(const GURL& url) {
SchemeMap::const_iterator judgment(scheme_policy_.find(url.scheme()));
if (judgment == scheme_policy_.end())
return false; // Unmentioned schemes are disallowed.
return judgment->second;
}
// Determine if the certain permissions have been granted to a file.
bool HasPermissionsForFile(const FilePath& file, int permissions) {
FilePath current_path = file.StripTrailingSeparators();
FilePath last_path;
while (current_path != last_path) {
if (file_permissions_.find(current_path) != file_permissions_.end())
return (file_permissions_[current_path] & permissions) == permissions;
last_path = current_path;
current_path = current_path.DirName();
}
return false;
}
bool CanUseCookiesForOrigin(const GURL& gurl) {
if (origin_lock_.is_empty())
return true;
GURL site_gurl = SiteInstanceImpl::GetSiteForURL(NULL, gurl);
return origin_lock_ == site_gurl;
}
void LockToOrigin(const GURL& gurl) {
origin_lock_ = gurl;
}
bool has_web_ui_bindings() const {
return enabled_bindings_ & content::BINDINGS_POLICY_WEB_UI;
}
bool can_read_raw_cookies() const {
return can_read_raw_cookies_;
}
private:
typedef std::map<std::string, bool> SchemeMap;
typedef std::map<FilePath, int> FileMap; // bit-set of PlatformFileFlags
// Maps URL schemes to whether permission has been granted or revoked:
// |true| means the scheme has been granted.
// |false| means the scheme has been revoked.
// If a scheme is not present in the map, then it has never been granted
// or revoked.
SchemeMap scheme_policy_;
// The set of files the child process is permited to upload to the web.
FileMap file_permissions_;
int enabled_bindings_;
bool can_read_raw_cookies_;
GURL origin_lock_;
DISALLOW_COPY_AND_ASSIGN(SecurityState);
};
ChildProcessSecurityPolicy::ChildProcessSecurityPolicy() {
// We know about these schemes and believe them to be safe.
RegisterWebSafeScheme(chrome::kHttpScheme);
RegisterWebSafeScheme(chrome::kHttpsScheme);
RegisterWebSafeScheme(chrome::kFtpScheme);
RegisterWebSafeScheme(chrome::kDataScheme);
RegisterWebSafeScheme("feed");
RegisterWebSafeScheme(chrome::kBlobScheme);
RegisterWebSafeScheme(chrome::kFileSystemScheme);
// We know about the following pseudo schemes and treat them specially.
RegisterPseudoScheme(chrome::kAboutScheme);
RegisterPseudoScheme(chrome::kJavaScriptScheme);
RegisterPseudoScheme(chrome::kViewSourceScheme);
}
ChildProcessSecurityPolicy::~ChildProcessSecurityPolicy() {
web_safe_schemes_.clear();
pseudo_schemes_.clear();
STLDeleteContainerPairSecondPointers(security_state_.begin(),
security_state_.end());
security_state_.clear();
}
// static
ChildProcessSecurityPolicy* ChildProcessSecurityPolicy::GetInstance() {
return Singleton<ChildProcessSecurityPolicy>::get();
}
void ChildProcessSecurityPolicy::Add(int child_id) {
base::AutoLock lock(lock_);
AddChild(child_id);
}
void ChildProcessSecurityPolicy::AddWorker(int child_id,
int main_render_process_id) {
base::AutoLock lock(lock_);
AddChild(child_id);
worker_map_[child_id] = main_render_process_id;
}
void ChildProcessSecurityPolicy::Remove(int child_id) {
base::AutoLock lock(lock_);
if (!security_state_.count(child_id))
return; // May be called multiple times.
delete security_state_[child_id];
security_state_.erase(child_id);
worker_map_.erase(child_id);
}
void ChildProcessSecurityPolicy::RegisterWebSafeScheme(
const std::string& scheme) {
base::AutoLock lock(lock_);
DCHECK(web_safe_schemes_.count(scheme) == 0) << "Add schemes at most once.";
DCHECK(pseudo_schemes_.count(scheme) == 0) << "Web-safe implies not pseudo.";
web_safe_schemes_.insert(scheme);
}
bool ChildProcessSecurityPolicy::IsWebSafeScheme(const std::string& scheme) {
base::AutoLock lock(lock_);
return (web_safe_schemes_.find(scheme) != web_safe_schemes_.end());
}
void ChildProcessSecurityPolicy::RegisterPseudoScheme(
const std::string& scheme) {
base::AutoLock lock(lock_);
DCHECK(pseudo_schemes_.count(scheme) == 0) << "Add schemes at most once.";
DCHECK(web_safe_schemes_.count(scheme) == 0) <<
"Pseudo implies not web-safe.";
pseudo_schemes_.insert(scheme);
}
bool ChildProcessSecurityPolicy::IsPseudoScheme(const std::string& scheme) {
base::AutoLock lock(lock_);
return (pseudo_schemes_.find(scheme) != pseudo_schemes_.end());
}
void ChildProcessSecurityPolicy::RegisterDisabledSchemes(
const std::set<std::string>& schemes) {
base::AutoLock lock(lock_);
disabled_schemes_ = schemes;
}
bool ChildProcessSecurityPolicy::IsDisabledScheme(const std::string& scheme) {
base::AutoLock lock(lock_);
return disabled_schemes_.find(scheme) != disabled_schemes_.end();
}
void ChildProcessSecurityPolicy::GrantRequestURL(
int child_id, const GURL& url) {
if (!url.is_valid())
return; // Can't grant the capability to request invalid URLs.
if (IsWebSafeScheme(url.scheme()))
return; // The scheme has already been whitelisted for every child process.
if (IsPseudoScheme(url.scheme())) {
// The view-source scheme is a special case of a pseudo-URL that eventually
// results in requesting its embedded URL.
if (url.SchemeIs(chrome::kViewSourceScheme)) {
// URLs with the view-source scheme typically look like:
// view-source:http://www.google.com/a
// In order to request these URLs, the child_id needs to be able to
// request the embedded URL.
GrantRequestURL(child_id, GURL(url.path()));
}
return; // Can't grant the capability to request pseudo schemes.
}
{
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return;
// If the child process has been commanded to request a scheme, then we
// grant it the capability to request URLs of that scheme.
state->second->GrantScheme(url.scheme());
}
}
void ChildProcessSecurityPolicy::GrantReadFile(int child_id,
const FilePath& file) {
GrantPermissionsForFile(child_id, file, kReadFilePermissions);
}
void ChildProcessSecurityPolicy::GrantReadDirectory(int child_id,
const FilePath& directory) {
GrantPermissionsForFile(child_id, directory, kEnumerateDirectoryPermissions);
}
void ChildProcessSecurityPolicy::GrantPermissionsForFile(
int child_id, const FilePath& file, int permissions) {
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return;
state->second->GrantPermissionsForFile(file, permissions);
}
void ChildProcessSecurityPolicy::RevokeAllPermissionsForFile(
int child_id, const FilePath& file) {
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return;
state->second->RevokeAllPermissionsForFile(file);
}
void ChildProcessSecurityPolicy::GrantScheme(int child_id,
const std::string& scheme) {
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return;
state->second->GrantScheme(scheme);
}
void ChildProcessSecurityPolicy::RevokeScheme(int child_id,
const std::string& scheme) {
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end()) {
return;
}
state->second->RevokeScheme(scheme);
}
void ChildProcessSecurityPolicy::GrantWebUIBindings(int child_id) {
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return;
state->second->GrantBindings(content::BINDINGS_POLICY_WEB_UI);
// Web UI bindings need the ability to request chrome: URLs.
state->second->GrantScheme(chrome::kChromeUIScheme);
// Web UI pages can contain links to file:// URLs.
state->second->GrantScheme(chrome::kFileScheme);
}
void ChildProcessSecurityPolicy::GrantReadRawCookies(int child_id) {
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return;
state->second->GrantReadRawCookies();
}
void ChildProcessSecurityPolicy::RevokeReadRawCookies(int child_id) {
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return;
state->second->RevokeReadRawCookies();
}
bool ChildProcessSecurityPolicy::CanRequestURL(
int child_id, const GURL& url) {
if (!url.is_valid())
return false; // Can't request invalid URLs.
if (IsDisabledScheme(url.scheme()))
return false; // The scheme is disabled by policy.
if (IsWebSafeScheme(url.scheme()))
return true; // The scheme has been white-listed for every child process.
if (IsPseudoScheme(url.scheme())) {
// There are a number of special cases for pseudo schemes.
if (url.SchemeIs(chrome::kViewSourceScheme)) {
// A view-source URL is allowed if the child process is permitted to
// request the embedded URL. Careful to avoid pointless recursion.
GURL child_url(url.path());
if (child_url.SchemeIs(chrome::kViewSourceScheme) &&
url.SchemeIs(chrome::kViewSourceScheme))
return false;
return CanRequestURL(child_id, child_url);
}
if (LowerCaseEqualsASCII(url.spec(), chrome::kAboutBlankURL))
return true; // Every child process can request <about:blank>.
// URLs like <about:memory> and <about:crash> shouldn't be requestable by
// any child process. Also, this case covers <javascript:...>, which should
// be handled internally by the process and not kicked up to the browser.
return false;
}
if (!content::GetContentClient()->browser()->IsHandledURL(url) &&
!net::URLRequest::IsHandledURL(url)) {
return true; // This URL request is destined for ShellExecute.
}
{
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return false;
// Otherwise, we consult the child process's security state to see if it is
// allowed to request the URL.
return state->second->CanRequestURL(url);
}
}
bool ChildProcessSecurityPolicy::CanReadFile(int child_id,
const FilePath& file) {
return HasPermissionsForFile(child_id, file, kReadFilePermissions);
}
bool ChildProcessSecurityPolicy::CanReadDirectory(int child_id,
const FilePath& directory) {
return HasPermissionsForFile(child_id,
directory,
kEnumerateDirectoryPermissions);
}
bool ChildProcessSecurityPolicy::HasPermissionsForFile(
int child_id, const FilePath& file, int permissions) {
base::AutoLock lock(lock_);
bool result = ChildProcessHasPermissionsForFile(child_id, file, permissions);
if (!result) {
// If this is a worker thread that has no access to a given file,
// let's check that its renderer process has access to that file instead.
WorkerToMainProcessMap::iterator iter = worker_map_.find(child_id);
if (iter != worker_map_.end() && iter->second != 0) {
result = ChildProcessHasPermissionsForFile(iter->second,
file,
permissions);
}
}
return result;
}
bool ChildProcessSecurityPolicy::HasWebUIBindings(int child_id) {
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return false;
return state->second->has_web_ui_bindings();
}
bool ChildProcessSecurityPolicy::CanReadRawCookies(int child_id) {
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return false;
return state->second->can_read_raw_cookies();
}
void ChildProcessSecurityPolicy::AddChild(int child_id) {
if (security_state_.count(child_id) != 0) {
NOTREACHED() << "Add child process at most once.";
return;
}
security_state_[child_id] = new SecurityState();
}
bool ChildProcessSecurityPolicy::ChildProcessHasPermissionsForFile(
int child_id, const FilePath& file, int permissions) {
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return false;
return state->second->HasPermissionsForFile(file, permissions);
}
bool ChildProcessSecurityPolicy::CanUseCookiesForOrigin(int child_id,
const GURL& gurl) {
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return false;
return state->second->CanUseCookiesForOrigin(gurl);
}
void ChildProcessSecurityPolicy::LockToOrigin(int child_id, const GURL& gurl) {
// "gurl" can be currently empty in some cases, such as file://blah.
DCHECK(SiteInstanceImpl::GetSiteForURL(NULL, gurl) == gurl);
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
DCHECK(state != security_state_.end());
state->second->LockToOrigin(gurl);
}
|
{
"content_hash": "f6b474c5400fb9510ae02d55dad26ce7",
"timestamp": "",
"source": "github",
"line_count": 482,
"max_line_length": 80,
"avg_line_length": 32.68879668049792,
"alnum_prop": 0.6891977659304392,
"repo_name": "paul99/clank",
"id": "4111082194f3ac322a3fcf6982386f80a6742aab",
"size": "16446",
"binary": false,
"copies": "1",
"ref": "refs/heads/chrome-18.0.1025.469",
"path": "content/browser/child_process_security_policy.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "56689"
},
{
"name": "C",
"bytes": "8707669"
},
{
"name": "C++",
"bytes": "89569069"
},
{
"name": "Go",
"bytes": "10440"
},
{
"name": "Java",
"bytes": "1201391"
},
{
"name": "JavaScript",
"bytes": "5587454"
},
{
"name": "Lua",
"bytes": "13641"
},
{
"name": "Objective-C",
"bytes": "4568468"
},
{
"name": "PHP",
"bytes": "11278"
},
{
"name": "Perl",
"bytes": "51521"
},
{
"name": "Python",
"bytes": "2615443"
},
{
"name": "R",
"bytes": "262"
},
{
"name": "Ruby",
"bytes": "107"
},
{
"name": "Scheme",
"bytes": "10604"
},
{
"name": "Shell",
"bytes": "588836"
}
],
"symlink_target": ""
}
|
/*global describe: true, expect: true, it: true, jasmine: true */
describe("@constant tag", function() {
var docSet = jasmine.getDocSetFromFile('test/fixtures/constanttag.js');
var FOO = docSet.getByLongname('FOO')[0];
var BAR = docSet.getByLongname('BAR')[0];
var BAZ = docSet.getByLongname('BAZ')[0];
var QUX = docSet.getByLongname('QUX')[0];
var SOCKET = docSet.getByLongname('SOCKET')[0];
var ROCKET = docSet.getByLongname('ROCKET')[0];
it("sets the doclet's 'kind' property to 'constant'", function() {
expect(FOO).toBeDefined();
expect(FOO.kind).toBe('constant');
expect(BAR).toBeDefined();
expect(BAR.kind).toBe('constant');
expect(BAZ).toBeDefined();
expect(BAZ.kind).toBe('constant');
expect(QUX).toBeDefined();
expect(QUX.kind).toBe('constant');
expect(SOCKET).toBeDefined();
expect(SOCKET.kind).toBe('constant');
expect(ROCKET).toBeDefined();
expect(ROCKET.kind).toBe('constant');
});
it("If used as a standalone, takes the name from the code", function() {
expect(FOO.name).toBe('FOO');
});
it("If used with just a name, sets the doclet's name to that", function() {
expect(BAR.name).toBe('BAR');
});
it("If used with a name and a type, sets the doclet's name and type appropriately", function() {
expect(BAZ.name).toBe('BAZ');
expect(typeof BAZ.type).toBe('object');
expect(BAZ.type.names).toBeDefined();
expect(BAZ.type.names.length).toBe(1);
expect(BAZ.type.names[0]).toBe('string');
});
it("If used with just a type, adds the type and takes the name from the code", function() {
expect(QUX.name).toBe('QUX');
expect(typeof QUX.type).toBe('object');
expect(QUX.type.names).toBeDefined();
expect(QUX.type.names.length).toBe(1);
expect(QUX.type.names[0]).toBe('number');
});
it("If used with a name and type, ignores the name in the code", function() {
expect(SOCKET.name).toBe('SOCKET');
expect(typeof SOCKET.type).toBe('object');
expect(SOCKET.type.names).toBeDefined();
expect(SOCKET.type.names.length).toBe(1);
expect(SOCKET.type.names[0]).toBe('Object');
});
it("If used with just a name, ignores the name in the code", function() {
expect(ROCKET.name).toBe('ROCKET');
});
});
|
{
"content_hash": "e1a759557116e3b2b14579b58fc185f3",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 100,
"avg_line_length": 37.833333333333336,
"alnum_prop": 0.5947136563876652,
"repo_name": "rodrigoramos/shaka-player",
"id": "e55778b6b2228f3aadb659219a21b024db9ffd61",
"size": "2497",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "third_party/jsdoc/test/specs/tags/constanttag.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "139"
},
{
"name": "CSS",
"bytes": "6475"
},
{
"name": "HTML",
"bytes": "114269"
},
{
"name": "JavaScript",
"bytes": "918945"
},
{
"name": "Python",
"bytes": "3656"
},
{
"name": "Shell",
"bytes": "10958"
}
],
"symlink_target": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.