text stringlengths 2 1.04M | meta dict |
|---|---|
package storage
import (
"github.com/docker/distribution"
"github.com/docker/distribution/context"
"github.com/docker/distribution/reference"
"github.com/docker/distribution/registry/storage/cache"
storagedriver "github.com/docker/distribution/registry/storage/driver"
)
// registry is the top-level implementation of Registry for use in the storage
// package. All instances should descend from this object.
type registry struct {
blobStore *blobStore
blobServer *blobServer
statter *blobStatter // global statter service.
blobDescriptorCacheProvider cache.BlobDescriptorCacheProvider
deleteEnabled bool
resumableDigestEnabled bool
}
// RegistryOption is the type used for functional options for NewRegistry.
type RegistryOption func(*registry) error
// EnableRedirect is a functional option for NewRegistry. It causes the backend
// blob server to attempt using (StorageDriver).URLFor to serve all blobs.
func EnableRedirect(registry *registry) error {
registry.blobServer.redirect = true
return nil
}
// EnableDelete is a functional option for NewRegistry. It enables deletion on
// the registry.
func EnableDelete(registry *registry) error {
registry.deleteEnabled = true
return nil
}
// DisableDigestResumption is a functional option for NewRegistry. It should be
// used if the registry is acting as a caching proxy.
func DisableDigestResumption(registry *registry) error {
registry.resumableDigestEnabled = false
return nil
}
// BlobDescriptorCacheProvider returns a functional option for
// NewRegistry. It creates a cached blob statter for use by the
// registry.
func BlobDescriptorCacheProvider(blobDescriptorCacheProvider cache.BlobDescriptorCacheProvider) RegistryOption {
// TODO(aaronl): The duplication of statter across several objects is
// ugly, and prevents us from using interface types in the registry
// struct. Ideally, blobStore and blobServer should be lazily
// initialized, and use the current value of
// blobDescriptorCacheProvider.
return func(registry *registry) error {
if blobDescriptorCacheProvider != nil {
statter := cache.NewCachedBlobStatter(blobDescriptorCacheProvider, registry.statter)
registry.blobStore.statter = statter
registry.blobServer.statter = statter
registry.blobDescriptorCacheProvider = blobDescriptorCacheProvider
}
return nil
}
}
// NewRegistry creates a new registry instance from the provided driver. The
// resulting registry may be shared by multiple goroutines but is cheap to
// allocate. If the Redirect option is specified, the backend blob server will
// attempt to use (StorageDriver).URLFor to serve all blobs.
func NewRegistry(ctx context.Context, driver storagedriver.StorageDriver, options ...RegistryOption) (distribution.Namespace, error) {
// create global statter
statter := &blobStatter{
driver: driver,
}
bs := &blobStore{
driver: driver,
statter: statter,
}
registry := ®istry{
blobStore: bs,
blobServer: &blobServer{
driver: driver,
statter: statter,
pathFn: bs.path,
},
statter: statter,
resumableDigestEnabled: true,
}
for _, option := range options {
if err := option(registry); err != nil {
return nil, err
}
}
return registry, nil
}
// Scope returns the namespace scope for a registry. The registry
// will only serve repositories contained within this scope.
func (reg *registry) Scope() distribution.Scope {
return distribution.GlobalScope
}
// Repository returns an instance of the repository tied to the registry.
// Instances should not be shared between goroutines but are cheap to
// allocate. In general, they should be request scoped.
func (reg *registry) Repository(ctx context.Context, canonicalName string) (distribution.Repository, error) {
if _, err := reference.ParseNamed(canonicalName); err != nil {
return nil, distribution.ErrRepositoryNameInvalid{
Name: canonicalName,
Reason: err,
}
}
var descriptorCache distribution.BlobDescriptorService
if reg.blobDescriptorCacheProvider != nil {
var err error
descriptorCache, err = reg.blobDescriptorCacheProvider.RepositoryScoped(canonicalName)
if err != nil {
return nil, err
}
}
return &repository{
ctx: ctx,
registry: reg,
name: canonicalName,
descriptorCache: descriptorCache,
}, nil
}
// repository provides name-scoped access to various services.
type repository struct {
*registry
ctx context.Context
name string
descriptorCache distribution.BlobDescriptorService
}
// Name returns the name of the repository.
func (repo *repository) Name() string {
return repo.name
}
func (repo *repository) Tags(ctx context.Context) distribution.TagService {
tags := &tagStore{
repository: repo,
blobStore: repo.registry.blobStore,
}
return tags
}
// Manifests returns an instance of ManifestService. Instantiation is cheap and
// may be context sensitive in the future. The instance should be used similar
// to a request local.
func (repo *repository) Manifests(ctx context.Context, options ...distribution.ManifestServiceOption) (distribution.ManifestService, error) {
manifestLinkPathFns := []linkPathFunc{
// NOTE(stevvooe): Need to search through multiple locations since
// 2.1.0 unintentionally linked into _layers.
manifestRevisionLinkPath,
blobLinkPath,
}
blobStore := &linkedBlobStore{
ctx: ctx,
blobStore: repo.blobStore,
repository: repo,
deleteEnabled: repo.registry.deleteEnabled,
blobAccessController: &linkedBlobStatter{
blobStore: repo.blobStore,
repository: repo,
linkPathFns: manifestLinkPathFns,
},
// TODO(stevvooe): linkPath limits this blob store to only
// manifests. This instance cannot be used for blob checks.
linkPathFns: manifestLinkPathFns,
}
ms := &manifestStore{
ctx: ctx,
repository: repo,
blobStore: blobStore,
schema1Handler: &signedManifestHandler{
ctx: ctx,
repository: repo,
blobStore: blobStore,
signatures: &signatureStore{
ctx: ctx,
repository: repo,
blobStore: repo.blobStore,
},
},
schema2Handler: &schema2ManifestHandler{
ctx: ctx,
repository: repo,
blobStore: blobStore,
},
manifestListHandler: &manifestListHandler{
ctx: ctx,
repository: repo,
blobStore: blobStore,
},
}
// Apply options
for _, option := range options {
err := option.Apply(ms)
if err != nil {
return nil, err
}
}
return ms, nil
}
// Blobs returns an instance of the BlobStore. Instantiation is cheap and
// may be context sensitive in the future. The instance should be used similar
// to a request local.
func (repo *repository) Blobs(ctx context.Context) distribution.BlobStore {
var statter distribution.BlobDescriptorService = &linkedBlobStatter{
blobStore: repo.blobStore,
repository: repo,
linkPathFns: []linkPathFunc{blobLinkPath},
}
if repo.descriptorCache != nil {
statter = cache.NewCachedBlobStatter(repo.descriptorCache, statter)
}
return &linkedBlobStore{
registry: repo.registry,
blobStore: repo.blobStore,
blobServer: repo.blobServer,
blobAccessController: statter,
repository: repo,
ctx: ctx,
// TODO(stevvooe): linkPath limits this blob store to only layers.
// This instance cannot be used for manifest checks.
linkPathFns: []linkPathFunc{blobLinkPath},
deleteEnabled: repo.registry.deleteEnabled,
resumableDigestEnabled: repo.resumableDigestEnabled,
}
}
| {
"content_hash": "e7a7bd94f6f81b1468ea3e35b40c1bde",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 141,
"avg_line_length": 30.674698795180724,
"alnum_prop": 0.730688661953391,
"repo_name": "BrickXu/distribution",
"id": "869895dd922ccbe307939de36dbdfaa5e515af87",
"size": "7638",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "registry/storage/registry.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "1189666"
},
{
"name": "Makefile",
"bytes": "2285"
},
{
"name": "Nginx",
"bytes": "1198"
},
{
"name": "Shell",
"bytes": "14125"
}
],
"symlink_target": ""
} |
import argparse
import os
import glyphsLib
def glyphs_files(directory):
for root, _dirs, files in os.walk(directory):
for filename in files:
if filename.endswith(".glyphs"):
yield os.path.join(root, filename)
def main():
parser = argparse.ArgumentParser(
"Translate all .glyphs files into UFO+designspace in the specified directories."
)
parser.add_argument(
"-o", "--out", metavar="OUTPUT_DIR", default="ufos", help="Output directory"
)
parser.add_argument("directories", nargs="*")
args = parser.parse_args()
for directory in args.directories:
files = glyphs_files(directory)
for filename in files:
try:
# Code for glyphsLib with roundtrip
from glyphsLib.builder import to_designspace
font = glyphsLib.GSFont(filename)
designspace = to_designspace(font)
dsname = font.familyName.replace(" ", "") + ".designspace"
designspace.write(os.path.join(args.out, dsname))
except ImportError:
# This is the version that works with glyphsLib 2.1.0
glyphsLib.build_masters(
filename, master_dir=args.out, designspace_instance_dir=args.out
)
if __name__ == "__main__":
main()
| {
"content_hash": "5e5eed9740bc3cd0d7c0e40d31725dbe",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 88,
"avg_line_length": 31.767441860465116,
"alnum_prop": 0.5878477306002928,
"repo_name": "googlei18n/glyphsLib",
"id": "08a495f29e05f21af1084e57fccb405fedb85501",
"size": "1963",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/all_to_ufos.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "715643"
}
],
"symlink_target": ""
} |
package com.intellij.openapi.fileEditor.impl;
import com.intellij.AppTopics;
import com.intellij.CommonBundle;
import com.intellij.codeStyle.CodeStyleFacade;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.TransactionGuard;
import com.intellij.openapi.application.TransactionGuardImpl;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.command.UndoConfirmationPolicy;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.ex.PrioritizedDocumentListener;
import com.intellij.openapi.editor.impl.EditorFactoryImpl;
import com.intellij.openapi.editor.impl.TrailingSpacesStripper;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.fileEditor.impl.text.TextEditorImpl;
import com.intellij.openapi.fileTypes.BinaryFileTypeDecompilers;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.UnknownFileType;
import com.intellij.openapi.project.*;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.openapi.vfs.encoding.EncodingManager;
import com.intellij.openapi.vfs.newvfs.NewVirtualFileSystem;
import com.intellij.pom.core.impl.PomModelImpl;
import com.intellij.psi.AbstractFileViewProvider;
import com.intellij.psi.ExternalChangeAction;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.PsiFileImpl;
import com.intellij.testFramework.LightVirtualFile;
import com.intellij.ui.UIBundle;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.ExceptionUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.messages.MessageBus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import javax.swing.*;
import java.awt.*;
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.nio.charset.Charset;
import java.util.*;
import java.util.List;
public class FileDocumentManagerImpl extends FileDocumentManager implements VirtualFileListener, VetoableProjectManagerListener, SafeWriteRequestor {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl");
public static final Key<Document> HARD_REF_TO_DOCUMENT_KEY = Key.create("HARD_REF_TO_DOCUMENT_KEY");
private static final Key<String> LINE_SEPARATOR_KEY = Key.create("LINE_SEPARATOR_KEY");
private static final Key<VirtualFile> FILE_KEY = Key.create("FILE_KEY");
private static final Key<Boolean> MUST_RECOMPUTE_FILE_TYPE = Key.create("Must recompute file type");
private static final Key<Boolean> BIG_FILE_PREVIEW = Key.create("BIG_FILE_PREVIEW");
private final Set<Document> myUnsavedDocuments = ContainerUtil.newConcurrentSet();
private final MessageBus myBus;
private static final Object lock = new Object();
private final FileDocumentManagerListener myMultiCaster;
private final TrailingSpacesStripper myTrailingSpacesStripper = new TrailingSpacesStripper();
private boolean myOnClose;
private volatile MemoryDiskConflictResolver myConflictResolver = new MemoryDiskConflictResolver();
private final PrioritizedDocumentListener myPhysicalDocumentChangeTracker = new PrioritizedDocumentListener() {
@Override
public int getPriority() {
return Integer.MIN_VALUE;
}
@Override
public void documentChanged(DocumentEvent e) {
final Document document = e.getDocument();
if (!ApplicationManager.getApplication().hasWriteAction(ExternalChangeAction.ExternalDocumentChange.class)) {
myUnsavedDocuments.add(document);
}
final Runnable currentCommand = CommandProcessor.getInstance().getCurrentCommand();
Project project = currentCommand == null ? null : CommandProcessor.getInstance().getCurrentCommandProject();
if (project == null)
project = ProjectUtil.guessProjectForFile(getFile(document));
String lineSeparator = CodeStyleFacade.getInstance(project).getLineSeparator();
document.putUserData(LINE_SEPARATOR_KEY, lineSeparator);
// avoid documents piling up during batch processing
if (areTooManyDocumentsInTheQueue(myUnsavedDocuments)) {
saveAllDocumentsLater();
}
}
};
public FileDocumentManagerImpl(@NotNull VirtualFileManager virtualFileManager, @NotNull ProjectManager projectManager) {
virtualFileManager.addVirtualFileListener(this);
projectManager.addProjectManagerListener(this);
myBus = ApplicationManager.getApplication().getMessageBus();
myBus.connect().subscribe(ProjectManager.TOPIC, this);
InvocationHandler handler = (proxy, method, args) -> {
multiCast(method, args);
return null;
};
final ClassLoader loader = FileDocumentManagerListener.class.getClassLoader();
myMultiCaster = (FileDocumentManagerListener)Proxy.newProxyInstance(loader, new Class[]{FileDocumentManagerListener.class}, handler);
}
private static void unwrapAndRethrow(Exception e) {
Throwable unwrapped = e;
if (e instanceof InvocationTargetException) {
unwrapped = e.getCause() == null ? e : e.getCause();
}
ExceptionUtil.rethrowUnchecked(unwrapped);
LOG.error(unwrapped);
}
@SuppressWarnings("OverlyBroadCatchBlock")
private void multiCast(@NotNull Method method, Object[] args) {
try {
method.invoke(myBus.syncPublisher(AppTopics.FILE_DOCUMENT_SYNC), args);
}
catch (ClassCastException e) {
LOG.error("Arguments: "+ Arrays.toString(args), e);
}
catch (Exception e) {
unwrapAndRethrow(e);
}
// Allows pre-save document modification
for (FileDocumentManagerListener listener : getListeners()) {
try {
method.invoke(listener, args);
}
catch (Exception e) {
unwrapAndRethrow(e);
}
}
// stripping trailing spaces
try {
method.invoke(myTrailingSpacesStripper, args);
}
catch (Exception e) {
unwrapAndRethrow(e);
}
}
@Override
@Nullable
public Document getDocument(@NotNull final VirtualFile file) {
ApplicationManager.getApplication().assertReadAccessAllowed();
DocumentEx document = (DocumentEx)getCachedDocument(file);
if (document == null) {
if (!file.isValid() || file.isDirectory() || isBinaryWithoutDecompiler(file)) return null;
boolean tooLarge = FileUtilRt.isTooLarge(file.getLength());
if (file.getFileType().isBinary() && tooLarge) return null;
final CharSequence text = tooLarge ? LoadTextUtil.loadText(file, getPreviewCharCount(file)) : LoadTextUtil.loadText(file);
synchronized (lock) {
document = (DocumentEx)getCachedDocument(file);
if (document != null) return document; // Double checking
document = (DocumentEx)createDocument(text, file);
document.setModificationStamp(file.getModificationStamp());
document.putUserData(BIG_FILE_PREVIEW, tooLarge ? Boolean.TRUE : null);
final FileType fileType = file.getFileType();
document.setReadOnly(tooLarge || !file.isWritable() || fileType.isBinary());
if (!(file instanceof LightVirtualFile || file.getFileSystem() instanceof NonPhysicalFileSystem)) {
document.addDocumentListener(myPhysicalDocumentChangeTracker);
}
if (file instanceof LightVirtualFile) {
registerDocument(document, file);
}
else {
document.putUserData(FILE_KEY, file);
cacheDocument(file, document);
}
}
myMultiCaster.fileContentLoaded(file, document);
}
return document;
}
public static boolean areTooManyDocumentsInTheQueue(Collection<Document> documents) {
if (documents.size() > 100) return true;
int totalSize = 0;
for (Document document : documents) {
totalSize += document.getTextLength();
if (totalSize > FileUtilRt.LARGE_FOR_CONTENT_LOADING) return true;
}
return false;
}
private static Document createDocument(final CharSequence text, VirtualFile file) {
boolean acceptSlashR = file instanceof LightVirtualFile && StringUtil.indexOf(text, '\r') >= 0;
boolean freeThreaded = Boolean.TRUE.equals(file.getUserData(AbstractFileViewProvider.FREE_THREADED));
return ((EditorFactoryImpl)EditorFactory.getInstance()).createDocument(text, acceptSlashR, freeThreaded);
}
@Override
@Nullable
public Document getCachedDocument(@NotNull VirtualFile file) {
Document hard = file.getUserData(HARD_REF_TO_DOCUMENT_KEY);
return hard != null ? hard : getDocumentFromCache(file);
}
public static void registerDocument(@NotNull final Document document, @NotNull VirtualFile virtualFile) {
synchronized (lock) {
document.putUserData(FILE_KEY, virtualFile);
virtualFile.putUserData(HARD_REF_TO_DOCUMENT_KEY, document);
}
}
@Override
@Nullable
public VirtualFile getFile(@NotNull Document document) {
return document.getUserData(FILE_KEY);
}
@TestOnly
public void dropAllUnsavedDocuments() {
if (!ApplicationManager.getApplication().isUnitTestMode()) {
throw new RuntimeException("This method is only for test mode!");
}
ApplicationManager.getApplication().assertWriteAccessAllowed();
if (!myUnsavedDocuments.isEmpty()) {
myUnsavedDocuments.clear();
fireUnsavedDocumentsDropped();
}
}
private void saveAllDocumentsLater() {
// later because some document might have been blocked by PSI right now
ApplicationManager.getApplication().invokeLater(() -> {
if (ApplicationManager.getApplication().isDisposed()) {
return;
}
final Document[] unsavedDocuments = getUnsavedDocuments();
for (Document document : unsavedDocuments) {
VirtualFile file = getFile(document);
if (file == null) continue;
Project project = ProjectUtil.guessProjectForFile(file);
if (project == null) continue;
if (PsiDocumentManager.getInstance(project).isDocumentBlockedByPsi(document)) continue;
saveDocument(document);
}
});
}
@Override
public void saveAllDocuments() {
saveAllDocuments(true);
}
/**
* @param isExplicit caused by user directly (Save action) or indirectly (e.g. Compile)
*/
public void saveAllDocuments(boolean isExplicit) {
ApplicationManager.getApplication().assertIsDispatchThread();
((TransactionGuardImpl)TransactionGuard.getInstance()).assertWriteActionAllowed();
myMultiCaster.beforeAllDocumentsSaving();
if (myUnsavedDocuments.isEmpty()) return;
final Map<Document, IOException> failedToSave = new HashMap<>();
final Set<Document> vetoed = new HashSet<>();
while (true) {
int count = 0;
for (Document document : myUnsavedDocuments) {
if (failedToSave.containsKey(document)) continue;
if (vetoed.contains(document)) continue;
try {
doSaveDocument(document, isExplicit);
}
catch (IOException e) {
//noinspection ThrowableResultOfMethodCallIgnored
failedToSave.put(document, e);
}
catch (SaveVetoException e) {
vetoed.add(document);
}
count++;
}
if (count == 0) break;
}
if (!failedToSave.isEmpty()) {
handleErrorsOnSave(failedToSave);
}
}
@Override
public void saveDocument(@NotNull final Document document) {
saveDocument(document, true);
}
public void saveDocument(@NotNull final Document document, final boolean explicit) {
ApplicationManager.getApplication().assertIsDispatchThread();
((TransactionGuardImpl)TransactionGuard.getInstance()).assertWriteActionAllowed();
if (!myUnsavedDocuments.contains(document)) return;
try {
doSaveDocument(document, explicit);
}
catch (IOException e) {
handleErrorsOnSave(Collections.singletonMap(document, e));
}
catch (SaveVetoException ignored) {
}
}
@Override
public void saveDocumentAsIs(@NotNull Document document) {
VirtualFile file = getFile(document);
boolean spaceStrippingEnabled = true;
if (file != null) {
spaceStrippingEnabled = TrailingSpacesStripper.isEnabled(file);
TrailingSpacesStripper.setEnabled(file, false);
}
try {
saveDocument(document);
}
finally {
if (file != null) {
TrailingSpacesStripper.setEnabled(file, spaceStrippingEnabled);
}
}
}
private static class SaveVetoException extends Exception {}
private void doSaveDocument(@NotNull final Document document, boolean isExplicit) throws IOException, SaveVetoException {
VirtualFile file = getFile(document);
if (file == null || file instanceof LightVirtualFile || file.isValid() && !isFileModified(file)) {
removeFromUnsaved(document);
return;
}
if (file.isValid() && needsRefresh(file)) {
file.refresh(false, false);
if (!myUnsavedDocuments.contains(document)) return;
}
if (!maySaveDocument(file, document, isExplicit)) {
throw new SaveVetoException();
}
WriteAction.run(() -> doSaveDocumentInWriteAction(document, file));
}
private boolean maySaveDocument(VirtualFile file, Document document, boolean isExplicit) {
return !myConflictResolver.hasConflict(file) &&
Arrays.stream(Extensions.getExtensions(FileDocumentSynchronizationVetoer.EP_NAME)).allMatch(vetoer -> vetoer.maySaveDocument(document, isExplicit));
}
private void doSaveDocumentInWriteAction(@NotNull final Document document, @NotNull final VirtualFile file) throws IOException {
if (!file.isValid()) {
removeFromUnsaved(document);
return;
}
if (!file.equals(getFile(document))) {
registerDocument(document, file);
}
boolean saveNeeded = false;
IOException ioException = null;
try {
saveNeeded = isSaveNeeded(document, file);
}
catch (IOException e) {
// in case of corrupted VFS try to stay consistent
ioException = e;
}
if (!saveNeeded) {
if (document instanceof DocumentEx) {
((DocumentEx)document).setModificationStamp(file.getModificationStamp());
}
removeFromUnsaved(document);
updateModifiedProperty(file);
if (ioException != null) throw ioException;
return;
}
PomModelImpl.guardPsiModificationsIn(() -> {
myMultiCaster.beforeDocumentSaving(document);
LOG.assertTrue(file.isValid());
String text = document.getText();
String lineSeparator = getLineSeparator(document, file);
if (!lineSeparator.equals("\n")) {
text = StringUtil.convertLineSeparators(text, lineSeparator);
}
Project project = ProjectLocator.getInstance().guessProjectForFile(file);
LoadTextUtil.write(project, file, this, text, document.getModificationStamp());
myUnsavedDocuments.remove(document);
LOG.assertTrue(!myUnsavedDocuments.contains(document));
myTrailingSpacesStripper.clearLineModificationFlags(document);
});
}
private static void updateModifiedProperty(@NotNull VirtualFile file) {
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
for (FileEditor editor : fileEditorManager.getAllEditors(file)) {
if (editor instanceof TextEditorImpl) {
((TextEditorImpl)editor).updateModifiedProperty();
}
}
}
}
private void removeFromUnsaved(@NotNull Document document) {
myUnsavedDocuments.remove(document);
fireUnsavedDocumentsDropped();
LOG.assertTrue(!myUnsavedDocuments.contains(document));
}
private static boolean isSaveNeeded(@NotNull Document document, @NotNull VirtualFile file) throws IOException {
if (file.getFileType().isBinary() || document.getTextLength() > 1000 * 1000) { // don't compare if the file is too big
return true;
}
byte[] bytes = file.contentsToByteArray();
CharSequence loaded = LoadTextUtil.getTextByBinaryPresentation(bytes, file, false, false);
return !Comparing.equal(document.getCharsSequence(), loaded);
}
private static boolean needsRefresh(final VirtualFile file) {
final VirtualFileSystem fs = file.getFileSystem();
return fs instanceof NewVirtualFileSystem && file.getTimeStamp() != ((NewVirtualFileSystem)fs).getTimeStamp(file);
}
@NotNull
public static String getLineSeparator(@NotNull Document document, @NotNull VirtualFile file) {
String lineSeparator = LoadTextUtil.getDetectedLineSeparator(file);
if (lineSeparator == null) {
lineSeparator = document.getUserData(LINE_SEPARATOR_KEY);
assert lineSeparator != null : document;
}
return lineSeparator;
}
@Override
@NotNull
public String getLineSeparator(@Nullable VirtualFile file, @Nullable Project project) {
String lineSeparator = file == null ? null : LoadTextUtil.getDetectedLineSeparator(file);
if (lineSeparator == null) {
CodeStyleFacade settingsManager = project == null
? CodeStyleFacade.getInstance()
: CodeStyleFacade.getInstance(project);
lineSeparator = settingsManager.getLineSeparator();
}
return lineSeparator;
}
@Override
public boolean requestWriting(@NotNull Document document, Project project) {
final VirtualFile file = getInstance().getFile(document);
if (project != null && file != null && file.isValid()) {
return !file.getFileType().isBinary() && ReadonlyStatusHandler.ensureFilesWritable(project, file);
}
if (document.isWritable()) {
return true;
}
document.fireReadOnlyModificationAttempt();
return false;
}
@Override
public void reloadFiles(@NotNull final VirtualFile... files) {
for (VirtualFile file : files) {
if (file.exists()) {
final Document doc = getCachedDocument(file);
if (doc != null) {
reloadFromDisk(doc);
}
}
}
}
@Override
@NotNull
public Document[] getUnsavedDocuments() {
if (myUnsavedDocuments.isEmpty()) {
return Document.EMPTY_ARRAY;
}
List<Document> list = new ArrayList<>(myUnsavedDocuments);
return list.toArray(Document.EMPTY_ARRAY);
}
@Override
public boolean isDocumentUnsaved(@NotNull Document document) {
return myUnsavedDocuments.contains(document);
}
@Override
public boolean isFileModified(@NotNull VirtualFile file) {
final Document doc = getCachedDocument(file);
return doc != null && isDocumentUnsaved(doc) && doc.getModificationStamp() != file.getModificationStamp();
}
@Override
public boolean isPartialPreviewOfALargeFile(@NotNull Document document) {
return document.getUserData(BIG_FILE_PREVIEW) == Boolean.TRUE;
}
@Override
public void propertyChanged(@NotNull VirtualFilePropertyEvent event) {
final VirtualFile file = event.getFile();
if (VirtualFile.PROP_WRITABLE.equals(event.getPropertyName())) {
final Document document = getCachedDocument(file);
if (document != null) {
ApplicationManager.getApplication().runWriteAction((ExternalChangeAction)() -> document.setReadOnly(!file.isWritable()));
}
}
else if (VirtualFile.PROP_NAME.equals(event.getPropertyName())) {
Document document = getCachedDocument(file);
if (document != null) {
// a file is linked to a document - chances are it is an "unknown text file" now
if (isBinaryWithoutDecompiler(file)) {
unbindFileFromDocument(file, document);
}
}
}
}
private void unbindFileFromDocument(@NotNull VirtualFile file, @NotNull Document document) {
removeDocumentFromCache(file);
file.putUserData(HARD_REF_TO_DOCUMENT_KEY, null);
document.putUserData(FILE_KEY, null);
}
private static boolean isBinaryWithDecompiler(@NotNull VirtualFile file) {
final FileType ft = file.getFileType();
return ft.isBinary() && BinaryFileTypeDecompilers.INSTANCE.forFileType(ft) != null;
}
private static boolean isBinaryWithoutDecompiler(@NotNull VirtualFile file) {
final FileType fileType = file.getFileType();
return fileType.isBinary() && BinaryFileTypeDecompilers.INSTANCE.forFileType(fileType) == null;
}
@Override
public void contentsChanged(@NotNull VirtualFileEvent event) {
if (event.isFromSave()) return;
final VirtualFile file = event.getFile();
final Document document = getCachedDocument(file);
if (document == null) {
myMultiCaster.fileWithNoDocumentChanged(file);
return;
}
if (isBinaryWithDecompiler(file)) {
myMultiCaster.fileWithNoDocumentChanged(file); // This will generate PSI event at FileManagerImpl
}
if (document.getModificationStamp() == event.getOldModificationStamp() || !isDocumentUnsaved(document)) {
reloadFromDisk(document);
}
}
@Override
public void reloadFromDisk(@NotNull final Document document) {
ApplicationManager.getApplication().assertIsDispatchThread();
final VirtualFile file = getFile(document);
assert file != null;
if (!fireBeforeFileContentReload(file, document)) {
return;
}
final Project project = ProjectLocator.getInstance().guessProjectForFile(file);
boolean[] isReloadable = {isReloadable(file, document, project)};
if (isReloadable[0]) {
CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(
new ExternalChangeAction.ExternalDocumentChange(document, project) {
@Override
public void run() {
if (!isBinaryWithoutDecompiler(file)) {
LoadTextUtil.clearCharsetAutoDetectionReason(file);
file.setBOM(null); // reset BOM in case we had one and the external change stripped it away
file.setCharset(null, null, false);
boolean wasWritable = document.isWritable();
document.setReadOnly(false);
boolean tooLarge = FileUtilRt.isTooLarge(file.getLength());
isReloadable[0] = isReloadable(file, document, project);
if (isReloadable[0]) {
CharSequence reloaded = tooLarge ? LoadTextUtil.loadText(file, getPreviewCharCount(file)) : LoadTextUtil.loadText(file);
((DocumentEx)document).replaceText(reloaded, file.getModificationStamp());
document.putUserData(BIG_FILE_PREVIEW, tooLarge ? Boolean.TRUE : null);
}
document.setReadOnly(!wasWritable);
}
}
}
), UIBundle.message("file.cache.conflict.action"), null, UndoConfirmationPolicy.REQUEST_CONFIRMATION);
}
if (isReloadable[0]) {
myMultiCaster.fileContentReloaded(file, document);
}
else {
unbindFileFromDocument(file, document);
myMultiCaster.fileWithNoDocumentChanged(file);
}
myUnsavedDocuments.remove(document);
}
private static boolean isReloadable(@NotNull VirtualFile file, @NotNull Document document, @Nullable Project project) {
PsiFile cachedPsiFile = project == null ? null : PsiDocumentManager.getInstance(project).getCachedPsiFile(document);
return !(FileUtilRt.isTooLarge(file.getLength()) && file.getFileType().isBinary()) &&
(cachedPsiFile == null || cachedPsiFile instanceof PsiFileImpl || isBinaryWithDecompiler(file));
}
@TestOnly
void setAskReloadFromDisk(@NotNull Disposable disposable, @NotNull MemoryDiskConflictResolver newProcessor) {
final MemoryDiskConflictResolver old = myConflictResolver;
myConflictResolver = newProcessor;
Disposer.register(disposable, () -> myConflictResolver = old);
}
@Override
public void fileDeleted(@NotNull VirtualFileEvent event) {
Document doc = getCachedDocument(event.getFile());
if (doc != null) {
myTrailingSpacesStripper.documentDeleted(doc);
}
}
@Override
public void beforeContentsChange(@NotNull VirtualFileEvent event) {
VirtualFile virtualFile = event.getFile();
// check file type in second order to avoid content detection running
if (virtualFile.getLength() == 0 && virtualFile.getFileType() == UnknownFileType.INSTANCE) {
virtualFile.putUserData(MUST_RECOMPUTE_FILE_TYPE, Boolean.TRUE);
}
if (ourConflictsSolverEnabled) {
myConflictResolver.beforeContentChange(event);
}
}
public static boolean recomputeFileTypeIfNecessary(@NotNull VirtualFile virtualFile) {
if (virtualFile.getUserData(MUST_RECOMPUTE_FILE_TYPE) != null) {
virtualFile.getFileType();
virtualFile.putUserData(MUST_RECOMPUTE_FILE_TYPE, null);
return true;
}
return false;
}
@Override
public boolean canClose(@NotNull Project project) {
if (!myUnsavedDocuments.isEmpty()) {
myOnClose = true;
try {
saveAllDocuments();
}
finally {
myOnClose = false;
}
}
return myUnsavedDocuments.isEmpty();
}
private void fireUnsavedDocumentsDropped() {
myMultiCaster.unsavedDocumentsDropped();
}
private boolean fireBeforeFileContentReload(final VirtualFile file, @NotNull Document document) {
for (FileDocumentSynchronizationVetoer vetoer : Extensions.getExtensions(FileDocumentSynchronizationVetoer.EP_NAME)) {
try {
if (!vetoer.mayReloadFileContent(file, document)) {
return false;
}
}
catch (Exception e) {
LOG.error(e);
}
}
myMultiCaster.beforeFileContentReload(file, document);
return true;
}
@NotNull
private static FileDocumentManagerListener[] getListeners() {
return FileDocumentManagerListener.EP_NAME.getExtensions();
}
private static int getPreviewCharCount(@NotNull VirtualFile file) {
Charset charset = EncodingManager.getInstance().getEncoding(file, false);
float bytesPerChar = charset == null ? 2 : charset.newEncoder().averageBytesPerChar();
return (int)(FileUtilRt.LARGE_FILE_PREVIEW_SIZE / bytesPerChar);
}
private void handleErrorsOnSave(@NotNull Map<Document, IOException> failures) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
IOException ioException = ContainerUtil.getFirstItem(failures.values());
if (ioException != null) {
throw new RuntimeException(ioException);
}
return;
}
for (IOException exception : failures.values()) {
LOG.warn(exception);
}
final String text = StringUtil.join(failures.values(), Throwable::getMessage, "\n");
final DialogWrapper dialog = new DialogWrapper(null) {
{
init();
setTitle(UIBundle.message("cannot.save.files.dialog.title"));
}
@Override
protected void createDefaultActions() {
super.createDefaultActions();
myOKAction.putValue(Action.NAME, UIBundle
.message(myOnClose ? "cannot.save.files.dialog.ignore.changes" : "cannot.save.files.dialog.revert.changes"));
myOKAction.putValue(DEFAULT_ACTION, null);
if (!myOnClose) {
myCancelAction.putValue(Action.NAME, CommonBundle.getCloseButtonText());
}
}
@Override
protected JComponent createCenterPanel() {
final JPanel panel = new JPanel(new BorderLayout(0, 5));
panel.add(new JLabel(UIBundle.message("cannot.save.files.dialog.message")), BorderLayout.NORTH);
final JTextPane area = new JTextPane();
area.setText(text);
area.setEditable(false);
area.setMinimumSize(new Dimension(area.getMinimumSize().width, 50));
panel.add(new JBScrollPane(area, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER),
BorderLayout.CENTER);
return panel;
}
};
if (dialog.showAndGet()) {
for (Document document : failures.keySet()) {
reloadFromDisk(document);
}
}
}
private final Map<VirtualFile, Document> myDocumentCache = ContainerUtil.createConcurrentWeakValueMap();
//temp setter for Rider 2017.1
public static boolean ourConflictsSolverEnabled = true;
// used in Upsource
protected void cacheDocument(@NotNull VirtualFile file, @NotNull Document document) {
myDocumentCache.put(file, document);
}
// used in Upsource
protected void removeDocumentFromCache(@NotNull VirtualFile file) {
myDocumentCache.remove(file);
}
// used in Upsource
protected Document getDocumentFromCache(@NotNull VirtualFile file) {
return myDocumentCache.get(file);
}
}
| {
"content_hash": "bab8f33ebec35f56dfbb3e35b5797743",
"timestamp": "",
"source": "github",
"line_count": 807,
"max_line_length": 159,
"avg_line_length": 36.38537794299876,
"alnum_prop": 0.7118823008548173,
"repo_name": "mglukhikh/intellij-community",
"id": "32609de4bef7accc79729f79d7b1f0aeaa10eaa7",
"size": "29963",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "20665"
},
{
"name": "AspectJ",
"bytes": "182"
},
{
"name": "Batchfile",
"bytes": "60827"
},
{
"name": "C",
"bytes": "211435"
},
{
"name": "C#",
"bytes": "1264"
},
{
"name": "C++",
"bytes": "197674"
},
{
"name": "CMake",
"bytes": "1675"
},
{
"name": "CSS",
"bytes": "201445"
},
{
"name": "CoffeeScript",
"bytes": "1759"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "Groovy",
"bytes": "3243028"
},
{
"name": "HLSL",
"bytes": "57"
},
{
"name": "HTML",
"bytes": "1899088"
},
{
"name": "J",
"bytes": "5050"
},
{
"name": "Java",
"bytes": "165554704"
},
{
"name": "JavaScript",
"bytes": "570364"
},
{
"name": "Jupyter Notebook",
"bytes": "93222"
},
{
"name": "Kotlin",
"bytes": "4611299"
},
{
"name": "Lex",
"bytes": "147047"
},
{
"name": "Makefile",
"bytes": "2352"
},
{
"name": "NSIS",
"bytes": "51276"
},
{
"name": "Objective-C",
"bytes": "27861"
},
{
"name": "Perl",
"bytes": "903"
},
{
"name": "Perl 6",
"bytes": "26"
},
{
"name": "Protocol Buffer",
"bytes": "6680"
},
{
"name": "Python",
"bytes": "25439881"
},
{
"name": "Roff",
"bytes": "37534"
},
{
"name": "Ruby",
"bytes": "1217"
},
{
"name": "Scala",
"bytes": "11698"
},
{
"name": "Shell",
"bytes": "66341"
},
{
"name": "Smalltalk",
"bytes": "338"
},
{
"name": "TeX",
"bytes": "25473"
},
{
"name": "Thrift",
"bytes": "1846"
},
{
"name": "TypeScript",
"bytes": "9469"
},
{
"name": "Visual Basic",
"bytes": "77"
},
{
"name": "XSLT",
"bytes": "113040"
}
],
"symlink_target": ""
} |
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :username, :name, :email
t.timestamps
end
end
end
| {
"content_hash": "eabc28b0eb958e6a840399aefd852181",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 43,
"avg_line_length": 20.625,
"alnum_prop": 0.6606060606060606,
"repo_name": "klaoha06/Kronos",
"id": "d7b5b262f0453ea985c4e05009098d70ef8fd91e",
"size": "165",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrate/20141121020416_create_users.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "21933"
}
],
"symlink_target": ""
} |
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_CONVOLUTION_FEATURE_GROUP_CONVERTER_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_CONVOLUTION_FEATURE_GROUP_CONVERTER_H_
#include "tensorflow/compiler/xla/service/hlo_module.h"
#include "tensorflow/compiler/xla/service/hlo_pass_interface.h"
#include "tensorflow/compiler/xla/status_macros.h"
#include "tensorflow/core/lib/core/stringpiece.h"
namespace xla {
// A pass which rewrites convolutions with feature_group_count > 1 into
// convolutions with feature_group_count = 1.
class ConvolutionFeatureGroupConverter : public HloPassInterface {
public:
ConvolutionFeatureGroupConverter() {}
tensorflow::StringPiece name() const override {
return "convolution-feature-group-converter";
}
// Run convolution rewriting on the given computation. Returns whether the
// computation was changed.
StatusOr<bool> Run(HloModule* module) override;
};
} // namespace xla
#endif // TENSORFLOW_COMPILER_XLA_SERVICE_CONVOLUTION_FEATURE_GROUP_CONVERTER_H_
| {
"content_hash": "b23307a394a10bf66cc25366041cba94",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 81,
"avg_line_length": 33.46666666666667,
"alnum_prop": 0.7818725099601593,
"repo_name": "ZhangXinNan/tensorflow",
"id": "f213cc870918d476e839f97ae067504038f8cacc",
"size": "1672",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tensorflow/compiler/xla/service/convolution_feature_group_converter.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "1286"
},
{
"name": "Batchfile",
"bytes": "9258"
},
{
"name": "C",
"bytes": "327005"
},
{
"name": "C#",
"bytes": "8215"
},
{
"name": "C++",
"bytes": "46648068"
},
{
"name": "CMake",
"bytes": "206720"
},
{
"name": "Dockerfile",
"bytes": "6978"
},
{
"name": "Go",
"bytes": "1210133"
},
{
"name": "HTML",
"bytes": "4681865"
},
{
"name": "Java",
"bytes": "830576"
},
{
"name": "Jupyter Notebook",
"bytes": "2632421"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "Makefile",
"bytes": "51309"
},
{
"name": "Objective-C",
"bytes": "15650"
},
{
"name": "Objective-C++",
"bytes": "99243"
},
{
"name": "PHP",
"bytes": "1357"
},
{
"name": "Perl",
"bytes": "7536"
},
{
"name": "PureBasic",
"bytes": "25356"
},
{
"name": "Python",
"bytes": "40046802"
},
{
"name": "Ruby",
"bytes": "553"
},
{
"name": "Shell",
"bytes": "455624"
},
{
"name": "Smarty",
"bytes": "6976"
}
],
"symlink_target": ""
} |
var deBounceHandler = {
deBounceSearch: function (callback) {
return _.debounce(callback, 250)
}
};
(function ($) {
$.fn.listsearch = function (options) {
var settings = $.extend({
elementsClass: '',
highlight: false,
searchForTextIn: '.text',
clearButton: '',
highlightClass: ''
}, options);
var targetElements = settings.elementsClass;
var clearButtonClass = settings.clearButton;
var searchForTextIn = settings.searchForTextIn;
var highlightClass = settings.highlightClass;
var textBoxContents = function() {
return textBox.val().trim();
};
var ClearButton = function(textboxToAddClearButtonTo, clearButtonClass) {
var clearSearch = function() {
textboxToAddClearButtonTo.val('').trigger('keyup').focus();
};
var hookUpEvents = function(clearButton) {
clearButton.click(function () { clearSearch(); });
textboxToAddClearButtonTo.keyup(function (e) {
if (e.keyCode === 27) {
clearSearch();
}
});
};
var showIfNecessary = function() {
$('.' + clearButtonClass).hide();
if (textBoxContents().length > 0) {
$('.' + clearButtonClass).show();
}
};
var initialize = function () {
if (clearButtonClass && clearButtonClass.length > 0) {
textboxToAddClearButtonTo.parent().prepend("<button title='Clear' class='icon-pipeline " + clearButtonClass + "'></button>");
var clearButton = $('.' + clearButtonClass);
clearButton.hide();
hookUpEvents(clearButton);
}
};
return {
initialize: initialize,
showIfNecessary: showIfNecessary
};
};
var CountHolder = function(textboxToAddCountHolderTo) {
var countTextHolder;
var countHolder;
var showIfNecessary = function() {
countTextHolder.hide();
if (textBoxContents().length > 0) {
countTextHolder.show();
}
};
var setCountTo = function(countToSet) {
countHolder.text(countToSet);
};
var initialize = function() {
textboxToAddCountHolderTo.parent().append("<div style='background: #fff8c1; left: 0; padding: 5px; position: absolute; right: 10px; top: 24px; display:none;' class='count'>Total <span id='found'></span> matches found.</div>");
countTextHolder = textboxToAddCountHolderTo.siblings('.count');
countHolder = $(countTextHolder).find("#found");
};
return {
setCountTo: setCountTo,
showIfNecessary: showIfNecessary,
initialize: initialize
};
};
var search = function() {
$(searchForTextIn).unhighlight({className: highlightClass});
$(targetElements).css('display', 'block');
$(targetElements).parent().css('display', 'block');
var q = textBoxContents();
if (q && q.length > 0) {
$(targetElements).css('display', 'none');
$(targetElements).parent().css('display', 'none');
$(searchForTextIn).highlight(q, {className: highlightClass});
var highlightedTargetElements = $(searchForTextIn + " ." + highlightClass).parents(targetElements);
highlightedTargetElements.css('display', 'block');
highlightedTargetElements.parent().css('display', 'block');
countHolder.setCountTo(highlightedTargetElements.length);
}
};
var doSearch = function() {
search();
clearButton.showIfNecessary();
countHolder.showIfNecessary();
};
var textBox = this;
textBox.wrap("<div class='search-with-clear'></div>");
var clearButton = new ClearButton(textBox, clearButtonClass);
var countHolder = new CountHolder(textBox);
clearButton.initialize();
countHolder.initialize();
textBox.keyup(deBounceHandler.deBounceSearch(doSearch));
return {
forceSearch: doSearch
}
};
}(jQuery));
| {
"content_hash": "00bc366278cc3c3a2ee32ab9f9c39488",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 242,
"avg_line_length": 34.11851851851852,
"alnum_prop": 0.5273556231003039,
"repo_name": "jyotisingh/gocd",
"id": "43d7d79c77afbbb8220d4a7b302166440fe98abf",
"size": "5351",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "server/webapp/WEB-INF/rails/app/assets/javascripts/jquery.listsearch.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "9039"
},
{
"name": "CSS",
"bytes": "755868"
},
{
"name": "FreeMarker",
"bytes": "182"
},
{
"name": "Groovy",
"bytes": "1086984"
},
{
"name": "HTML",
"bytes": "620670"
},
{
"name": "Java",
"bytes": "19749982"
},
{
"name": "JavaScript",
"bytes": "3138078"
},
{
"name": "NSIS",
"bytes": "17037"
},
{
"name": "PLSQL",
"bytes": "4414"
},
{
"name": "PLpgSQL",
"bytes": "6490"
},
{
"name": "PowerShell",
"bytes": "1511"
},
{
"name": "Ruby",
"bytes": "2975330"
},
{
"name": "SQLPL",
"bytes": "15479"
},
{
"name": "Shell",
"bytes": "212901"
},
{
"name": "TypeScript",
"bytes": "943024"
},
{
"name": "XSLT",
"bytes": "182513"
}
],
"symlink_target": ""
} |
package org.mockito.internal.verification.checkers;
import static java.util.Arrays.asList;
import java.util.List;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Mock;
import org.mockito.exceptions.verification.WantedButNotInvoked;
import org.mockito.exceptions.verification.junit.ArgumentsAreDifferent;
import org.mockito.internal.invocation.InvocationBuilder;
import org.mockito.internal.invocation.InvocationMatcher;
import org.mockito.invocation.Invocation;
import org.mockitousage.IMethods;
import org.mockitoutil.TestBase;
public class MissingInvocationCheckerTest extends TestBase {
private MissingInvocationChecker checker;
private InvocationMatcher wanted;
private List<Invocation> invocations;
@Mock
private IMethods mock;
@Rule
public ExpectedException exception = ExpectedException.none();
@Before
public void setup() {
checker = new MissingInvocationChecker();
}
@Test
public void shouldPassBecauseActualInvocationFound() {
wanted = buildSimpleMethod().toInvocationMatcher();
invocations = asList(buildSimpleMethod().toInvocation());
checker.check(invocations, wanted);
}
@Test
public void shouldReportWantedButNotInvoked() {
wanted = buildSimpleMethod().toInvocationMatcher();
invocations = asList(buildDifferentMethod().toInvocation());
exception.expect(WantedButNotInvoked.class);
exception.expectMessage("Wanted but not invoked:");
exception.expectMessage("mock.simpleMethod()");
exception.expectMessage("However, there were other interactions with this mock:");
exception.expectMessage("mock.differentMethod();");
checker.check(invocations, wanted);
}
@Test
public void shouldReportWantedInvocationDiffersFromActual() {
wanted = buildIntArgMethod().arg(2222).toInvocationMatcher();
invocations = asList(buildIntArgMethod().arg(1111).toInvocation());
exception.expect(ArgumentsAreDifferent.class);
exception.expectMessage("Argument(s) are different! Wanted:");
exception.expectMessage("mock.intArgumentMethod(2222);");
exception.expectMessage("Actual invocation has different arguments:");
exception.expectMessage("mock.intArgumentMethod(1111);");
checker.check(invocations, wanted);
}
private InvocationBuilder buildIntArgMethod() {
return new InvocationBuilder().mock(mock).method("intArgumentMethod").argTypes(int.class);
}
private InvocationBuilder buildSimpleMethod() {
return new InvocationBuilder().mock(mock).simpleMethod();
}
private InvocationBuilder buildDifferentMethod() {
return new InvocationBuilder().mock(mock).differentMethod();
}
} | {
"content_hash": "ba80244847ec19fab6c29968821acc8b",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 92,
"avg_line_length": 30.39080459770115,
"alnum_prop": 0.7938729198184569,
"repo_name": "Jazzepi/mockito",
"id": "921233c3c15381330c1ee978e823e74a34b7ab28",
"size": "2763",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/org/mockito/internal/verification/checkers/MissingInvocationCheckerTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Groovy",
"bytes": "27261"
},
{
"name": "HTML",
"bytes": "8386"
},
{
"name": "Java",
"bytes": "1936031"
}
],
"symlink_target": ""
} |
package org.apache.hc.core5.http.io;
import java.io.IOException;
import org.apache.hc.core5.http.HttpConnection;
import org.apache.hc.core5.util.Timeout;
/**
* Abstract blocking HTTP connection interface.
*
* @since 5.0
*/
public interface BHttpConnection extends HttpConnection {
/**
* Checks if input data is available from the connection. May wait for
* the specified time until some data becomes available. Note that some
* implementations may completely ignore the timeout parameter.
*
* @param timeout the maximum time to wait for data
* @return true if data is available; false if there was no data available
* even after waiting for {@code timeout}.
* @throws IOException if an error happens on the connection
*/
boolean isDataAvailable(Timeout timeout) throws IOException;
/**
* Checks whether this connection has gone down.
* Network connections may get closed during some time of inactivity
* for several reasons. The next time a read is attempted on such a
* connection it will throw an IOException.
* This method tries to alleviate this inconvenience by trying to
* find out if a connection is still usable. Implementations may do
* that by attempting a read with a very small timeout. Thus this
* method may block for a small amount of time before returning a result.
* It is therefore an <i>expensive</i> operation.
*
* @return {@code true} if attempts to use this connection are likely
* to fail and this connection should be closed,
* or {@code false} if they are likely to succeed
*/
boolean isStale() throws IOException;
/**
* Writes out all pending buffered data over the open connection.
*
* @throws java.io.IOException in case of an I/O error
*/
void flush() throws IOException;
}
| {
"content_hash": "48cee9da664a66874cd9cb265a16b990",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 78,
"avg_line_length": 35.886792452830186,
"alnum_prop": 0.6908517350157729,
"repo_name": "apache/httpcomponents-core",
"id": "c23af9b8ec3babe7f3cf57b1dd246b08f77341a3",
"size": "3085",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "httpcore5/src/main/java/org/apache/hc/core5/http/io/BHttpConnection.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "844"
},
{
"name": "Dockerfile",
"bytes": "3530"
},
{
"name": "Java",
"bytes": "5276772"
}
],
"symlink_target": ""
} |
trivial_casts, trivial_numeric_casts,
unused_import_braces, unused_qualifications)]
extern crate argparse;
extern crate ansi_term;
#[cfg_attr(test, macro_use)]
extern crate itertools;
#[macro_use]
extern crate log;
extern crate lru_cache;
extern crate parking_lot;
extern crate time;
extern crate twox_hash;
extern crate fnv;
extern crate serde_json;
extern crate serde;
#[macro_use]
extern crate lazy_static;
#[macro_use]
mod sorceries;
mod space;
mod identity;
mod motion;
mod landmark;
mod life;
mod mind;
mod substrate;
mod uci;
// Unlikely Command Integration
mod test_landmark;
use std::fs::OpenOptions;
use std::io;
use std::io::Write;
use std::process;
use ansi_term::Colour as Color;
use argparse::{ArgumentParser, Print, Store, StoreOption, StoreTrue};
use log::{LogLevelFilter, LogMetadata, LogRecord, SetLoggerError};
use time::{Duration, get_time};
use identity::{Agent, Team};
use life::{Commit, Patch, TransitPatch, WorldState};
use mind::{Variation, fixed_depth_sequence_kickoff, iterative_deepening_kickoff,
kickoff, pagan_variation_format, Memory};
use substrate::memory_free;
use serde_json::to_string;
use serde::Serialize;
fn encode<T>(value: &T) -> String
where T: ?Sized + serde::ser::Serialize {
to_string(value).unwrap()
}
struct DebugLogger;
impl DebugLogger {
pub fn init() -> Result<(), SetLoggerError> {
log::set_logger(|max_log_level| {
max_log_level.set(LogLevelFilter::Debug);
Box::new(DebugLogger)
})
}
}
impl log::Log for DebugLogger {
fn enabled(&self, _metadata: &LogMetadata) -> bool {
true
}
fn log(&self, record: &LogRecord) {
// XXX: can't the open file handle live inside the DebugLogger struct?!
let mut log_file = OpenOptions::new()
.write(true)
.append(true)
.create(true)
.open("leafline.log")
.expect("couldn't open log file?!");
let log_message = format!("[{}] {}\n",
time::now()
.strftime("%Y-%m-%d %H:%M:%S.%f")
.unwrap(),
record.args());
log_file.write_all(&log_message.into_bytes())
.expect("couldn't write to log file?!");
}
}
#[derive(Debug, Clone)]
enum LookaheadBound {
Depth(u8, Option<u8>),
DepthSequence(Vec<u8>),
Seconds(u8),
}
impl LookaheadBound {
pub fn duration(&self) -> Duration {
match *self {
LookaheadBound::Seconds(secs) => Duration::seconds(i64::from(secs)),
_ => {
moral_panic!("`duration()` called on non-Seconds LookaheadBound \
variant")
}
}
}
pub fn new_from_sequence_depiction(depiction: &str) -> Self {
let depth_runes = depiction.split(',');
let depth_sequence = depth_runes.map(|dd| {
dd.parse::<u8>()
.expect("couldn't parse depth \
sequence")
})
.collect::<Vec<_>>();
LookaheadBound::DepthSequence(depth_sequence)
}
pub fn from_args(lookahead_depth: Option<u8>,
lookahead_extension: Option<u8>,
lookahead_depth_sequence: Option<String>,
lookahead_seconds: Option<u8>)
-> Result<Option<Self>, String> {
let mut bound = None;
let confirm_bound_is_none =
|b: &Option<LookaheadBound>| -> Result<bool, String> {
if b.is_some() {
Err("more than one of `--depth`, `--depth-sequence`, or \
`--seconds` was passed"
.to_owned())
} else {
Ok(true)
}
};
if let Some(depth) = lookahead_depth {
confirm_bound_is_none(&bound)?;
bound = Some(LookaheadBound::Depth(depth, lookahead_extension));
}
if let Some(sequence_depiction) = lookahead_depth_sequence {
confirm_bound_is_none(&bound)?;
bound = Some(LookaheadBound::new_from_sequence_depiction(
&sequence_depiction));
}
if let Some(seconds) = lookahead_seconds {
confirm_bound_is_none(&bound)?;
bound = Some(LookaheadBound::Seconds(seconds));
}
Ok(bound)
}
}
fn forecast<T: 'static + Memory>(world: WorldState, bound: LookaheadBound, déjà_vu_bound: f32)
-> (Vec<(Commit, f32, T)>, u8, Duration) {
let start_thinking = get_time();
let forecasts;
let depth;
match bound {
LookaheadBound::Depth(ds, es) => {
forecasts = kickoff::<T>(&world, ds, es, false, déjà_vu_bound);
depth = ds;
}
LookaheadBound::DepthSequence(ds) => {
depth = *ds.last().unwrap();
forecasts = fixed_depth_sequence_kickoff::<T>(
&world, ds, false, déjà_vu_bound);
// XXX TODO: if we're just returning a number, it should be the
// lowest depth, but we should really report all of them
}
LookaheadBound::Seconds(_) => {
let (fs, ds) = iterative_deepening_kickoff::<T>(
&world, bound.duration(), false, déjà_vu_bound);
forecasts = fs;
depth = ds;
}
}
let stop_thinking = get_time();
let thinking_time = stop_thinking - start_thinking;
(forecasts, depth, thinking_time)
}
#[derive(Serialize)]
struct Postcard {
world: String,
patch: TransitPatch,
hospitalization: Option<Agent>,
thinking_time: u64,
depth: u8,
counterreplies: Vec<TransitPatch>,
rosetta_stone: String,
}
#[derive(Serialize)]
struct LastMissive {
the_triumphant: Option<Team>,
}
#[allow(clippy::clcollapsible_if)]
fn correspondence(reminder: &str, bound: LookaheadBound, déjà_vu_bound: f32)
-> String {
let in_medias_res = WorldState::reconstruct(reminder);
let (mut forecasts, depth, sidereal) = forecast::<Patch>(in_medias_res,
bound,
déjà_vu_bound);
if !forecasts.is_empty() {
let (determination, _karma, _variation) = forecasts.swap_remove(0);
// XXX TODO FIXME: this doesn't distinguish amongst ascensions
// (and we can imagine somewhat contrived situations where only
// some of them are admissible movements)
let counterreplies = determination.tree
.lookahead()
.iter()
.map(|c| TransitPatch::from(c.patch))
.collect::<Vec<_>>();
if counterreplies.is_empty() {
if determination.tree.in_critical_endangerment(Team::Orange) {
return encode(&LastMissive {
the_triumphant: Some(Team::Blue),
})
} else {
return encode(&LastMissive { the_triumphant: None });
}
}
let postcard = Postcard {
world: determination.tree.preserve(),
patch: TransitPatch::from(determination.patch),
hospitalization: determination.hospitalization,
thinking_time: sidereal.num_milliseconds() as u64,
depth,
counterreplies,
rosetta_stone: determination.patch.abbreviated_pagan_movement_rune(),
};
encode(&postcard)
} else if in_medias_res.in_critical_endangerment(Team::Blue) {
encode(&LastMissive { the_triumphant: Some(Team::Orange) })
} else {
encode(&LastMissive { the_triumphant: None })
}
}
fn the_end() {
println!("THE END");
process::exit(0);
}
fn main() {
// Does argparse not offer an analogue of Python's argparse's
// `add_mutually_exclusive_group`
// (https://docs.python.org/3/library/argparse.html#mutual-exclusion)?
// Contribution opportunity if so??
let mut lookahead_depth: Option<u8> = None;
let mut lookahead_extension: Option<u8> = None;
// TODO CONSIDER: would argparse's Collect action be cleaner?
let mut lookahead_depth_sequence: Option<String> = None;
let mut lookahead_seconds: Option<u8> = None;
let mut from_runes: Option<String> = None;
let mut correspond: bool = false;
let mut uci_dæmon: bool = false;
let mut déjà_vu_bound: f32 = 2.0;
let mut debug_logging: bool = false;
{
let mut parser = ArgumentParser::new();
parser.set_description("Leafline: an oppositional strategy game engine");
parser.refer(&mut lookahead_depth).add_option(
&["--depth"],
StoreOption,
"rank moves using AI minimax lookahead this deep");
parser.refer(&mut lookahead_extension).add_option(
&["--quiet"],
StoreOption,
"search with quietness extension this deep");
parser.refer(&mut lookahead_depth_sequence).add_option(
&["--depth-sequence"],
StoreOption,
"rank moves using AI minimax lookahead to these depths");
parser.refer(&mut lookahead_seconds).add_option(
&["--seconds"],
StoreOption,
"rank moves using AI minimax for about this many seconds");
parser.refer(&mut correspond).add_option(
&["--correspond"],
StoreTrue,
"just output the serialization of the AI's top response and \
legal replies thereto");
parser.refer(&mut uci_dæmon).add_option(
&["--uci", "--deamon", "--dæmon"],
StoreTrue,
"run Unlikely Command Integration dæmon for external driver play");
parser.refer(&mut from_runes).add_option(
&["--from"],
StoreOption,
"start a game from the given book of preservation runes");
parser.refer(&mut déjà_vu_bound).add_option(
&["--déjà-vu-bound", "--deja-vu-bound"],
Store,
"try to not store more entries in the déjà vu table than fit in \
this many GiB of memory",
);
parser.refer(&mut debug_logging).add_option(
&["--debug"],
StoreTrue,
"run with debug logging to file",
);
parser.add_option(&["--version", "-v"],
Print(env!("CARGO_PKG_VERSION").to_owned()), "diplay the version");
parser.parse_args_or_exit();
}
if debug_logging {
DebugLogger::init().expect("couldn't initialize logging?!")
}
if correspond {
let bound_maybe_result = LookaheadBound::from_args(lookahead_depth,
lookahead_extension,
lookahead_depth_sequence,
lookahead_seconds);
let bound = match bound_maybe_result {
Ok(bound_maybe) => {
match bound_maybe {
Some(bound) => bound,
None => {
moral_panic!("`--correspond` passed without exactly one \
of `--depth`, `--depth-sequence`, or \
`--seconds`")
}
}
}
Err(error) => {
moral_panic!(error)
}
};
let from = from_runes.expect("`--correspond` requires `--from`");
println!("{}", correspondence(&from, bound, déjà_vu_bound));
process::exit(0);
}
if uci_dæmon {
uci::dæmon();
// ↑ dæmon will loop
process::exit(0);
}
println!("Welcome to Leafline v. {}!", env!("CARGO_PKG_VERSION"));
match memory_free() {
Some(bytes) => {
println!("Leafline substrate accountant detected {:.3} \
GiB of free memory.",
bytes.in_gib());
}
None => {
println!("Could not detect amount of free memory! \
It is possible \
that you are struggling with an inferior nonfree \
operating system forced on you by your masters in \
Cupertino or Redmond");
}
}
let mut world = match from_runes {
Some(runes) => WorldState::reconstruct(&runes),
None => WorldState::new(),
};
let mut premonitions: Vec<Commit>;
let bound_maybe = LookaheadBound::from_args(lookahead_depth,
lookahead_extension,
lookahead_depth_sequence,
lookahead_seconds)
.unwrap();
loop {
match bound_maybe {
None => {
premonitions = world.lookahead();
if premonitions.is_empty() {
// XXX TODO distinguish between deadlock and
// ultimate endangerment
the_end();
}
println!("{}", world);
for (index, premonition) in premonitions.iter().enumerate() {
println!("{:>2}. {}", index, premonition)
}
}
Some(ref bound) => {
let (our_forecasts, depth, thinking_time) =
forecast::<Variation>(world, bound.clone(), déjà_vu_bound);
let forecasts = our_forecasts;
println!("{}", world);
let depth_report = match *bound {
LookaheadBound::Depth(standard, Some(quietening)) => {
format!(
"at least {} and up to {}",
standard,
standard + quietening)
}
_ => format!("{}", depth),
};
println!("(scoring alternatives {} levels deep took {} ms)",
depth_report,
thinking_time.num_milliseconds());
premonitions = Vec::new();
for (index, sight) in forecasts.into_iter().enumerate() {
let (commit, score, variation) = sight;
println!("{:>2}: {} — score {} ‣ representative variation: {}",
index,
commit,
Color::Purple.bold()
.paint(&format!("{:.1}", score)),
pagan_variation_format(&variation));
premonitions.push(commit);
}
if premonitions.is_empty() {
the_end();
}
}
}
loop {
print!("\nSelect a move>> ");
io::stdout().flush().expect("couldn't flush stdout");
let mut input_buffer = String::new();
io::stdin()
.read_line(&mut input_buffer)
.expect("couldn't read input");
if input_buffer.trim() == "quit" {
the_end();
}
let choice: usize = match input_buffer.trim().parse() {
Ok(i) => i,
Err(e) => {
println!("Error parsing choice: {:?}. Try again.", e);
continue;
}
};
if choice < premonitions.len() {
world = premonitions[choice].tree;
break;
} else {
println!("{} isn't among the choices. Try again.", choice);
}
}
}
}
#[cfg(test)]
mod tests {
use super::{LookaheadBound, correspondence};
use ::{Postcard, encode};
use life::TransitPatch;
use space::{RelaxedLocale, Locale};
use identity::{Agent, JobDescription, Team};
use LastMissive;
#[test]
fn concerning_correspondence_victory_conditions() {
let blue_concession = correspondence("R6k/6pp/8/8/8/8/8/8 b - -",
LookaheadBound::Depth(2, None),
1.0);
assert_eq!("{\"the_triumphant\":\"Orange\"}".to_owned(),
blue_concession);
}
#[test]
fn test_serialize_postcard() {
let p = Postcard {
world: "rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2".to_string(),
patch: TransitPatch {
star: Agent { team: Team::Orange, job_description: JobDescription::Scholar },
whence: RelaxedLocale::from(Locale::new(1, 2)),
whither: RelaxedLocale::from(Locale::new(3, 4)),
},
hospitalization: None,
thinking_time: 123,
depth: 4,
counterreplies: vec![],
rosetta_stone: "Bd5".to_string()
};
assert_eq!(r#"{
"world":"rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2",
"patch":{
"star":{
"team":"Orange",
"job_description":"Scholar"
},
"whence":{"rank":1,"file":2},
"whither":{"rank":3,"file":4}
},
"hospitalization":null,
"thinking_time":123,
"depth":4,
"counterreplies":[],
"rosetta_stone":"Bd5"
}"#.replace("\n", ""),
encode(&p)
);
}
#[test]
fn test_serialize_last_missive() {
let l1 = LastMissive { the_triumphant: None };
assert_eq!(r#"{"the_triumphant":null}"#, encode(&l1));
let l1 = LastMissive { the_triumphant: Some(Team::Orange) };
assert_eq!(r#"{"the_triumphant":"Orange"}"#, encode(&l1));
}
}
| {
"content_hash": "699b2ef4378969f9761b80a4eb2fac30",
"timestamp": "",
"source": "github",
"line_count": 519,
"max_line_length": 95,
"avg_line_length": 34.45472061657033,
"alnum_prop": 0.5115199642098199,
"repo_name": "FoxLisk/Leafline",
"id": "c78af2d8e0948c07ad64a04d3d0695a1e9319e57",
"size": "18190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main.rs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "539"
},
{
"name": "Clojure",
"bytes": "12410"
},
{
"name": "HTML",
"bytes": "6997"
},
{
"name": "JavaScript",
"bytes": "13249"
},
{
"name": "Makefile",
"bytes": "909"
},
{
"name": "Python",
"bytes": "8207"
},
{
"name": "Rust",
"bytes": "138214"
}
],
"symlink_target": ""
} |
package org.hisp.dhis.common;
import java.util.Date;
import org.hisp.dhis.analytics.EventOutputType;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
/**
* @author Lars Helge Overland
*/
public interface EventAnalyticalObject
extends AnalyticalObject
{
Program getProgram();
ProgramStage getProgramStage();
Date getStartDate();
Date getEndDate();
EventOutputType getOutputType();
NameableObject getValue();
boolean isCollapseDataDimensions();
// -------------------------------------------------------------------------
// Base class emulation methods
// -------------------------------------------------------------------------
DataElement getDataElementValueDimension();
void setDataElementValueDimension( DataElement dataElementValueDimension );
TrackedEntityAttribute getAttributeValueDimension();
void setAttributeValueDimension( TrackedEntityAttribute attributeValueDimension );
}
| {
"content_hash": "4d8b949f4a78a6a694629b87984d5f5c",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 89,
"avg_line_length": 25.84090909090909,
"alnum_prop": 0.644678979771328,
"repo_name": "kakada/dhis2",
"id": "6c00c5d87cb5843ca92875208cf6cc1e452a6abe",
"size": "2693",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dhis-api/src/main/java/org/hisp/dhis/common/EventAnalyticalObject.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "396164"
},
{
"name": "Game Maker Language",
"bytes": "20893"
},
{
"name": "HTML",
"bytes": "340997"
},
{
"name": "Java",
"bytes": "18116166"
},
{
"name": "JavaScript",
"bytes": "7103857"
},
{
"name": "Ruby",
"bytes": "1011"
},
{
"name": "Shell",
"bytes": "376"
},
{
"name": "XSLT",
"bytes": "24103"
}
],
"symlink_target": ""
} |
angular.module('app').directive('areaComments',['$stateParams', '$http', function($stateParams, $http){
return{
restrict: 'A',
replace: true,
scope: false,
templateUrl: 'areas/comment.html',
link: function(scope){
scope.commentFormData = {
areaID: $stateParams.areaID
};
scope.submitComment = function(){
$http.post('/v1/comments', scope.commentFormData)
.success(function(response){
scope.area.comments.unshift(response.comment);
// Reset the form upon successful post
scope.commentFormData = {};
})
};
scope.deleteComment = function(comment_id, commentIndex){
$http.delete('/v1/comments/' + comment_id)
.success(function(response){
scope.area.comments.splice(commentIndex, 1)
})
};
scope.commentFields = [
{
key: 'comment_headline',
type: 'input',
templateOptions: {
label: 'Headline',
placeholder: "What's this spot like?"
}
},
{
key: 'comment_body',
type: 'textarea',
templateOptions: {
label: "Describe the area",
placeholder: 'Tell us about the area. Better approach? What are the best days to visit?'
}
}
];
}
}
}]); | {
"content_hash": "182020f339d1e7cfa4d1068a6ca2e2fa",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 103,
"avg_line_length": 30.466666666666665,
"alnum_prop": 0.5390226112326769,
"repo_name": "Pal0r/butteskier",
"id": "463ce694807d094d339e04510885ca35372b032f",
"size": "1371",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/assets/javascripts/angular/directives/AreaComment.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2172301"
},
{
"name": "HTML",
"bytes": "30305"
},
{
"name": "JavaScript",
"bytes": "21667970"
},
{
"name": "Ruby",
"bytes": "84114"
},
{
"name": "Shell",
"bytes": "14726"
}
],
"symlink_target": ""
} |
LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
# Values for CC, CFLAGS, CXX, CXXFLAGS are provided by OSS-Fuzz.
# Outside of OSS-Fuzz use the ones you prefer or rely on the default values.
# Do not use the -fsanitize=* flags by default.
# OSS-Fuzz will use different -fsanitize=* flags for different builds (asan, ubsan, msan, ...)
# You may add extra compiler flags like this:
CXXFLAGS += -std=c++11
all: do_stuff_unittest do_stuff_fuzzer
clean:
rm -fv *.a *.o *unittest *_fuzzer *_seed_corpus.zip crash-* *.zip
# Continuos integration system should run "make clean && make check"
check: all
./do_stuff_unittest
./do_stuff_fuzzer do_stuff_test_data/*
# Unit tests
do_stuff_unittest: do_stuff_unittest.cpp my_api.a
${CXX} ${CXXFLAGS} $< my_api.a -o $@
# Fuzz target, links against $LIB_FUZZING_ENGINE, so that
# you may choose which fuzzing engine to use.
do_stuff_fuzzer: do_stuff_fuzzer.cpp my_api.a standalone_fuzz_target_runner.o
${CXX} ${CXXFLAGS} $< my_api.a ${LIB_FUZZING_ENGINE} -o $@
zip -q -r do_stuff_fuzzer_seed_corpus.zip do_stuff_test_data
# The library itself.
my_api.a: my_api.cpp my_api.h
${CXX} ${CXXFLAGS} $< -c
ar ruv my_api.a my_api.o
# The standalone fuzz target runner.
standalone_fuzz_target_runner.o: standalone_fuzz_target_runner.cpp
| {
"content_hash": "6ea90fbb5952e9a562305b708bf3943f",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 94,
"avg_line_length": 33.81578947368421,
"alnum_prop": 0.7151750972762646,
"repo_name": "skia-dev/oss-fuzz",
"id": "8ca5e2243bfe7fc5ae8e35fa0edc299cfc138e45",
"size": "1929",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "projects/example/my-api-repo/Makefile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "553498"
},
{
"name": "C++",
"bytes": "412656"
},
{
"name": "CMake",
"bytes": "1635"
},
{
"name": "Dockerfile",
"bytes": "874184"
},
{
"name": "Go",
"bytes": "67217"
},
{
"name": "HTML",
"bytes": "13787"
},
{
"name": "Java",
"bytes": "551460"
},
{
"name": "JavaScript",
"bytes": "2508"
},
{
"name": "Makefile",
"bytes": "13162"
},
{
"name": "Python",
"bytes": "969565"
},
{
"name": "Ruby",
"bytes": "1827"
},
{
"name": "Rust",
"bytes": "8384"
},
{
"name": "Shell",
"bytes": "1356613"
},
{
"name": "Starlark",
"bytes": "5471"
},
{
"name": "Swift",
"bytes": "1363"
}
],
"symlink_target": ""
} |
import React from "react";
import moment from "moment";
class BlogEntry extends React.Component {
render() {
console.log(this.props);
return (
<div>
<h2>{this.props.blogEntry[0].title}</h2>
<p>by {this.props.blogEntry[0].author}</p>
<p>
{moment(this.props.blogEntry[0].createdAt).format(
"dddd, MMMM Do YYYY, h:mm a"
)}
</p>
<p>{this.props.blogEntry[0].content}</p>
</div>
);
}
}
export default BlogEntry;
| {
"content_hash": "0a6594c313ea63a1a5db99475adf2db7",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 60,
"avg_line_length": 23.09090909090909,
"alnum_prop": 0.5531496062992126,
"repo_name": "relhtml/prologue",
"id": "17a378be07517d97cb31e9281e6e152ca743ede5",
"size": "508",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "components/BlogEntry/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "40147"
}
],
"symlink_target": ""
} |
package org.apache.drill.exec.store.easy.text.compliant;
import org.apache.drill.TestSelectWithOption;
import org.apache.drill.categories.RowSetTests;
import org.apache.drill.common.types.TypeProtos.MinorType;
import org.apache.drill.exec.physical.rowSet.RowSet;
import org.apache.drill.exec.physical.rowSet.RowSetBuilder;
import org.apache.drill.exec.record.metadata.SchemaBuilder;
import org.apache.drill.exec.record.metadata.TupleMetadata;
import org.apache.drill.exec.store.easy.text.TextFormatPlugin;
import org.apache.drill.test.rowSet.RowSetUtilities;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import static org.apache.drill.test.rowSet.RowSetUtilities.strArray;
import static org.junit.Assert.assertTrue;
/**
* Test table properties with the compliant text reader. The
* table properties override selected properties in the format
* plugin config. The tests here start with a "stock" CSV
* format plugin config without headers. We then use table
* properties to vary the table format: without headers, skip
* first row, with headers.
* <p>
* The tests also verify that, without headers, if a schema
* is provided, the text format plugin will create columns
* using that schema rather than using the "columns" array
* column.
*
* @see TestSelectWithOption for similar tests using table
* properties within SQL
*/
@Category(RowSetTests.class)
public class TestCsvTableProperties extends BaseCsvTest {
@BeforeClass
public static void setup() throws Exception {
BaseCsvTest.setup(false, false);
}
private static final String COL_SCHEMA = "id int not null, name varchar not null";
private static final String SCHEMA_SQL =
"create schema (%s) " +
"for table %s PROPERTIES ('" + TextFormatPlugin.HAS_HEADERS_PROP +
"'='%s', '" + TextFormatPlugin.SKIP_FIRST_LINE_PROP + "'='%s')";
private RowSet expectedSchemaRows() {
TupleMetadata expectedSchema = new SchemaBuilder()
.add("id", MinorType.INT)
.add("name", MinorType.VARCHAR)
.buildSchema();
return new RowSetBuilder(client.allocator(), expectedSchema)
.addRow(10, "fred")
.addRow(20, "wilma")
.build();
}
private RowSet expectedArrayRows() {
TupleMetadata expectedSchema = new SchemaBuilder()
.addArray("columns", MinorType.VARCHAR)
.buildSchema();
return new RowSetBuilder(client.allocator(), expectedSchema)
.addSingleCol(strArray("10", "fred"))
.addSingleCol(strArray("20", "wilma"))
.build();
}
private static final String SELECT_ALL = "SELECT * FROM %s";
private static final String[] noHeaders = {
"10,fred",
"20,wilma"
};
@Test
public void testNoHeadersWithSchema() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("noHwS", noHeaders);
run(SCHEMA_SQL, COL_SCHEMA, tablePath, false, false);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
RowSetUtilities.verify(expectedSchemaRows(), actual);
} finally {
resetSchemaSupport();
}
}
@Test
public void testNoHeadersWithoutSchema() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("noHnoS", noHeaders);
run(SCHEMA_SQL, "", tablePath, false, false);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
RowSetUtilities.verify(expectedArrayRows(), actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] extraCols = {
"10,fred,23.45",
"20,wilma,1234.56,vip"
};
@Test
public void testNoHeadersWithSchemaExtraCols() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("extraCols", extraCols);
run(SCHEMA_SQL, COL_SCHEMA, tablePath, false, false);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
TupleMetadata expectedSchema = new SchemaBuilder()
.add("id", MinorType.INT)
.add("name", MinorType.VARCHAR)
.buildSchema();
RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema)
.addRow(10, "fred")
.addRow(20, "wilma")
.build();
RowSetUtilities.verify(expected, actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] skipHeaders = {
"ignore,me",
"10,fred",
"20,wilma"
};
@Test
public void testSkipHeadersWithSchema() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("skipHwS", skipHeaders);
run(SCHEMA_SQL, COL_SCHEMA, tablePath, false, true);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
RowSetUtilities.verify(expectedSchemaRows(), actual);
} finally {
resetSchemaSupport();
}
}
@Test
public void testSkipHeadersWithoutSchema() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("skipHnoS", skipHeaders);
run(SCHEMA_SQL, "", tablePath, false, true);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
RowSetUtilities.verify(expectedArrayRows(), actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] withHeaders = {
"id, name",
"10,fred",
"20,wilma"
};
@Test
public void testHeadersWithSchema() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("headwS", withHeaders);
run(SCHEMA_SQL, COL_SCHEMA, tablePath, true, false);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
RowSetUtilities.verify(expectedSchemaRows(), actual);
} finally {
resetSchemaSupport();
}
}
@Test
public void testHeadersWithoutSchema() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("headnoS", withHeaders);
run(SCHEMA_SQL, "", tablePath, true, false);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
TupleMetadata expectedSchema = new SchemaBuilder()
.add("id", MinorType.VARCHAR)
.add("name", MinorType.VARCHAR)
.buildSchema();
RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema)
.addRow("10", "fred")
.addRow("20", "wilma")
.build();
RowSetUtilities.verify(expected, actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] barDelim = {
"10|fred",
"20|wilma"
};
@Test
public void testDelimiter() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("barDelim", barDelim);
String sql = String.format(SCHEMA_SQL, COL_SCHEMA, tablePath, false, false);
sql = sql.substring(0, sql.length() - 1) +
", '" + TextFormatPlugin.DELIMITER_PROP + "'='|')";
run(sql);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
RowSetUtilities.verify(expectedSchemaRows(), actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] customCommentChar = {
"@Comment",
"#10,fred",
"#20,wilma"
};
private RowSet expectedCommentRows() {
TupleMetadata expectedSchema = new SchemaBuilder()
.addArray("columns", MinorType.VARCHAR)
.buildSchema();
return new RowSetBuilder(client.allocator(), expectedSchema)
.addSingleCol(strArray("#10", "fred"))
.addSingleCol(strArray("#20", "wilma"))
.build();
}
@Test
public void testComment() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("customCommentChar", customCommentChar);
String sql = String.format(SCHEMA_SQL, "", tablePath, false, false);
sql = sql.substring(0, sql.length() - 1) +
", '" + TextFormatPlugin.COMMENT_CHAR_PROP + "'='@')";
run(sql);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
RowSetUtilities.verify(expectedCommentRows(), actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] noCommentChar = {
"#10,fred",
"#20,wilma"
};
/**
* Users have complained about the comment character. We usually
* suggest they change it to some other character. This test verifies
* that the plugin will choose the ASCII NUL (0) character if the
* comment property is set to a blank string. Since NUL never occurs
* in the input, the result is to essentially disable comment support.
*/
@Test
public void testNoComment() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("noCommentChar", noCommentChar);
String sql = String.format(SCHEMA_SQL, "", tablePath, false, false);
sql = sql.substring(0, sql.length() - 1) +
", '" + TextFormatPlugin.COMMENT_CHAR_PROP + "'='')";
run(sql);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
RowSetUtilities.verify(expectedCommentRows(), actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] quotesData = {
"1,@foo@",
"2,@foo~@bar@",
// Test proper handling of escapes. This was broken in V2.
"3,@foo~bar@",
"4,@foo~~bar@"
};
/**
* Test quote and quote escape
*/
@Test
public void testQuoteChars() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("customQuotes", quotesData);
String sql = "create schema () " +
"for table " + tablePath + " PROPERTIES ('" +
TextFormatPlugin.HAS_HEADERS_PROP + "'='false', '" +
TextFormatPlugin.SKIP_FIRST_LINE_PROP + "'='false', '" +
TextFormatPlugin.QUOTE_PROP + "'='@', '" +
TextFormatPlugin.QUOTE_ESCAPE_PROP + "'='~')";
run(sql);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
TupleMetadata expectedSchema = new SchemaBuilder()
.addArray("columns", MinorType.VARCHAR)
.buildSchema();
RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema)
.addSingleCol(strArray("1", "foo"))
.addSingleCol(strArray("2", "foo@bar"))
.addSingleCol(strArray("3", "foo~bar"))
.addSingleCol(strArray("4", "foo~~bar"))
.build();
RowSetUtilities.verify(expected, actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] doubleQuotesData = {
"1,@foo@",
"2,@foo@@bar@",
};
/**
* Test that the quote escape can be the quote character
* itself. In this case, <escape>&<lt;escape> is the
* same as <quote><quote> and is considered to
* be an escaped quote. There is no "orphan" escape
* case.
*/
@Test
public void testDoubleQuoteChars() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("doubleQuotes", doubleQuotesData);
String sql = "create schema () " +
"for table " + tablePath + " PROPERTIES ('" +
TextFormatPlugin.HAS_HEADERS_PROP + "'='false', '" +
TextFormatPlugin.SKIP_FIRST_LINE_PROP + "'='false', '" +
TextFormatPlugin.QUOTE_PROP + "'='@', '" +
TextFormatPlugin.QUOTE_ESCAPE_PROP + "'='@')";
run(sql);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
TupleMetadata expectedSchema = new SchemaBuilder()
.addArray("columns", MinorType.VARCHAR)
.buildSchema();
RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema)
.addSingleCol(strArray("1", "foo"))
.addSingleCol(strArray("2", "foo@bar"))
.build();
RowSetUtilities.verify(expected, actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] quotesAndCustomNewLineData = {
"1,@foo@!2,@foo@@bar@!",
};
@Test
public void testQuotesAndCustomNewLine() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("quotesAndCustomNewLine", quotesAndCustomNewLineData);
String sql = "create schema () " +
"for table " + tablePath + " PROPERTIES ('" +
TextFormatPlugin.HAS_HEADERS_PROP + "'='false', '" +
TextFormatPlugin.SKIP_FIRST_LINE_PROP + "'='false', '" +
TextFormatPlugin.LINE_DELIM_PROP + "'='!', '" +
TextFormatPlugin.QUOTE_PROP + "'='@', '" +
TextFormatPlugin.QUOTE_ESCAPE_PROP + "'='@')";
run(sql);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
TupleMetadata expectedSchema = new SchemaBuilder()
.addArray("columns", MinorType.VARCHAR)
.buildSchema();
RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema)
.addSingleCol(strArray("1", "foo"))
.addSingleCol(strArray("2", "foo@bar"))
.build();
RowSetUtilities.verify(expected, actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] specialCharsData = {
"10\u0001'fred'",
"20\u0001'wilma'"
};
/**
* End-to-end test of special characters for delimiter (a control
* character, ASCII 0x01) and quote (same as the SQL quote.)
*/
@Test
public void testSpecialChars() throws Exception {
try {
enableSchemaSupport();
String tablePath = buildTable("specialChars", specialCharsData);
String sql = String.format("create schema (%s) " +
"for table %s PROPERTIES ('" +
TextFormatPlugin.HAS_HEADERS_PROP + "'='false', '" +
TextFormatPlugin.SKIP_FIRST_LINE_PROP + "'='false', '" +
// Obscure Calcite parsing feature. See
// SqlParserUtil.checkUnicodeEscapeChar()
// See also https://issues.apache.org/jira/browse/CALCITE-2273
// \U0001 also seems to work.
TextFormatPlugin.DELIMITER_PROP + "'='\01', '" +
// Looks like the lexer accepts Java escapes: \n, \r,
// presumably \t, though not tested here.
TextFormatPlugin.LINE_DELIM_PROP + "'='\n', '" +
// See: http://drill.apache.org/docs/lexical-structure/#string
TextFormatPlugin.QUOTE_PROP + "'='''')",
COL_SCHEMA, tablePath);
run(sql);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
RowSetUtilities.verify(expectedSchemaRows(), actual);
} finally {
resetSchemaSupport();
}
}
/**
* Verify that a custom newline character works, and that the symbol
* '\n' can be used in SQL and is stored properly in the schema file.
*/
@Test
public void testNewlineProp() throws Exception {
try {
enableSchemaSupport();
String tableName = "newline";
File rootDir = new File(testDir, tableName);
assertTrue(rootDir.mkdir());
try(PrintWriter out = new PrintWriter(new FileWriter(new File(rootDir, ROOT_FILE)))) {
out.print("1,fred\r2,wilma\r");
}
String tablePath = "`dfs.data`.`" + tableName + "`";
String sql = "create schema () " +
"for table " + tablePath + " PROPERTIES ('" +
TextFormatPlugin.HAS_HEADERS_PROP + "'='false', '" +
TextFormatPlugin.SKIP_FIRST_LINE_PROP + "'='false', '" +
TextFormatPlugin.LINE_DELIM_PROP + "'='\r')";
run(sql);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
TupleMetadata expectedSchema = new SchemaBuilder()
.addArray("columns", MinorType.VARCHAR)
.buildSchema();
RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema)
.addSingleCol(strArray("1", "fred"))
.addSingleCol(strArray("2", "wilma"))
.build();
RowSetUtilities.verify(expected, actual);
} finally {
resetSchemaSupport();
}
}
private static final String[] messyQuotesData = {
"first\"field\"here,another \"field",
"end quote\",another\"",
"many\"\"\"\",more\"\"",
"\"not\"end\",\"\"wtf\" \"",
"\"newline\nhere\",\"and here\"\"\n\""
};
/**
* The legacy "V2" text reader had special handling for quotes
* that appear inside fields. Example:<pre><tt>
* first"field"here,another "field</tt></pre>
* <p>
* Since behavior in this case is ill-defined, the reader
* apparently treated quotes as normal characters unless the
* field started with a quote. There is an option in the UniVocity
* code to set this behavior, but it is not exposed in Drill.
* So, this test verifies the non-customizable messy quote handling
* logic.
* <p>
* If a field starts with a quote, quoting rules kick in, including
* the quote escape, which is, by default, itself a quote. So
* <br><code>"foo""bar"</code><br>
* is read as
* <br><code>foo"bar</code><br>
* But, for fields not starting with a quote, the quote escape
* is ignored, so:
* <br><code>foo""bar</code><br>
* is read as
* <br><code>foo""bar</code><br>
* This seems more like a bug than a feature, but it does appear to be
* how the "new" text reader always worked, so the behavior is preserved.
* <p>
* Also, seems that the text reader supported embedded newlines, even
* though such behavior <i><b>will not work</b></i> if the embedded
* newline occurs near a split. In this case, the reader will scan
* forward to find a record delimiter (a newline by default), will
* find the embedded newline, and will read a partial first record.
* Again, this appears to be legacy behavior, and so is preserved,
* even if broken.
* <p>
* The key thing is that if the CSV is well-formed (no messy quotes,
* properly quoted fields with proper escapes, no embedded newlines)
* then things will work OK.
*/
@Test
public void testMessyQuotes() throws Exception {
String tablePath = buildTable("messyQuotes", messyQuotesData);
RowSet actual = client.queryBuilder().sql(SELECT_ALL, tablePath).rowSet();
TupleMetadata expectedSchema = new SchemaBuilder()
.addArray("columns", MinorType.VARCHAR)
.buildSchema();
RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema)
.addSingleCol(strArray("first\"field\"here", "another \"field"))
.addSingleCol(strArray("end quote\"", "another\""))
.addSingleCol(strArray("many\"\"\"\"", "more\"\""))
.addSingleCol(strArray("not\"end", "\"wtf\" "))
.addSingleCol(strArray("newline\nhere", "and here\"\n"))
.build();
RowSetUtilities.verify(expected, actual);
}
}
| {
"content_hash": "592b83827d41ed5ab2f0ee32adad3565",
"timestamp": "",
"source": "github",
"line_count": 534,
"max_line_length": 92,
"avg_line_length": 35.4625468164794,
"alnum_prop": 0.639911284786397,
"repo_name": "Ben-Zvi/drill",
"id": "a22d11ccf4928937b9eaf75d870926a5e3b303bd",
"size": "19738",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "exec/java-exec/src/test/java/org/apache/drill/exec/store/easy/text/compliant/TestCsvTableProperties.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "21592"
},
{
"name": "Batchfile",
"bytes": "7649"
},
{
"name": "C",
"bytes": "31425"
},
{
"name": "C++",
"bytes": "592989"
},
{
"name": "CMake",
"bytes": "24975"
},
{
"name": "CSS",
"bytes": "15036"
},
{
"name": "Dockerfile",
"bytes": "1440"
},
{
"name": "FreeMarker",
"bytes": "191783"
},
{
"name": "Java",
"bytes": "29529379"
},
{
"name": "JavaScript",
"bytes": "81650"
},
{
"name": "PLSQL",
"bytes": "2685"
},
{
"name": "Python",
"bytes": "5388"
},
{
"name": "Shell",
"bytes": "100838"
},
{
"name": "TSQL",
"bytes": "6340"
}
],
"symlink_target": ""
} |
<?php
class Show_model extends CI_Model {
//Initialize the connection to the database
public function __construct() {
parent::__construct();
$this->load->database();
}
public function searchBySong($songName){
$songName = htmlspecialchars($songName);
//SQL string
$sql = "SELECT s.title AS Song_title, ar.name AS Artist, al.title AS Album, s.category AS Genre
FROM song s, produces aps, artist ar, releases r, album al
WHERE s.title LIKE '%" . $this->db->escape_like_str($songName) .
"%' AND aps.sid = s.sid AND ar.artist_id = aps.artist_id AND ar.artist_id = r.artist_id AND al.album_id = r.album_id;";
//used to prevent sql injection attacks
//$this->db->escape($songName);
//$this->db->escape_like_str($search)
//gets the return object from the query
$queryObj = $this->db->query($sql);
return $queryObj->result_array();
}
public function searchByArtist($artistName){
$artistName = htmlspecialchars($artistName);
$sql = "SELECT s.title AS Song_title, ar.name AS Artist, al.title AS Album, s.category AS Genre
FROM song s, produces aps, artist ar, releases r, album al
WHERE ar.name LIKE '%" . $this->db->escape_like_str($artistName) .
"%' AND aps.sid = s.sid AND ar.artist_id = aps.artist_id AND ar.artist_id = r.artist_id AND al.album_id = r.album_id;";
$queryObj = $this->db->query($sql);
return $queryObj->result_array();
}
public function searchByAlbum($albumName){
$albumName = htmlspecialchars($albumName);
$sql = "SELECT s.title AS Song_title, ar.name AS Artist, al.title AS Album, s.category AS Genre
FROM song s, produces aps, artist ar, releases r, album al
WHERE al.title LIKE '%" . $this->db->escape_like_str($albumName) .
"%' AND aps.sid = s.sid AND ar.artist_id = aps.artist_id AND ar.artist_id = r.artist_id AND al.album_id = r.album_id;";
$queryObj = $this->db->query($sql);
return $queryObj->result_array();
}
//Searches for album name, artist name, and song name all at once
public function genericSearch($searchString){
$searchString = htmlspecialchars($searchString);
$sql = "SELECT s.title AS Song_title, ar.name AS Artist, al.title AS Album, s.category AS Genre
FROM song s, produces aps, artist ar, releases r, album al
WHERE (al.title LIKE '%" . $this->db->escape_like_str($searchString) .
"%' OR ar.name LIKE '%" . $this->db->escape_like_str($searchString) .
"%' OR s.title LIKE '%" . $this->db->escape_like_str($searchString) .
"%') AND aps.sid = s.sid AND ar.artist_id = aps.artist_id AND ar.artist_id = r.artist_id AND al.album_id = r.album_id;";
$queryObj = $this->db->query($sql);
return $queryObj->result_array();
}
//Input: a genre of music that is exact
public function searchByGenre($genre){
$genre = htmlspecialchars($genre);
$sql = "SELECT s.title AS Song_title, ar.name AS Artist, al.title AS Album, s.category AS Genre
FROM song s, produces aps, artist ar, releases r, album al
WHERE s.category = " . $this->db->escape($genre)
. " AND aps.sid = s.sid AND ar.artist_id = aps.artist_id AND ar.artist_id = r.artist_id AND al.album_id = r.album_id;";
$queryObj = $this->db->query($sql);
return $queryObj->result_array();
}
//Input: data is an array containing the uid of the user and the string that was searched for
//Output: none
public function searchAlbum($data){
$uid = htmlspecialchars($data['uid']);
$albumName = htmlspecialchars($data['albumName']);
$albumID = "select album_id FROM album WHERE title=" . $this->db->escape($albumName) . ";";
$albumIDs = $this->db->query($albumID);
for($i = 0; $i < $albumIDs->num_rows(); $i++){
$albumID = $albumIDs->row($i)->album_id;
$sql = "INSERT INTO search_album (uid, album_id, date_time) VALUES (" . $this->db->escape($uid) . ",'" . $albumID . "', NOW());";
$this->db->query($sql);
}
}
public function searchSong($data){
$uid = htmlspecialchars($data['uid']);
$songName = htmlspecialchars($data['songName']);
$songID = "select sid FROM song WHERE title=" . $this->db->escape($songName) . ";";
$songIDs = $this->db->query($songID);
for($i = 0; $i < $songIDs->num_rows(); $i++){
$songID = $songIDs->row($i)->sid;
$sql = "INSERT INTO search_song (uid, sid, date_time) VALUES (" . $this->db->escape($uid) . ",'" . $songID . "', NOW());";
$this->db->query($sql);
}
}
public function searchArtist($data){
$uid = htmlspecialchars($data['uid']);
$artistName = htmlspecialchars($data['artistName']);
$artistID = "select artist_id FROM artist WHERE name=" . $this->db->escape($artistName) . ";";
$artistIDs = $this->db->query($artistID);
for($i = 0; $i < $artistIDs->num_rows(); $i++){
$artistID = $artistIDs->row($i)->artist_id;
$sql = "INSERT INTO search_artist (uid, artist_id, date_time) VALUES (" . $this->db->escape($uid) . ",'" . $artistID . "', NOW());";
$this->db->query($sql);
}
}
/*public function advancedSearch($data){
switch($data){
case
}
}*/
}
| {
"content_hash": "a9d14cddefce24e7a3076448f0d5b979",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 144,
"avg_line_length": 45.24193548387097,
"alnum_prop": 0.5737967914438503,
"repo_name": "dbmfzf/CS4380-Group1-KCOU-DBMS",
"id": "72c0a18629f89cc370d818555a7d1457d5096dda",
"size": "5610",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/models/show_model.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "240"
},
{
"name": "CSS",
"bytes": "14680"
},
{
"name": "HTML",
"bytes": "8139111"
},
{
"name": "JavaScript",
"bytes": "56182"
},
{
"name": "PHP",
"bytes": "1739470"
}
],
"symlink_target": ""
} |
package com.emmaguy.todayilearned.settings;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.text.TextUtils;
import com.emmaguy.todayilearned.R;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import javax.inject.Inject;
/**
* Created by emma on 05/07/15.
*/
public class WearableActionStorage implements ActionStorage {
private static final String NONE_SELECTED_VALUE = "-1";
private final SharedPreferences mSharedPreferences;
private final WearableActions mWearableActions;
private final Resources mResources;
private final Context mContext;
@Inject
public WearableActionStorage(WearableActions wearableActions, SharedPreferences sharedPreferences, Resources resources, Context context) {
mWearableActions = wearableActions;
mSharedPreferences = sharedPreferences;
mResources = resources;
mContext = context;
}
@Override public ArrayList<Integer> getSelectedActionIds() {
String commaSeparatedActions = mSharedPreferences.getString(mContext.getString(R.string.prefs_key_actions_order), "");
ArrayList<Integer> selectedActions = parseActionsFromString(commaSeparatedActions);
if (selectedActions == null) {
selectedActions = toActionIdsList(mWearableActions.getAllActions(), true);
}
return selectedActions;
}
@Override public List<Integer> getActionIds() {
String commaSeparatedOrderedActions = mSharedPreferences.getString(mResources.getString(R.string.prefs_key_actions_order_ordered), "");
List<Integer> actions = parseActionsFromString(commaSeparatedOrderedActions);
final LinkedHashMap<Integer, Action> allActions = mWearableActions.getAllActions();
if (actions == null) {
actions = toActionIdsList(allActions, false);
}
if (actions.size() != allActions.size()) {
// Find the missing action(s) and add them
for (Integer action : allActions.keySet()) {
if (!actions.contains(action)) {
actions.add(allActions.get(action).getId());
}
}
}
return actions;
}
@Override public void save(ArrayList<Action> actions, HashMap<Integer, Action> selectedActions) {
mSharedPreferences
.edit()
.putString(mContext.getString(R.string.prefs_key_actions_order_ordered), TextUtils.join(",", getOrderedActionIds(actions)))
.putString(mContext.getString(R.string.prefs_key_actions_order), getSelectedOrderedActions(actions, selectedActions))
.apply();
}
private ArrayList<Integer> parseActionsFromString(String commaSeparatedActions) {
ArrayList<Integer> actions = new ArrayList<>();
if (commaSeparatedActions.equals(NONE_SELECTED_VALUE)) {
return actions;
}
if (TextUtils.isEmpty(commaSeparatedActions)) {
return null;
}
String[] split = commaSeparatedActions.split(",");
for (String s : split) {
actions.add(Integer.parseInt(s));
}
return actions;
}
private ArrayList<Integer> toActionIdsList(LinkedHashMap<Integer, Action> actions, boolean excludeDisabled) {
ArrayList<Integer> arrayList = new ArrayList<>();
for (Action action : actions.values()) {
if (!excludeDisabled) {
arrayList.add(action.getId());
} else if (action.isEnabled()) {
arrayList.add(action.getId());
}
}
return arrayList;
}
private String getSelectedOrderedActions(ArrayList<Action> actions, HashMap<Integer, Action> selectedActions) {
ArrayList<Integer> list = new ArrayList<>();
for (Action a : actions) {
if (selectedActions.containsKey(a.getId()) && a.isEnabled()) {
list.add(a.getId());
}
}
if (list.isEmpty()) {
return WearableActionStorage.NONE_SELECTED_VALUE;
}
return TextUtils.join(",", list);
}
private ArrayList<Integer> getOrderedActionIds(ArrayList<Action> actions) {
ArrayList<Integer> orderedActionIds = new ArrayList<>();
for (Action a : actions) {
orderedActionIds.add(a.getId());
}
return orderedActionIds;
}
}
| {
"content_hash": "a99ea01062129ae2f763529eaea6e8ce",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 143,
"avg_line_length": 34.738461538461536,
"alnum_prop": 0.6519043401240036,
"repo_name": "azeemba/wear-notify-for-reddit",
"id": "4640b43f3fd97e4921f3f7b4e392d64ab928b52e",
"size": "4516",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mobile/src/main/java/com/emmaguy/todayilearned/settings/WearableActionStorage.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "290184"
}
],
"symlink_target": ""
} |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DocumentSet.tosum_field'
db.add_column(u'crowdataapp_documentset', 'tosum_field',
self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='tosum_fields', null=True, to=orm['crowdataapp.DocumentSetFormField']),
keep_default=False)
def backwards(self, orm):
# Deleting field 'DocumentSet.tosum_field'
db.delete_column(u'crowdataapp_documentset', 'tosum_field_id')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'crowdataapp.canonicalfieldentrylabel': {
'Meta': {'object_name': 'CanonicalFieldEntryLabel'},
'document_set': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'canonical_values'", 'null': 'True', 'to': u"orm['crowdataapp.DocumentSet']"}),
'form_field': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'form_field'", 'to': u"orm['crowdataapp.DocumentSetFormField']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '2000', 'null': 'True'})
},
u'crowdataapp.document': {
'Meta': {'object_name': 'Document'},
'document_set': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'documents'", 'to': u"orm['crowdataapp.DocumentSet']"}),
'entries_threshold_override': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True'}),
'url': ('django.db.models.fields.URLField', [], {'max_length': "'512'"}),
'verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
},
u'crowdataapp.documentset': {
'Meta': {'object_name': 'DocumentSet'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'entries_threshold': ('django.db.models.fields.IntegerField', [], {'default': '3'}),
'head_html': ('django.db.models.fields.TextField', [], {'default': '\'<!-- <script> or <link rel="stylesheet"> tags go here -->\'', 'null': 'True'}),
'header_image': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': "'128'"}),
'published': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'slug': ('django_extensions.db.fields.AutoSlugField', [], {'allow_duplicates': 'False', 'max_length': '50', 'separator': "u'-'", 'blank': 'True', 'populate_from': "'name'", 'overwrite': 'False'}),
'template_function': ('django.db.models.fields.TextField', [], {'default': "'// Javascript function to insert the document into the DOM.\\n// Receives the URL of the document as its only parameter.\\n// Must be called insertDocument\\n// JQuery is available\\n// resulting element should be inserted into div#document-viewer-container\\nfunction insertDocument(document_url) {\\n}\\n'"}),
'tosum_field': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'tosum_fields'", 'null': 'True', 'to': u"orm['crowdataapp.DocumentSetFormField']"}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
u'crowdataapp.documentsetfieldentry': {
'Meta': {'object_name': 'DocumentSetFieldEntry'},
'canonical_label': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fields'", 'null': 'True', 'to': u"orm['crowdataapp.CanonicalFieldEntryLabel']"}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
'entry': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fields'", 'to': u"orm['crowdataapp.DocumentSetFormEntry']"}),
'field_id': ('django.db.models.fields.IntegerField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '2000', 'null': 'True'}),
'verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
},
u'crowdataapp.documentsetform': {
'Meta': {'object_name': 'DocumentSetForm'},
'button_text': ('django.db.models.fields.CharField', [], {'default': "u'Submit'", 'max_length': '50'}),
'document_set': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'form'", 'unique': 'True', 'to': u"orm['crowdataapp.DocumentSet']"}),
'email_copies': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
'email_from': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'email_message': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'email_subject': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
'expiry_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'intro': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'login_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'publish_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'response': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'send_email': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'sites': ('django.db.models.fields.related.ManyToManyField', [], {'default': '[1]', 'to': u"orm['sites.Site']", 'symmetrical': 'False'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}),
'status': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'crowdataapp.documentsetformentry': {
'Meta': {'object_name': 'DocumentSetFormEntry'},
'document': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'form_entries'", 'null': 'True', 'to': u"orm['crowdataapp.Document']"}),
'entry_time': ('django.db.models.fields.DateTimeField', [], {}),
'form': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'entries'", 'to': u"orm['crowdataapp.DocumentSetForm']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'})
},
u'crowdataapp.documentsetformfield': {
'Meta': {'object_name': 'DocumentSetFormField'},
'autocomplete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'choices': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'}),
'default': ('django.db.models.fields.CharField', [], {'max_length': '2000', 'blank': 'True'}),
'field_type': ('django.db.models.fields.IntegerField', [], {}),
'form': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fields'", 'to': u"orm['crowdataapp.DocumentSetForm']"}),
'help_text': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'label': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'order': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'placeholder_text': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'required': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}),
'verify': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'visible': ('django.db.models.fields.BooleanField', [], {'default': 'True'})
},
u'crowdataapp.documentsetrankingdefinition': {
'Meta': {'object_name': 'DocumentSetRankingDefinition'},
'amount_rows_on_home': ('django.db.models.fields.IntegerField', [], {'default': '10', 'null': 'True'}),
'document_set': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'rankings'", 'to': u"orm['crowdataapp.DocumentSet']"}),
'grouping_function': ('django.db.models.fields.CharField', [], {'default': "'SUM'", 'max_length': '10'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'label_field': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'label_fields'", 'to': u"orm['crowdataapp.DocumentSetFormField']"}),
'magnitude_field': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'magnitude_fields'", 'null': 'True', 'to': u"orm['crowdataapp.DocumentSetFormField']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'sort_order': ('django.db.models.fields.BooleanField', [], {'default': 'False'})
},
u'crowdataapp.userprofile': {
'Meta': {'object_name': 'UserProfile'},
'country': ('django_countries.fields.CountryField', [], {'max_length': '2', 'null': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': "'128'"}),
'show_in_leaderboard': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'unique': 'True'})
},
u'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
}
}
complete_apps = ['crowdataapp'] | {
"content_hash": "e6365c02d25260374d30ac602d2c46ee",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 400,
"avg_line_length": 84.77325581395348,
"alnum_prop": 0.5676565393320074,
"repo_name": "crowdata/crowdata",
"id": "5653032d785ae0573693fc0aa6c6389933fe07a1",
"size": "14605",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "crowdataapp/migrations/0027_auto__add_field_documentset_tosum_field.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "154335"
},
{
"name": "HTML",
"bytes": "73866"
},
{
"name": "JavaScript",
"bytes": "28009"
},
{
"name": "Python",
"bytes": "517551"
}
],
"symlink_target": ""
} |
package com.redhat.ceylon.compiler.js.util;
import com.redhat.ceylon.common.log.JULLogger;
/**
* Simple logger impl.
*
* @author Stephane Epardaud, Tako Schotanus
*/
public class JsJULLogger extends JULLogger {
static java.util.logging.Logger log = java.util.logging.Logger.getLogger("com.redhat.ceylon.log.js");
@Override
protected java.util.logging.Logger logger() {
return log;
}
}
| {
"content_hash": "14d45b54dac3c636f0593d6a322184ad",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 105,
"avg_line_length": 20,
"alnum_prop": 0.7071428571428572,
"repo_name": "gijsleussink/ceylon",
"id": "2af72676dfc77f9874e2bbebc021b1153bd292a7",
"size": "1073",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "compiler-js/src/main/java/com/redhat/ceylon/compiler/js/util/JsJULLogger.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4574"
},
{
"name": "CSS",
"bytes": "19001"
},
{
"name": "Ceylon",
"bytes": "5755595"
},
{
"name": "GAP",
"bytes": "167605"
},
{
"name": "Groff",
"bytes": "47559"
},
{
"name": "HTML",
"bytes": "4562"
},
{
"name": "Java",
"bytes": "23452104"
},
{
"name": "JavaScript",
"bytes": "480101"
},
{
"name": "Makefile",
"bytes": "19934"
},
{
"name": "Perl",
"bytes": "2756"
},
{
"name": "Shell",
"bytes": "185109"
},
{
"name": "XSLT",
"bytes": "2000144"
}
],
"symlink_target": ""
} |
<?php
use yii\helpers\Html;
use kartik\grid\GridView;
use yii\bootstrap\Dropdown;
use kartik\widgets\Select2;
/* @var $searchModel backend\models\TrainingClassStudentSearch */
$this->title = 'Student : '.\yii\helpers\Inflector::camel2words($training->name);
$this->params['breadcrumbs'][] = ['label' => 'Trainings', 'url' => \yii\helpers\Url::to(['/'.$this->context->module->uniqueId.'/training/index'])];
$this->params['breadcrumbs'][] = ['label' => 'Training Class', 'url' => \yii\helpers\Url::to(['/'.$this->context->module->uniqueId.'/training-class/index','tb_training_id'=>$tb_training_id])];
$this->params['breadcrumbs'][] = $this->title;
$controller = $this->context;
$menus = $controller->module->getMenuItems();
$this->params['sideMenu'][$controller->module->uniqueId]=$menus;
?>
<div class="training-class-student-index">
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<div class="panel" id="panel-heading-dashboard" style="display:none;" >
<a href="<?= yii\helpers\Url::to(["training/dashboard","id"=>$training->id]) ?>" style="color:#666;padding:5px;display:block;text-align:center;background:#ddd;border-bottom: 1px solid #ddd;border-radius:4px 4px 0 0">
<span class="badge"><i class="fa fa-arrow-circle-left"></i> Back To Dashboard</span>
</a>
<?php
\hscstudio\heart\widgets\Box::begin([
'type'=>'small', // ,small, solid, tiles
'bgColor'=>'red', // , aqua, green, yellow, red, blue, purple, teal, maroon, navy, light-blue
'options' => [
],
'headerOptions' => [
'button' => ['collapse','remove'],
'position' => 'right', //right, left
'color' => '', //primary, info, warning, success, danger
'class' => '',
],
'header' => 'T',
'bodyOptions' => [],
'icon' => 'fa fa-user',
//'link' => ['./training-class','tb_training_id'=>$training->id],
'footerOptions' => ['class'=>'hide'],
//'footer' => 'More info <i class="fa fa-arrow-circle-right"></i>',
]);
?>
<h3>Student</h3>
<p>Student of Training</p>
<?php
\hscstudio\heart\widgets\Box::end();
?>
</div>
<?php
$this->registerJs('
$("div#panel-heading-dashboard").slideToggle("slow");
');
?>
<?php \yii\widgets\Pjax::begin([
'id'=>'pjax-gridview',
]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'kartik\grid\SerialColumn'],
[
'attribute' => 'tb_student_id',
'label' => 'NAMA',
'value' => function ($data) {
return $data->student->name;
}
],
[
'label' => 'NIP',
'width' => '200px',
'value' => function ($data) {
return $data->student->nip;
}
],
/*
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'number',
'vAlign'=>'middle',
'headerOptions'=>['class'=>'kv-sticky-column'],
'contentOptions'=>['class'=>'kv-sticky-column'],
'editableOptions'=>['header'=>'Number', 'size'=>'md','formOptions'=>['action'=>\yii\helpers\Url::to('editable')]]
],
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'headClass',
'vAlign'=>'middle',
'headerOptions'=>['class'=>'kv-sticky-column'],
'contentOptions'=>['class'=>'kv-sticky-column'],
'editableOptions'=>['header'=>'HeadClass', 'size'=>'md','formOptions'=>['action'=>\yii\helpers\Url::to('editable')]]
],
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'activity',
'vAlign'=>'middle',
'headerOptions'=>['class'=>'kv-sticky-column'],
'contentOptions'=>['class'=>'kv-sticky-column'],
'editableOptions'=>['header'=>'Activity', 'size'=>'md','formOptions'=>['action'=>\yii\helpers\Url::to('editable')]]
],
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'presence',
//'pageSummary' => 'Page Total',
'vAlign'=>'middle',
'headerOptions'=>['class'=>'kv-sticky-column'],
'contentOptions'=>['class'=>'kv-sticky-column'],
'editableOptions'=>['header'=>'Presence', 'size'=>'md','formOptions'=>['action'=>\yii\helpers\Url::to('editable')]]
],
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'pretest',
'vAlign'=>'middle',
'headerOptions'=>['class'=>'kv-sticky-column'],
'contentOptions'=>['class'=>'kv-sticky-column'],
'editableOptions'=>['header'=>'Pretest', 'size'=>'md','formOptions'=>['action'=>\yii\helpers\Url::to('editable')]]
],
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'posttest',
'vAlign'=>'middle',
'headerOptions'=>['class'=>'kv-sticky-column'],
'contentOptions'=>['class'=>'kv-sticky-column'],
'editableOptions'=>['header'=>'Posttest', 'size'=>'md','formOptions'=>['action'=>\yii\helpers\Url::to('editable')]]
],
*/
['class' => 'kartik\grid\ActionColumn'],
],
'panel' => [
'heading'=>'<h3 class="panel-title"><i class="fa fa-fw fa-globe"></i></h3>',
'before'=>
Html::a('<i class="fa fa-fw fa-arrow-left"></i> Back To Training Class', \yii\helpers\Url::to(['/'.$this->context->module->uniqueId.'/training-class/index','tb_training_id'=>$tb_training_id]), ['class' => 'btn btn-warning']).' '.
Html::a('<i class="fa fa-fw fa-plus"></i> Create Training Class Student', ['create'], ['class' => 'btn btn-success']).
'<div class="pull-right" style="margin-right:5px;">'.
Select2::widget([
'name' => 'class',
'data' => $listTrainingClass,
'value' => $tb_training_class_id,
'options' => [
'placeholder' => 'Class ...',
'class'=>'form-control',
'onchange'=>'
$.pjax.reload({
url: "'.\yii\helpers\Url::to(['index','tb_training_id'=>$tb_training_id]).'&tb_training_class_id="+$(this).val(),
container: "#pjax-gridview",
timeout: 1,
});
',
],
]).
'</div>',
'after'=>Html::a('<i class="fa fa-fw fa-repeat"></i> Reset Grid', ['index','tb_training_id'=>$tb_training_id,'tb_training_class_id'=>$tb_training_class_id], ['class' => 'btn btn-info']),
'showFooter'=>false
],
'responsive'=>true,
'hover'=>true,
]); ?>
<?php
echo Html::beginTag('div', ['class'=>'row']);
echo Html::beginTag('div', ['class'=>'col-md-2']);
echo Html::beginTag('div', ['class'=>'dropdown']);
echo Html::button('PHPExcel <span class="caret"></span></button>',
['type'=>'button', 'class'=>'btn btn-default', 'data-toggle'=>'dropdown']);
echo Dropdown::widget([
'items' => [
['label' => 'EXport XLSX', 'url' => ['php-excel?filetype=xlsx&template=yes']],
['label' => 'EXport XLS', 'url' => ['php-excel?filetype=xls&template=yes']],
['label' => 'Export PDF', 'url' => ['php-excel?filetype=pdf&template=no']],
],
]);
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::beginTag('div', ['class'=>'col-md-2']);
echo Html::beginTag('div', ['class'=>'dropdown']);
echo Html::button('OpenTBS <span class="caret"></span></button>',
['type'=>'button', 'class'=>'btn btn-default', 'data-toggle'=>'dropdown']);
echo Dropdown::widget([
'items' => [
['label' => 'EXport DOCX', 'url' => ['open-tbs?filetype=docx']],
['label' => 'EXport ODT', 'url' => ['open-tbs?filetype=odt']],
['label' => 'EXport XLSX', 'url' => ['open-tbs?filetype=xlsx']],
],
]);
echo Html::endTag('div');
echo Html::endTag('div');
echo Html::beginTag('div', ['class'=>'col-md-8']);
$form = \yii\bootstrap\ActiveForm::begin([
'options'=>['enctype'=>'multipart/form-data'],
'action'=>['import','tb_training_id'=>$tb_training_id,'tb_training_class_id'=>$tb_training_class_id],
]);
echo \kartik\widgets\FileInput::widget([
'name' => 'importFile',
//'options' => ['multiple' => true],
'pluginOptions' => [
'previewFileType' => 'any',
'uploadLabel'=>"Import Excel",
]
]);
\yii\bootstrap\ActiveForm::end();
echo Html::endTag('div');
echo Html::endTag('div');
?>
<?php \yii\widgets\Pjax::end(); ?>
</div>
| {
"content_hash": "e8b31c803825bcb1a8ace4519ed104b1",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 233,
"avg_line_length": 36.3710407239819,
"alnum_prop": 0.5719084349340632,
"repo_name": "hscstudio/osyawwal",
"id": "1ba5632ca962aa74c4ac399944d83ae339f6fecb",
"size": "8038",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "backend/modules/pusdiklat/execution/views/buff/training-class-student/index.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "2728"
},
{
"name": "PHP",
"bytes": "3644324"
},
{
"name": "Shell",
"bytes": "1552"
}
],
"symlink_target": ""
} |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.artists import PrimitiveArtist
from .artist import RhinoArtist
class PlaneArtist(RhinoArtist, PrimitiveArtist):
"""Artist for drawing planes.
Parameters
----------
plane : :class:`~compas.geometry.Plane`
A COMPAS plane.
layer : str, optional
The layer that should contain the drawing.
**kwargs : dict, optional
Additional keyword arguments.
For more info, see :class:`RhinoArtist` and :class:`PrimitiveArtist`.
"""
def __init__(self, plane, layer=None, **kwargs):
super(PlaneArtist, self).__init__(primitive=plane, layer=layer, **kwargs)
def draw(self):
"""Draw the plane.
Returns
-------
list[System.Guid]
The GUIDs of the created Rhino objects.
"""
raise NotImplementedError
| {
"content_hash": "a6b717de3766b385ad8a517ee17817bb",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 81,
"avg_line_length": 26.194444444444443,
"alnum_prop": 0.6320254506892895,
"repo_name": "compas-dev/compas",
"id": "2e2f679c267c2cee3edd0cd60f716f0be77ce480",
"size": "943",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/compas_rhino/artists/planeartist.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "3181804"
}
],
"symlink_target": ""
} |
var mongoose = require('mongoose')
var validate = require('../../lib/validate.js');
var Schema = mongoose.Schema
, crypto = require('crypto')
, _ = require('underscore');
/**
* User Schema
*/
var ProjectSchema = new Schema({
project_title: { type: String, default:'', required:true },
project_no: { type: String, default: '', required: true },
sponsoring_agency: { type: String, default:'', required:true },
type_of_agency: { type: String, default:''},
country: { type: String, default:'', required:true },
collaborating_agency: { type: String, default:'', required:true },
research_area: { type: String, default:'', required:true },
sanction_number: { type: Number, default:'', required:true, validate:[validate.numeric] },
sanction_date: { type: Date, default:'', required:true },
duration: { type: Number, default:'', required:true, validate:[validate.numeric] },
start_date: { type: Date, default:'', required:true },
end_date: { type: Date, default:'', required:true },
sanctioned_amount: { type: Number, default:'', required:true, validate:[validate.numeric] },
project_class_id: { type: Schema.ObjectId, ref: 'Projectclass', required: true },
department_id: { type: Schema.ObjectId, ref: 'Department', required:true },
attachments:[
{
name: { type: String, default: '' },
type: { type: String, default: '' },
url: { type: String, default: '' }
}
],
investigator: [
{
faculty_id: { type: Schema.Types.ObjectId, ref: 'Faculty'},
role: { type: String, default: '' }
}
],
project_post: [
{
designation_id: { type: Schema.Types.ObjectId, ref: 'Designation'},
salary: { type: Number, default: '' }
}
],
funds:[
{
fund_type: { type: String, default: '' },
fund_amount: { type: Number, default: '' },
fund_category: { type: String, default: '' }
}
]
});
mongoose.model('Project', ProjectSchema);
| {
"content_hash": "810b28b63c7cc0fd68fefa3e93550a3f",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 97,
"avg_line_length": 37.464285714285715,
"alnum_prop": 0.5705433746425167,
"repo_name": "hiteshtr/R-D-Automation",
"id": "ce7fcaec6e4f5980a3b77c0bf37d5916e60c23f6",
"size": "2098",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/project.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "76954"
},
{
"name": "JavaScript",
"bytes": "100696"
},
{
"name": "PHP",
"bytes": "30"
},
{
"name": "Perl",
"bytes": "47"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>graphs: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.12.1 / graphs - 8.8.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
graphs
<small>
8.8.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-05-11 14:48:27 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-05-11 14:48:27 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
coq 8.12.1 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.08.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.08.1 Official release 4.08.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/graphs"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Graphs"]
depends: [
"ocaml"
"coq" {>= "8.8" & < "8.9~"}
"coq-int-map" {>= "8.8" & < "8.9~"}
]
tags: [ "keyword: graphs" "keyword: graph theory" "keyword: cycle detection" "keyword: paths" "keyword: constraints" "keyword: inequalities" "keyword: reflection" "category: Computer Science/Decision Procedures and Certified Algorithms/Decision procedures" "category: Miscellaneous/Extracted Programs/Combinatorics" ]
authors: [ "Jean Goubault" ]
bug-reports: "https://github.com/coq-contribs/graphs/issues"
dev-repo: "git+https://github.com/coq-contribs/graphs.git"
synopsis: "Satisfiability of inequality constraints and detection of cycles with negative weight in graphs"
description:
"*******************************************************************"
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/graphs/archive/v8.8.0.tar.gz"
checksum: "md5=aa176fba6a90b6ffff8f673958baa68d"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-graphs.8.8.0 coq.8.12.1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.12.1).
The following dependencies couldn't be met:
- coq-graphs -> coq < 8.9~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-graphs.8.8.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "f85e798db10882f09593b30481d434d8",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 407,
"avg_line_length": 43.23780487804878,
"alnum_prop": 0.5426597094909039,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "63a2359fe65cc6004b448450b03de2788f683e79",
"size": "7116",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.08.1-2.0.5/released/8.12.1/graphs/8.8.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
BROWSERIFY := "node_modules/.bin/browserify"
ESLINT := "node_modules/.bin/eslint"
KARMA := "node_modules/.bin/karma"
MOCHA := "bin/mocha"
NYC := "node_modules/.bin/nyc"
ifdef COVERAGE
define test_node
$(NYC) --report-dir coverage/reports/$(1) $(MOCHA)
endef
else
test_node := $(MOCHA)
endif
TM_BUNDLE = JavaScript\ mocha.tmbundle
SRC = $(shell find lib -name "*.js" -type f | LC_ALL=C sort)
TESTS = $(shell find test -name "*.js" -type f | sort)
all: mocha.js
mocha.js BUILDTMP/mocha.js: $(SRC) browser-entry.js
@printf "==> [Browser :: build]\n"
mkdir -p ${@D}
$(BROWSERIFY) ./browser-entry \
--plugin ./scripts/dedefine \
--ignore 'fs' \
--ignore 'glob' \
--ignore 'path' \
--ignore 'supports-color' > $@
clean:
@printf "==> [Clean]\n"
rm -rf BUILDTMP
lint:
@printf "==> [Test :: Lint]\n"
$(ESLINT) . "bin/*"
test-node: test-bdd test-tdd test-qunit test-exports test-unit test-integration test-jsapi test-compilers test-glob test-requires test-reporters test-only test-global-only
test-browser: clean BUILDTMP/mocha.js test-browser-unit test-browser-bdd test-browser-qunit test-browser-tdd test-browser-exports
test: lint test-node test-browser
test-browser-unit:
@printf "==> [Test :: Browser]\n"
NODE_PATH=BUILDTMP $(KARMA) start --single-run
test-browser-bdd:
@printf "==> [Test :: Browser :: BDD]\n"
MOCHA_UI=bdd $(MAKE) test-browser-unit
test-browser-qunit:
@printf "==> [Test :: Browser :: QUnit]\n"
MOCHA_UI=qunit $(MAKE) test-browser-unit
test-browser-tdd:
@printf "==> [Test :: Browser :: TDD]\n"
MOCHA_UI=tdd $(MAKE) test-browser-unit
test-jsapi:
@printf "==> [Test :: JS API]\n"
node test/jsapi
test-unit:
@printf "==> [Test :: Unit]\n"
$(call test_node,unit) test/acceptance/*.js \
--growl \
test/*.js
test-integration:
@printf "==> [Test :: Integrations]\n"
$(call test_node,integration) --timeout 5000 \
test/integration/*.js
test-compilers:
@printf "==> [Test :: Compilers]\n"
$(call test_node,compilers) --compilers coffee:coffee-script/register,foo:./test/compiler/foo \
test/acceptance/test.coffee \
test/acceptance/test.foo
test-requires:
@printf "==> [Test :: Requires]\n"
$(call test_node,requires) --compilers coffee:coffee-script/register \
--require test/acceptance/require/a.js \
--require test/acceptance/require/b.coffee \
--require test/acceptance/require/c.js \
--require test/acceptance/require/d.coffee \
test/acceptance/require/require.spec.js
test-bdd:
@printf "==> [Test :: BDD]\n"
$(call test_node,bdd) --ui bdd \
test/acceptance/interfaces/bdd.spec
test-tdd:
@printf "==> [Test :: TDD]\n"
$(call test_node,tdd) --ui tdd \
test/acceptance/interfaces/tdd.spec
test-qunit:
@printf "==> [Test :: QUnit]\n"
$(call test_node,qunit) --ui qunit \
test/acceptance/interfaces/qunit.spec
test-exports:
@printf "==> [Test :: Exports]\n"
$(call test_node,exports) --ui exports \
test/acceptance/interfaces/exports.spec
test-glob:
@printf "==> [Test :: Glob]\n"
bash ./test/acceptance/glob/glob.sh
test-reporters:
@printf "==> [Test :: Reporters]\n"
$(call test_node,reporters) test/reporters/*.js
test-only:
@printf "==> [Test :: Only]\n"
$(call test_node,only-tdd) --ui tdd \
test/acceptance/misc/only/tdd.spec
$(call test_node,only-bdd) --ui bdd \
test/acceptance/misc/only/bdd.spec
$(call test_node,only-bdd-require) --ui qunit \
test/acceptance/misc/only/bdd-require.spec
test-global-only:
@printf "==> [Test :: Global Only]\n"
$(call test_node,global-only-tdd) --ui tdd \
test/acceptance/misc/only/global/tdd.spec
$(call test_node,global-only-bdd) --ui bdd \
test/acceptance/misc/only/global/bdd.spec
$(call test_node,global-only-qunit) --ui qunit \
test/acceptance/misc/only/global/qunit.spec
test-mocha:
@printf "==> [Test :: Mocha]\n"
$(call test_node,mocha) test/mocha
non-tty:
@printf "==> [Test :: Non-TTY]\n"
$(call test_node,non-tty-dot) --reporter dot \
test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/dot.out
@echo dot:
@cat /tmp/dot.out
$(call test_node,non-tty-list) --reporter list \
test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/list.out
@echo list:
@cat /tmp/list.out
$(call test_node,non-tty-spec) --reporter spec \
test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/spec.out
@echo spec:
@cat /tmp/spec.out
tm:
@printf "==> [TM]\n"
open editors/$(TM_BUNDLE)
.PHONY: test-jsapi test-compilers watch test test-node test-bdd test-tdd test-qunit test-exports test-unit test-integration non-tty tm clean test-browser test-browser-unit test-browser-bdd test-browser-qunit test-browser-tdd test-browser-exports lint test-only test-global-only
| {
"content_hash": "acbda864319e65938575e83016184411",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 277,
"avg_line_length": 27.437869822485208,
"alnum_prop": 0.6812594349795126,
"repo_name": "menelaos/mocha-solarized",
"id": "33408bfbad98cab6bf9300545126a175865074a6",
"size": "4637",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Makefile",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5616"
},
{
"name": "CoffeeScript",
"bytes": "212"
},
{
"name": "HTML",
"bytes": "7183"
},
{
"name": "JavaScript",
"bytes": "885033"
},
{
"name": "Makefile",
"bytes": "4637"
},
{
"name": "Shell",
"bytes": "2944"
}
],
"symlink_target": ""
} |
package analyzer
import (
"reflect"
"gopkg.in/src-d/go-mysql-server.v0/sql"
"gopkg.in/src-d/go-mysql-server.v0/sql/expression"
"gopkg.in/src-d/go-mysql-server.v0/sql/plan"
)
type transformedJoin struct {
node sql.Node
condCols map[string]*transformedSource
}
type transformedSource struct {
correct string
wrong []string
}
func resolveNaturalJoins(ctx *sql.Context, a *Analyzer, n sql.Node) (sql.Node, error) {
span, ctx := ctx.Span("resolve_natural_joins")
defer span.Finish()
if n.Resolved() {
return n, nil
}
var transformed []*transformedJoin
var aliasTables = map[string][]string{}
var colsToUnresolve = map[string]*transformedSource{}
a.Log("resolving natural joins, node of type %T", n)
node, err := n.TransformUp(func(n sql.Node) (sql.Node, error) {
a.Log("transforming node of type: %T", n)
if alias, ok := n.(*plan.TableAlias); ok {
table := alias.Child.(*plan.ResolvedTable).Name()
aliasTables[alias.Name()] = append(aliasTables[alias.Name()], table)
return n, nil
}
if n.Resolved() {
return n, nil
}
join, ok := n.(*plan.NaturalJoin)
if !ok {
return n, nil
}
// we need both leaves resolved before resolving this one
if !join.Left.Resolved() || !join.Right.Resolved() {
return n, nil
}
leftSchema, rightSchema := join.Left.Schema(), join.Right.Schema()
var conditions, common, left, right []sql.Expression
var seen = make(map[string]struct{})
for i, lcol := range leftSchema {
var found bool
leftCol := expression.NewGetFieldWithTable(
i,
lcol.Type,
lcol.Source,
lcol.Name,
lcol.Nullable,
)
for j, rcol := range rightSchema {
if lcol.Name == rcol.Name {
common = append(common, leftCol)
conditions = append(
conditions,
expression.NewEquals(
leftCol,
expression.NewGetFieldWithTable(
len(leftSchema)+j,
rcol.Type,
rcol.Source,
rcol.Name,
rcol.Nullable,
),
),
)
found = true
seen[lcol.Name] = struct{}{}
if source, ok := colsToUnresolve[lcol.Name]; ok {
source.correct = lcol.Source
source.wrong = append(source.wrong, rcol.Source)
} else {
colsToUnresolve[lcol.Name] = &transformedSource{
correct: lcol.Source,
wrong: []string{rcol.Source},
}
}
break
}
}
if !found {
left = append(left, leftCol)
}
}
if len(conditions) == 0 {
return plan.NewCrossJoin(join.Left, join.Right), nil
}
for i, col := range rightSchema {
if _, ok := seen[col.Name]; !ok {
right = append(
right,
expression.NewGetFieldWithTable(
len(leftSchema)+i,
col.Type,
col.Source,
col.Name,
col.Nullable,
),
)
}
}
projections := append(append(common, left...), right...)
tj := &transformedJoin{
node: plan.NewProject(
projections,
plan.NewInnerJoin(
join.Left,
join.Right,
expression.JoinAnd(conditions...),
),
),
condCols: colsToUnresolve,
}
transformed = append(transformed, tj)
return tj.node, nil
})
if err != nil || len(transformed) == 0 {
return node, err
}
var transformedSeen bool
return node.TransformUp(func(node sql.Node) (sql.Node, error) {
if ok, _ := isTransformedNode(node, transformed); ok {
transformedSeen = true
return node, nil
}
if !transformedSeen {
return node, nil
}
expressioner, ok := node.(sql.Expressioner)
if !ok {
return node, nil
}
return expressioner.TransformExpressions(func(e sql.Expression) (sql.Expression, error) {
var col, table string
switch e := e.(type) {
case *expression.GetField:
col, table = e.Name(), e.Table()
case *expression.UnresolvedColumn:
col, table = e.Name(), e.Table()
default:
return e, nil
}
sources, ok := colsToUnresolve[col]
if !ok {
return e, nil
}
if !mustUnresolve(aliasTables, table, sources.wrong) {
return e, nil
}
return expression.NewUnresolvedQualifiedColumn(
sources.correct,
col,
), nil
})
})
}
func isTransformedNode(node sql.Node, transformed []*transformedJoin) (is bool, colsToUnresolve map[string]*transformedSource) {
var project *plan.Project
var join *plan.InnerJoin
switch n := node.(type) {
case *plan.Project:
var ok bool
join, ok = n.Child.(*plan.InnerJoin)
if !ok {
return
}
project = n
case *plan.InnerJoin:
join = n
default:
return
}
for _, t := range transformed {
tproject, ok := t.node.(*plan.Project)
if !ok {
return
}
tjoin, ok := tproject.Child.(*plan.InnerJoin)
if !ok {
return
}
if project != nil && !reflect.DeepEqual(project.Projections, tproject.Projections) {
continue
}
if reflect.DeepEqual(join.Cond, tjoin.Cond) {
is = true
colsToUnresolve = t.condCols
}
}
return
}
func mustUnresolve(aliasTable map[string][]string, table string, wrongSources []string) bool {
return isIn(table, wrongSources) || isAliasFor(aliasTable, table, wrongSources)
}
func isIn(s string, l []string) bool {
for _, e := range l {
if s == e {
return true
}
}
return false
}
func isAliasFor(aliasTable map[string][]string, table string, wrongSources []string) bool {
tables, ok := aliasTable[table]
if !ok {
return false
}
for _, t := range tables {
if isIn(t, wrongSources) {
return true
}
}
return false
}
| {
"content_hash": "d599b52d6c7d6d403cef066451ade8d3",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 128,
"avg_line_length": 20.330827067669173,
"alnum_prop": 0.634430473372781,
"repo_name": "campoy/justforfunc",
"id": "aed53b6b249e702e94c5d01de70ff1b5bd02f359",
"size": "5408",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/gopkg.in/src-d/go-mysql-server.v0/sql/analyzer/resolve_natural_joins.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "1717"
},
{
"name": "Go",
"bytes": "85430"
},
{
"name": "Makefile",
"bytes": "4294"
}
],
"symlink_target": ""
} |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Common")
from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Indicators import *
from QuantConnect.Data.Market import TradeBar
class RollingWindowAlgorithm(QCAlgorithm):
'''Example on how to use Rolling Window with bar and indicator'''
def Initialize(self):
'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
self.SetStartDate(2013,10,1) #Set Start Date
self.SetEndDate(2013,11,1) #Set End Date
self.SetCash(100000) #Set Strategy Cash
# Find more symbols here: http://quantconnect.com/data
self.AddEquity("SPY", Resolution.Daily)
# Creates a Rolling Window indicator to keep the 2 TradeBar
self.window = RollingWindow[TradeBar](2) # For other security types, use QuoteBar
# Creates an indicator and adds to a rolling window when it is updated
self.SMA("SPY", 5).Updated += self.SmaUpdated
self.smaWin = RollingWindow[IndicatorDataPoint](5)
def SmaUpdated(self, sender, updated):
'''Adds updated values to rolling window'''
self.smaWin.Add(updated)
def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''
# Add SPY TradeBar in rollling window
self.window.Add(data["SPY"])
# Wait for windows to be ready.
if not (self.window.IsReady and self.smaWin.IsReady): return
currBar = self.window[0] # Current bar had index zero.
pastBar = self.window[1] # Past bar has index one.
self.Log("Price: {0} -> {1} ... {2} -> {3}".format(pastBar.Time, pastBar.Close, currBar.Time, currBar.Close))
currSma = self.smaWin[0] # Current SMA had index zero.
pastSma = self.smaWin[self.smaWin.Count-1] # Oldest SMA has index of window count minus 1.
self.Log("SMA: {0} -> {1} ... {2} -> {3}".format(pastSma.Time, pastSma.Value, currSma.Time, currSma.Value))
if not self.Portfolio.Invested and currSma.Value > pastSma.Value:
self.SetHoldings("SPY", 1) | {
"content_hash": "532d8a21defbb6dcf8ee7ebefb6b77f1",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 151,
"avg_line_length": 44.94202898550725,
"alnum_prop": 0.6804256691389874,
"repo_name": "Mendelone/forex_trading",
"id": "897a82f05a704eff6290400ad3f011d92dcb8bf8",
"size": "3103",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Algorithm.Python/RollingWindowAlgorithm.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2540"
},
{
"name": "C#",
"bytes": "13840878"
},
{
"name": "F#",
"bytes": "1723"
},
{
"name": "Java",
"bytes": "852"
},
{
"name": "Jupyter Notebook",
"bytes": "13963"
},
{
"name": "Python",
"bytes": "134139"
},
{
"name": "Shell",
"bytes": "2308"
},
{
"name": "Visual Basic",
"bytes": "2448"
}
],
"symlink_target": ""
} |
package com.jeometry.twod.segment;
import com.aljebra.field.impl.doubles.Decimal;
import com.aljebra.vector.Vect;
import com.jeometry.twod.scalar.SegmentLength;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
/**
* Tests for {@link RandomSegment}.
* @since 0.1
*/
public final class RandomSegmentTest {
/**
* {@link RandomSegment} builds a random segment with the end extremity
* different from the start extremity.
*/
@Test
public void createsSegmentWithDifferentExtremities() {
final Segment<Double> seg = new RandomSegment<>();
final Vect<Double> start = seg.start();
final Vect<Double> end = seg.end();
MatcherAssert.assertThat(start, Matchers.not(Matchers.equalTo(end)));
final double error = 1.e-6;
MatcherAssert.assertThat(
new SegmentLength<>(seg).value(new Decimal()),
Matchers.not(Matchers.closeTo(0., error))
);
}
}
| {
"content_hash": "2eef9b924ea7e14837bfd00b75a8ef2d",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 77,
"avg_line_length": 29,
"alnum_prop": 0.6734279918864098,
"repo_name": "HDouss/jeometry",
"id": "ebad41a8885ed7a6a6cd5fb591d3b1f32027800b",
"size": "2135",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jeometry-api/src/test/java/com/jeometry/twod/segment/RandomSegmentTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "932064"
}
],
"symlink_target": ""
} |
using Caliburn.Micro;
namespace TestApp1
{
public interface IDockAwareWindowManager : IWindowManager
{
/// <summary>
/// Shows a tool window.
/// </summary>
/// <param name = "viewModel">The view model.</param>
/// <param name = "context">The context.</param>
/// <param name="selectWhenShown">If set to <c>true</c> the window will be selected when shown.</param>
/// <param name = "dockSide">The dock side (Left, Right, Top, Bottom).</param>
void ShowToolWindow(object viewModel, object context, bool selectWhenShown = true);
//DockSide dockSide = DockSide.Left);
/// <summary>
/// Shows a floating window.
/// </summary>
/// <param name = "viewModel">The view model.</param>
/// <param name = "context">The context.</param>
/// <param name="selectWhenShown">If set to <c>true</c> the window will be selected when shown.</param>
void ShowFloatingWindow(object viewModel, object context, bool selectWhenShown = true);
/// <summary>
/// Shows a document window.
/// </summary>
/// <param name = "viewModel">The view model.</param>
/// <param name = "context">The context.</param>
/// <param name="selectWhenShown">If set to <c>true</c> the window will be selected when shown.</param>
void ShowDocumentWindow(object viewModel, object context, bool selectWhenShown = true);
}
} | {
"content_hash": "a7f94ebd8506a1b7facdd1fd2a5f34c7",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 107,
"avg_line_length": 41.84848484848485,
"alnum_prop": 0.6509775524981897,
"repo_name": "dbuksbaum/ActiproCM",
"id": "a9250ef5d09133349d8962bc630fa878c5665b6c",
"size": "1381",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ACMTest/TestApp1/IDockAwareWindowManager.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "23664"
},
{
"name": "PowerShell",
"bytes": "147"
},
{
"name": "Puppet",
"bytes": "9790"
}
],
"symlink_target": ""
} |
<html lang="en">
<head>
<title>AVR - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Embedded-Processors.html#Embedded-Processors" title="Embedded Processors">
<link rel="prev" href="Z8000.html#Z8000" title="Z8000">
<link rel="next" href="CRIS.html#CRIS" title="CRIS">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="AVR"></a>
Next: <a rel="next" accesskey="n" href="CRIS.html#CRIS">CRIS</a>,
Previous: <a rel="previous" accesskey="p" href="Z8000.html#Z8000">Z8000</a>,
Up: <a rel="up" accesskey="u" href="Embedded-Processors.html#Embedded-Processors">Embedded Processors</a>
<hr>
</div>
<h4 class="subsection">21.3.12 Atmel AVR</h4>
<p><a name="index-AVR-1398"></a>
When configured for debugging the Atmel AVR, <span class="sc">gdb</span> supports the
following AVR-specific commands:
<dl>
<dt><code>info io_registers</code><dd><a name="index-info-io_005fregisters_0040r_007b_002c-AVR_007d-1399"></a><a name="index-I_002fO-registers-_0028Atmel-AVR_0029-1400"></a>This command displays information about the AVR I/O registers. For
each register, <span class="sc">gdb</span> prints its number and value.
</dl>
</body></html>
| {
"content_hash": "5fc38287a6f6066cfb03482c782fe8d4",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 240,
"avg_line_length": 44.70967741935484,
"alnum_prop": 0.7193362193362194,
"repo_name": "sahdman/rpi_android_kernel",
"id": "96824cd10a3dae47ec3ce187f3ef093511e666a6",
"size": "2772",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "toolchain/gcc-arm-none-eabi-4_6-2012q2/share/doc/html/gdb/AVR.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "091b945900e71407d7e5405ca5b652bc",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "54ce755d775b9627844dbf12e4ee1da570d02e2d",
"size": "178",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Podostemaceae/Rhyncholacis/Rhyncholacis dentata/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
.class public final Lcom/google/common/io/CountingInputStream;
.super Ljava/io/FilterInputStream;
.source "CountingInputStream.java"
# annotations
.annotation build Lcom/google/common/annotations/Beta;
.end annotation
# instance fields
.field private count:J
.field private mark:J
# direct methods
.method public constructor <init>(Ljava/io/InputStream;)V
.locals 2
.param p1, "in" # Ljava/io/InputStream;
.prologue
.line 43
invoke-direct {p0, p1}, Ljava/io/FilterInputStream;-><init>(Ljava/io/InputStream;)V
.line 35
const-wide/16 v0, -0x1
iput-wide v0, p0, Lcom/google/common/io/CountingInputStream;->mark:J
.line 44
return-void
.end method
# virtual methods
.method public getCount()J
.locals 2
.prologue
.line 48
iget-wide v0, p0, Lcom/google/common/io/CountingInputStream;->count:J
return-wide v0
.end method
.method public declared-synchronized mark(I)V
.locals 2
.param p1, "readlimit" # I
.prologue
.line 74
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/google/common/io/CountingInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v0, p1}, Ljava/io/InputStream;->mark(I)V
.line 75
iget-wide v0, p0, Lcom/google/common/io/CountingInputStream;->count:J
iput-wide v0, p0, Lcom/google/common/io/CountingInputStream;->mark:J
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 77
monitor-exit p0
return-void
.line 74
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public read()I
.locals 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
.line 52
iget-object v1, p0, Lcom/google/common/io/CountingInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v1}, Ljava/io/InputStream;->read()I
move-result v0
.line 53
.local v0, "result":I
const/4 v1, -0x1
if-eq v0, v1, :cond_0
.line 54
iget-wide v2, p0, Lcom/google/common/io/CountingInputStream;->count:J
const-wide/16 v4, 0x1
add-long/2addr v2, v4
iput-wide v2, p0, Lcom/google/common/io/CountingInputStream;->count:J
.line 56
:cond_0
return v0
.end method
.method public read([BII)I
.locals 6
.param p1, "b" # [B
.param p2, "off" # I
.param p3, "len" # I
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
.line 60
iget-object v1, p0, Lcom/google/common/io/CountingInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v1, p1, p2, p3}, Ljava/io/InputStream;->read([BII)I
move-result v0
.line 61
.local v0, "result":I
const/4 v1, -0x1
if-eq v0, v1, :cond_0
.line 62
iget-wide v2, p0, Lcom/google/common/io/CountingInputStream;->count:J
int-to-long v4, v0
add-long/2addr v2, v4
iput-wide v2, p0, Lcom/google/common/io/CountingInputStream;->count:J
.line 64
:cond_0
return v0
.end method
.method public declared-synchronized reset()V
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
.line 80
monitor-enter p0
:try_start_0
iget-object v0, p0, Lcom/google/common/io/CountingInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v0}, Ljava/io/InputStream;->markSupported()Z
move-result v0
if-nez v0, :cond_0
.line 81
new-instance v0, Ljava/io/IOException;
const-string v1, "Mark not supported"
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v0
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 80
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.line 83
:cond_0
:try_start_1
iget-wide v0, p0, Lcom/google/common/io/CountingInputStream;->mark:J
const-wide/16 v2, -0x1
cmp-long v0, v0, v2
if-nez v0, :cond_1
.line 84
new-instance v0, Ljava/io/IOException;
const-string v1, "Mark not set"
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v0
.line 87
:cond_1
iget-object v0, p0, Lcom/google/common/io/CountingInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v0}, Ljava/io/InputStream;->reset()V
.line 88
iget-wide v0, p0, Lcom/google/common/io/CountingInputStream;->mark:J
iput-wide v0, p0, Lcom/google/common/io/CountingInputStream;->count:J
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
.line 89
monitor-exit p0
return-void
.end method
.method public skip(J)J
.locals 5
.param p1, "n" # J
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
.line 68
iget-object v2, p0, Lcom/google/common/io/CountingInputStream;->in:Ljava/io/InputStream;
invoke-virtual {v2, p1, p2}, Ljava/io/InputStream;->skip(J)J
move-result-wide v0
.line 69
.local v0, "result":J
iget-wide v2, p0, Lcom/google/common/io/CountingInputStream;->count:J
add-long/2addr v2, v0
iput-wide v2, p0, Lcom/google/common/io/CountingInputStream;->count:J
.line 70
return-wide v0
.end method
| {
"content_hash": "4a6755b0d3aff5b25926332eef4052c3",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 92,
"avg_line_length": 20.908396946564885,
"alnum_prop": 0.6438481197517342,
"repo_name": "Zecozhang/click_project",
"id": "7d46462ee255956eb1a1cce6e0749143e6c80db0",
"size": "5478",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "APP/Music-master/smali/com/google/common/io/CountingInputStream.smali",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "10265"
},
{
"name": "HTML",
"bytes": "37165"
},
{
"name": "Java",
"bytes": "1183235"
},
{
"name": "JavaScript",
"bytes": "5866"
},
{
"name": "Smali",
"bytes": "21017973"
}
],
"symlink_target": ""
} |
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
| {
"content_hash": "76637f7be344966420c2c38f98cbc575",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 85,
"avg_line_length": 39,
"alnum_prop": 0.7623514696685428,
"repo_name": "minnowlab/giggle",
"id": "da394b848cbd36f03caf5f70918fbbacde34459d",
"size": "1599",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "config/environments/development.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8234"
},
{
"name": "CoffeeScript",
"bytes": "4826"
},
{
"name": "HTML",
"bytes": "61291"
},
{
"name": "Ruby",
"bytes": "78066"
}
],
"symlink_target": ""
} |
export default function() {
return `
<div class="md-accordion-content" layout="column">
<md-button class="md-accordion-toggle" ng-if="$mdAccordionContent.heading" ng-click="$mdAccordionContent.changeState();" ng-class="{ 'md-active': $mdAccordionContent.visible }">
<div layout="row">
<md-icon ng-if="$mdAccordionContent.svgIcon" md-svg-icon="$mdAccordionContent.svgIcon"></md-icon>
<md-icon ng-if="$mdAccordionContent.icon">{{ $mdAccordionContent.icon }}</md-icon>
<span flex>{{ $mdAccordionContent.heading }}</span>
<i ng-if="$mdAccordionContent.arrow" class="fa fa-chevron-down accordion-arrow" aria-hidden="true"></i>
</div>
</md-button>
<div class="md-accordion-wrapper" md-accordion-disable-animate ng-class="{ 'md-active': $mdAccordionContent.visible, 'md-accordion-wrapper-icons': $mdAccordionContent.icon }" layout="column" ng-transclude></div>
</div>
`;
}
| {
"content_hash": "4e130df5624f8c2718b34c9839c645bc",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 218,
"avg_line_length": 53.111111111111114,
"alnum_prop": 0.6673640167364017,
"repo_name": "ajsb85/angular-material-accordion",
"id": "8d4a2e18540ac431256e1504b9084f98d823d24f",
"size": "956",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/scripts/mdAccordionContent/template.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11394"
},
{
"name": "HTML",
"bytes": "4035"
},
{
"name": "JavaScript",
"bytes": "8642"
}
],
"symlink_target": ""
} |
#include "plot/regressionPlot.h"
#include <assert.h>
PLOTLIB_INLINE RegressionPlot::RegressionPlot(const PVec &exogenous, const PVec &endogenous)
{
mStream << "sns.regplot(np.array(" << this->ToArray(exogenous) << "),np.array(" << this->ToArray(endogenous) << ")";
}
PLOTLIB_INLINE std::string RegressionPlot::ToString()
{
return mStream.str() + " )";
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetXBins(const PVec &bins)
{
this->AddArgument("x_bins", this->ToArray(bins));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetXBins(size_t bins)
{
this->AddArgument("x_bins", bins);
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetXConfidenceInterval(size_t ci)
{
assert(ci <= 100);
this->AddArgument("x_ci", ci);
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetConfidenceInterval(size_t ci)
{
assert(ci <= 100);
this->AddArgument("ci", ci);
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::Scatter(bool scatter)
{
this->AddArgument("scatter", GetBool(scatter));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::FitRegression(bool fit)
{
this->AddArgument("fit_reg", GetBool(fit));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetNBoots(size_t nboots)
{
this->AddArgument("n_boots", nboots);
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetOrder(size_t order)
{
this->AddArgument("order", order);
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::Logistic(bool logistic)
{
this->AddArgument("logistic", GetBool(logistic));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::Lowess(bool lowess)
{
this->AddArgument("lowess", GetBool(lowess));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::Robust(bool robust)
{
this->AddArgument("robust", GetBool(robust));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::LogX(bool logx)
{
this->AddArgument("logx", GetBool(logx));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetXPartial(const PMat &mat)
{
this->AddArgument("x_partial", this->ToArray(mat));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetYPartial(const PMat &mat)
{
this->AddArgument("y_partial", this->ToArray(mat));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::Truncate(bool trunc)
{
this->AddArgument("truncate", GetBool(trunc));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetXJitter(double jitter)
{
this->AddArgument("x_jitter", jitter);
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetYJitter(double jitter)
{
this->AddArgument("y_jitter", jitter);
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetLabel(const std::string &label)
{
this->AddArgument("label", this->GetString(label));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetColour(const std::string &colour)
{
this->AddArgument("color", this->GetString(colour));
return *this;
}
PLOTLIB_INLINE RegressionPlot &RegressionPlot::SetMarker(const std::string &marker)
{
this->AddArgument("marker", this->GetString(marker));
return *this;
} | {
"content_hash": "14b636807d14031b1c511faaead44d55",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 120,
"avg_line_length": 24.124087591240876,
"alnum_prop": 0.7122541603630862,
"repo_name": "Zefiros-Software/PlotLib",
"id": "cf57a27fc2ffd16cd9ab549d34baa28d462abcde",
"size": "4473",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "plot/src/regressionPlot.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "2655"
},
{
"name": "C++",
"bytes": "461715"
},
{
"name": "Lua",
"bytes": "5227"
}
],
"symlink_target": ""
} |
package org.apache.gora.mongodb.utils;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import org.apache.avro.util.Utf8;
import org.bson.BSONObject;
import java.nio.ByteBuffer;
import java.util.Date;
/**
* Utility class to build {@link DBObject} used by MongoDB in an easy way by
* directly specifying the fully qualified names of fields.
*
* @author Fabien Poulard <fpoulard@dictanova.com>
*/
public class BSONDecorator {
final private DBObject myBson;
public BSONDecorator(final DBObject obj) {
myBson = obj;
}
/**
* Access the decorated {@link BSONObject}.
*
* @return the decorated {@link DBObject} in its actual state
*/
public DBObject asDBObject() {
return myBson;
}
/**
* Check if the field passed in parameter exists or not. The field is passed
* as a fully qualified name that is the path to the field from the root of
* the document (for example: "field1" or "parent.child.field2").
*
* @param fieldName fully qualified name of the field
* @return true if the field and all its parents exists in the decorated
* {@link DBObject}, false otherwise
*/
public boolean containsField(String fieldName) {
// Prepare for in depth setting
String[] fields = fieldName.split("\\.");
int i = 0;
DBObject intermediate = myBson;
// Set intermediate parents
while (i < (fields.length - 1)) {
if (!intermediate.containsField(fields[i]))
return false;
intermediate = (DBObject) intermediate.get(fields[i]);
i++;
}
// Check final field
return intermediate.containsField(fields[fields.length - 1]);
}
/**
* Access field as a {@link BasicDBObject}.
*
* @param fieldName fully qualified name of the field to be accessed
* @return value of the field as a {@link BasicDBObject}
*/
public BasicDBObject getDBObject(String fieldName) {
return (BasicDBObject) getFieldParent(fieldName)
.get(getLeafName(fieldName));
}
/**
* Access field as a {@link BasicDBList}.
*
* @param fieldName fully qualified name of the field to be accessed
* @return value of the field as a {@link BasicDBList}
*/
public BasicDBList getDBList(String fieldName) {
return (BasicDBList) getFieldParent(fieldName).get(getLeafName(fieldName));
}
/**
* Access field as a boolean.
*
* @param fieldName fully qualified name of the field to be accessed
* @return value of the field as a boolean
*/
public Boolean getBoolean(String fieldName) {
BasicDBObject parent = getFieldParent(fieldName);
String lf = getLeafName(fieldName);
return parent.containsField(lf) ? parent.getBoolean(lf) : null;
}
/**
* Access field as a double.
*
* @param fieldName fully qualified name of the field to be accessed
* @return value of the field as a double
*/
public Double getDouble(String fieldName) {
BasicDBObject parent = getFieldParent(fieldName);
String lf = getLeafName(fieldName);
return parent.containsField(lf) ? parent.getDouble(lf) : null;
}
/**
* Access field as a int.
*
* @param fieldName fully qualified name of the field to be accessed
* @return value of the field as a double
*/
public Integer getInt(String fieldName) {
BasicDBObject parent = getFieldParent(fieldName);
String lf = getLeafName(fieldName);
return parent.containsField(lf) && parent.get(lf) != null ? parent.getInt(lf) : null;
}
/**
* Access field as a long.
*
* @param fieldName fully qualified name of the field to be accessed
* @return value of the field as a double
*/
public Long getLong(String fieldName) {
BasicDBObject parent = getFieldParent(fieldName);
String lf = getLeafName(fieldName);
return parent.containsField(lf) ? parent.getLong(lf) : null;
}
/**
* Access field as a date.
*
* @param fieldName fully qualified name of the field to be accessed
* @return value of the field as a date
*/
public Date getDate(String fieldName) {
BasicDBObject parent = getFieldParent(fieldName);
String lf = getLeafName(fieldName);
return parent.getDate(lf);
}
/**
* Access field as a Utf8 string.
*
* @param fieldName fully qualified name of the field to be accessed
* @return value of the field as a {@link Utf8} string
*/
public Utf8 getUtf8String(String fieldName) {
BasicDBObject parent = getFieldParent(fieldName);
String value = parent.getString(getLeafName(fieldName));
return (value != null) ? new Utf8(value) : null;
}
/**
* Access field as bytes.
*
* @param fieldName fully qualified name of the field to be accessed
* @return value of the field
*/
public ByteBuffer getBytes(String fieldName) {
Object o = get(fieldName);
if (o == null)
return null;
else if (o instanceof byte[])
return ByteBuffer.wrap((byte[]) o);
else
return (ByteBuffer) o;
}
/**
* Access field as an object, no casting.
*
* @param fieldName fully qualified name of the field to be accessed
* @return value of the field
*/
public Object get(String fieldName) {
BasicDBObject parent = getFieldParent(fieldName);
return parent.get(getLeafName(fieldName));
}
/**
* Set field. Create the intermediate levels if necessary as
* {@link BasicDBObject} fields.
*
* @param fieldName fully qualified name of the field to be accessed
* @param value value of the field
*/
public void put(String fieldName, Object value) {
BasicDBObject parent = getFieldParent(fieldName, true);
parent.put(getLeafName(fieldName), value);
}
// ////////////////////////////////////////////////////////////// UTILITIES
/**
* Retrieve the parent of a field.
*
* @param fieldName fully qualified name of the field
* @param createIfMissing create the intermediate fields if necessary
* @return the parent of the field
* @throws IllegalAccessError if the field does not exist
*/
private BasicDBObject getFieldParent(String fieldName, boolean createIfMissing) {
String[] fields = fieldName.split("\\.");
int i = 0;
BasicDBObject intermediate = (BasicDBObject) myBson;
// Set intermediate parents
while (i < (fields.length - 1)) {
if (!intermediate.containsField(fields[i]))
if (createIfMissing)
intermediate.put(fields[i], new BasicDBObject());
else
throw new IllegalAccessError("The field '" + fieldName
+ "' does not exist: '" + fields[i] + "' is missing.");
intermediate = (BasicDBObject) intermediate.get(fields[i]);
i++;
}
return intermediate;
}
private BasicDBObject getFieldParent(String fieldName) {
return getFieldParent(fieldName, false);
}
/**
* Compute the name of the leaf field.
*
* @param fieldName fully qualified name of the target field
* @return name of the field at the end of the tree (leaf)
*/
private String getLeafName(String fieldName) {
int i = fieldName.lastIndexOf(".");
if (i < 0)
return fieldName;
else
return fieldName.substring(i + 1);
}
}
| {
"content_hash": "872528638c848cd2f4351acd6e936086",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 89,
"avg_line_length": 29.650205761316872,
"alnum_prop": 0.6663428174878556,
"repo_name": "renato2099/gora",
"id": "ec48329feff34c2d30028ec4c4d51d7831fd93ee",
"size": "8017",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gora-mongodb/src/main/java/org/apache/gora/mongodb/utils/BSONDecorator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "5192"
},
{
"name": "HTML",
"bytes": "3059"
},
{
"name": "Java",
"bytes": "1401480"
},
{
"name": "Shell",
"bytes": "10156"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>mutual-exclusion: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.9.0 / mutual-exclusion - 8.6.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
mutual-exclusion
<small>
8.6.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-11-25 09:17:08 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-11-25 09:17:08 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.9.0 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/mutual-exclusion"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/MutualExclusion"]
depends: [
"ocaml"
"coq" {>= "8.6" & < "8.7~"}
]
tags: [ "keyword: mutual exclusion" "keyword: concurrency" "keyword: Peterson's algorithm" "keyword: co-inductive types" "keyword: co-induction" "category: Computer Science/Concurrent Systems and Protocols/Correctness of specific protocols" "category: Miscellaneous/Extracted Programs/Automata and protocols" ]
authors: [ "Eduardo Giménez" ]
bug-reports: "https://github.com/coq-contribs/mutual-exclusion/issues"
dev-repo: "git+https://github.com/coq-contribs/mutual-exclusion.git"
synopsis: "A certification of Peterson's algorithm for managing mutual exclusion"
description: """
This is a proof of certification of Peterson's algorithm
for managing mutual exclusion. The case of two processes is treated
in the directory called ``binary'' (see the README file in this
directory). The case of n processes will be available soon."""
flags: light-uninstall
url {
src:
"https://github.com/coq-contribs/mutual-exclusion/archive/v8.6.0.tar.gz"
checksum: "md5=732cd6c59820a7311c03cdd5b7f75710"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-mutual-exclusion.8.6.0 coq.8.9.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.9.0).
The following dependencies couldn't be met:
- coq-mutual-exclusion -> coq < 8.7~ -> ocaml < 4.02.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-mutual-exclusion.8.6.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "433988caa860e3a7f85f57b884d59f6b",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 384,
"avg_line_length": 44.45614035087719,
"alnum_prop": 0.5631412786108919,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "ad870e85303a88842bef1940483a86c0a6c31d57",
"size": "7628",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.02.3-2.0.6/released/8.9.0/mutual-exclusion/8.6.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xmomen.module.base.entity.mapper.CdAttachmentMapper" >
<resultMap id="BaseResultMap" type="com.xmomen.module.base.entity.CdAttachment" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="business_id" property="businessId" jdbcType="VARCHAR" />
<result column="type" property="type" jdbcType="VARCHAR" />
<result column="file_name" property="fileName" jdbcType="VARCHAR" />
<result column="file_extend" property="fileExtend" jdbcType="VARCHAR" />
<result column="file_path" property="filePath" jdbcType="VARCHAR" />
<result column="upload_date" property="uploadDate" jdbcType="TIMESTAMP" />
<result column="upload_user" property="uploadUser" jdbcType="VARCHAR" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, business_id, type, file_name, file_extend, file_path, upload_date, upload_user
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.base.entity.CdAttachmentExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from cd_attachment
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="com.xmomen.module.base.entity.CdAttachmentExample" >
delete from cd_attachment
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insertSelective" parameterType="com.xmomen.module.base.entity.CdAttachment" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
insert into cd_attachment
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="businessId != null" >
business_id,
</if>
<if test="type != null" >
type,
</if>
<if test="fileName != null" >
file_name,
</if>
<if test="fileExtend != null" >
file_extend,
</if>
<if test="filePath != null" >
file_path,
</if>
<if test="uploadDate != null" >
upload_date,
</if>
<if test="uploadUser != null" >
upload_user,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="businessId != null" >
#{businessId,jdbcType=VARCHAR},
</if>
<if test="type != null" >
#{type,jdbcType=VARCHAR},
</if>
<if test="fileName != null" >
#{fileName,jdbcType=VARCHAR},
</if>
<if test="fileExtend != null" >
#{fileExtend,jdbcType=VARCHAR},
</if>
<if test="filePath != null" >
#{filePath,jdbcType=VARCHAR},
</if>
<if test="uploadDate != null" >
#{uploadDate,jdbcType=TIMESTAMP},
</if>
<if test="uploadUser != null" >
#{uploadUser,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.xmomen.module.base.entity.CdAttachmentExample" resultType="java.lang.Integer" >
select count(*) from cd_attachment
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update cd_attachment
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.businessId != null" >
business_id = #{record.businessId,jdbcType=VARCHAR},
</if>
<if test="record.type != null" >
type = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.fileName != null" >
file_name = #{record.fileName,jdbcType=VARCHAR},
</if>
<if test="record.fileExtend != null" >
file_extend = #{record.fileExtend,jdbcType=VARCHAR},
</if>
<if test="record.filePath != null" >
file_path = #{record.filePath,jdbcType=VARCHAR},
</if>
<if test="record.uploadDate != null" >
upload_date = #{record.uploadDate,jdbcType=TIMESTAMP},
</if>
<if test="record.uploadUser != null" >
upload_user = #{record.uploadUser,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper> | {
"content_hash": "557cd1bc8c38ed0fa6705a6548af5b79",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 147,
"avg_line_length": 37.026595744680854,
"alnum_prop": 0.5594023847148398,
"repo_name": "xmomen/dms-webapp",
"id": "9c681e543a1567a4e0ae9cf738e084427db95e6f",
"size": "6961",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/resources/com/xmomen/module/base/entity/mapper/CdAttachmentMapper.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "130491"
},
{
"name": "FreeMarker",
"bytes": "51609"
},
{
"name": "HTML",
"bytes": "928276"
},
{
"name": "Java",
"bytes": "3239352"
},
{
"name": "JavaScript",
"bytes": "1825310"
},
{
"name": "PHP",
"bytes": "1245"
}
],
"symlink_target": ""
} |
{% block top_of_page %}{% endblock %}
<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8 unbranded" lang="{{ html_lang|default('en') }}"><![endif]-->
<!--[if gt IE 8]><!--><html class="unbranded" lang="{{ html_lang|default('en') }}"><!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>{% block page_title %}{% endblock %}</title>
<!--[if gt IE 8]><!--><link href="{{ asset_path }}stylesheets/govuk-template.css?0.18.3" media="screen" rel="stylesheet" /><!--<![endif]-->
<!--[if IE 6]><link href="{{ asset_path }}stylesheets/govuk-template-ie6.css?0.18.3" media="screen" rel="stylesheet" /><![endif]-->
<!--[if IE 7]><link href="{{ asset_path }}stylesheets/govuk-template-ie7.css?0.18.3" media="screen" rel="stylesheet" /><![endif]-->
<!--[if IE 8]><link href="{{ asset_path }}stylesheets/govuk-template-ie8.css?0.18.3" media="screen" rel="stylesheet" /><![endif]-->
<link href="{{ asset_path }}stylesheets/govuk-template-print.css?0.18.3" media="print" rel="stylesheet" />
<!--[if IE 8]><link href="{{ asset_path }}stylesheets/fonts-ie8.css?0.18.3" media="all" rel="stylesheet" /><![endif]-->
<!--[if gte IE 9]><!--><link href="{{ asset_path }}stylesheets/fonts.css?0.18.3" media="all" rel="stylesheet" /><!--<![endif]-->
<!--[if lt IE 9]><script src="{{ asset_path }}javascripts/ie.js?0.18.3"></script><![endif]-->
<link rel="shortcut icon" href="{{ asset_path }}images/favicon.ico?0.18.3" type="image/x-icon" />
<link rel="mask-icon" href="{{ asset_path }}images/gov.uk_logotype_crown.svg?0.18.3" color="#0b0c0c">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{ asset_path }}images/apple-touch-icon-152x152.png?0.18.3">
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="{{ asset_path }}images/apple-touch-icon-120x120.png?0.18.3">
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="{{ asset_path }}images/apple-touch-icon-76x76.png?0.18.3">
<link rel="apple-touch-icon-precomposed" href="{{ asset_path }}images/apple-touch-icon-60x60.png?0.18.3">
<link rel="stylesheet" href="/public/stylesheets/borchester-2.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:image" content="{{ asset_path }}images/opengraph-image.png?0.18.3">
{% block head %}{% endblock %}
</head>
<body class="{% block body_classes %}{% endblock %}">
<script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
{% block body_start %}{% endblock %}
<div id="skiplink-container">
<div>
<a href="#content" class="skiplink">{{ skip_link_message|default('Skip to main content') }}</a>
</div>
</div>
<div id="global-cookie-message">
{% block cookie_message %}{% endblock %}
</div>
<!--end global-cookie-message-->
<header role="banner" id="global-header" class="{% block header_class %}{% endblock %}">
<div class="header">
<nav class="top-bar">
<div class="name">
<h1> Borchester City Council </h1>
</div>
</nav>
</div>
</header>
<!--end header-->
{% block after_header %}{% endblock %}
{% block content %}{% endblock %}
<footer class="group js-footer" id="footer" role="contentinfo">
<div class="footer-wrapper">
{% block footer_top %}{% endblock %}
<div class="footer-meta">
<div class="footer-meta-inner">
{% block footer_support_links %}{% endblock %}
<div class="open-government-licence">
<p class="logo"><a href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" rel="license">Open Government Licence</a></p>
{% block licence_message %}<p>All content is available under the <a href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" rel="license">Open Government Licence v3.0</a>, except where otherwise stated</p>{% endblock %}
</div>
</div>
</div>
</div>
</footer>
<!--end footer-->
<div id="global-app-error" class="app-error hidden"></div>
<script src="{{ asset_path }}javascripts/govuk-template.js?0.18.3" type="text/javascript"></script>
{% block body_end %}{% endblock %}
<script>if (typeof window.GOVUK === 'undefined') document.body.className = document.body.className.replace('js-enabled', '');</script>
</body>
</html>
| {
"content_hash": "69e1be1e0868bdba066cdcd63c737c88",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 261,
"avg_line_length": 44.55882352941177,
"alnum_prop": 0.603080308030803,
"repo_name": "stephenjoe1/pay-link-set-up",
"id": "8661c08356f5c8844f559ddf705e8b11c60683d3",
"size": "4545",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/govuk_template_unbranded.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1380810"
},
{
"name": "HTML",
"bytes": "158646"
},
{
"name": "JavaScript",
"bytes": "114901"
},
{
"name": "Shell",
"bytes": "1495"
}
],
"symlink_target": ""
} |
package com.google.cloud.bigtable.hbase2_x;
import com.google.api.core.InternalApi;
import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation;
import com.google.cloud.bigtable.hbase.AbstractBigtableTable;
import com.google.cloud.bigtable.hbase.adapters.CheckAndMutateUtil;
import com.google.cloud.bigtable.hbase.adapters.HBaseRequestAdapter;
import com.google.cloud.bigtable.hbase.util.FutureUtil;
import com.google.common.base.Preconditions;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.hadoop.hbase.CompareOperator;
import org.apache.hadoop.hbase.client.AbstractBigtableConnection;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.Row;
import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.client.coprocessor.Batch;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
import org.apache.hadoop.hbase.io.TimeRange;
/** For internal use only - public for technical reasons. */
@InternalApi("For internal usage only")
public class BigtableTable extends AbstractBigtableTable {
@SuppressWarnings("deprecation")
public static final CompareOp toCompareOp(CompareOperator compareOp) {
switch (compareOp) {
case EQUAL:
return CompareOp.EQUAL;
case GREATER:
return CompareOp.GREATER;
case GREATER_OR_EQUAL:
return CompareOp.GREATER_OR_EQUAL;
case LESS:
return CompareOp.LESS;
case LESS_OR_EQUAL:
return CompareOp.LESS_OR_EQUAL;
case NO_OP:
return CompareOp.NO_OP;
case NOT_EQUAL:
return CompareOp.NOT_EQUAL;
default:
throw new IllegalArgumentException("CompareOp type: " + compareOp + " cannot be converted");
}
}
public BigtableTable(
AbstractBigtableConnection bigtableConnection, HBaseRequestAdapter hbaseAdapter) {
super(bigtableConnection, hbaseAdapter);
}
/** {@inheritDoc} */
@Override
public boolean checkAndDelete(
byte[] row,
byte[] family,
byte[] qualifier,
CompareOperator compareOp,
byte[] value,
Delete delete)
throws IOException {
return super.checkAndDelete(row, family, qualifier, toCompareOp(compareOp), value, delete);
}
/** {@inheritDoc} */
@Override
public boolean checkAndMutate(
final byte[] row,
final byte[] family,
final byte[] qualifier,
final CompareOperator compareOp,
final byte[] value,
final RowMutations rm)
throws IOException {
return super.checkAndMutate(row, family, qualifier, toCompareOp(compareOp), value, rm);
}
/** {@inheritDoc} */
@Override
public boolean checkAndPut(
byte[] row, byte[] family, byte[] qualifier, CompareOperator compareOp, byte[] value, Put put)
throws IOException {
return super.checkAndPut(row, family, qualifier, toCompareOp(compareOp), value, put);
}
/** {@inheritDoc} */
@Override
public boolean[] exists(List<Get> gets) throws IOException {
return existsAll(gets);
}
/** {@inheritDoc} */
@Override
public TableDescriptor getDescriptor() throws IOException {
return super.getTableDescriptor();
}
@Override
public RegionLocator getRegionLocator() throws IOException {
throw new UnsupportedOperationException("not implemented");
}
@Override
public long getOperationTimeout(TimeUnit arg0) {
return 0;
}
@Override
public int getReadRpcTimeout() {
return 0;
}
@Override
public long getReadRpcTimeout(TimeUnit arg0) {
return 0;
}
@Override
public long getRpcTimeout(TimeUnit arg0) {
return 0;
}
@Override
public int getWriteRpcTimeout() {
return 0;
}
@Override
public long getWriteRpcTimeout(TimeUnit arg0) {
return 0;
}
@Override
public void setReadRpcTimeout(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void setWriteRpcTimeout(int arg0) {
// TODO Auto-generated method stub
}
@Override
public CheckAndMutateBuilder checkAndMutate(byte[] row, byte[] family) {
final CheckAndMutateUtil.RequestBuilder builder =
new CheckAndMutateUtil.RequestBuilder(hbaseAdapter, row, family);
return new CheckAndMutateBuilder() {
/** {@inheritDoc} */
@Override
public CheckAndMutateBuilder qualifier(byte[] qualifier) {
builder.qualifier(qualifier);
return this;
}
/** {@inheritDoc} */
@Override
public CheckAndMutateBuilder ifNotExists() {
builder.ifNotExists();
return this;
}
/** {@inheritDoc} */
@Override
public CheckAndMutateBuilder ifMatches(CompareOperator compareOp, byte[] value) {
Preconditions.checkNotNull(compareOp, "compareOp is null");
if (compareOp != CompareOperator.NOT_EQUAL) {
Preconditions.checkNotNull(value, "value is null for compareOperator: " + compareOp);
}
builder.ifMatches(BigtableTable.toCompareOp(compareOp), value);
return this;
}
/** {@inheritDoc} */
public CheckAndMutateBuilder timeRange(TimeRange timeRange) {
builder.timeRange(timeRange.getMin(), timeRange.getMax());
return this;
}
/** {@inheritDoc} */
@Override
public boolean thenPut(Put put) throws IOException {
try {
builder.withPut(put);
return call();
} catch (Exception e) {
throw new IOException("Could not CheckAndMutate.thenPut: " + e.getMessage(), e);
}
}
/** {@inheritDoc} */
@Override
public boolean thenDelete(Delete delete) throws IOException {
try {
builder.withDelete(delete);
return call();
} catch (Exception e) {
throw new IOException("Could not CheckAndMutate.thenDelete: " + e.getMessage(), e);
}
}
/** {@inheritDoc} */
@Override
public boolean thenMutate(RowMutations rowMutations) throws IOException {
try {
builder.withMutations(rowMutations);
return call();
} catch (Exception e) {
throw new IOException("Could not CheckAndMutate.thenMutate: " + e.getMessage(), e);
}
}
private boolean call() throws IOException {
ConditionalRowMutation conditionalRowMutation = builder.build();
Boolean response =
FutureUtil.unwrap(clientWrapper.checkAndMutateRowAsync(conditionalRowMutation));
return CheckAndMutateUtil.wasMutationApplied(conditionalRowMutation, response);
}
};
}
@Override
public <R> void batchCallback(
List<? extends Row> actions, Object[] results, Batch.Callback<R> callback)
throws IOException, InterruptedException {
// This check is intentional because HBase-2.x does not perform param validation before return.
if (actions.isEmpty()) {
return;
}
super.batchCallback(actions, results, callback);
}
}
| {
"content_hash": "375ed664c9ba7694ac84f177d227d8ca",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 100,
"avg_line_length": 30.159663865546218,
"alnum_prop": 0.6831986625801059,
"repo_name": "googleapis/java-bigtable-hbase",
"id": "2a5a42ec04121c978aab2a4f52590d2f5b5db24a",
"size": "7771",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "bigtable-hbase-2.x-parent/bigtable-hbase-2.x/src/main/java/com/google/cloud/bigtable/hbase2_x/BigtableTable.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "127"
},
{
"name": "Java",
"bytes": "3680154"
},
{
"name": "Python",
"bytes": "1401"
},
{
"name": "Shell",
"bytes": "37129"
}
],
"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_80) on Thu Oct 15 19:27:06 UTC 2015 -->
<title>RemoveTagsResult (AWS SDK for Java - 1.10.27)</title>
<meta name="date" content="2015-10-15">
<link rel="stylesheet" type="text/css" href="../../../../../JavaDoc.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="RemoveTagsResult (AWS SDK for Java - 1.10.27)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em>
<!-- Scripts for Syntax Highlighter START-->
<script id="syntaxhighlight_script_core" type="text/javascript" src = "http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/resources/syntaxhighlight/scripts/shCore.js">
</script>
<script id="syntaxhighlight_script_java" type="text/javascript" src = "http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/resources/syntaxhighlight/scripts/shBrushJava.js">
</script>
<link id="syntaxhighlight_css_core" rel="stylesheet" type="text/css" href = "http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/resources/syntaxhighlight/styles/shCoreDefault.css"/>
<link id="syntaxhighlight_css_theme" rel="stylesheet" type="text/css" href = "http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/resources/syntaxhighlight/styles/shThemeDefault.css"/>
<!-- Scripts for Syntax Highlighter END-->
<div>
<!-- BEGIN-SECTION -->
<div id="divsearch" style="float:left;">
<span id="lblsearch" for="searchQuery">
<label>Search</label>
</span>
<form id="nav-search-form" target="_parent" method="get" action="http://docs.aws.amazon.com/search/doc-search.html#facet_doc_guide=API+Reference&facet_doc_product=AWS+SDK+for+Java">
<div id="nav-searchfield-outer" class="nav-sprite">
<div class="nav-searchfield-inner nav-sprite">
<div id="nav-searchfield-width">
<input id="nav-searchfield" name="searchQuery">
</div>
</div>
</div>
<div id="nav-search-button" class="nav-sprite">
<input alt="" id="nav-search-button-inner" type="image">
</div>
<input name="searchPath" type="hidden" value="documentation-guide" />
<input name="this_doc_product" type="hidden" value="AWS SDK for Java" />
<input name="this_doc_guide" type="hidden" value="API Reference" />
<input name="doc_locale" type="hidden" value="en_us" />
</form>
</div>
<!-- END-SECTION -->
<!-- BEGIN-FEEDBACK-SECTION -->
<div id="feedback-section">
<h3>Did this page help you?</h3>
<div id="feedback-link-sectioin">
<a id="feedback_yes" target="_blank" style="display:inline;">Yes</a>
<a id="feedback_no" target="_blank" style="display:inline;">No</a>
<a id="go_cti" target="_blank" style="display:inline;">Tell us about it...</a>
</div>
</div>
<script type="text/javascript">
window.onload = function(){
/* Dynamically add feedback links */
var javadoc_root_name = "/javadoc/";
var javadoc_path = location.href.substring(0, location.href.lastIndexOf(javadoc_root_name) + javadoc_root_name.length);
var file_path = location.href.substring(location.href.lastIndexOf(javadoc_root_name) + javadoc_root_name.length);
var feedback_yes_url = javadoc_path + "javadoc-resources/feedbackyes.html?topic_id=";
var feedback_no_url = javadoc_path + "javadoc-resources/feedbackno.html?topic_id=";
var feedback_tellmore_url = "https://aws-portal.amazon.com/gp/aws/html-forms-controller/documentation/aws_doc_feedback_04?service_name=Java-Ref&file_name=";
if(file_path != "overview-frame.html") {
var file_name = file_path.replace(/[/.]/g, '_');
document.getElementById("feedback_yes").setAttribute("href", feedback_yes_url + file_name);
document.getElementById("feedback_no").setAttribute("href", feedback_no_url + file_name);
document.getElementById("go_cti").setAttribute("href", feedback_tellmore_url + file_name);
} else {
// hide the search box and the feeback links in overview-frame page,
// show "AWS SDK for Java" instead.
document.getElementById("feedback-section").outerHTML = "AWS SDK for Java";
document.getElementById("divsearch").outerHTML = "";
}
};
</script>
<!-- END-FEEDBACK-SECTION -->
</div>
</em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/amazonaws/services/cloudtrail/model/RemoveTagsRequest.html" title="class in com.amazonaws.services.cloudtrail.model"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../com/amazonaws/services/cloudtrail/model/Resource.html" title="class in com.amazonaws.services.cloudtrail.model"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/amazonaws/services/cloudtrail/model/RemoveTagsResult.html" target="_top">Frames</a></li>
<li><a href="RemoveTagsResult.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.amazonaws.services.cloudtrail.model</div>
<h2 title="Class RemoveTagsResult" class="title">Class RemoveTagsResult</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.amazonaws.services.cloudtrail.model.RemoveTagsResult</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable, java.lang.Cloneable</dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">RemoveTagsResult</span>
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable</pre>
<div class="block"><p>
Returns the objects or data listed below if successful. Otherwise, returns an
error.
</p></div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../serialized-form.html#com.amazonaws.services.cloudtrail.model.RemoveTagsResult">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/amazonaws/services/cloudtrail/model/RemoveTagsResult.html#RemoveTagsResult()">RemoveTagsResult</a></strong>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../com/amazonaws/services/cloudtrail/model/RemoveTagsResult.html" title="class in com.amazonaws.services.cloudtrail.model">RemoveTagsResult</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../com/amazonaws/services/cloudtrail/model/RemoveTagsResult.html#clone()">clone</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/amazonaws/services/cloudtrail/model/RemoveTagsResult.html#equals(java.lang.Object)">equals</a></strong>(java.lang.Object obj)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/amazonaws/services/cloudtrail/model/RemoveTagsResult.html#hashCode()">hashCode</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/amazonaws/services/cloudtrail/model/RemoveTagsResult.html#toString()">toString</a></strong>()</code>
<div class="block">Returns a string representation of this object; useful for testing and
debugging.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>getClass, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="RemoveTagsResult()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>RemoveTagsResult</h4>
<pre>public RemoveTagsResult()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="toString()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre>public java.lang.String toString()</pre>
<div class="block">Returns a string representation of this object; useful for testing and
debugging.</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>toString</code> in class <code>java.lang.Object</code></dd>
<dt><span class="strong">Returns:</span></dt><dd>A string representation of this object.</dd><dt><span class="strong">See Also:</span></dt><dd><code>Object.toString()</code></dd></dl>
</li>
</ul>
<a name="equals(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>equals</h4>
<pre>public boolean equals(java.lang.Object obj)</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>equals</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="hashCode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashCode</h4>
<pre>public int hashCode()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>hashCode</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="clone()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>clone</h4>
<pre>public <a href="../../../../../com/amazonaws/services/cloudtrail/model/RemoveTagsResult.html" title="class in com.amazonaws.services.cloudtrail.model">RemoveTagsResult</a> clone()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>clone</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em>
<div>
<!-- Script for Syntax Highlighter START -->
<script type="text/javascript">
SyntaxHighlighter.all()
</script>
<!-- Script for Syntax Highlighter END -->
</div>
<script src="http://a0.awsstatic.com/chrome/js/1.0.46/jquery.1.9.js" type="text/javascript"></script>
<script>jQuery.noConflict();</script>
<script>
jQuery(function ($) {
$("div.header").prepend('<!--REGION_DISCLAIMER_DO_NOT_REMOVE-->');
});
</script>
<!-- BEGIN-URCHIN-TRACKER -->
<script src="http://l0.awsstatic.com/js/urchin.js" type="text/javascript"></script>
<script type="text/javascript">urchinTracker();</script>
<!-- END-URCHIN-TRACKER -->
<!-- SiteCatalyst code version: H.25.2. Copyright 1996-2012 Adobe, Inc. All Rights Reserved.
More info available at http://www.omniture.com -->
<script language="JavaScript" type="text/javascript" src="https://media.amazonwebservices.com/js/sitecatalyst/s_code.min.js (view-source:https://media.amazonwebservices.com/js/sitecatalyst/s_code.min.js)" />
<script language="JavaScript" type="text/javascript">
<!--
// Documentation Service Name
s.prop66='AWS SDK for Java';
s.eVar66='D=c66';
// Documentation Guide Name
s.prop65='API Reference';
s.eVar65='D=c65';
var s_code=s.t();if(s_code)document.write(s_code)
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-')
//-->
</script>
<noscript>
<img src="http://amazonwebservices.d2.sc.omtrdc.net/b/ss/awsamazondev/1/H.25.2--NS/0" height="1" width="1" border="0" alt="" />
</noscript>
<!--/DO NOT REMOVE/-->
<!-- End SiteCatalyst code version: H.25.2. -->
</em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../com/amazonaws/services/cloudtrail/model/RemoveTagsRequest.html" title="class in com.amazonaws.services.cloudtrail.model"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../com/amazonaws/services/cloudtrail/model/Resource.html" title="class in com.amazonaws.services.cloudtrail.model"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/amazonaws/services/cloudtrail/model/RemoveTagsResult.html" target="_top">Frames</a></li>
<li><a href="RemoveTagsResult.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.
</small></p>
</body>
</html>
| {
"content_hash": "b0494fe1160f1a341658ef0ba126325b",
"timestamp": "",
"source": "github",
"line_count": 444,
"max_line_length": 223,
"avg_line_length": 40.840090090090094,
"alnum_prop": 0.6086692770087685,
"repo_name": "TomNong/Project2-Intel-Edison",
"id": "0f49dc0bf8066b6508d196844250060f0828e204",
"size": "18133",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "documentation/javadoc/com/amazonaws/services/cloudtrail/model/RemoveTagsResult.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "5522"
}
],
"symlink_target": ""
} |
// Copyright 2018 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.skydoc.fakebuildapi.apple;
import com.google.devtools.build.lib.starlarkbuildapi.FileApi;
import com.google.devtools.build.lib.starlarkbuildapi.apple.AppleStaticLibraryInfoApi;
import com.google.devtools.build.lib.starlarkbuildapi.apple.ObjcProviderApi;
import com.google.devtools.build.lib.syntax.EvalException;
import com.google.devtools.build.lib.syntax.Printer;
/**
* Fake implementation of {@link AppleStaticLibraryInfoApi}.
*/
public class FakeAppleStaticLibraryInfo implements AppleStaticLibraryInfoApi {
@Override
public FileApi getMultiArchArchive() {
return null;
}
@Override
public ObjcProviderApi<?> getDepsObjcProvider() {
return null;
}
@Override
public String toProto() throws EvalException {
return "";
}
@Override
public String toJson() throws EvalException {
return "";
}
@Override
public void repr(Printer printer) {}
/**
* Fake implementation of {@link AppleStaticLibraryInfoProvider}.
*/
public static class FakeAppleStaticLibraryInfoProvider
implements AppleStaticLibraryInfoProvider<FileApi, ObjcProviderApi<FileApi>> {
@Override
public AppleStaticLibraryInfoApi appleStaticLibrary(FileApi archive,
ObjcProviderApi<FileApi> objcProvider)
throws EvalException {
return new FakeAppleStaticLibraryInfo();
}
@Override
public void repr(Printer printer) {}
}
}
| {
"content_hash": "0b57c1de9ed1246df5d14a190c520286",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 86,
"avg_line_length": 30.507462686567163,
"alnum_prop": 0.7544031311154599,
"repo_name": "werkt/bazel",
"id": "9680513569978f291c612fdb4a2c89753470b3eb",
"size": "2044",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/google/devtools/build/skydoc/fakebuildapi/apple/FakeAppleStaticLibraryInfo.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2916"
},
{
"name": "C",
"bytes": "16022"
},
{
"name": "C++",
"bytes": "1171078"
},
{
"name": "HTML",
"bytes": "20211"
},
{
"name": "Java",
"bytes": "29573073"
},
{
"name": "Makefile",
"bytes": "248"
},
{
"name": "Objective-C",
"bytes": "8797"
},
{
"name": "Objective-C++",
"bytes": "1043"
},
{
"name": "PowerShell",
"bytes": "5536"
},
{
"name": "Python",
"bytes": "1400777"
},
{
"name": "Shell",
"bytes": "1169561"
},
{
"name": "Smarty",
"bytes": "487938"
}
],
"symlink_target": ""
} |
var PostModal = function () {
this.$elm = $($.parseHTML('' +
'<div class="modal fade" tabindex="-1" role="dialog">' +
' <div class="modal-dialog">' +
' <div class="modal-content">' +
' <div class="modal-header">' +
' <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>' +
' <h4 class="modal-title">Upload image</h4>' +
' </div>' +
' <div class="modal-body">' +
' <form method="POST" enctype="multipart/form-data" action="/postImage"> ' +
' <div class="input-group full-width"> ' +
' <label for="title">Title</label>' +
' <input id="title" name="title" pattern=".{1,}" type="text" class="form-control" required placeholder="Title"> ' +
' </div> ' +
' <h4>File to upload:</h4> ' +
' <input class="btn btn-default" pattern="*.jpg" type="file" name="file"><br /> ' +
' <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>' +
' <button type="submit" class="btn btn-primary">Post</button>' +
' </form>' +
' </div><!-- /.modal-body -->' +
' </div><!-- /.modal-content -->' +
' </div><!-- /.modal-dialog -->' +
'</div><!-- /.modal -->'));
};
PostModal.prototype.show = function () {
var self = this;
$("body").append(self.$elm);
self.$elm.modal('show');
self.$elm.on('hidden.bs.modal', function () {
self.$elm.remove();
$('.modal-backdrop').remove();
});
}; | {
"content_hash": "d4bfb21d62e0f62dd27b380a2ee0dfac",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 151,
"avg_line_length": 48.18421052631579,
"alnum_prop": 0.4440196613872201,
"repo_name": "Omegapoint/facepalm",
"id": "02436ee6a005d394fb0ecaab4cd9c194642bf174",
"size": "2445",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/resources/static/js/components/PostModal.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "7596"
},
{
"name": "HTML",
"bytes": "47341"
},
{
"name": "Java",
"bytes": "144841"
},
{
"name": "JavaScript",
"bytes": "5355"
},
{
"name": "Shell",
"bytes": "225"
}
],
"symlink_target": ""
} |
package com.commonsware.android.preso.decktastic;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class LeanbackActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getFragmentManager().findFragmentById(android.R.id.content) == null) {
getFragmentManager()
.beginTransaction()
.add(android.R.id.content, new RosterFragment()).commit();
}
}
public void showPreso(PresoContents preso) {
startActivity(new Intent(this, MainActivity.class)
.putExtra(MainActivity.EXTRA_PRESO_ID,
preso.id));
}
}
| {
"content_hash": "b0bfa86560d1fffd20c26cad8166f99b",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 78,
"avg_line_length": 27.76923076923077,
"alnum_prop": 0.682825484764543,
"repo_name": "alexsh/cw-omnibus",
"id": "839115cfef1ca0349a4e27d6ae49c60c9cea4d89",
"size": "1411",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Presentation/Decktastic/app/src/main/java/com/commonsware/android/preso/decktastic/LeanbackActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "54274"
},
{
"name": "Groovy",
"bytes": "4601"
},
{
"name": "HTML",
"bytes": "2293656"
},
{
"name": "Java",
"bytes": "3404604"
},
{
"name": "JavaScript",
"bytes": "646239"
},
{
"name": "Kotlin",
"bytes": "7397"
},
{
"name": "Python",
"bytes": "546"
},
{
"name": "Ruby",
"bytes": "2071"
},
{
"name": "Shell",
"bytes": "1020"
}
],
"symlink_target": ""
} |
package com.bubbl;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.microsoft.codepush.react.CodePush;
import com.react.rnspinkit.RNSpinkitPackage;
import com.reactnative.photoview.PhotoViewPackage;
import cl.json.RNSharePackage;
import com.BV.LinearGradient.LinearGradientPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new CodePush(null, getApplicationContext(), BuildConfig.DEBUG),
new RNSpinkitPackage(),
new PhotoViewPackage(),
new RNSharePackage(),
new LinearGradientPackage(),
new VectorIconsPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| {
"content_hash": "3155de162c369058943d9e415bc43a0d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 78,
"avg_line_length": 27.379310344827587,
"alnum_prop": 0.7317380352644837,
"repo_name": "simonayzman/Bubbl",
"id": "d502535e06a128a2d1a5eb11903b8a68c28b851e",
"size": "1588",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "android/app/src/main/java/com/bubbl/MainApplication.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1943"
},
{
"name": "JavaScript",
"bytes": "64238"
},
{
"name": "Objective-C",
"bytes": "4507"
},
{
"name": "Python",
"bytes": "1635"
},
{
"name": "Shell",
"bytes": "2312"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<title>Spectrogram</title>
<link rel="shortcut icon" href="../images/icon.png" type="image/gif">
<script src="../js/prong.js"></script>
<link rel='stylesheet' href='testPage.css'></link>
<script src="qadi-min.js"></script>
<link rel="stylesheet" type="text/css" href="qadi.css"/>
<style>
body {
background-color:#333;
color:white;
}
/* waveform */
.area {
fill: steelblue;
}
.line {
stroke: steelblue;
fill:none;
}
/* timeline */
.timeline path,
.timeline line {
fill: none;
stroke: white;
shape-rendering: crispEdges;
}
.timeline text {
fill:white;
shape-rendering: crispEdges;
}
</style>
</head>
<body>
<iframe src="./"></iframe>
<div id="main">
Spectrogram<br />
<ul id="qadi">
<li>You can see a spectrogram below the waveform.</li>
<li>The spectrogram is redrawn when you zoom or scroll the waveform.</li>
<li>The spectrogram looks correct when the time starts at zero.</li>
</ul>
<br />
<br />
<div style="position:absolute;width:1000px;height:400px">
<svg style="position:absolute" width="100%">
<g id="waveform"></g>
<g id="onsetsContainer"></g>
</svg>
<canvas id="spectrogram" width="1000" height="600" style="position:absolute;top:100px"></canvas>
<svg id="timeline" height="30" width="1000" style="position:absolute" class="timeline"></svg>
</div>
</div>
<script>
// first load the sound ...
prong.sound('https://dl.dropboxusercontent.com/u/5613860/audio/four_devices_computer.mp3', function(buffer){
var d3 = prong.d3;
var width = 1000,
channel = buffer.getChannelData(0),
// ... then create and display the waveform
x = d3.scale.linear().domain([5, 15]).range([0, width]);
var timeline = prong
.timeline()
.x(x)
.scrollZone(d3.select('BODY'));
d3.select('#timeline').call(timeline);
var spectrogram = prong.spectrogram()
.x(x)
.height(300)
.timeline(timeline);
d3.select('#spectrogram')
.datum({
_buffer : buffer,
_channel : channel
})
.call(spectrogram);
var waveform = prong.waveform()
.x(x)
.height(150)
.timeline(timeline);
d3.select('#waveform')
.datum({
_buffer : buffer,
_channel : channel
})
.call(waveform);
})
</script>
</body>
</html> | {
"content_hash": "bce18b09fc93d49300e60b639521130e",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 116,
"avg_line_length": 26.463636363636365,
"alnum_prop": 0.5001717622810031,
"repo_name": "lukebarlow/prong",
"id": "fb65cf7353e0e5af1818af849f8a4eb0819126e9",
"size": "2911",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/tests/spectrogram.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "15561"
},
{
"name": "CoffeeScript",
"bytes": "150253"
},
{
"name": "HTML",
"bytes": "177813"
},
{
"name": "JavaScript",
"bytes": "75866"
}
],
"symlink_target": ""
} |
from supriya.commands.Request import Request
from supriya.enums import RequestId
class NodeCommandRequest(Request):
### CLASS VARIABLES ###
__slots__ = ()
request_id = RequestId.NODE_COMMAND
### INITIALIZER ###
def __init__(self):
Request.__init__(self)
raise NotImplementedError
### PUBLIC METHODS ###
def to_osc(self, *, with_placeholders=False, with_request_name=False):
raise NotImplementedError
| {
"content_hash": "72a0ee92a64266df6796a337dd5402b0",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 74,
"avg_line_length": 20.954545454545453,
"alnum_prop": 0.648590021691974,
"repo_name": "Pulgama/supriya",
"id": "bdeda6a6fcade1c94964e1d640a59fb6bb4d0f9c",
"size": "461",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "supriya/commands/NodeCommandRequest.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "6712"
},
{
"name": "CSS",
"bytes": "446"
},
{
"name": "HTML",
"bytes": "1083"
},
{
"name": "JavaScript",
"bytes": "6163"
},
{
"name": "Makefile",
"bytes": "6775"
},
{
"name": "Python",
"bytes": "2790612"
},
{
"name": "Shell",
"bytes": "569"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".ui.activity.LottieAnimationViewActivity"
tools:showIn="@layout/activity_lottie_animation_view">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animation_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:lottie_autoPlay="true"
app:lottie_fileName="PinJump.json"
app:lottie_loop="true"
/>
<LinearLayout
android:layout_below="@id/animation_view"
android:layout_width="match_parent"
android:orientation="horizontal"
android:padding="16dp"
android:layout_height="wrap_content">
<Button
android:text="restart"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_margin="10dp"
android:id="@+id/start"
android:layout_height="wrap_content"/>
<Button
android:text="success"
android:layout_width="0dp"
android:id="@+id/success"
android:layout_weight="1"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
<Button
android:text="error"
android:layout_width="0dp"
android:id="@+id/error"
android:layout_weight="1"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
</LinearLayout>
</RelativeLayout>
| {
"content_hash": "67844d5854c7974bf0e26ab03de827fc",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 64,
"avg_line_length": 35.283018867924525,
"alnum_prop": 0.6165775401069519,
"repo_name": "REBOOTERS/AndroidAnimationExercise",
"id": "3d3a362d923857d445ce7547d6a1652baabac350",
"size": "1870",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/content_lottie_animation_view.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "161111"
},
{
"name": "C++",
"bytes": "1230"
},
{
"name": "CMake",
"bytes": "1885"
},
{
"name": "CSS",
"bytes": "2727"
},
{
"name": "Groovy",
"bytes": "557"
},
{
"name": "HTML",
"bytes": "73983"
},
{
"name": "Java",
"bytes": "1994679"
},
{
"name": "JavaScript",
"bytes": "32332"
},
{
"name": "Kotlin",
"bytes": "536262"
},
{
"name": "Ruby",
"bytes": "300"
},
{
"name": "SCSS",
"bytes": "13539"
}
],
"symlink_target": ""
} |
namespace PAL
{
Application::Application(std::unique_ptr<Process>&& mainProcess, size_t workerCount) :
m_scheduler(std::move(mainProcess), workerCount)
{
}
void Application::Run()
{
m_scheduler.Run();
}
bool Application::IsProcessCompleted()
{
return m_scheduler.IsProcessCompleted();
}
void Application::PrintLogs(std::chrono::high_resolution_clock::time_point referenceTime)
{
m_scheduler.PrintLogs(referenceTime);
}
void Application::GenerateGraph(const std::wstring& filename)
{
m_scheduler.GenerateGraph(filename);
}
} // PAL | {
"content_hash": "870f67a2351dce38a44a3ff7f681ba4c",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 90,
"avg_line_length": 20,
"alnum_prop": 0.7285714285714285,
"repo_name": "mwasplund/PAL",
"id": "b518016a1e3d2c7936c2b002324dea5c7c926ca8",
"size": "804",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Core/Scheduler/Application.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "78159"
}
],
"symlink_target": ""
} |
require 'seeme'
require 'byebug'
require 'webmock/rspec'
require 'vcr'
WebMock.disable_net_connect!(allow_localhost: true)
def stub_base_url
"#{Seeme.endpoint_uri}/gateway"
end
def configure_seeme
Seeme.configure do |c|
c.api_key = "user"
c.secure_http = false
c.callback_url = "http://localhost/callback"
end
end | {
"content_hash": "934343dc704013e0aba4c739db9cc9ec",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 51,
"avg_line_length": 17.63157894736842,
"alnum_prop": 0.7044776119402985,
"repo_name": "pepusz/seeme_ruby",
"id": "314d8f14223efce80b9ecd41e9bc8b32c425c44f",
"size": "335",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/spec_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "11013"
}
],
"symlink_target": ""
} |
package uk.ac.ed.ph.snuggletex.dombuilding;
import uk.ac.ed.ph.snuggletex.internal.DOMBuilder;
import uk.ac.ed.ph.snuggletex.internal.SnuggleParseException;
import uk.ac.ed.ph.snuggletex.tokens.ArgumentContainerToken;
import uk.ac.ed.ph.snuggletex.tokens.CommandToken;
import org.w3c.dom.Element;
/**
* Handles complex Math commands (i.e. ones taking arguments) that map very easily onto
* MathML elements where each argument becomes a child element of the resulting MathML
* container.
*
* @author David McKain
* @version $Revision$
*/
public final class MathComplexCommandHandler implements CommandHandler {
private final String elementName;
public MathComplexCommandHandler(final String elementName) {
this.elementName = elementName;
}
public void handleCommand(DOMBuilder builder, Element parentElement, CommandToken token)
throws SnuggleParseException {
Element result = builder.appendMathMLElement(parentElement, elementName);
for (ArgumentContainerToken argument : token.getArguments()) {
builder.handleMathTokensAsSingleElement(result, argument);
}
}
}
| {
"content_hash": "2593a743618b28abd3534908c3486de7",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 92,
"avg_line_length": 34.23529411764706,
"alnum_prop": 0.7465635738831615,
"repo_name": "kduske-n4/snuggletex",
"id": "480d75fc4b67ffe454482683f2a455415116697d",
"size": "1258",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "snuggletex-core/src/main/java/uk/ac/ed/ph/snuggletex/dombuilding/MathComplexCommandHandler.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "14653"
},
{
"name": "Java",
"bytes": "1113418"
},
{
"name": "JavaScript",
"bytes": "68568"
},
{
"name": "TeX",
"bytes": "381581"
},
{
"name": "XSLT",
"bytes": "287838"
}
],
"symlink_target": ""
} |
//: interfaces/interfaceprocessor/FilterProcessor.java
package interfaces.interfaceprocessor;
import interfaces.filters.*;
class FilterAdapter implements Processor {
Filter filter;
public FilterAdapter(Filter filter) {
this.filter = filter;
}
public String name() { return filter.name(); }
public Waveform process(Object input) {
return filter.process((Waveform)input);
}
}
public class FilterProcessor {
public static void main(String[] args) {
Waveform w = new Waveform();
Apply.process(new FilterAdapter(new LowPass(1.0)), w);
Apply.process(new FilterAdapter(new HighPass(2.0)), w);
Apply.process(
new FilterAdapter(new BandPass(3.0, 4.0)), w);
}
} /* Output:
Using Processor LowPass
Waveform 0
Using Processor HighPass
Waveform 0
Using Processor BandPass
Waveform 0
*///:~
| {
"content_hash": "a8fcf5e22c29c3c773b2d280ba3c9f4f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 59,
"avg_line_length": 26.64516129032258,
"alnum_prop": 0.7239709443099274,
"repo_name": "mayonghui2112/helloWorld",
"id": "a2b6dc5c1d38902fc5e38fcf2b620d2007938543",
"size": "826",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "sourceCode/testMaven/thinkingInJava/src/main/java/interfaces/interfaceprocessor/FilterProcessor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AngelScript",
"bytes": "521"
},
{
"name": "Batchfile",
"bytes": "39234"
},
{
"name": "C",
"bytes": "22329"
},
{
"name": "C++",
"bytes": "13466"
},
{
"name": "CSS",
"bytes": "61000"
},
{
"name": "Go",
"bytes": "6819"
},
{
"name": "Groovy",
"bytes": "8821"
},
{
"name": "HTML",
"bytes": "9234922"
},
{
"name": "Java",
"bytes": "21874329"
},
{
"name": "JavaScript",
"bytes": "46483"
},
{
"name": "NSIS",
"bytes": "42042"
},
{
"name": "Objective-C++",
"bytes": "26102"
},
{
"name": "PLpgSQL",
"bytes": "3746"
},
{
"name": "Perl",
"bytes": "13860"
},
{
"name": "Python",
"bytes": "33132"
},
{
"name": "Shell",
"bytes": "51005"
},
{
"name": "TSQL",
"bytes": "50756"
},
{
"name": "XSLT",
"bytes": "38702"
}
],
"symlink_target": ""
} |
import Model, {
createCustomFieldsSchema,
NOTE_TYPE,
REPORT_RELATED_OBJECT_TYPE,
REPORT_STATE_PUBLISHED,
yupDate
} from "components/Model"
import _isEmpty from "lodash/isEmpty"
import moment from "moment"
import REPORTS_ICON from "resources/reports.png"
import Settings from "settings"
import utils from "utils"
import * as yup from "yup"
import Person from "./Person"
import Task from "./Task"
export default class Report extends Model {
static resourceName = "Report"
static listName = "reportList"
static getInstanceName = "report"
static relatedObjectType = REPORT_RELATED_OBJECT_TYPE
static STATE = {
DRAFT: "DRAFT",
PENDING_APPROVAL: "PENDING_APPROVAL",
APPROVED: "APPROVED",
PUBLISHED: REPORT_STATE_PUBLISHED,
REJECTED: "REJECTED",
CANCELLED: "CANCELLED"
}
static STATE_LABELS = {
[Report.STATE.DRAFT]: "Draft",
[Report.STATE.PENDING_APPROVAL]: "Pending Approval",
[Report.STATE.APPROVED]: "Approved",
[Report.STATE.PUBLISHED]: "Published",
[Report.STATE.CANCELLED]: "Cancelled",
[Report.STATE.REJECTED]: "Changes requested"
}
static STATE_COLORS = {
[Report.STATE.DRAFT]: "#bdbdaf",
[Report.STATE.PENDING_APPROVAL]: "#848478",
[Report.STATE.APPROVED]: "#75eb75",
[Report.STATE.PUBLISHED]: "#5cb85c",
[Report.STATE.CANCELLED]: "#ec971f",
[Report.STATE.REJECTED]: "#c23030"
}
static ENGAGEMENT_STATUS = {
HAPPENED: "HAPPENED",
FUTURE: "FUTURE",
CANCELLED: "CANCELLED"
}
static ENGAGEMENT_STATUS_LABELS = {
[Report.ENGAGEMENT_STATUS.HAPPENED]: "Happened",
[Report.ENGAGEMENT_STATUS.FUTURE]: "Future",
[Report.ENGAGEMENT_STATUS.CANCELLED]: "Cancelled"
}
static CANCELLATION_REASON = {
CANCELLED_BY_ADVISOR: "CANCELLED_BY_ADVISOR",
CANCELLED_BY_PRINCIPAL: "CANCELLED_BY_PRINCIPAL",
CANCELLED_DUE_TO_TRANSPORTATION: "CANCELLED_DUE_TO_TRANSPORTATION",
CANCELLED_DUE_TO_FORCE_PROTECTION: "CANCELLED_DUE_TO_FORCE_PROTECTION",
CANCELLED_DUE_TO_ROUTES: "CANCELLED_DUE_TO_ROUTES",
CANCELLED_DUE_TO_THREAT: "CANCELLED_DUE_TO_THREAT",
CANCELLED_DUE_TO_AVAILABILITY_OF_INTERPRETERS:
"CANCELLED_DUE_TO_AVAILABILITY_OF_INTERPRETERS",
CANCELLED_DUE_TO_NETWORK_ISSUES: "CANCELLED_DUE_TO_NETWORK_ISSUES"
}
static ATMOSPHERE = {
POSITIVE: "POSITIVE",
NEGATIVE: "NEGATIVE",
NEUTRAL: "NEUTRAL"
}
static ATMOSPHERE_LABELS = {
[Report.ATMOSPHERE.POSITIVE]: "Positive",
[Report.ATMOSPHERE.NEGATIVE]: "Negative",
[Report.ATMOSPHERE.NEUTRAL]: "Neutral"
}
static TASKS_ASSESSMENTS_PARENT_FIELD = "tasksAssessments"
static TASKS_ASSESSMENTS_UUIDS_FIELD = "tasksAssessmentsUuids"
static ATTENDEES_ASSESSMENTS_PARENT_FIELD = "attendeesAssessments"
static ATTENDEES_ASSESSMENTS_UUIDS_FIELD = "attendeesAssessmentsUuids"
// create yup schema for the customFields, based on the customFields config
static customFieldsSchema = createCustomFieldsSchema(
Settings.fields.report.customFields
)
static yupSchema = yup
.object()
.shape({
intent: yup
.string()
.nullable()
.required(`You must provide the ${Settings.fields.report.intent}`)
.default("")
.label(Settings.fields.report.intent),
engagementDate: yupDate
.nullable()
.required("You must provide the Date of Engagement")
.default(null),
duration: yup.number().nullable().default(null),
// not actually in the database, but used for validation:
cancelled: yup
.boolean()
.default(false)
.label(Settings.fields.report.cancelled),
cancelledReason: yup
.string()
.nullable()
.when("cancelled", (cancelled, schema) =>
cancelled
? schema.required("You must provide a reason for cancellation")
: schema.nullable()
)
.default(null),
atmosphere: yup
.string()
.nullable()
.when(
["cancelled", "engagementDate"],
(cancelled, engagementDate, schema) =>
cancelled
? schema.nullable()
: !Report.isFuture(engagementDate)
? schema.required(
`You must provide the overall ${Settings.fields.report.atmosphere} of the engagement`
)
: schema.nullable()
)
.default(null)
.label(Settings.fields.report.atmosphere),
atmosphereDetails: yup
.string()
.nullable()
.when(
["cancelled", "atmosphere", "engagementDate"],
(cancelled, atmosphere, engagementDate, schema) =>
cancelled
? schema.nullable()
: !Report.isFuture(engagementDate)
? atmosphere === Report.ATMOSPHERE.POSITIVE
? schema.nullable()
: schema.required(
`You must provide ${Settings.fields.report.atmosphereDetails} if the engagement was not Positive`
)
: schema.nullable()
)
.default("")
.label(Settings.fields.report.atmosphereDetails),
location: yup
.object()
.nullable()
.test(
"location",
"location error",
// can't use arrow function here because of binding to 'this'
function(location) {
return _isEmpty(location)
? this.createError({ message: "You must provide the Location" })
: true
}
)
.default({}),
reportPeople: yup
.array()
.nullable()
.when("cancelled", (cancelled, schema) =>
cancelled
? schema.nullable()
: schema // Only do validation warning when engagement not cancelled
.test(
"primary-principal",
"primary principal error",
// can't use arrow function here because of binding to 'this'
function(reportPeople) {
const err = Report.checkPrimaryAttendee(
reportPeople,
Person.ROLE.PRINCIPAL
)
return err ? this.createError({ message: err }) : true
}
)
.test(
"primary-advisor",
"primary advisor error",
// can't use arrow function here because of binding to 'this'
function(reportPeople) {
const err = Report.checkPrimaryAttendee(
reportPeople,
Person.ROLE.ADVISOR
)
return err ? this.createError({ message: err }) : true
}
)
.test(
"no-author",
"no author error",
// can't use arrow function here because of binding to 'this'
function(reportPeople) {
const err = Report.checkAnyAuthor(reportPeople)
return err ? this.createError({ message: err }) : true
}
)
.test(
"attending-author",
"no attending author error",
// can't use arrow function here because of binding to 'this'
function(reportPeople) {
const err = Report.checkAttendingAuthor(reportPeople)
return err ? this.createError({ message: err }) : true
}
)
.test(
"purposeless-people",
"purposeless people error",
// can't use arrow function here because of binding to 'this'
function(reportPeople) {
const err = Report.checkUnInvolvedPeople(reportPeople)
return err ? this.createError({ message: err }) : true
}
)
)
.default([]),
principalOrg: yup.object().nullable().default({}),
advisorOrg: yup.object().nullable().default({}),
tasks: yup
.array()
.nullable()
.test(
"tasks",
"tasks error",
// can't use arrow function here because of binding to 'this'
function(tasks) {
return _isEmpty(tasks)
? this.createError({
message: `You must provide at least one ${Settings.fields.task.subLevel.shortLabel}`
})
: true
}
)
.default([]),
comments: yup.array().nullable().default([]),
reportText: yup
.string()
.nullable()
.when("cancelled", (cancelled, schema) =>
cancelled
? schema.nullable()
: schema.test(
"reportText",
"reportText error",
// can't use arrow function here because of binding to 'this'
function(reportText) {
return utils.isEmptyHtml(reportText)
? this.createError({
message: `You must provide the ${Settings.fields.report.reportText}`
})
: true
}
)
)
.default("")
.label(Settings.fields.report.reportText),
nextSteps: yup
.string()
.nullable()
.when(["engagementDate"], (engagementDate, schema) =>
!Report.isFuture(engagementDate)
? schema.required(
`You must provide a brief summary of the ${Settings.fields.report.nextSteps.label}`
)
: schema.nullable()
)
.default("")
.label(Settings.fields.report.nextSteps.label),
keyOutcomes: yup
.string()
.nullable()
.when(
["cancelled", "engagementDate"],
(cancelled, engagementDate, schema) =>
cancelled
? schema.nullable()
: Settings.fields.report.keyOutcomes &&
!Report.isFuture(engagementDate)
? schema.required(
`You must provide a brief summary of the ${Settings.fields.report.keyOutcomes}`
)
: schema.nullable()
)
.default("")
.label(Settings.fields.report.keyOutcomes),
reportSensitiveInformation: yup
.object()
.nullable()
.default({ uuid: null, text: null }),
authorizationGroups: yup.array().nullable().default([])
})
// not actually in the database, the database contains the JSON customFields
.concat(Report.customFieldsSchema)
.concat(Model.yupSchema)
static yupWarningSchema = yup.object().shape({
reportSensitiveInformation: yup.object().nullable().default({}),
authorizationGroups: yup
.array()
.nullable()
.when(
["reportSensitiveInformation", "reportSensitiveInformation.text"],
(reportSensitiveInformation, reportSensitiveInformationText, schema) =>
_isEmpty(reportSensitiveInformation) ||
_isEmpty(reportSensitiveInformationText)
? schema.nullable()
: schema.required(`You should provide authorization groups who can access the sensitive information.
If you do not do so, you will remain the only one authorized to see the sensitive information you have entered`)
)
})
static autocompleteQuery = "uuid, intent, authors { uuid, name, rank, role }"
constructor(props) {
super(Model.fillObject(props, Report.yupSchema))
}
static isDraft(state) {
return state === Report.STATE.DRAFT
}
isDraft() {
return Report.isDraft(this.state)
}
static isPending(state) {
return state === Report.STATE.PENDING_APPROVAL
}
isPending() {
return Report.isPending(this.state)
}
static isPublished(state) {
return state === Report.STATE.PUBLISHED
}
isPublished() {
return Report.isPublished(this.state)
}
static isRejected(state) {
return state === Report.STATE.REJECTED
}
isRejected() {
return Report.isRejected(this.state)
}
static isCancelled(state) {
return state === Report.STATE.CANCELLED
}
isCancelled() {
return Report.isCancelled(this.state)
}
static isFuture(engagementDate) {
return engagementDate && moment().endOf("day").isBefore(engagementDate)
}
isFuture() {
return Report.isFuture(this.engagementDate)
}
static isApproved(state) {
return state === Report.STATE.APPROVED
}
isApproved() {
return Report.isApproved(this.state)
}
static getStateForClassName(report) {
return `${
Report.isFuture(report.engagementDate) ? "future-" : ""
}${report.state.toLowerCase()}`
}
getStateForClassName() {
return Report.getStateForClassName(this)
}
showWorkflow() {
return this.state && !this.isDraft()
}
iconUrl() {
return REPORTS_ICON
}
toString() {
return this.intent || "None"
}
static checkPrimaryAttendee(reportPeople, role) {
const primaryAttendee = Report.getPrimaryAttendee(reportPeople, role)
const roleName = Person.humanNameOfRole(role)
if (!primaryAttendee) {
return `You must provide the primary ${roleName} for the Engagement`
} else if (primaryAttendee.status !== Model.STATUS.ACTIVE) {
return `The primary ${roleName} - ${primaryAttendee.name} - needs to have an active profile`
} else if (
primaryAttendee.endOfTourDate &&
moment(primaryAttendee.endOfTourDate).isBefore(moment().startOf("day"))
) {
return `The primary ${roleName}'s - ${primaryAttendee.name} - end of tour date has passed`
} else if (!primaryAttendee.position) {
return `The primary ${roleName} - ${primaryAttendee.name} - needs to be assigned to a position`
} else if (primaryAttendee.position.status !== Model.STATUS.ACTIVE) {
return `The primary ${roleName} - ${primaryAttendee.name} - needs to be in an active position`
}
}
static checkAttendingAuthor(reportPeople) {
if (!reportPeople?.some(rp => rp.author && rp.attendee)) {
return "You must provide at least 1 attending author"
}
}
static checkAnyAuthor(reportPeople) {
if (!reportPeople?.some(rp => rp.author)) {
return "You must provide at least 1 author"
}
}
// Report people shouldn't have any person who is both non-attending and non-author
static checkUnInvolvedPeople(reportPeople) {
if (reportPeople?.some(rp => !rp.author && !rp.attendee)) {
return "You must remove the people who have no involvement (neither attending nor author) before submitting"
}
}
static getPrimaryAttendee(reportPeople, role) {
return reportPeople?.find(
el => el.role === role && el.primary && el.attendee
)
}
static sortReportPeople(reportPeople) {
return [...reportPeople].sort((rp1, rp2) => {
// primary first, then authors, then alphabetical
if (rp1.primary !== rp2.primary) {
return rp1.primary ? -1 : 1
} else if (rp1.author !== rp2.author) {
return rp1.author ? -1 : 1
}
return (rp1.name || rp1.uuid).localeCompare(rp2.name || rp2.uuid)
})
}
static getEngagementDateFormat() {
return Settings.engagementsIncludeTimeAndDuration
? Settings.dateFormats.forms.displayLong.withTime
: Settings.dateFormats.forms.displayLong.date
}
getReportApprovedAt() {
if (this.workflow && this.isApproved()) {
const actions = Object.assign([], this.workflow)
const lastApprovalStep = actions.pop()
return !lastApprovalStep ? "" : lastApprovalStep.createdAt
}
}
getRelatedObjectsEngagementAssessments(
entityType,
entitiesAssessmentsFieldName,
entitiesAssessmentsUuidsFieldName
) {
const notesToAssessments = this.notes
.filter(
n => n.type === NOTE_TYPE.ASSESSMENT && n.noteRelatedObjects.length > 1
)
.map(n => ({
entityUuids: n.noteRelatedObjects
.filter(ro => ro.relatedObjectType === entityType.relatedObjectType)
.map(ro => ro.relatedObjectUuid),
assessmentUuid: n.uuid,
assessment: utils.parseJsonSafe(n.text),
assessmentKey: n.assessmentKey
}))
.filter(n => !_isEmpty(n.entityUuids))
// When updating the instant assessments, we need for each entity the uuid of the
// related instant assessment
const entitiesAssessmentsUuids = {}
// Get initial entities assessments values
const entitiesAssessments = {}
notesToAssessments.forEach(m => {
m.entityUuids.forEach(entityUuid => {
const splittedKey = m.assessmentKey.split(".")
const parsedKey = splittedKey.pop()
entitiesAssessmentsUuids[entityUuid] = m.assessmentUuid
entitiesAssessments[entityUuid] = entitiesAssessments[entityUuid] || {}
entitiesAssessments[entityUuid][parsedKey] = m.assessment
})
})
return {
[entitiesAssessmentsUuidsFieldName]: entitiesAssessmentsUuids,
[entitiesAssessmentsFieldName]: entitiesAssessments
}
}
getTasksEngagementAssessments() {
return this.getRelatedObjectsEngagementAssessments(
Task,
Report.TASKS_ASSESSMENTS_PARENT_FIELD,
Report.TASKS_ASSESSMENTS_UUIDS_FIELD
)
}
getAttendeesEngagementAssessments() {
return this.getRelatedObjectsEngagementAssessments(
Person,
Report.ATTENDEES_ASSESSMENTS_PARENT_FIELD,
Report.ATTENDEES_ASSESSMENTS_UUIDS_FIELD
)
}
static getReportSchema(tasks, reportPeople) {
// Update the report schema according to the selected report tasks and attendees
// instant assessments schema
let reportSchema = Report.yupSchema
const {
assessmentsConfig: tasksInstantAssessmentsConfig,
assessmentsSchema: tasksInstantAssessmentsSchema
} = Task.getInstantAssessmentsDetailsForEntities(
tasks,
Report.TASKS_ASSESSMENTS_PARENT_FIELD
)
const {
assessmentsConfig: attendeesInstantAssessmentsConfig,
assessmentsSchema: attendeesInstantAssessmentsSchema
} = Person.getInstantAssessmentsDetailsForEntities(
reportPeople?.filter(rp => rp.attendee),
Report.ATTENDEES_ASSESSMENTS_PARENT_FIELD
)
if (!_isEmpty(tasksInstantAssessmentsConfig)) {
reportSchema = reportSchema.concat(tasksInstantAssessmentsSchema)
}
if (!_isEmpty(attendeesInstantAssessmentsConfig)) {
reportSchema = reportSchema.concat(attendeesInstantAssessmentsSchema)
}
return reportSchema
}
static hasConflict(report01, report02) {
if (report01.uuid === report02.uuid) {
return false // same report is not a conflicting report
}
// cancelled reports not counted as conflict
if (
Report.isCancelled(report01.state) ||
Report.isCancelled(report02.state)
) {
return false
}
let start01
let end01
if (
!Settings.engagementsIncludeTimeAndDuration ||
report01.duration === null
) {
// It is an all-day event
start01 = moment(report01.engagementDate).startOf("day")
end01 = moment(report01.engagementDate).endOf("day")
} else {
start01 = moment(report01.engagementDate)
end01 = moment(report01.engagementDate).add(report01.duration, "minute")
}
let start02
let end02
if (
!Settings.engagementsIncludeTimeAndDuration ||
report02.duration === null
) {
// It is an all-day event
start02 = moment(report02.engagementDate).startOf("day")
end02 = moment(report02.engagementDate).endOf("day")
} else {
start02 = moment(report02.engagementDate)
end02 = moment(report02.engagementDate).add(report02.duration, "minute")
}
return (
start01.isSame(start02) ||
(end01.isAfter(start02) && start01.isBefore(end02))
)
}
static getFormattedEngagementDate(report) {
if (!report?.engagementDate) {
return ""
}
const start = moment(report.engagementDate)
if (!report.duration) {
return Settings.engagementsIncludeTimeAndDuration
? start.format(Settings.dateFormats.forms.displayLong.date) +
" (all day)"
: start.format(Report.getEngagementDateFormat())
}
const end = moment(report.engagementDate).add(report.duration, "minutes")
return (
start.format(Report.getEngagementDateFormat()) +
end.format(
start.isSame(end, "day")
? " - HH:mm"
: " >>> " + Report.getEngagementDateFormat()
)
)
}
static FILTERED_CLIENT_SIDE_FIELDS = [
"authors",
"cancelled",
"showSensitiveInfo",
Report.TASKS_ASSESSMENTS_PARENT_FIELD,
Report.ATTENDEES_ASSESSMENTS_PARENT_FIELD,
Report.TASKS_ASSESSMENTS_UUIDS_FIELD,
Report.ATTENDEES_ASSESSMENTS_UUIDS_FIELD
]
static filterClientSideFields(obj, ...additionalFields) {
return Model.filterClientSideFields(
obj,
...Report.FILTERED_CLIENT_SIDE_FIELDS,
...additionalFields
)
}
filterClientSideFields(...additionalFields) {
return Report.filterClientSideFields(this, ...additionalFields)
}
}
| {
"content_hash": "8f01d30a5dd829071159370cc555db74",
"timestamp": "",
"source": "github",
"line_count": 656,
"max_line_length": 124,
"avg_line_length": 32.230182926829265,
"alnum_prop": 0.6172728562644847,
"repo_name": "NCI-Agency/anet",
"id": "d9cdf4b3f1c0c4b3fb93feb308ac19bec97a9f4c",
"size": "21143",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "client/src/models/Report.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "36473"
},
{
"name": "Dockerfile",
"bytes": "213"
},
{
"name": "FreeMarker",
"bytes": "1844"
},
{
"name": "HTML",
"bytes": "648"
},
{
"name": "Handlebars",
"bytes": "2172"
},
{
"name": "Java",
"bytes": "1464201"
},
{
"name": "JavaScript",
"bytes": "1990816"
},
{
"name": "Perl",
"bytes": "1760"
},
{
"name": "Shell",
"bytes": "2025"
},
{
"name": "XSLT",
"bytes": "3762"
}
],
"symlink_target": ""
} |
class IFloatBuffer;
class IShortBuffer;
class GPUProgramState;
class SGGeometryNode : public SGNode {
private:
const int _primitive;
IFloatBuffer* _vertices;
IFloatBuffer* _colors;
IFloatBuffer* _uv;
IFloatBuffer* _normals;
IShortBuffer* _indices;
GLState* _glState;
void createGLState();
public:
SGGeometryNode(const std::string& id,
const std::string& sId,
int primitive,
IFloatBuffer* vertices,
IFloatBuffer* colors,
IFloatBuffer* uv,
IFloatBuffer* normals,
IShortBuffer* indices) :
SGNode(id, sId),
_primitive(primitive),
_vertices(vertices),
_colors(colors),
_uv(uv),
_normals(normals),
_indices(indices),
_glState(new GLState())
{
createGLState();
}
~SGGeometryNode();
void rawRender(const G3MRenderContext* rc, const GLState* glState);
const GLState* createState(const G3MRenderContext* rc,
const GLState* parentState) {
_glState->setParent(parentState);
return _glState;
}
std::string description() {
return "SGGeometryNode";
}
};
#endif
| {
"content_hash": "4fb681999ab1b2fad108f4c332770960",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 69,
"avg_line_length": 22.181818181818183,
"alnum_prop": 0.5959016393442623,
"repo_name": "AeroGlass/g3m",
"id": "1f2082b464cbff47f0f8665ccbb5a825b9061fd7",
"size": "1438",
"binary": false,
"copies": "4",
"ref": "refs/heads/purgatory",
"path": "iOS/G3MiOSSDK/Commons/Rendererers/SGGeometryNode.hpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Batchfile",
"bytes": "7767"
},
{
"name": "C",
"bytes": "12488"
},
{
"name": "C++",
"bytes": "2483573"
},
{
"name": "CSS",
"bytes": "854"
},
{
"name": "HTML",
"bytes": "29099"
},
{
"name": "Java",
"bytes": "2678952"
},
{
"name": "JavaScript",
"bytes": "13022"
},
{
"name": "Objective-C",
"bytes": "152753"
},
{
"name": "Objective-C++",
"bytes": "344579"
},
{
"name": "PostScript",
"bytes": "693603"
},
{
"name": "Python",
"bytes": "26399"
}
],
"symlink_target": ""
} |
"""
txtemplate
=======================
Provides a common twisted-friendly interface for
template systems like:
- Clearsilver
- Genshi
- Jinja2
"""
from .templates import ClearsilverTemplateLoader
from .templates import GenshiTemplateLoader
from .templates import Jinja2TemplateLoader
__version__ = "1.0.4"
__all__ = ["ClearsilverTemplateLoader",
"GenshiTemplateLoader",
"Jinja2TemplateLoader"]
| {
"content_hash": "9910143dc2fcd5caf40d6bc309fedc72",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 48,
"avg_line_length": 17.791666666666668,
"alnum_prop": 0.6885245901639344,
"repo_name": "steder/txtemplate",
"id": "57455f82e1c0111e6d24b0b656776d2cd15b7e3d",
"size": "441",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "txtemplate/__init__.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "28191"
}
],
"symlink_target": ""
} |
(function ($) {
$.fn.tabs = function () {
return this.each(function() {
// For each set of tabs, we want to keep track of
// which tab is active and its associated content
var $this = $(this),
window_width = $(window).width();
$this.width('100%');
// Set Tab Width for each tab
var $num_tabs = $(this).children('li').length;
$this.children('li').each(function() {
$(this).width((100/$num_tabs)+'%');
});
var $active, $content, $links = $this.find('li.tab a'),
$tabs_width = $this.width(),
$tab_width = $this.find('li').first().outerWidth(),
$index = 0;
// If the location.hash matches one of the links, use that as the active tab.
// console.log($(".tabs .tab a[href='#tab3']"));
$active = $($links.filter('[href="'+location.hash+'"]'));
// If no match is found, use the first link or any with class 'active' as the initial active tab.
if ($active.length === 0) {
$active = $(this).find('li.tab a.active').first();
}
if ($active.length === 0) {
$active = $(this).find('li.tab a').first();
}
$active.addClass('active');
$index = $links.index($active);
if ($index < 0) {
$index = 0;
}
$content = $($active[0].hash);
// append indicator then set indicator width to tab width
$this.append('<div class="indicator"></div>');
var $indicator = $this.find('.indicator');
if ($this.is(":visible")) {
$indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
$indicator.css({"left": $index * $tab_width});
}
$(window).resize(function () {
$tabs_width = $this.width();
$tab_width = $this.find('li').first().outerWidth();
if ($index < 0) {
$index = 0;
}
if ($tab_width !== 0 && $tabs_width !== 0) {
$indicator.css({"right": $tabs_width - (($index + 1) * $tab_width)});
$indicator.css({"left": $index * $tab_width});
}
});
// Hide the remaining content
$links.not($active).each(function () {
$(this.hash).hide();
});
// Bind the click event handler
$this.on('click', 'a', function(e){
$tabs_width = $this.width();
$tab_width = $this.find('li').first().outerWidth();
// Make the old tab inactive.
$active.removeClass('active');
$content.hide();
// Update the variables with the new link and content
$active = $(this);
$content = $(this.hash);
$links = $this.find('li.tab a');
// Make the tab active.
$active.addClass('active');
var $prev_index = $index;
$index = $links.index($(this));
if ($index < 0) {
$index = 0;
}
// Change url to current tab
// window.location.hash = $active.attr('href');
$content.show();
// Update indicator
if (($index - $prev_index) >= 0) {
$indicator.velocity({"right": $tabs_width - (($index + 1) * $tab_width)}, { duration: 300, queue: false, easing: 'easeOutQuad'});
$indicator.velocity({"left": $index * $tab_width}, {duration: 300, queue: false, easing: 'easeOutQuad', delay: 80});
}
else {
$indicator.velocity({"left": $index * $tab_width}, { duration: 300, queue: false, easing: 'easeOutQuad'});
$indicator.velocity({"right": $tabs_width - (($index + 1) * $tab_width)}, {duration: 300, queue: false, easing: 'easeOutQuad', delay: 80});
}
// Prevent the anchor's default click action
e.preventDefault();
});
});
};
}( jQuery ));
| {
"content_hash": "554ba496c2503748df400e96e9bbdbec",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 147,
"avg_line_length": 32.01801801801802,
"alnum_prop": 0.5422059651097355,
"repo_name": "robocon/platwo-eventadmin",
"id": "0cd0a1a50e85bc8598488268a0c3f89e7cff8286",
"size": "3554",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "public/js/tabs.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "342"
},
{
"name": "CSS",
"bytes": "307367"
},
{
"name": "JavaScript",
"bytes": "383717"
},
{
"name": "PHP",
"bytes": "51036"
}
],
"symlink_target": ""
} |
package com.nilhcem.droidconde.data.database.model;
import android.content.ContentValues;
import android.database.Cursor;
import com.nilhcem.droidconde.utils.Database;
import rx.functions.Func1;
public class Session {
public static final String TABLE = "sessions";
public static final String ID = "_id";
public static final String START_AT = "start_at";
public static final String DURATION = "duration";
public static final String ROOM_ID = "room_id";
public static final String SPEAKERS_IDS = "speakers_ids";
public static final String TITLE = "title";
public static final String DESCRIPTION = "description";
public final int id;
public final String startAt;
public final int duration;
public final int roomId;
public final String speakersIds;
public final String title;
public final String description;
public static final Func1<Cursor, Session> MAPPER = cursor -> {
int id = Database.getInt(cursor, ID);
String startAt = Database.getString(cursor, START_AT);
int duration = Database.getInt(cursor, DURATION);
int roomId = Database.getInt(cursor, ROOM_ID);
String speakersIds = Database.getString(cursor, SPEAKERS_IDS);
String title = Database.getString(cursor, TITLE);
String description = Database.getString(cursor, DESCRIPTION);
return new Session(id, startAt, duration, roomId, speakersIds, title, description);
};
public Session(int id, String startAt, int duration, int roomId, String speakersIds, String title, String description) {
this.id = id;
this.startAt = startAt;
this.duration = duration;
this.roomId = roomId;
this.speakersIds = speakersIds;
this.title = title;
this.description = description;
}
public static ContentValues createContentValues(Session session) {
ContentValues values = new ContentValues();
values.put(ID, session.id);
values.put(START_AT, session.startAt);
values.put(DURATION, session.duration);
values.put(ROOM_ID, session.roomId);
values.put(SPEAKERS_IDS, session.speakersIds);
values.put(TITLE, session.title);
values.put(DESCRIPTION, session.description);
return values;
}
}
| {
"content_hash": "b34deece61729505557c820b84977f58",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 124,
"avg_line_length": 37.11290322580645,
"alnum_prop": 0.6862233811386353,
"repo_name": "Nilhcem/droidconde-2016",
"id": "d46b433bd130fc426eef63268679d5cfe3cc31ca",
"size": "2301",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/nilhcem/droidconde/data/database/model/Session.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "264"
},
{
"name": "IDL",
"bytes": "1725"
},
{
"name": "Java",
"bytes": "217878"
},
{
"name": "JavaScript",
"bytes": "1912"
},
{
"name": "Kotlin",
"bytes": "8813"
},
{
"name": "Prolog",
"bytes": "656"
},
{
"name": "Shell",
"bytes": "1039"
}
],
"symlink_target": ""
} |
/*
Read integers A and B from input file and write their sum in output file.
Input
Input file contains A and B (0<A,B<10001).
Output
Write answer in output file.
Sample Input
5 3
Sample Output
8
*/
#include<iostream>
using namespace std;
int main() {
int a,b;
cin >> a >> b;
cout << a+b;
return 0;
}
| {
"content_hash": "2926c7307ca71388a6510a542e6921bc",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 73,
"avg_line_length": 10.966666666666667,
"alnum_prop": 0.6382978723404256,
"repo_name": "gzc/sgu",
"id": "6403da9bfec07e8b02416a0cb8884e8dd55dd9ec",
"size": "329",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "100-199/100.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "135301"
},
{
"name": "Java",
"bytes": "3408"
},
{
"name": "Python",
"bytes": "1259"
}
],
"symlink_target": ""
} |
<html>
<head>
<title>Mozilla/5.0 (compatible; YYSpider; +http://www.yunyun.com/spider.html)</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">
</head>
<body>
<div class="container">
<div class="section">
<h1 class="header center orange-text">User agent detail</h1>
<div class="row center">
Mozilla/5.0 (compatible; YYSpider; +http://www.yunyun.com/spider.html)
<p>
Detected by 6 of 8 providers<br />
As bot detected by 5 of 7
</p>
</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></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>Actions</th></tr><tr><td>BrowscapPhp<br /><small>6011</small></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>DonatjUAParser<br /><small>v0.5.0</small></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>PiwikDeviceDetector<br /><small>3.5.1</small></td><td> </td><td> </td><td> </td><td></td><td></td><td></td><td></td><td></td><td>yes</td><td>Yunyun Bot</td><td>Search bot</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-fc0f1b55-50d8-49c2-bb12-4cc1d8144ebf">Detail</a>
<!-- Modal Structure -->
<div id="modal-fc0f1b55-50d8-49c2-bb12-4cc1d8144ebf" 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] => Yunyun Bot
[category] => Search bot
[url] => http://www.yunyun.com/SiteInfo.php?r=about
[producer] => Array
(
[name] => YunYun
[url] => http://www.yunyun.com
)
)
[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.0</small></td><td> </td><td><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></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-8c08f104-4e61-421b-9405-291b09c383dc">Detail</a>
<!-- Modal Structure -->
<div id="modal-8c08f104-4e61-421b-9405-291b09c383dc" 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] => Mozilla/5.0 (compatible; YYSpider; +http://www.yunyun.com/spider.html)
)
[name:Sinergi\BrowserDetector\Browser:private] => unknown
[version:Sinergi\BrowserDetector\Browser:private] => unknown
[isRobot:Sinergi\BrowserDetector\Browser:private] => 1
[isChromeFrame: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] => Mozilla/5.0 (compatible; YYSpider; +http://www.yunyun.com/spider.html)
)
)
[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] => Mozilla/5.0 (compatible; YYSpider; +http://www.yunyun.com/spider.html)
)
)
)
</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></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td></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>yes</td><td>YYSpider</td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-8f4c86c5-433e-4536-b799-ad26d77264e0">Detail</a>
<!-- Modal Structure -->
<div id="modal-8f4c86c5-433e-4536-b799-ad26d77264e0" 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] =>
[minor] =>
[patch] =>
[family] => YYSpider
)
[os] => UAParser\Result\OperatingSystem Object
(
[major] =>
[minor] =>
[patch] =>
[patchMinor] =>
[family] => Other
)
[device] => UAParser\Result\Device Object
(
[brand] => Spider
[model] => Desktop
[family] => Spider
)
[originalUserAgent] => Mozilla/5.0 (compatible; YYSpider; +http://www.yunyun.com/spider.html)
)
</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>WhichBrowser<br /><small>2.0.9</small></td><td> </td><td> </td><td> </td><td></td><td></td><td></td><td></td><td><i class="material-icons">close</i></td><td>yes</td><td></td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-62f1f3a3-0c44-4ecb-9ee2-48145e35736b">Detail</a>
<!-- Modal Structure -->
<div id="modal-62f1f3a3-0c44-4ecb-9ee2-48145e35736b" 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></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><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>yes</td><td>misc crawler</td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-bd437f52-91e9-4ce8-88f7-6e5206ed6635">Detail</a>
<!-- Modal Structure -->
<div id="modal-bd437f52-91e9-4ce8-88f7-6e5206ed6635" 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.6.4</small></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td></td><td></td><td>Desktop</td><td></td><td></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-3a72b31e-c3c1-4317-a357-7a6d5e3c7027">Detail</a>
<!-- Modal Structure -->
<div id="modal-3a72b31e-c3c1-4317-a357-7a6d5e3c7027" 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] => Google Bot
[form_factor] => Desktop
[is_phone] => false
[is_app_webview] => false
)
[all] => Array
(
[brand_name] => Google
[model_name] => Bot
[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] =>
[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
[controlcap_is_smartphone] => default
[controlcap_is_ios] => default
[controlcap_is_android] => default
[controlcap_is_robot] => force_true
[controlcap_is_app] => default
[controlcap_advertised_device_os] => default
[controlcap_advertised_device_os_version] => default
[controlcap_advertised_browser] => default
[controlcap_advertised_browser_version] => default
[controlcap_is_windows_phone] => default
[controlcap_is_full_desktop] => default
[controlcap_is_largescreen] => default
[controlcap_is_mobile] => default
[controlcap_is_touchscreen] => default
[controlcap_is_wml_preferred] => default
[controlcap_is_xhtmlmp_preferred] => default
[controlcap_is_html_preferred] => default
[controlcap_form_factor] => default
[controlcap_complete_device_name] => default
)
)
</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></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-01-26 16:39:23</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.1.1/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": "d81a4b74a1cf8c0a1c19f115cc852ebc",
"timestamp": "",
"source": "github",
"line_count": 870,
"max_line_length": 437,
"avg_line_length": 39.89195402298851,
"alnum_prop": 0.5097677634991068,
"repo_name": "ThaDafinser/UserAgentParserComparison",
"id": "8f3343ab01a97743973289da4af1d7641e8c4806",
"size": "34707",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "v3/user-agent-detail/cb/10/cb10680e-256a-49b5-b315-5e2433af707d.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2060859160"
}
],
"symlink_target": ""
} |
import _plotly_utils.basevalidators
class YValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="y", parent_name="layout.updatemenu", **kwargs):
super(YValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs.pop("edit_type", "arraydraw"),
max=kwargs.pop("max", 3),
min=kwargs.pop("min", -2),
**kwargs,
)
| {
"content_hash": "a27e51d0d1b3dcd8aad1737d63c736f7",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 83,
"avg_line_length": 36.23076923076923,
"alnum_prop": 0.583864118895966,
"repo_name": "plotly/plotly.py",
"id": "3d0d153064f18d6dcac407fb585b15a249df5f19",
"size": "471",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/python/plotly/plotly/validators/layout/updatemenu/_y.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "545"
},
{
"name": "JavaScript",
"bytes": "2074"
},
{
"name": "PostScript",
"bytes": "565328"
},
{
"name": "Python",
"bytes": "31506317"
},
{
"name": "TypeScript",
"bytes": "71337"
}
],
"symlink_target": ""
} |
Ember.RadioButton = Ember.View.extend({
tagName : "input",
type : "radio",
attributeBindings : [ "name", "type", "value", "checked:checked:" ],
click : function() {
this.set("selection", this.$().val())
},
checked : function() {
return this.get("value") == this.get("selection");
}.property()
}); | {
"content_hash": "04bd1c9e78f0419b72a4067e977c7252",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 72,
"avg_line_length": 31.181818181818183,
"alnum_prop": 0.5510204081632653,
"repo_name": "michaelbreyes/TechChallenge",
"id": "8546b08519aae7a3114cf0caf2b70e29fbbb23cc",
"size": "343",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/scripts/views/radio_button.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7108"
},
{
"name": "HTML",
"bytes": "1464"
},
{
"name": "Handlebars",
"bytes": "15757"
},
{
"name": "JavaScript",
"bytes": "246746"
}
],
"symlink_target": ""
} |
/**
* Effectively the "enum" datatype. Used for selections from DropSlots. Has both displayText (what the user sees
* the option listed as) and a value (used internally) that could be anything (number, string). Selecting a Variable
* or List from a DropSlot results in SelectionData with a value that's a reference to a Variable or List. However,
* when SelectionData is written to XML, the value is first turned into a string. The Block using the SelectionData
* reconstructs the correct value from the string.
*
* SelectionData uses "" as the value for "Empty SelectionData" (essentially null) when nothing it selected.
*
* @param {string} displayText - The text shown to the user on the DropSlot with this data
* @param {*} value - Used internally, type depends on context
* @param {boolean} [isValid=true]
* @constructor
*/
function SelectionData(displayText, value, isValid) {
// Only the empty SelectionData can have "" as the value. So value === "" implies displayText === ""
DebugOptions.assert(value !== "" || displayText === "");
DebugOptions.validateNonNull(displayText, value);
Data.call(this, Data.types.selection, value, isValid);
this.displayText = displayText;
}
SelectionData.prototype = Object.create(Data.prototype);
SelectionData.prototype.constructor = SelectionData;
/**
* When converted to a string, the display text is used
* @return {StringData}
*/
SelectionData.prototype.asString = function() {
return new StringData(this.displayText, true);
};
/**
* @return {SelectionData}
*/
SelectionData.prototype.asSelection = function() {
return this;
};
/**
* Returns whether this SelectionData is the empty (null) SelectionData.
* @return {boolean}
*/
SelectionData.prototype.isEmpty = function() {
return this.value === "";
};
/**
* Generates SelectionData from XML. When imported, displayText = "" and value is a string. All DropSlots/RoundSlots
* sanitize the data and reconstruct the original displayText and value. This prevents the user from editing their
* save file to put arbitrary, invalid displayText in the SelectionData. It also allows us to change the displayed
* text of an option without breaking save files
* @param {Node} dataNode
* @return {SelectionData|null}
*/
SelectionData.importXml = function(dataNode) {
const value = XmlWriter.getTextNode(dataNode, "value");
if (value == null) return null;
return new SelectionData("", value);
};
/**
* Returns new empty SelectionData
* TODO: perhaps remove isValid parameter
* @param {boolean} [isValid=true]
* @return {SelectionData}
*/
SelectionData.empty = function(isValid) {
return new SelectionData("", "", isValid);
}; | {
"content_hash": "867c5e6042b687aa840dd17ff36e6d5e",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 118,
"avg_line_length": 37.563380281690144,
"alnum_prop": 0.7330333708286464,
"repo_name": "BirdBrainTechnologies/HummingbirdDragAndDrop-",
"id": "548cdd74a4a572a43663debc059ef81033dbed43",
"size": "2667",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Data/SelectionData.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3089"
},
{
"name": "HTML",
"bytes": "25811"
},
{
"name": "JavaScript",
"bytes": "3155678"
},
{
"name": "Python",
"bytes": "4528"
},
{
"name": "TeX",
"bytes": "58660"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.arquillian.hol</groupId>
<artifactId>arquillian-hol-parent</artifactId>
<version>1.0.0.Alpha1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>lab02-solution</artifactId>
<name>Arquillian HOL Lab02 Solution</name>
<packaging>jar</packaging>
<properties>
<version.fest_assert>1.4</version.fest_assert>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.arquillian</groupId>
<artifactId>arquillian-universe</artifactId>
<version>${version.arquillian_universe}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>${version.fest_assert}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-web-7.0</artifactId>
<version>${version.jboss_spec}</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.arquillian.universe</groupId>
<artifactId>arquillian-junit</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.arquillian.universe</groupId>
<artifactId>arquillian-chameleon</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>
| {
"content_hash": "ef14ba334525a39076dc41ea2e6f8331",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 100,
"avg_line_length": 27.209302325581394,
"alnum_prop": 0.6431623931623932,
"repo_name": "arquillian/arquillian-hol",
"id": "2edd5359955325f6a247acfb3c1972fa7b46260e",
"size": "2340",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lab02-solution/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "14760"
},
{
"name": "Groovy",
"bytes": "8794"
},
{
"name": "HTML",
"bytes": "10772"
},
{
"name": "Java",
"bytes": "159204"
}
],
"symlink_target": ""
} |
Echo "Windows OSX App bundler running..."
set DIR = %~dp0
Echo "Setting working dir to %DIR%!"
cd %DIR%
Echo "Copy Vidada.app template to target"
Xcopy Vidada.app .\..\target\Vidada.app /E /i /Y
cd .\..\target\
Echo "Assembling Vidada.jar into app..."
mkdir Vidada.app\Contents\Resources\Java
Copy vidada.jar Vidada.app\Contents\Resources\Java\Vidada.jar /Y
Echo "Assembling jar dependencies into app..."
Xcopy lib Vidada.app\Contents\Resources\Java\lib /E /i /Y
Echo "OSX App created successfully!"
| {
"content_hash": "9a2cced35c51ddebb6719d1b01770f14",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 64,
"avg_line_length": 28.055555555555557,
"alnum_prop": 0.7346534653465346,
"repo_name": "Vidada-Project/Vidada",
"id": "14d54a44e86a385d182bd252f4d9aee067252f0b",
"size": "505",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vidada/build/bundle-app.bat",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5888"
},
{
"name": "Java",
"bytes": "792340"
},
{
"name": "Shell",
"bytes": "1989"
}
],
"symlink_target": ""
} |
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2012 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
package com.google.appinventor.components.runtime;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.PropertyCategory;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.annotations.UsesPermissions;
import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.runtime.util.MediaUtil;
import com.google.appinventor.components.runtime.util.TextViewUtil;
import com.google.appinventor.components.runtime.util.ViewUtil;
import android.view.MotionEvent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.graphics.drawable.shapes.RectShape;
import android.graphics.drawable.shapes.RoundRectShape;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.view.View.OnLongClickListener;
import java.io.IOException;
/**
* Underlying base class for click-based components, not directly accessible to Simple programmers.
*
*/
@SimpleObject
@UsesPermissions(permissionNames = "android.permission.INTERNET")
public abstract class ButtonBase extends AndroidViewComponent
implements OnClickListener, OnFocusChangeListener, OnLongClickListener, View.OnTouchListener {
private static final String LOG_TAG = "ButtonBase";
private final android.widget.Button view;
// Constant for shape
// 10px is the radius of the rounded corners.
// 10px was chosen for esthetic reasons.
private static final float ROUNDED_CORNERS_RADIUS = 10f;
private static final float[] ROUNDED_CORNERS_ARRAY = new float[] { ROUNDED_CORNERS_RADIUS,
ROUNDED_CORNERS_RADIUS, ROUNDED_CORNERS_RADIUS, ROUNDED_CORNERS_RADIUS,
ROUNDED_CORNERS_RADIUS, ROUNDED_CORNERS_RADIUS, ROUNDED_CORNERS_RADIUS,
ROUNDED_CORNERS_RADIUS };
// Constant background color for buttons with a Shape other than default
private static final int SHAPED_DEFAULT_BACKGROUND_COLOR = Color.LTGRAY;
// Backing for text alignment
private int textAlignment;
// Backing for background color
private int backgroundColor;
// Backing for font typeface
private int fontTypeface;
// Backing for font bold
private boolean bold;
// Used for determining if visual feedback should be provided for buttons that have images
private boolean showFeedback=true;
// Backing for font italic
private boolean italic;
// Backing for text color
private int textColor;
// Backing for button shape
private int shape;
// Image path
private String imagePath = "";
// This is our handle on Android's nice 3-d default button.
private Drawable defaultButtonDrawable;
// This is our handle in Android's default button color states;
private ColorStateList defaultColorStateList;
// This is the Drawable corresponding to the Image property.
// If an Image has never been set or if the most recent Image
// could not be loaded, this is null.
private Drawable backgroundImageDrawable;
/**
* Creates a new ButtonBase component.
*
* @param container container, component will be placed in
*/
public ButtonBase(ComponentContainer container) {
super(container);
view = new android.widget.Button(container.$context());
// Save the default values in case the user wants them back later.
defaultButtonDrawable = view.getBackground();
defaultColorStateList = view.getTextColors();
// Adds the component to its designated container
container.$add(this);
// Listen to clicks and focus changes
view.setOnClickListener(this);
view.setOnFocusChangeListener(this);
view.setOnLongClickListener(this);
view.setOnTouchListener(this);
// Default property values
TextAlignment(Component.ALIGNMENT_CENTER);
// BackgroundColor and Image are dangerous properties:
// Once either of them is set, the 3D bevel effect for the button is
// irretrievable, except by reloading defaultButtonDrawable, defined above.
BackgroundColor(Component.COLOR_DEFAULT);
Image("");
Enabled(true);
fontTypeface = Component.TYPEFACE_DEFAULT;
TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
FontSize(Component.FONT_DEFAULT_SIZE);
Text("");
TextColor(Component.COLOR_DEFAULT);
Shape(Component.BUTTON_SHAPE_DEFAULT);
}
/**
* If a custom background images is specified for the button, then it will lose the pressed
* and disabled image effects; no visual feedback.
* The approach below is to provide a visual feedback if and only if an image is assigned
* to the button. In this situation, we overlay a gray background when pressed and
* release when not-pressed.
*/
@Override
public boolean onTouch(View view, MotionEvent me)
{
//NOTE: We ALWAYS return false because we want to indicate that this listener has not
//been consumed. Using this approach, other listeners (e.g. OnClick) can process as normal.
if (me.getAction() == MotionEvent.ACTION_DOWN) {
//button pressed, provide visual feedback AND return false
if (ShowFeedback()) {
view.getBackground().setAlpha(70); // translucent
view.invalidate();
}
TouchDown();
} else if (me.getAction() == MotionEvent.ACTION_UP ||
me.getAction() == MotionEvent.ACTION_CANCEL) {
//button released, set button back to normal AND return false
if (ShowFeedback()) {
view.getBackground().setAlpha(255); // opaque
view.invalidate();
}
TouchUp();
}
return false;
}
@Override
public View getView() {
return view;
}
/**
* Indicates when a button is touch down
*/
@SimpleEvent(description = "Indicates that the button was pressed down.")
public void TouchDown() {
EventDispatcher.dispatchEvent(this, "TouchDown");
}
/**
* Indicates when a button touch ends
*/
@SimpleEvent(description = "Indicates that a button has been released.")
public void TouchUp() {
EventDispatcher.dispatchEvent(this, "TouchUp");
}
/**
* Indicates the cursor moved over the button so it is now possible
* to click it.
*/
@SimpleEvent(description = "Indicates the cursor moved over the button so " +
"it is now possible to click it.")
public void GotFocus() {
EventDispatcher.dispatchEvent(this, "GotFocus");
}
/**
* Indicates the cursor moved away from the button so it is now no
* longer possible to click it.
*/
@SimpleEvent(description = "Indicates the cursor moved away from " +
"the button so it is now no longer possible to click it.")
public void LostFocus() {
EventDispatcher.dispatchEvent(this, "LostFocus");
}
/**
* Returns the alignment of the button's text: center, normal
* (e.g., left-justified if text is written left to right), or
* opposite (e.g., right-justified if text is written left to right).
*
* @return one of {@link Component#ALIGNMENT_NORMAL},
* {@link Component#ALIGNMENT_CENTER} or
* {@link Component#ALIGNMENT_OPPOSITE}
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
description = "Left, center, or right.",
userVisible = false)
public int TextAlignment() {
return textAlignment;
}
/**
* Specifies the alignment of the button's text: center, normal
* (e.g., left-justified if text is written left to right), or
* opposite (e.g., right-justified if text is written left to right).
*
* @param alignment one of {@link Component#ALIGNMENT_NORMAL},
* {@link Component#ALIGNMENT_CENTER} or
* {@link Component#ALIGNMENT_OPPOSITE}
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_TEXTALIGNMENT,
defaultValue = Component.ALIGNMENT_CENTER + "")
@SimpleProperty(userVisible = false)
public void TextAlignment(int alignment) {
this.textAlignment = alignment;
TextViewUtil.setAlignment(view, alignment, true);
}
/**
* Returns the style of the button.
*
* @return one of {@link Component#BUTTON_SHAPE_DEFAULT},
* {@link Component#BUTTON_SHAPE_ROUNDED},
* {@link Component#BUTTON_SHAPE_RECT} or
* {@link Component#BUTTON_SHAPE_OVAL}
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
userVisible = false)
public int Shape() {
return shape;
}
/**
* Specifies the style the button. This does not check that the argument is a legal value.
*
* @param shape one of {@link Component#BUTTON_SHAPE_DEFAULT},
* {@link Component#BUTTON_SHAPE_ROUNDED},
* {@link Component#BUTTON_SHAPE_RECT} or
* {@link Component#BUTTON_SHAPE_OVAL}
*
* @throws IllegalArgumentException if shape is not a legal value.
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BUTTON_SHAPE,
defaultValue = Component.BUTTON_SHAPE_DEFAULT + "")
@SimpleProperty(description = "Specifies the button's shape (default, rounded," +
" rectangular, oval). The shape will not be visible if an Image is being displayed.",
userVisible = false)
public void Shape(int shape) {
this.shape = shape;
updateAppearance();
}
/**
* Returns the path of the button's image.
*
* @return the path of the button's image
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
description = "Image to display on button.")
public String Image() {
return imagePath;
}
/**
* Specifies the path of the button's image.
*
* <p/>See {@link MediaUtil#determineMediaSource} for information about what
* a path can be.
*
* @param path the path of the button's image
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_ASSET,
defaultValue = "")
@SimpleProperty(description = "Specifies the path of the button's image. " +
"If there is both an Image and a BackgroundColor, only the Image will be " +
"visible.")
public void Image(String path) {
// If it's the same as on the prior call and the prior load was successful,
// do nothing.
if (path.equals(imagePath) && backgroundImageDrawable != null) {
return;
}
imagePath = (path == null) ? "" : path;
// Clear the prior background image.
backgroundImageDrawable = null;
// Load image from file.
if (imagePath.length() > 0) {
try {
backgroundImageDrawable = MediaUtil.getBitmapDrawable(container.$form(), imagePath);
} catch (IOException ioe) {
// TODO(user): Maybe raise Form.ErrorOccurred.
Log.e(LOG_TAG, "Unable to load " + imagePath);
// Fall through with a value of null for backgroundImageDrawable.
}
}
// Update the appearance based on the new value of backgroundImageDrawable.
updateAppearance();
}
/**
* Returns the button's background color as an alpha-red-green-blue
* integer.
*
* @return background RGB color with alpha
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
description = "Returns the button's background color")
public int BackgroundColor() {
return backgroundColor;
}
/**
* Specifies the button's background color as an alpha-red-green-blue
* integer. If the parameter is {@link Component#COLOR_DEFAULT}, the
* original beveling is restored. If an Image has been set, the color
* change will not be visible until the Image is removed.
*
* @param argb background RGB color with alpha
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_COLOR,
defaultValue = Component.DEFAULT_VALUE_COLOR_DEFAULT)
@SimpleProperty(description = "Specifies the button's background color. " +
"The background color will not be visible if an Image is being displayed.")
public void BackgroundColor(int argb) {
backgroundColor = argb;
updateAppearance();
}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_COLOR_GRADIENT,
defaultValue = Component.DEFAULT_VALUE_COLOR_DEFAULT)
@SimpleProperty(description = "Specifies the button's background color gradient " +
"The background color will not be visible if an Image is being displayed.")
public void BackgroundColorGradient(int argb) {
backgroundColor = argb;
updateAppearance();
}
// Update appearance based on values of backgroundImageDrawable, backgroundColor and shape.
// Images take precedence over background colors.
private void updateAppearance() {
// If there is no background image,
// the appearance depends solely on the background color and shape.
if (backgroundImageDrawable == null) {
if (shape == Component.BUTTON_SHAPE_DEFAULT) {
if (backgroundColor == Component.COLOR_DEFAULT) {
// If there is no background image and color is default,
// restore original 3D bevel appearance.
ViewUtil.setBackgroundDrawable(view, defaultButtonDrawable);
} else {
// Clear the background image.
ViewUtil.setBackgroundDrawable(view, null);
// Set to the specified color (possibly COLOR_NONE for transparent).
TextViewUtil.setBackgroundColor(view, backgroundColor);
}
} else {
// If there is no background image and the shape is something other than default,
// create a drawable with the appropriate shape and color.
setShape();
}
} else {
// If there is a background image
ViewUtil.setBackgroundImage(view, backgroundImageDrawable);
}
}
// Throw IllegalArgumentException if shape has illegal value.
private void setShape() {
ShapeDrawable drawable = new ShapeDrawable();
// Set color of drawable.
drawable.getPaint().setColor((backgroundColor == Component.COLOR_DEFAULT)
? SHAPED_DEFAULT_BACKGROUND_COLOR : backgroundColor);
// Set shape of drawable.
switch (shape) {
case Component.BUTTON_SHAPE_ROUNDED:
drawable.setShape(new RoundRectShape(ROUNDED_CORNERS_ARRAY, null, null));
break;
case Component.BUTTON_SHAPE_RECT:
drawable.setShape(new RectShape());
break;
case Component.BUTTON_SHAPE_OVAL:
drawable.setShape(new OvalShape());
break;
default:
throw new IllegalArgumentException();
}
// Set drawable to the background of the button.
view.setBackgroundDrawable(drawable);
view.invalidate();
}
/**
* Returns true if the button is active and clickable.
*
* @return {@code true} indicates enabled, {@code false} disabled
*/
@SimpleProperty(
category = PropertyCategory.BEHAVIOR,
description = "If set, user can tap check box to cause action.")
public boolean Enabled() {
return TextViewUtil.isEnabled(view);
}
/**
* Specifies whether the button should be active and clickable.
*
* @param enabled {@code true} for enabled, {@code false} disabled
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
defaultValue = "True")
@SimpleProperty
public void Enabled(boolean enabled) {
TextViewUtil.setEnabled(view, enabled);
}
/**
* Returns true if the button's text should be bold.
* If bold has been requested, this property will return true, even if the
* font does not support bold.
*
* @return {@code true} indicates bold, {@code false} normal
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
description = "If set, button text is displayed in bold.")
public boolean FontBold() {
return bold;
}
/**
* Specifies whether the button's text should be bold.
* Some fonts do not support bold.
*
* @param bold {@code true} indicates bold, {@code false} normal
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
defaultValue = "False")
@SimpleProperty(
category = PropertyCategory.APPEARANCE)
public void FontBold(boolean bold) {
this.bold = bold;
TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
}
/**
* Specifies if a visual feedback should be shown when a button with an assigned image
* is pressed.
*
* @param showFeedback {@code true} enables showing feedback,
* {@code false} disables it
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
defaultValue = "True")
@SimpleProperty(description = "Specifies if a visual feedback should be shown " +
" for a button that as an image as background.")
public void ShowFeedback(boolean showFeedback) {
this.showFeedback =showFeedback;
}
/**
* Returns true if the button's text should be bold.
* If bold has been requested, this property will return true, even if the
* font does not support bold.
*
* @return {@code true} indicates visual feedback will be shown,
* {@code false} visual feedback will not be shown
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
description = "Returns the button's visual feedback state")
public boolean ShowFeedback() {
return showFeedback;
}
/**
* Returns true if the button's text should be italic.
* If italic has been requested, this property will return true, even if the
* font does not support italic.
*
* @return {@code true} indicates italic, {@code false} normal
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
description = "If set, button text is displayed in italics.")
public boolean FontItalic() {
return italic;
}
/**
* Specifies whether the button's text should be italic.
* Some fonts do not support italic.
*
* @param italic {@code true} indicates italic, {@code false} normal
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN,
defaultValue = "False")
@SimpleProperty(
category = PropertyCategory.APPEARANCE)
public void FontItalic(boolean italic) {
this.italic = italic;
TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
}
/**
* Returns the button's text's font size, measured in sp(scale-independent pixels).
*
* @return font size in sp(scale-independent pixels).
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
description = "Point size for button text.")
public float FontSize() {
return TextViewUtil.getFontSize(view, container.$context());
}
/**
* Specifies the button's text's font size, measured in sp(scale-independent pixels).
*
* @param size font size in sp(scale-independent pixels)
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_NON_NEGATIVE_FLOAT,
defaultValue = Component.FONT_DEFAULT_SIZE + "")
@SimpleProperty(
category = PropertyCategory.APPEARANCE)
public void FontSize(float size) {
TextViewUtil.setFontSize(view, size);
}
/**
* Returns the button's text's font face as default, serif, sans
* serif, or monospace.
*
* @return one of {@link Component#TYPEFACE_DEFAULT},
* {@link Component#TYPEFACE_SERIF},
* {@link Component#TYPEFACE_SANSSERIF} or
* {@link Component#TYPEFACE_MONOSPACE}
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
description = "Font family for button text.",
userVisible = false)
public int FontTypeface() {
return fontTypeface;
}
/**
* Specifies the button's text's font face as default, serif, sans
* serif, or monospace.
*
* @param typeface one of {@link Component#TYPEFACE_DEFAULT},
* {@link Component#TYPEFACE_SERIF},
* {@link Component#TYPEFACE_SANSSERIF} or
* {@link Component#TYPEFACE_MONOSPACE}
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_TYPEFACE,
defaultValue = Component.TYPEFACE_DEFAULT + "")
@SimpleProperty(
userVisible = false)
public void FontTypeface(int typeface) {
fontTypeface = typeface;
TextViewUtil.setFontTypeface(view, fontTypeface, bold, italic);
}
/**
* Returns the text displayed by the button.
*
* @return button caption
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
description = "Text to display on button.")
public String Text() {
return TextViewUtil.getText(view);
}
/**
* Specifies the text displayed by the button.
*
* @param text new caption for button
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING,
defaultValue = "")
@SimpleProperty
public void Text(String text) {
TextViewUtil.setText(view, text);
}
/**
* Returns the button's text color as an alpha-red-green-blue
* integer.
*
* @return text RGB color with alpha
*/
@SimpleProperty(
category = PropertyCategory.APPEARANCE,
description = "Color for button text.")
public int TextColor() {
return textColor;
}
/**
* Specifies the button's text color as an alpha-red-green-blue
* integer.
*
* @param argb text RGB color with alpha
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_COLOR,
defaultValue = Component.DEFAULT_VALUE_COLOR_DEFAULT)
@SimpleProperty
public void TextColor(int argb) {
// TODO(user): I think there is a way of only setting the color for the enabled state
textColor = argb;
if (argb != Component.COLOR_DEFAULT) {
TextViewUtil.setTextColor(view, argb);
} else {
TextViewUtil.setTextColors(view, defaultColorStateList);
}
}
/**
* Specifies the button's text color as an alpha-red-green-blue
* integer.
*
* @param argb text RGB color with alpha
*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_COLOR_GRADIENT,
defaultValue = Component.DEFAULT_VALUE_COLOR_DEFAULT)
@SimpleProperty
public void TextColorGradient(int argb) {
// TODO(user): I think there is a way of only setting the color for the enabled state
textColor = argb;
if (argb != Component.COLOR_DEFAULT) {
TextViewUtil.setTextColor(view, argb);
} else {
TextViewUtil.setTextColors(view, defaultColorStateList);
}
}
public abstract void click();
// Override this if your component actually will consume a long
// click. A 'false' returned from this function will cause a long
// click to be interpreted as a click (and the click function will
// be called).
public boolean longClick() {
return false;
}
// OnClickListener implementation
@Override
public void onClick(View view) {
click();
}
// OnFocusChangeListener implementation
@Override
public void onFocusChange(View previouslyFocused, boolean gainFocus) {
if (gainFocus) {
GotFocus();
} else {
LostFocus();
}
}
// OnLongClickListener implementation
@Override
public boolean onLongClick(View view) {
return longClick();
}
}
| {
"content_hash": "4795ee1cc3baaf89ae401a3cd9cb1f84",
"timestamp": "",
"source": "github",
"line_count": 705,
"max_line_length": 99,
"avg_line_length": 33.91914893617021,
"alnum_prop": 0.6863630661146657,
"repo_name": "tatuzaumm/app-inventor2-custom",
"id": "56f89c9c26a805ed9a1f8ca9a1c51233879b53af",
"size": "23913",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/ButtonBase.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "2466"
},
{
"name": "CSS",
"bytes": "105283"
},
{
"name": "HTML",
"bytes": "1150513"
},
{
"name": "Java",
"bytes": "6932035"
},
{
"name": "JavaScript",
"bytes": "529424"
},
{
"name": "Protocol Buffer",
"bytes": "523"
},
{
"name": "Python",
"bytes": "277683"
},
{
"name": "Scheme",
"bytes": "132037"
},
{
"name": "Shell",
"bytes": "2517"
}
],
"symlink_target": ""
} |
BOT_NAME = 'dytt8'
SPIDER_MODULES = ['dytt8.spiders']
NEWSPIDER_MODULE = 'dytt8.spiders'
# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'dytt8 (+http://www.yourdomain.com)'
# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS=32
# Configure a delay for requests for the same website (default: 0)
# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY=3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN=16
#CONCURRENT_REQUESTS_PER_IP=16
# Disable cookies (enabled by default)
#COOKIES_ENABLED=False
# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED=False
# Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
# 'Accept-Language': 'en',
#}
# Enable or disable spider middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
# 'dytt8.middlewares.MyCustomSpiderMiddleware': 543,
#}
# Enable or disable downloader middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
# 'dytt8.middlewares.MyCustomDownloaderMiddleware': 543,
#}
# Enable or disable extensions
# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
#EXTENSIONS = {
# 'scrapy.telnet.TelnetConsole': None,
#}
# Configure item pipelines
# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
#ITEM_PIPELINES = {
# 'dytt8.pipelines.SomePipeline': 300,
#}
# Enable and configure the AutoThrottle extension (disabled by default)
# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
# NOTE: AutoThrottle will honour the standard settings for concurrency and delay
#AUTOTHROTTLE_ENABLED=True
# The initial download delay
#AUTOTHROTTLE_START_DELAY=5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY=60
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG=False
# Enable and configure HTTP caching (disabled by default)
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED=True
#HTTPCACHE_EXPIRATION_SECS=0
#HTTPCACHE_DIR='httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES=[]
#HTTPCACHE_STORAGE='scrapy.extensions.httpcache.FilesystemCacheStorage'
| {
"content_hash": "0e3652eccfa874e8c7c5e41bbb045267",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 109,
"avg_line_length": 34.45945945945946,
"alnum_prop": 0.7756862745098039,
"repo_name": "trainking/dytt8",
"id": "82cb59c7197266a0f910ea3c362af1008c759bc9",
"size": "2980",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dytt8/settings.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "4689"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>IVIMTensFit—Wolfram Language Documentation</title>
<meta name="buildnumber" content="0000000" />
<meta name="historydata" content="{XX, , , }" />
<meta name="keywords" content="IVIMTensFit" />
<meta name="description" content="IVIMTensFit is an option for IVIMCalc. When set True the tissue diffusion component wil be calculated as a tensor." />
<script language="JavaScript" type="text/javascript">baselang='IVIMTensFit';</script>
<!--#include virtual="/common/includes/gl-head-includes.html"-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!--[if IE]>
<style type="text/css">
/* doctype problem overrides */
#menu .searchboxsub, #menu .searchboxsub-on { padding-bottom: 0; }
#menu .headerSearchSubmit { margin-bottom: 4px; }
/*
.WRIdropMenu .WRImenuContents { margin-top: -2px; margin-left: -2px; }
.WRIdropMenu .WRImenuContents .WRImenuContents { margin: 0; }
*/
</style>
<![endif]-->
<link rel="stylesheet" href="../css/reference.css" />
<link rel="stylesheet" href="../css/clipboard.css" />
<script src="../javascript/jquery/core/1.7.2/jquery.min.js"></script>
<script src="../javascript/reference.js"></script>
<script src="../javascript/documentation-search.js"></script>
<script src="../javascript/faster-page-load.js"></script>
<script src="../javascript/hyperlink-filter.js"></script>
<script src="../javascript/brokenlinks.js"></script>
<script src="../javascript/clipboard.js"></script>
<script src="../javascript/image-swap.js"></script>
<script language="JavaScript" type="text/javascript" src="../javascript/toggle-highlight.js"></script>
</head>
<body id="ref" class="function">
<a name="top"></a>
<div class="main-wrapper">
<div class="outer-wrapper">
<div class="wrapper mainOuter">
<div class="mainContent">
<div class="topContentWrap">
<div class="ribbonWrap">
<span class="ribbonOuter"><span class="ribbonInner">Q M R I TOOLS PACKAGE SYMBOL</span></span>
</div>
<div class="clear"><!-- --></div>
</div>
<h1>IVIMTensFit</h1>
<img src="Files/IVIMTensFit/1.png"
height="46"
width="8"
alt="" />
<div class="ObjectNameTranslation"></div>
<div class="functionIntroWrap">
<div class="functionIntro">
<p><span class="IF">IVIMTensFit</span><br />is an option for <span class="IF"><a class="package-symbol" href="../ref/IVIMCalc.html">IVIMCalc</a></span>. When set True the tissue diffusion component wil be calculated as a tensor.</p>
</div>
</div>
</div>
</div><!-- /wrapper -->
</div>
</body></html> | {
"content_hash": "28abb6808bb53f8448de149c7e187f3f",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 235,
"avg_line_length": 35.35526315789474,
"alnum_prop": 0.6546334201711946,
"repo_name": "mfroeling/DTITools",
"id": "5a9209f9fca91b324e554d99fdc45557f3e7b9d7",
"size": "2687",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/htmldoc/ref/IVIMTensFit.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Mathematica",
"bytes": "1883103"
},
{
"name": "TeX",
"bytes": "18704"
}
],
"symlink_target": ""
} |
using System.Diagnostics;
using Xunit;
using XunitPlatformID = Xunit.PlatformID;
namespace System.IO.Tests
{
public class Directory_GetFileSystemEntries_str : FileSystemTest
{
#region Utilities
public static string[] WindowsInvalidUnixValid = new string[] { " ", " ", "\n", ">", "<", "\t" };
protected virtual bool TestFiles { get { return true; } } // True if the virtual GetEntries mmethod returns files
protected virtual bool TestDirectories { get { return true; } } // True if the virtual GetEntries mmethod returns Directories
public virtual string[] GetEntries(string dirName)
{
return Directory.GetFileSystemEntries(dirName);
}
#endregion
#region UniversalTests
[Fact]
public void NullFileName()
{
Assert.Throws<ArgumentNullException>(() => GetEntries(null));
}
[Fact]
public void EmptyFileName()
{
Assert.Throws<ArgumentException>(() => GetEntries(string.Empty));
}
[Fact]
public void InvalidFileNames()
{
Assert.Throws<DirectoryNotFoundException>(() => GetEntries("DoesNotExist"));
Assert.Throws<ArgumentException>(() => GetEntries("\0"));
}
[Fact]
public void EmptyDirectory()
{
DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath());
Assert.Empty(GetEntries(testDir.FullName));
}
[Fact]
public void GetEntriesThenDelete()
{
string testDirPath = GetTestFilePath();
DirectoryInfo testDirInfo = new DirectoryInfo(testDirPath);
testDirInfo.Create();
string testDir1 = GetTestFileName();
string testDir2 = GetTestFileName();
string testFile1 = GetTestFileName();
string testFile2 = GetTestFileName();
string testFile3 = GetTestFileName();
string testFile4 = GetTestFileName();
string testFile5 = GetTestFileName();
testDirInfo.CreateSubdirectory(testDir1);
testDirInfo.CreateSubdirectory(testDir2);
using (File.Create(Path.Combine(testDirPath, testFile1)))
using (File.Create(Path.Combine(testDirPath, testFile2)))
using (File.Create(Path.Combine(testDirPath, testFile3)))
{
string[] results;
using (File.Create(Path.Combine(testDirPath, testFile4)))
using (File.Create(Path.Combine(testDirPath, testFile5)))
{
results = GetEntries(testDirPath);
Assert.NotNull(results);
Assert.NotEmpty(results);
if (TestFiles)
{
Assert.Contains(Path.Combine(testDirPath, testFile1), results);
Assert.Contains(Path.Combine(testDirPath, testFile2), results);
Assert.Contains(Path.Combine(testDirPath, testFile3), results);
Assert.Contains(Path.Combine(testDirPath, testFile4), results);
Assert.Contains(Path.Combine(testDirPath, testFile5), results);
}
if (TestDirectories)
{
Assert.Contains(Path.Combine(testDirPath, testDir1), results);
Assert.Contains(Path.Combine(testDirPath, testDir2), results);
}
}
File.Delete(Path.Combine(testDirPath, testFile4));
File.Delete(Path.Combine(testDirPath, testFile5));
FailSafeDirectoryOperations.DeleteDirectory(testDir1, true);
results = GetEntries(testDirPath);
Assert.NotNull(results);
Assert.NotEmpty(results);
if (TestFiles)
{
Assert.Contains(Path.Combine(testDirPath, testFile1), results);
Assert.Contains(Path.Combine(testDirPath, testFile2), results);
Assert.Contains(Path.Combine(testDirPath, testFile3), results);
}
if (TestDirectories)
{
Assert.Contains(Path.Combine(testDirPath, testDir2), results);
}
}
}
[Fact]
public virtual void IgnoreSubDirectoryFiles()
{
string subDir = GetTestFileName();
Directory.CreateDirectory(Path.Combine(TestDirectory, subDir));
string testFile = Path.Combine(TestDirectory, GetTestFileName());
string testFileInSub = Path.Combine(TestDirectory, subDir, GetTestFileName());
string testDir = Path.Combine(TestDirectory, GetTestFileName());
string testDirInSub = Path.Combine(TestDirectory, subDir, GetTestFileName());
Directory.CreateDirectory(testDir);
Directory.CreateDirectory(testDirInSub);
using (File.Create(testFile))
using (File.Create(testFileInSub))
{
string[] results = GetEntries(TestDirectory);
if (TestFiles)
Assert.Contains(testFile, results);
if (TestDirectories)
Assert.Contains(testDir, results);
Assert.DoesNotContain(testFileInSub, results);
Assert.DoesNotContain(testDirInSub, results);
}
}
[Fact]
public void NonexistentPath()
{
Assert.Throws<DirectoryNotFoundException>(() => GetEntries(GetTestFilePath()));
}
[Fact]
public void TrailingSlashes()
{
DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath());
Directory.CreateDirectory(Path.Combine(testDir.FullName, GetTestFileName()));
using (File.Create(Path.Combine(testDir.FullName, GetTestFileName())))
{
string[] strArr = GetEntries(testDir.FullName + new string(Path.DirectorySeparatorChar, 5));
Assert.NotNull(strArr);
Assert.NotEmpty(strArr);
}
}
#endregion
#region PlatformSpecific
[Fact]
public void InvalidPath()
{
foreach (char invalid in Path.GetInvalidFileNameChars())
{
if (invalid == '/' || invalid == '\\')
{
Assert.Throws<DirectoryNotFoundException>(() => GetEntries(Path.Combine(TestDirectory, string.Format("te{0}st", invalid.ToString()))));
}
else if (invalid == ':')
{
if (FileSystemDebugInfo.IsCurrentDriveNTFS())
Assert.Throws<NotSupportedException>(() => GetEntries(Path.Combine(TestDirectory, string.Format("te{0}st", invalid.ToString()))));
}
else
{
Assert.Throws<ArgumentException>(() => GetEntries(Path.Combine(TestDirectory, string.Format("te{0}st", invalid.ToString()))));
}
}
}
[Fact]
[PlatformSpecific(XunitPlatformID.Windows)]
public void WindowsInvalidCharsPath()
{
Assert.All(WindowsInvalidUnixValid, invalid =>
Assert.Throws<ArgumentException>(() => GetEntries(invalid)));
}
[Fact]
[PlatformSpecific(XunitPlatformID.AnyUnix)]
public void UnixValidCharsFilePath()
{
if (TestFiles)
{
DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath());
foreach (string valid in WindowsInvalidUnixValid)
File.Create(Path.Combine(testDir.FullName, valid)).Dispose();
string[] results = GetEntries(testDir.FullName);
Assert.All(WindowsInvalidUnixValid, valid =>
Assert.Contains(Path.Combine(testDir.FullName, valid), results));
}
}
[Fact]
[PlatformSpecific(XunitPlatformID.AnyUnix)]
public void UnixValidCharsDirectoryPath()
{
if (TestDirectories)
{
DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath());
foreach (string valid in WindowsInvalidUnixValid)
testDir.CreateSubdirectory(valid);
string[] results = GetEntries(testDir.FullName);
Assert.All(WindowsInvalidUnixValid, valid =>
Assert.Contains(Path.Combine(testDir.FullName, valid), results));
}
}
#endregion
}
public sealed class Directory_GetEntries_CurrentDirectory : RemoteExecutorTestBase
{
[Fact]
public void CurrentDirectory()
{
string testDir = GetTestFilePath();
Directory.CreateDirectory(testDir);
File.WriteAllText(Path.Combine(testDir, GetTestFileName()), "cat");
Directory.CreateDirectory(Path.Combine(testDir, GetTestFileName()));
RemoteInvoke((testDirectory) =>
{
Directory.SetCurrentDirectory(testDirectory);
Assert.NotEmpty(Directory.GetFileSystemEntries(Directory.GetCurrentDirectory()));
Assert.NotEmpty(Directory.GetFileSystemEntries(Directory.GetCurrentDirectory(), "*"));
Assert.NotEmpty(Directory.GetFileSystemEntries(Directory.GetCurrentDirectory(), "*", SearchOption.AllDirectories));
Assert.NotEmpty(Directory.GetFileSystemEntries(Directory.GetCurrentDirectory(), "*", SearchOption.TopDirectoryOnly));
Assert.NotEmpty(Directory.GetDirectories(Directory.GetCurrentDirectory()));
Assert.NotEmpty(Directory.GetDirectories(Directory.GetCurrentDirectory(), "*"));
Assert.NotEmpty(Directory.GetDirectories(Directory.GetCurrentDirectory(), "*", SearchOption.AllDirectories));
Assert.NotEmpty(Directory.GetDirectories(Directory.GetCurrentDirectory(), "*", SearchOption.TopDirectoryOnly));
Assert.NotEmpty(Directory.GetFiles(Directory.GetCurrentDirectory()));
Assert.NotEmpty(Directory.GetFiles(Directory.GetCurrentDirectory(), "*"));
Assert.NotEmpty(Directory.GetFiles(Directory.GetCurrentDirectory(), "*", SearchOption.AllDirectories));
Assert.NotEmpty(Directory.GetFiles(Directory.GetCurrentDirectory(), "*", SearchOption.TopDirectoryOnly));
Assert.NotEmpty(Directory.EnumerateFileSystemEntries(Directory.GetCurrentDirectory()));
Assert.NotEmpty(Directory.EnumerateFileSystemEntries(Directory.GetCurrentDirectory(), "*"));
Assert.NotEmpty(Directory.EnumerateFileSystemEntries(Directory.GetCurrentDirectory(), "*", SearchOption.AllDirectories));
Assert.NotEmpty(Directory.EnumerateFileSystemEntries(Directory.GetCurrentDirectory(), "*", SearchOption.TopDirectoryOnly));
Assert.NotEmpty(Directory.EnumerateDirectories(Directory.GetCurrentDirectory()));
Assert.NotEmpty(Directory.EnumerateDirectories(Directory.GetCurrentDirectory(), "*"));
Assert.NotEmpty(Directory.EnumerateDirectories(Directory.GetCurrentDirectory(), "*", SearchOption.AllDirectories));
Assert.NotEmpty(Directory.EnumerateDirectories(Directory.GetCurrentDirectory(), "*", SearchOption.TopDirectoryOnly));
Assert.NotEmpty(Directory.EnumerateFiles(Directory.GetCurrentDirectory()));
Assert.NotEmpty(Directory.EnumerateFiles(Directory.GetCurrentDirectory(), "*"));
Assert.NotEmpty(Directory.EnumerateFiles(Directory.GetCurrentDirectory(), "*", SearchOption.AllDirectories));
Assert.NotEmpty(Directory.EnumerateFiles(Directory.GetCurrentDirectory(), "*", SearchOption.TopDirectoryOnly));
return SuccessExitCode;
}, testDir).Dispose();
}
}
}
| {
"content_hash": "c518a97f1b79c8abdd7480d9f9395b11",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 155,
"avg_line_length": 44.83394833948339,
"alnum_prop": 0.5966255144032921,
"repo_name": "shmao/corefx",
"id": "cfc1962501aa088f6e369eb26b230803e1fbb907",
"size": "12354",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/System.IO.FileSystem/tests/Directory/GetFileSystemEntries_str.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "1C Enterprise",
"bytes": "903"
},
{
"name": "ASP",
"bytes": "1687"
},
{
"name": "Batchfile",
"bytes": "19589"
},
{
"name": "C",
"bytes": "1113016"
},
{
"name": "C#",
"bytes": "115268432"
},
{
"name": "C++",
"bytes": "502895"
},
{
"name": "CMake",
"bytes": "51008"
},
{
"name": "DIGITAL Command Language",
"bytes": "26402"
},
{
"name": "Groff",
"bytes": "4236"
},
{
"name": "Groovy",
"bytes": "23409"
},
{
"name": "HTML",
"bytes": "653"
},
{
"name": "Makefile",
"bytes": "9085"
},
{
"name": "Objective-C",
"bytes": "9335"
},
{
"name": "OpenEdge ABL",
"bytes": "139178"
},
{
"name": "Perl",
"bytes": "3895"
},
{
"name": "PowerShell",
"bytes": "50639"
},
{
"name": "Python",
"bytes": "1535"
},
{
"name": "Shell",
"bytes": "52315"
},
{
"name": "Visual Basic",
"bytes": "829986"
},
{
"name": "XSLT",
"bytes": "423435"
}
],
"symlink_target": ""
} |
package com.android.launcher3;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
abstract class LauncherAnimatorUpdateListener implements AnimatorUpdateListener {
public void onAnimationUpdate(ValueAnimator animation) {
final float b = (Float) animation.getAnimatedValue();
final float a = 1f - b;
onAnimationUpdate(a, b);
}
abstract void onAnimationUpdate(float a, float b);
} | {
"content_hash": "851f9f4071c743a99eb145ba64323af5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 81,
"avg_line_length": 29.4375,
"alnum_prop": 0.7579617834394905,
"repo_name": "anuprakash/Launcher3",
"id": "ec9fd4d16e494501414b4243ef471e25a29f14ae",
"size": "1090",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/android/launcher3/LauncherAnimatorUpdateListener.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2074211"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "1f94f745930e5e65d5b49ad27783635e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "bcdb132cf013d93d77f386c5ec2191c7b6a87cea",
"size": "227",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Protozoa/Dinophyta/Dinophyceae/Gymnodiniales/Kareniaceae/Karenia/Karenia mikimotoi/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package gift
import (
"net/http"
"net/url"
"testing"
"github.com/pierrre/imageserver"
imageserver_http "github.com/pierrre/imageserver/http"
)
var _ imageserver_http.Parser = &ResizeParser{}
func TestResizeParserParse(t *testing.T) {
prs := &ResizeParser{}
for _, tc := range []struct {
name string
query url.Values
expectedParams imageserver.Params
expectedParamError string
}{
{
name: "Empty",
},
{
name: "Width",
query: url.Values{"width": {"100"}},
expectedParams: imageserver.Params{resizeParam: imageserver.Params{
"width": 100,
}},
},
{
name: "Height",
query: url.Values{"height": {"100"}},
expectedParams: imageserver.Params{resizeParam: imageserver.Params{
"height": 100,
}},
},
{
name: "Resampling",
query: url.Values{"resampling": {"lanczos"}},
expectedParams: imageserver.Params{resizeParam: imageserver.Params{
"resampling": "lanczos",
}},
},
{
name: "Mode",
query: url.Values{"mode": {"fit"}},
expectedParams: imageserver.Params{resizeParam: imageserver.Params{
"mode": "fit",
}},
},
{
name: "WidthInvalid",
query: url.Values{"width": {"invalid"}},
expectedParamError: resizeParam + ".width",
},
{
name: "HeightInvalid",
query: url.Values{"height": {"invalid"}},
expectedParamError: resizeParam + ".height",
},
} {
t.Run(tc.name, func(t *testing.T) {
u := &url.URL{
Scheme: "http",
Host: "localhost",
RawQuery: tc.query.Encode(),
}
req, err := http.NewRequest("GET", u.String(), nil)
if err != nil {
t.Fatal(err)
}
params := imageserver.Params{}
err = prs.Parse(req, params)
if err != nil {
if err, ok := err.(*imageserver.ParamError); ok && tc.expectedParamError == err.Param {
return
}
t.Fatal(err)
}
if params.String() != tc.expectedParams.String() {
t.Fatalf("unexpected params: got %s, want %s", params, tc.expectedParams)
}
})
}
}
func TestResizeParserResolve(t *testing.T) {
prs := &ResizeParser{}
httpParam := prs.Resolve(resizeParam + ".width")
if httpParam != "width" {
t.Fatal("not equal")
}
}
func TestResizeParserResolveNoMatch(t *testing.T) {
prs := &ResizeParser{}
httpParam := prs.Resolve("foo")
if httpParam != "" {
t.Fatal("not equal")
}
}
| {
"content_hash": "88e470e5f2a8034c7b94c27099fc9c3d",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 91,
"avg_line_length": 23.203883495145632,
"alnum_prop": 0.598744769874477,
"repo_name": "pierrre/imageserver",
"id": "efbc07e7eff57b738cd7e6aeceec20ab8c9bba31",
"size": "2390",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "http/gift/resize_test.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "216803"
},
{
"name": "Makefile",
"bytes": "1119"
}
],
"symlink_target": ""
} |
<div class="container-fluid videos-container" id="top">
<div class="row search-box">
<form class="form-inline text-center">
<button ng-click="$ctrl.returnHome()" ng-show="!$ctrl.showHome">
<span class="glyphicon glyphicon-home"></span>
</button>
<button ng-show="$ctrl.isPlaylistVideo" ng-click="$ctrl.playAll()" type="button" class="btn btn-default">
Play all
</button>
<label><p>Search<span class="glyphicon glyphicon-search"></span></p></label>
<input ng-model="$ctrl.query" />
<select ng-model="$ctrl.age" ng-change="$ctrl.ageChange($ctrl.age)">
<option value="baby">Bébé</option>
<option value="child">Enfant</option>
<option value="greatChild">Grand enfant</option>
<option value="adult">Adulte</option>
<option value="all">Tous</option>
</select>
</form>
</div>
<div class="row videos-list">
<ul class="videos">
<p class="text-center">
<button ng-click="$ctrl.returnHome()" ng-show="$ctrl.showHome" class="button-home text-center">
<span class="glyphicon glyphicon-home"></span>
</button>
</p>
<video-detail ng-repeat="video in $ctrl.videos |
filter: checkDescription($ctrl.query) |
filter: checkAge('age') |
orderBy: ['seen', $ctrl.orderBy] as filteredVideos" video="video" on-glyphicon-change="$ctrl.glyphiconChange(video)" on-already-seen="$ctrl.alreadySeen(video)" on-play-video="$ctrl.playVideo(video)" on-update-video="$ctrl.updateVideo(video)" class="video-list-item">
</video-detail>
</ul>
</div>
</div>
<control-panel></control-panel>
| {
"content_hash": "01cea8e35bd97636346e2840c4ead03b",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 303,
"avg_line_length": 53.27777777777778,
"alnum_prop": 0.5411887382690302,
"repo_name": "AlvaGingra/webVideoSite",
"id": "a446ff75d45644532ed8285faadaccf315c67935",
"size": "1920",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/video-list/video-list.template.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9530"
},
{
"name": "HTML",
"bytes": "9719"
},
{
"name": "JavaScript",
"bytes": "30783"
},
{
"name": "Perl",
"bytes": "13499"
}
],
"symlink_target": ""
} |
! { dg-do run }
! { dg-options "-fcheck=recursion" }
!
! PR fortran/39577
!
! Recursive but valid program
! Contributed by Dominique Dhumieres
!
recursive function fac(i) result (res)
integer :: i, j, k, res
k = 1
goto 100
entry bifac(i,j) result (res)
k = j
100 continue
if (i < k) then
res = 1
else
res = i * bifac(i-k,k)
end if
end function
program test
interface
recursive function fac(n) result (res)
integer :: res
integer :: n
end function fac
recursive function bifac(m,n) result (res)
integer :: m, n, res
end function bifac
end interface
print *, fac(5)
print *, bifac(5,2)
print*, fac(6)
print *, bifac(6,2)
print*, fac(0)
print *, bifac(1,2)
end program test
| {
"content_hash": "ffe79edcf9b34dadb8fd169df22b8ca9",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 44,
"avg_line_length": 18.2,
"alnum_prop": 0.6346153846153846,
"repo_name": "the-linix-project/linix-kernel-source",
"id": "e68e5fc566b1b39aa5901370cb1719efb2de1de4",
"size": "728",
"binary": false,
"copies": "185",
"ref": "refs/heads/master",
"path": "gccsrc/gcc-4.7.2/gcc/testsuite/gfortran.dg/recursive_check_14.f90",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ada",
"bytes": "38139979"
},
{
"name": "Assembly",
"bytes": "3723477"
},
{
"name": "Awk",
"bytes": "83739"
},
{
"name": "C",
"bytes": "103607293"
},
{
"name": "C#",
"bytes": "55726"
},
{
"name": "C++",
"bytes": "38577421"
},
{
"name": "CLIPS",
"bytes": "6933"
},
{
"name": "CSS",
"bytes": "32588"
},
{
"name": "Emacs Lisp",
"bytes": "13451"
},
{
"name": "FORTRAN",
"bytes": "4294984"
},
{
"name": "GAP",
"bytes": "13089"
},
{
"name": "Go",
"bytes": "11277335"
},
{
"name": "Haskell",
"bytes": "2415"
},
{
"name": "Java",
"bytes": "45298678"
},
{
"name": "JavaScript",
"bytes": "6265"
},
{
"name": "Matlab",
"bytes": "56"
},
{
"name": "OCaml",
"bytes": "148372"
},
{
"name": "Objective-C",
"bytes": "995127"
},
{
"name": "Objective-C++",
"bytes": "436045"
},
{
"name": "PHP",
"bytes": "12361"
},
{
"name": "Pascal",
"bytes": "40318"
},
{
"name": "Perl",
"bytes": "358808"
},
{
"name": "Python",
"bytes": "60178"
},
{
"name": "SAS",
"bytes": "1711"
},
{
"name": "Scilab",
"bytes": "258457"
},
{
"name": "Shell",
"bytes": "2610907"
},
{
"name": "Tcl",
"bytes": "17983"
},
{
"name": "TeX",
"bytes": "1455571"
},
{
"name": "XSLT",
"bytes": "156419"
}
],
"symlink_target": ""
} |
CONTINUE = 100
SWITCHING = 101
OK = 200
CREATED = 201
ACCEPTED = 202
NON_AUTHORITATIVE_INFORMATION = 203
NO_CONTENT = 204
RESET_CONTENT = 205
PARTIAL_CONTENT = 206
MULTI_STATUS = 207
MULTIPLE_CHOICE = 300
MOVED_PERMANENTLY = 301
FOUND = 302
SEE_OTHER = 303
NOT_MODIFIED = 304
USE_PROXY = 305
TEMPORARY_REDIRECT = 307
BAD_REQUEST = 400
UNAUTHORIZED = 401
PAYMENT_REQUIRED = 402
FORBIDDEN = 403
NOT_FOUND = 404
NOT_ALLOWED = 405
NOT_ACCEPTABLE = 406
PROXY_AUTH_REQUIRED = 407
REQUEST_TIMEOUT = 408
CONFLICT = 409
GONE = 410
LENGTH_REQUIRED = 411
PRECONDITION_FAILED = 412
REQUEST_ENTITY_TOO_LARGE = 413
REQUEST_URI_TOO_LONG = 414
UNSUPPORTED_MEDIA_TYPE = 415
REQUESTED_RANGE_NOT_SATISFIABLE = 416
EXPECTATION_FAILED = 417
UNPROCESSABLE_ENTITY = 422 # RFC 2518
LOCKED = 423 # RFC 2518
FAILED_DEPENDENCY = 424 # RFC 2518
INTERNAL_SERVER_ERROR = 500
NOT_IMPLEMENTED = 501
BAD_GATEWAY = 502
SERVICE_UNAVAILABLE = 503
GATEWAY_TIMEOUT = 504
HTTP_VERSION_NOT_SUPPORTED = 505
LOOP_DETECTED = 506
INSUFFICIENT_STORAGE_SPACE = 507
NOT_EXTENDED = 510
RESPONSES = {
# 100
CONTINUE: "Continue",
SWITCHING: "Switching Protocols",
# 200
OK: "OK",
CREATED: "Created",
ACCEPTED: "Accepted",
NON_AUTHORITATIVE_INFORMATION: "Non-Authoritative Information",
NO_CONTENT: "No Content",
RESET_CONTENT: "Reset Content.",
PARTIAL_CONTENT: "Partial Content",
MULTI_STATUS: "Multi-Status",
# 300
MULTIPLE_CHOICE: "Multiple Choices",
MOVED_PERMANENTLY: "Moved Permanently",
FOUND: "Found",
SEE_OTHER: "See Other",
NOT_MODIFIED: "Not Modified",
USE_PROXY: "Use Proxy",
# 306 unused
TEMPORARY_REDIRECT: "Temporary Redirect",
# 400
BAD_REQUEST: "Bad Request",
UNAUTHORIZED: "Unauthorized",
PAYMENT_REQUIRED: "Payment Required",
FORBIDDEN: "Forbidden",
NOT_FOUND: "Not Found",
NOT_ALLOWED: "Method Not Allowed",
NOT_ACCEPTABLE: "Not Acceptable",
PROXY_AUTH_REQUIRED: "Proxy Authentication Required",
REQUEST_TIMEOUT: "Request Time-out",
CONFLICT: "Conflict",
GONE: "Gone",
LENGTH_REQUIRED: "Length Required",
PRECONDITION_FAILED: "Precondition Failed",
REQUEST_ENTITY_TOO_LARGE: "Request Entity Too Large",
REQUEST_URI_TOO_LONG: "Request-URI Too Long",
UNSUPPORTED_MEDIA_TYPE: "Unsupported Media Type",
REQUESTED_RANGE_NOT_SATISFIABLE: "Requested Range Not Satisfiable",
EXPECTATION_FAILED: "Expectation Failed",
UNPROCESSABLE_ENTITY: "Unprocessable Entity",
LOCKED: "Locked",
FAILED_DEPENDENCY: "Failed Dependency",
# 500
INTERNAL_SERVER_ERROR: "Internal Server Error",
NOT_IMPLEMENTED: "Not Implemented",
BAD_GATEWAY: "Bad Gateway",
SERVICE_UNAVAILABLE: "Service Unavailable",
GATEWAY_TIMEOUT: "Gateway Time-out",
HTTP_VERSION_NOT_SUPPORTED: "HTTP Version Not Supported",
LOOP_DETECTED: "Loop In Linked or Bound Resource",
INSUFFICIENT_STORAGE_SPACE: "Insufficient Storage Space",
NOT_EXTENDED: "Not Extended"
}
# No __all__ necessary -- everything is exported
| {
"content_hash": "d60993ed3cd5134a83d28bd486448fae",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 71,
"avg_line_length": 33.94690265486726,
"alnum_prop": 0.5607403545359749,
"repo_name": "trevor/calendarserver",
"id": "17e3644a49bfa706d2ce51e8cbfe147230795c6e",
"size": "5053",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "txweb2/responsecode.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4214"
},
{
"name": "D",
"bytes": "13143"
},
{
"name": "JavaScript",
"bytes": "76566"
},
{
"name": "Python",
"bytes": "9260291"
},
{
"name": "Shell",
"bytes": "78964"
}
],
"symlink_target": ""
} |
if not File.directory?"/var/www/thespace"
directory "/var/www/thespace" do
action :create
recursive true
end
end
if not File.directory?"/var/log/thespace"
directory "/var/log/thespace" do
action :create
recursive true
mode 0744
owner "apache"
group "apache"
end
end
# thespace http template
template "/etc/httpd/conf.d/thespace-vhost.conf" do
source "thespace-vhost.erb"
mode 0644
owner "root"
group "root"
notifies :restart, resources(:service => "apache2")
end
| {
"content_hash": "078aec065d8d5f044c463332f37f43f0",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 55,
"avg_line_length": 19.666666666666668,
"alnum_prop": 0.6685499058380414,
"repo_name": "TheSpace/vagrant-centos-apache2",
"id": "c9e8d660ac525e5ffe48e2cb95a85494cd3aa95e",
"size": "532",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "recipes/thespace.rb",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "50294"
},
{
"name": "Perl",
"bytes": "847"
},
{
"name": "Ruby",
"bytes": "96593"
},
{
"name": "Shell",
"bytes": "3604"
}
],
"symlink_target": ""
} |
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>reveal.js - The HTML Presentation Framework</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/theme/default.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>Reveal.js</h1>
<h3>HTML Presentations Made Easy</h3>
<p>
<small>Created by <a href="http://hakim.se">Hakim El Hattab</a> / <a href="http://twitter.com/hakimel">@hakimel</a></small>
</p>
</section>
<section>
<h2>Heads Up</h2>
<p>
reveal.js is a framework for easily creating beautiful presentations using HTML. You'll need a browser with
support for CSS 3D transforms to see it in its full glory.
</p>
<aside class="notes">
Oh hey, these are some notes. They'll be hidden in your presentation, but you can see them if you open the speaker notes window (hit 's' on your keyboard).
</aside>
</section>
<!-- Example of nested vertical slides -->
<section>
<section>
<h2>Vertical Slides</h2>
<p>
Slides can be nested inside of other slides,
try pressing <a href="#" class="navigate-down">down</a>.
</p>
<a href="#" class="image navigate-down">
<img width="178" height="238" src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Down arrow">
</a>
</section>
<section>
<h2>Basement Level 1</h2>
<p>Press down or up to navigate.</p>
</section>
<section>
<h2>Basement Level 2</h2>
<p>Cornify</p>
<a class="test" href="http://cornify.com">
<img width="280" height="326" src="https://s3.amazonaws.com/hakim-static/reveal-js/cornify.gif" alt="Unicorn">
</a>
</section>
<section>
<h2>Basement Level 3</h2>
<p>That's it, time to go back up.</p>
<a href="#/2" class="image">
<img width="178" height="238" src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Up arrow" style="-webkit-transform: rotate(180deg);">
</a>
</section>
</section>
<section>
<h2>Slides</h2>
<p>
Not a coder? No problem. There's a fully-featured visual editor for authoring these, try it out at <a href="http://slid.es" target="_blank">http://slid.es</a>.
</p>
</section>
<section>
<h2>Point of View</h2>
<p>
Press <strong>ESC</strong> to enter the slide overview.
</p>
<p>
Hold down alt and click on any element to zoom in on it using <a href="http://lab.hakim.se/zoom-js">zoom.js</a>. Alt + click anywhere to zoom back out.
</p>
</section>
<section>
<h2>Works in Mobile Safari</h2>
<p>
Try it out! You can swipe through the slides and pinch your way to the overview.
</p>
</section>
<section>
<h2>Marvelous Unordered List</h2>
<ul>
<li>No order here</li>
<li>Or here</li>
<li>Or here</li>
<li>Or here</li>
</ul>
</section>
<section>
<h2>Fantastic Ordered List</h2>
<ol>
<li>One is smaller than...</li>
<li>Two is smaller than...</li>
<li>Three!</li>
</ol>
</section>
<section data-markdown>
<script type="text/template">
## Markdown support
For those of you who like that sort of thing. Instructions and a bit more info available [here](https://github.com/hakimel/reveal.js#markdown).
```
<section data-markdown>
## Markdown support
For those of you who like that sort of thing.
Instructions and a bit more info available [here](https://github.com/hakimel/reveal.js#markdown).
</section>
```
</script>
</section>
<section id="transitions">
<h2>Transition Styles</h2>
<p>
You can select from different transitions, like: <br>
<a href="?transition=cube#/transitions">Cube</a> -
<a href="?transition=page#/transitions">Page</a> -
<a href="?transition=concave#/transitions">Concave</a> -
<a href="?transition=zoom#/transitions">Zoom</a> -
<a href="?transition=linear#/transitions">Linear</a> -
<a href="?transition=fade#/transitions">Fade</a> -
<a href="?transition=none#/transitions">None</a> -
<a href="?#/transitions">Default</a>
</p>
</section>
<section id="themes">
<h2>Themes</h2>
<p>
Reveal.js comes with a few themes built in: <br>
<a href="?#/themes">Default</a> -
<a href="?theme=sky#/themes">Sky</a> -
<a href="?theme=beige#/themes">Beige</a> -
<a href="?theme=simple#/themes">Simple</a> -
<a href="?theme=serif#/themes">Serif</a> -
<a href="?theme=night#/themes">Night</a> <br>
<a href="?theme=moon.css#/themes">Moon</a> -
<a href="?theme=simple.css#/themes">Simple</a> -
<a href="?theme=solarized.css#/themes">Solarized</a>
</p>
<p>
<small>
* Theme demos are loaded after the presentation which leads to flicker. In production you should load your theme in the <code><head></code> using a <code><link></code>.
</small>
</p>
</section>
<section>
<h2>Global State</h2>
<p>
Set <code>data-state="something"</code> on a slide and <code>"something"</code>
will be added as a class to the document element when the slide is open. This lets you
apply broader style changes, like switching the background.
</p>
</section>
<section data-state="customevent">
<h2>Custom Events</h2>
<p>
Additionally custom events can be triggered on a per slide basis by binding to the <code>data-state</code> name.
</p>
<pre><code data-trim contenteditable style="font-size: 18px; margin-top: 20px;">
Reveal.addEventListener( 'customevent', function() {
console.log( '"customevent" has fired' );
} );
</code></pre>
</section>
<section>
<section data-background="#007777">
<h2>Slide Backgrounds</h2>
<p>
Set <code>data-background="#007777"</code> on a slide to change the full page background to the given color. All CSS color formats are supported.
</p>
<a href="#" class="image navigate-down">
<img width="178" height="238" src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Down arrow">
</a>
</section>
<section data-background="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png">
<h2>Image Backgrounds</h2>
<pre><code><section data-background="image.png"></code></pre>
</section>
<section data-background="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" data-background-repeat="repeat" data-background-size="100px">
<h2>Repeated Image Backgrounds</h2>
<pre><code style="word-wrap: break-word;"><section data-background="image.png" data-background-repeat="repeat" data-background-size="100px"></code></pre>
</section>
</section>
<section data-transition="linear" data-background="#4d7e65" data-background-transition="slide">
<h2>Background Transitions</h2>
<p>
Pass reveal.js the <code>backgroundTransition: 'slide'</code> config argument to make backgrounds slide rather than fade.
</p>
</section>
<section data-transition="linear" data-background="#8c4738" data-background-transition="slide">
<h2>Background Transition Override</h2>
<p>
You can override background transitions per slide by using <code>data-background-transition="slide"</code>.
</p>
</section>
<section>
<h2>Clever Quotes</h2>
<p>
These guys come in two forms, inline: <q cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">
“The nice thing about standards is that there are so many to choose from”</q> and block:
</p>
<blockquote cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">
“For years there has been a theory that millions of monkeys typing at random on millions of typewriters would
reproduce the entire works of Shakespeare. The Internet has proven this theory to be untrue.”
</blockquote>
</section>
<section>
<h2>Pretty Code</h2>
<pre><code data-trim contenteditable>
function linkify( selector ) {
if( supports3DTransforms ) {
var nodes = document.querySelectorAll( selector );
for( var i = 0, len = nodes.length; i < len; i++ ) {
var node = nodes[i];
if( !node.className ) {
node.className += ' roll';
}
}
}
}
</code></pre>
<p>Courtesy of <a href="http://softwaremaniacs.org/soft/highlight/en/description/">highlight.js</a>.</p>
</section>
<section>
<h2>Intergalactic Interconnections</h2>
<p>
You can link between slides internally,
<a href="#/2/3">like this</a>.
</p>
</section>
<section>
<section>
<h2>Fragmented Views</h2>
<p>Hit the next arrow...</p>
<p class="fragment">... to step through ...</p>
<ol>
<li class="fragment"><code>any type</code></li>
<li class="fragment"><em>of view</em></li>
<li class="fragment"><strong>fragments</strong></li>
</ol>
<aside class="notes">
This slide has fragments which are also stepped through in the notes window.
</aside>
</section>
<section>
<h2>Fragment Styles</h2>
<p>There's a few styles of fragments, like:</p>
<p class="fragment grow">grow</p>
<p class="fragment shrink">shrink</p>
<p class="fragment roll-in">roll-in</p>
<p class="fragment fade-out">fade-out</p>
<p class="fragment highlight-red">highlight-red</p>
<p class="fragment highlight-green">highlight-green</p>
<p class="fragment highlight-blue">highlight-blue</p>
</section>
</section>
<section>
<h2>Spectacular image!</h2>
<a class="image" href="http://lab.hakim.se/meny/" target="_blank">
<img width="320" height="299" src="http://s3.amazonaws.com/hakim-static/portfolio/images/meny.png" alt="Meny">
</a>
</section>
<section>
<h2>Export to PDF</h2>
<p>Presentations can be <a href="https://github.com/hakimel/reveal.js#pdf-export">exported to PDF</a>, below is an example that's been uploaded to SlideShare.</p>
<iframe id="slideshare" src="http://www.slideshare.net/slideshow/embed_code/13872948" width="455" height="356" style="margin:0;overflow:hidden;border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen> </iframe>
<script>
document.getElementById('slideshare').attributeName = 'allowfullscreen';
</script>
</section>
<section>
<h2>Take a Moment</h2>
<p>
Press b or period on your keyboard to enter the 'paused' mode. This mode is helpful when you want to take distracting slides off the screen
during a presentation.
</p>
</section>
<section>
<h2>Stellar Links</h2>
<ul>
<li><a href="http://slid.es">Try the online editor</a></li>
<li><a href="https://github.com/hakimel/reveal.js">Source code on GitHub</a></li>
<li><a href="http://twitter.com/hakimel">Follow me on Twitter</a></li>
</ul>
</section>
<section>
<h1>THE END</h1>
<h3>BY Hakim El Hattab / hakim.se</h3>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
multiplex: {
id: '55a6a9856070f0ff',
secret: '13836278890069594870',
url: '192.168.1.107:1948'
},
controls: true,
progress: true,
history: true,
center: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.10/socket.io.min.js', async: true },
{ src: 'plugin/multiplex/master.js', async: true }
]
});
</script>
</body>
</html>
| {
"content_hash": "8d68d36d11c067671a200a0eca514282",
"timestamp": "",
"source": "github",
"line_count": 391,
"max_line_length": 238,
"avg_line_length": 35.88235294117647,
"alnum_prop": 0.6255167498218104,
"repo_name": "haxiom/continuous_js_talk",
"id": "b62eb24fa6e49061c955a8d1f51d64e83ffc83c8",
"size": "14030",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "master.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "95769"
},
{
"name": "JavaScript",
"bytes": "224966"
}
],
"symlink_target": ""
} |
package org.springframework.data.solr.repository.config;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.core.annotation.AnnotationAttributes;
import org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource;
import org.springframework.data.repository.config.RepositoryConfigurationExtension;
import org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport;
import org.springframework.data.repository.config.RepositoryConfigurationSource;
import org.springframework.data.repository.config.XmlRepositoryConfigurationSource;
import org.springframework.data.solr.core.SolrExceptionTranslator;
import org.springframework.data.solr.core.SolrOperations;
import org.springframework.data.solr.core.SolrTemplate;
import org.springframework.data.solr.core.convert.MappingSolrConverter;
import org.springframework.data.solr.core.convert.SolrCustomConversions;
import org.springframework.data.solr.core.mapping.SimpleSolrMappingContext;
import org.springframework.data.solr.core.mapping.SolrDocument;
import org.springframework.data.solr.repository.SolrCrudRepository;
import org.springframework.data.solr.repository.SolrRepository;
import org.springframework.data.solr.repository.support.SolrRepositoryFactoryBean;
import org.springframework.data.solr.server.support.HttpSolrClientFactory;
import org.springframework.util.StringUtils;
import org.w3c.dom.Element;
/**
* {@link RepositoryConfigurationExtension} implementation to configure Solr repository configuration support,
* evaluating the {@link EnableSolrRepositories} annotation or the equivalent XML element.
*
* @author Oliver Gierke
* @author Christoph Strobl
* @author Mark Paluch
*/
public class SolrRepositoryConfigExtension extends RepositoryConfigurationExtensionSupport {
enum BeanDefinitionName {
SOLR_MAPPTING_CONTEXT("solrMappingContext"), SOLR_OPERATIONS("solrOperations"), SOLR_CLIENT(
"solrClient"), SOLR_CONVERTER("solrConverter"), CUSTOM_CONVERSIONS("customConversions");
String beanName;
BeanDefinitionName(String beanName) {
this.beanName = beanName;
}
public String getBeanName() {
return beanName;
}
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryConfigurationExtension#getRepositoryFactoryClassName()
*/
@Override
public String getRepositoryFactoryBeanClassName() {
return SolrRepositoryFactoryBean.class.getName();
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#getModulePrefix()
*/
@Override
protected String getModulePrefix() {
return "solr";
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#postProcess(org.springframework.beans.factory.support.BeanDefinitionBuilder, org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource)
*/
@Override
public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {
AnnotationAttributes attributes = config.getAttributes();
builder.addPropertyReference(BeanDefinitionName.SOLR_OPERATIONS.getBeanName(),
attributes.getString("solrTemplateRef"));
builder.addPropertyValue("schemaCreationSupport", attributes.getBoolean("schemaCreationSupport"));
builder.addPropertyReference(BeanDefinitionName.SOLR_MAPPTING_CONTEXT.getBeanName(), "solrMappingContext");
builder.addPropertyReference(BeanDefinitionName.SOLR_CONVERTER.getBeanName(), "solrConverter");
}
@Override
public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource configurationSource) {
super.registerBeansForRoot(registry, configurationSource);
registeCustomConversionsIfNotPresent(registry, configurationSource);
registerSolrMappingContextIfNotPresent(registry, configurationSource);
registerSolrConverterIfNotPresent(registry, configurationSource);
registerSolrTemplateIfNotPresent(registry, configurationSource);
registerIfNotAlreadyRegistered(
BeanDefinitionBuilder.genericBeanDefinition(SolrExceptionTranslator.class).getBeanDefinition(), registry,
"solrExceptionTranslator", configurationSource);
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#postProcess(org.springframework.beans.factory.support.BeanDefinitionBuilder, org.springframework.data.repository.config.XmlRepositoryConfigurationSource)
*/
@Override
public void postProcess(BeanDefinitionBuilder builder, XmlRepositoryConfigurationSource config) {
Element element = config.getElement();
builder.addPropertyReference(BeanDefinitionName.SOLR_OPERATIONS.getBeanName(),
element.getAttribute("solr-template-ref"));
if (StringUtils.hasText(element.getAttribute("schema-creation-support"))) {
builder.addPropertyValue("schemaCreationSupport", element.getAttribute("schema-creation-support"));
}
builder.addPropertyReference(BeanDefinitionName.SOLR_MAPPTING_CONTEXT.getBeanName(), "solrMappingContext");
builder.addPropertyReference(BeanDefinitionName.SOLR_CONVERTER.getBeanName(), "solrConverter");
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#getIdentifyingAnnotations()
*/
@Override
protected Collection<Class<? extends Annotation>> getIdentifyingAnnotations() {
return Collections.singleton(SolrDocument.class);
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#getIdentifyingTypes()
*/
@Override
protected Collection<Class<?>> getIdentifyingTypes() {
return Arrays.asList(SolrRepository.class, SolrCrudRepository.class);
}
private void registeCustomConversionsIfNotPresent(BeanDefinitionRegistry registry,
RepositoryConfigurationSource configurationSource) {
RootBeanDefinition definition = new RootBeanDefinition(SolrCustomConversions.class);
definition.getConstructorArgumentValues().addGenericArgumentValue(Collections.emptyList());
definition.setRole(AbstractBeanDefinition.ROLE_INFRASTRUCTURE);
definition.setSource(configurationSource.getSource());
registerIfNotAlreadyRegistered(definition, registry, BeanDefinitionName.CUSTOM_CONVERSIONS.getBeanName(),
definition);
}
private void registerSolrMappingContextIfNotPresent(BeanDefinitionRegistry registry,
RepositoryConfigurationSource configurationSource) {
RootBeanDefinition definition = new RootBeanDefinition(SimpleSolrMappingContext.class);
definition.setRole(AbstractBeanDefinition.ROLE_INFRASTRUCTURE);
definition.setSource(configurationSource.getSource());
registerIfNotAlreadyRegistered(definition, registry, BeanDefinitionName.SOLR_MAPPTING_CONTEXT.getBeanName(),
definition);
}
private void registerSolrConverterIfNotPresent(BeanDefinitionRegistry registry,
RepositoryConfigurationSource configurationSource) {
RootBeanDefinition definition = new RootBeanDefinition(MappingSolrConverter.class);
ConstructorArgumentValues ctorArgs = new ConstructorArgumentValues();
ctorArgs.addIndexedArgumentValue(0,
new RuntimeBeanReference(BeanDefinitionName.SOLR_MAPPTING_CONTEXT.getBeanName()));
definition.setConstructorArgumentValues(ctorArgs);
MutablePropertyValues properties = new MutablePropertyValues();
properties.add("customConversions", new RuntimeBeanReference(BeanDefinitionName.CUSTOM_CONVERSIONS.getBeanName()));
definition.setPropertyValues(properties);
definition.setRole(AbstractBeanDefinition.ROLE_INFRASTRUCTURE);
definition.setSource(configurationSource.getSource());
registerIfNotAlreadyRegistered(definition, registry, BeanDefinitionName.SOLR_CONVERTER.getBeanName(), definition);
}
private void registerSolrTemplateIfNotPresent(BeanDefinitionRegistry registry,
RepositoryConfigurationSource configurationSource) {
RootBeanDefinition solrTemplateDefinition = new RootBeanDefinition(SolrTemplate.class);
solrTemplateDefinition.setTargetType(SolrOperations.class);
ConstructorArgumentValues ctorArgs = new ConstructorArgumentValues();
ctorArgs.addIndexedArgumentValue(0, createHttpSolrClientFactory());
ctorArgs.addIndexedArgumentValue(1, new RuntimeBeanReference(BeanDefinitionName.SOLR_CONVERTER.getBeanName()));
solrTemplateDefinition.setConstructorArgumentValues(ctorArgs);
registerIfNotAlreadyRegistered(solrTemplateDefinition, registry, "solrTemplate", solrTemplateDefinition);
}
private BeanDefinition createHttpSolrClientFactory() {
GenericBeanDefinition solrClientFactory = new GenericBeanDefinition();
solrClientFactory.setBeanClass(HttpSolrClientFactory.class);
ConstructorArgumentValues args = new ConstructorArgumentValues();
args.addIndexedArgumentValue(0, new RuntimeBeanReference(BeanDefinitionName.SOLR_CLIENT.getBeanName()));
solrClientFactory.setConstructorArgumentValues(args);
return solrClientFactory;
}
}
| {
"content_hash": "7e2dcc761bae9850e00b2d7f4a22f140",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 252,
"avg_line_length": 44.72222222222222,
"alnum_prop": 0.8376811594202899,
"repo_name": "cipous/spring-data-solr",
"id": "c9d8e402cfddf24fb12d6f61390bcdbb20c8ee10",
"size": "10282",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/springframework/data/solr/repository/config/SolrRepositoryConfigExtension.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1371370"
}
],
"symlink_target": ""
} |
#include "gmp.h"
#include "gmp-impl.h"
/* Any fraction bits are truncated, meaning simply discarded.
For values bigger than a long, the low bits are returned, like
mpz_get_si, but this isn't documented.
Notice this is equivalent to mpz_set_f + mpz_get_si.
Implementation:
fl is established in basically the same way as for mpf_get_ui, see that
code for explanations of the conditions.
However unlike mpf_get_ui we need an explicit return 0 for exp<=0. When
f is a negative fraction (ie. size<0 and exp<=0) we can't let fl==0 go
through to the zany final "~ ((fl - 1) & LONG_MAX)", that would give
-0x80000000 instead of the desired 0. */
long
mpf_get_si (mpf_srcptr f) __GMP_NOTHROW
{
mp_exp_t exp;
mp_size_t size, abs_size;
mp_srcptr fp;
mp_limb_t fl;
exp = EXP (f);
size = SIZ (f);
fp = PTR (f);
/* fraction alone truncates to zero
this also covers zero, since we have exp==0 for zero */
if (exp <= 0)
return 0L;
/* there are some limbs above the radix point */
fl = 0;
abs_size = ABS (size);
if (abs_size >= exp)
fl = fp[abs_size-exp];
#if BITS_PER_ULONG > GMP_NUMB_BITS
if (exp > 1 && abs_size+1 >= exp)
fl |= fp[abs_size - exp + 1] << GMP_NUMB_BITS;
#endif
if (size > 0)
return fl & LONG_MAX;
else
/* this form necessary to correctly handle -0x80..00 */
return -1 - (long) ((fl - 1) & LONG_MAX);
}
| {
"content_hash": "c2478e93c5fa426930ee1b5deda2a584",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 75,
"avg_line_length": 23.949152542372882,
"alnum_prop": 0.6312809624911536,
"repo_name": "J-Gravity/j-gravity",
"id": "5b63dbd4256bc66540595158223c92f166e59889",
"size": "2454",
"binary": false,
"copies": "25",
"ref": "refs/heads/master",
"path": "physics_checker/gmp-6.1.2/mpf/get_si.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "3124727"
},
{
"name": "C",
"bytes": "9619174"
},
{
"name": "C++",
"bytes": "889812"
},
{
"name": "Emacs Lisp",
"bytes": "13769"
},
{
"name": "Fortran",
"bytes": "2267"
},
{
"name": "GDB",
"bytes": "1201"
},
{
"name": "HTML",
"bytes": "75321"
},
{
"name": "Lex",
"bytes": "2858"
},
{
"name": "M4",
"bytes": "423252"
},
{
"name": "Makefile",
"bytes": "1849397"
},
{
"name": "Objective-C",
"bytes": "98922"
},
{
"name": "Perl",
"bytes": "125238"
},
{
"name": "Perl 6",
"bytes": "33053"
},
{
"name": "Roff",
"bytes": "14183"
},
{
"name": "Ruby",
"bytes": "4397"
},
{
"name": "Shell",
"bytes": "2928099"
},
{
"name": "TeX",
"bytes": "323102"
},
{
"name": "XS",
"bytes": "72638"
},
{
"name": "Yacc",
"bytes": "11479"
}
],
"symlink_target": ""
} |
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddPasswordResets extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token')->index();
$table->timestamp('created_at');
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}
| {
"content_hash": "3862c0082aedcb0f5a930794bd3d8e7b",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 71,
"avg_line_length": 21.444444444444443,
"alnum_prop": 0.5734024179620034,
"repo_name": "Pterodactyl/Panel",
"id": "0584e36178e5ea17ed57859f213340ab2819ff9f",
"size": "579",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "database/migrations/2016_01_23_201433_add_password_resets.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "19668"
},
{
"name": "HTML",
"bytes": "434532"
},
{
"name": "JavaScript",
"bytes": "95971"
},
{
"name": "PHP",
"bytes": "1790620"
},
{
"name": "Shell",
"bytes": "4060"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?>
<tei xml:space="preserve">
<teiHeader>
<fileDesc xml:id="D2B0444DFF4D6022A8516BCA26DAB3C7A9610EBA"/>
</teiHeader>
<text xml:lang="en">
<front>
<lb/>
<title level="j">EUROPHYSICS LETTERS<lb/></title>
<date>15 October 1997<lb/></date>
<reference>Europhys. Lett., 40 (2), pp. 153-158 (1997)<lb/></reference>
<docTitle>
<titlePart>Microscopic dynamics in liquid deuterium:<lb/> A transition from collective to single-particle regimes<lb/></titlePart>
</docTitle>
<byline>
<docAuthor>M. Mukherjee 1 , F. J. Bermejo 1 , B. Fåk 2 and S. M. Bennington 3<lb/></docAuthor>
</byline>
<byline>
<affiliation>1 Instituto de Estructura de la Materia, Consejo Superior de Investigaciones Científicas<lb/> </affiliation>
</byline>
<address>Serrano 123, E-28006 Madrid, Spain<lb/></address>
<byline>
<affiliation>2 Département de Recherche Fondamentale sur la Matière Condensée, SPSMS/MDN<lb/> CEA Grenoble </affiliation>
</byline>
<address>-38054 Grenoble, France<lb/></address>
<byline>
<affiliation>3 Rutherford Appleton Laboratory -Chilton,</affiliation>
</byline>
<address>Didcot Oxon, OX11 0QX, UK<lb/></address>
(
<note type="submission">received 16 June 1997; accepted 9 September 1997</note>
)<lb/>
<keyword>PACS. 62.10+s -Mechanical properties of liquids.<lb/> PACS. 62.60+v -Acoustical properties of liquids.<lb/></keyword>
Abstract. -
<div type="abstract">Well-defined (propagating) collective density fluctuations are found for liquid<lb/> deuterium up to large wave vectors at SVP conditions. Their phase velocities as well as<lb/> the wave vector dependence of the excitation linewidths and strengths indicate that what is<lb/> experimentally observed is dominated by a continuation to large wave vectors of hydrodynamic<lb/> (sound-mode) excitations. For wave vectors 2.3 ≤ Q ≤ 4Å<lb/> −1 , the spectrum approaches that<lb/> of a weakly interacting fluid. A transition to a regime dominated by single-particle (recoil and<lb/> quantized rotation) motions is found to occur within 4.2 ≤ Q ≤ 4.5Å<lb/> −1 , depending upon<lb/> thermodynamic conditions.<lb/></div>
<note type="copyright">c Les Editions de Physique</note>
</front>
</text>
</tei>
| {
"content_hash": "a31fbed12d794ccf7eb246487c138274",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 731,
"avg_line_length": 41.074074074074076,
"alnum_prop": 0.7294860234445446,
"repo_name": "kermitt2/grobid",
"id": "a1b6a91eb19c5cc9dbdd1f1664287de681f6a864",
"size": "2237",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "grobid-trainer/resources/dataset/header/corpus/tei/D2B0444DFF4D6022A8516BCA26DAB3C7A9610EBA.training.header.tei.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "226"
},
{
"name": "CSS",
"bytes": "57790"
},
{
"name": "HTML",
"bytes": "1875327"
},
{
"name": "Java",
"bytes": "3462313"
},
{
"name": "JavaScript",
"bytes": "800191"
},
{
"name": "Python",
"bytes": "21316"
},
{
"name": "Roff",
"bytes": "74517"
},
{
"name": "Ruby",
"bytes": "113884"
},
{
"name": "SWIG",
"bytes": "2372"
},
{
"name": "Shell",
"bytes": "5144"
},
{
"name": "XQuery",
"bytes": "8998"
},
{
"name": "XSLT",
"bytes": "18226"
}
],
"symlink_target": ""
} |
module SuperTues
module Board
module Observer
def observers
@observers ||= {}
end
def observer_id
@observer_id = if @observer_id
@observer_id += 1
else
0
end
end
def add_observer(&block)
id = observer_id
observers[id] = Proc.new # implicit block conversion
id
end
def remove_observer(id)
observers.delete(id)
end
private
def notify_observers(*args)
observers.values.each { |proc| proc.call *args }
end
end
end
end | {
"content_hash": "c6fad2ea71817bb71149cd70f35a7273",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 60,
"avg_line_length": 19.058823529411764,
"alnum_prop": 0.48302469135802467,
"repo_name": "jonlhouse/super_tues-board",
"id": "1c110ef90ef867451219c44c978fa253f2cadea3",
"size": "648",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/super_tues/board/observer.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "97119"
}
],
"symlink_target": ""
} |
require 'spec_helper'
describe "generate_readable_ident" do
context 'prefix' do
it 'should be empty if not supplied' do
ident = ReadableIdent.generate_readable_ident(length: 10);
ident.length.should eq 10
ident.should_not start_with('-')
end
it 'must be in specified regex' do
expect { ReadableIdent.generate_readable_ident(prefix: 'ß') }.to \
raise_error(ArgumentError, 'prefix is not in specified regex')
end
it 'should start with the given prefix' do
ident = ReadableIdent.generate_readable_ident(prefix: 'custom_prefix')
ident.should start_with('custom_prefix')
end
end
context 'seperator' do
it 'should have a dash as seperator if prefix is specified' do
ident = ReadableIdent.generate_readable_ident(prefix: 'hello')
ident.should start_with('hello-')
end
it 'should have an empty seperator if specified and has prefix' do
ident = ReadableIdent.generate_readable_ident(prefix: 'hello', seperator: '', length: 10)
ident.should =~ /hello[a-zA-Z0-9]{10}/
end
it 'must have the length of 1' do
expect { ReadableIdent.generate_readable_ident(seperator: '123') }.to \
raise_error(ArgumentError, 'seperator length must be 1')
end
it 'must be in specified regex' do
expect { ReadableIdent.generate_readable_ident(seperator: "µ") }.to \
raise_error(ArgumentError, 'seperator is not in specified regex')
end
it 'should have use the supplied seperator' do
ident = ReadableIdent.generate_readable_ident(seperator: '~')
ident.should start_with('~')
end
end
context 'length' do
it 'should generate ident with given length' do
ident = ReadableIdent.generate_readable_ident(length: 22)
ident.length.should eq 22
end
it 'must be numeric or raise AgrumentError' do
expect { ReadableIdent.generate_readable_ident(length: 'a') }.to \
raise_error(ArgumentError, 'length must be numeric')
end
it 'should have a length of 4 if no length given' do
ident = ReadableIdent.generate_readable_ident
ident.length.should eq 4
end
end
end
| {
"content_hash": "3af61b609f519886eec251b5e9b88254",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 95,
"avg_line_length": 30.633802816901408,
"alnum_prop": 0.6749425287356322,
"repo_name": "mschewe/readable_ident",
"id": "42c142868b6997f87aec385c3dad0d26364101ae",
"size": "2204",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/readable_ident/readable_ident_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "7857"
}
],
"symlink_target": ""
} |
<?php
/**
* This file is part of Vegas package
*
* @author Slawomir Zytko <slawek@amsterdam-standard.pl>
* @company Amsterdam Standard Sp. z o.o.
* @homepage http://cmf.vegas
*/
namespace App\Shared;
use Vegas\Di\Injector\SharedServiceProviderInterface;
class ViewCache implements SharedServiceProviderInterface
{
/**
* @return string
*/
public function getName()
{
return 'viewCache';
}
/**
* @param \Phalcon\DiInterface $di
* @return mixed
*/
public function getProvider(\Phalcon\DiInterface $di)
{
return function() use ($di) {
//Cache data for one day by default
$frontCache = new \Phalcon\Cache\Frontend\Output([
"lifetime" => 1
]);
//File backend settings
$cache = new \Phalcon\Cache\Backend\File($frontCache, [
"cacheDir" => $di->get('config')->application->view->cacheDir
]);
return $cache;
};
}
} | {
"content_hash": "1654ec0fd65eba11ac6c965da4599643",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 22.555555555555557,
"alnum_prop": 0.5714285714285714,
"repo_name": "maniolek/crud",
"id": "ae4fbf7aa6ad0ea84f5a0eb9d7505f6305ee74f9",
"size": "1015",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/fixtures/app/shared/ViewCache.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "90415"
},
{
"name": "Volt",
"bytes": "7703"
}
],
"symlink_target": ""
} |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Escaper {
public partial class SiteMaster {
/// <summary>
/// MainContent control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ContentPlaceHolder MainContent;
}
}
| {
"content_hash": "95ff9ab38c9eefe7649456508821d1f7",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 84,
"avg_line_length": 32.125,
"alnum_prop": 0.4721141374837873,
"repo_name": "LazarDL/TelerikHomeworks",
"id": "3bed41ffdb7b27de29041aa2aeb72326891f008e",
"size": "773",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ASPWebFors/WebAndHTMLController/Escaper/Site.Master.designer.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "307819"
},
{
"name": "C#",
"bytes": "3112321"
},
{
"name": "CSS",
"bytes": "282650"
},
{
"name": "CoffeeScript",
"bytes": "491"
},
{
"name": "JavaScript",
"bytes": "12003372"
},
{
"name": "XSLT",
"bytes": "2333"
}
],
"symlink_target": ""
} |
package com.github.bednar.persistence.event;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import com.github.bednar.base.event.AbstractSubscriber;
import com.github.bednar.persistence.contract.Resource;
import com.github.bednar.persistence.inject.service.Database;
import com.mycila.event.Event;
/**
* @author Jakub Bednář (19/08/2013 3:46 PM)
*/
public class ReadSubscriber extends AbstractSubscriber<ReadEvent>
{
@Inject
private Database database;
@Nonnull
@Override
public Class<ReadEvent> eventType()
{
return ReadEvent.class;
}
@SuppressWarnings("unchecked")
@Override
public void onEvent(final Event<ReadEvent> event) throws Exception
{
try (Database.Transaction transaction = database.transaction())
{
Resource resource = transaction.read(
event.getSource().getKey(),
event.getSource().getType());
event.getSource().success(resource);
}
catch (Exception e)
{
event.getSource().fail(e);
}
}
}
| {
"content_hash": "ef0f016e7d90a17fcf7f2e0218855af0",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 71,
"avg_line_length": 25.627906976744185,
"alnum_prop": 0.6542649727767695,
"repo_name": "bednar/persistence",
"id": "3d7dde27988e8f73d52d717f292e4b6bab4eee68",
"size": "1104",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/github/bednar/persistence/event/ReadSubscriber.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Java",
"bytes": "46522"
}
],
"symlink_target": ""
} |
package com.google.android.exoplayer2.source.dash;
import android.net.Uri;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.extractor.ChunkIndex;
import com.google.android.exoplayer2.extractor.Extractor;
import com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor;
import com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor;
import com.google.android.exoplayer2.source.chunk.ChunkExtractorWrapper;
import com.google.android.exoplayer2.source.chunk.InitializationChunk;
import com.google.android.exoplayer2.source.dash.manifest.DashManifest;
import com.google.android.exoplayer2.source.dash.manifest.DashManifestParser;
import com.google.android.exoplayer2.source.dash.manifest.Period;
import com.google.android.exoplayer2.source.dash.manifest.RangedUri;
import com.google.android.exoplayer2.source.dash.manifest.Representation;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.HttpDataSource;
import com.google.android.exoplayer2.upstream.ParsingLoadable;
import com.google.android.exoplayer2.util.MimeTypes;
import java.io.IOException;
import java.util.List;
/**
* Utility methods for DASH streams.
*/
public final class DashUtil {
/**
* Loads a DASH manifest.
*
* @param dataSource The {@link HttpDataSource} from which the manifest should be read.
* @param uri The {@link Uri} of the manifest to be read.
* @return An instance of {@link DashManifest}.
* @throws IOException Thrown when there is an error while loading.
*/
public static DashManifest loadManifest(DataSource dataSource, Uri uri)
throws IOException {
ParsingLoadable<DashManifest> loadable =
new ParsingLoadable<>(dataSource, uri, C.DATA_TYPE_MANIFEST, new DashManifestParser());
loadable.load();
return loadable.getResult();
}
/**
* Loads {@link DrmInitData} for a given period in a DASH manifest.
*
* @param dataSource The {@link HttpDataSource} from which data should be loaded.
* @param period The {@link Period}.
* @return The loaded {@link DrmInitData}, or null if none is defined.
* @throws IOException Thrown when there is an error while loading.
* @throws InterruptedException Thrown if the thread was interrupted.
*/
public static DrmInitData loadDrmInitData(DataSource dataSource, Period period)
throws IOException, InterruptedException {
int primaryTrackType = C.TRACK_TYPE_VIDEO;
Representation representation = getFirstRepresentation(period, primaryTrackType);
if (representation == null) {
primaryTrackType = C.TRACK_TYPE_AUDIO;
representation = getFirstRepresentation(period, primaryTrackType);
if (representation == null) {
return null;
}
}
Format manifestFormat = representation.format;
Format sampleFormat = DashUtil.loadSampleFormat(dataSource, primaryTrackType, representation);
return sampleFormat == null
? manifestFormat.drmInitData
: sampleFormat.copyWithManifestFormatInfo(manifestFormat).drmInitData;
}
/**
* Loads initialization data for the {@code representation} and returns the sample {@link Format}.
*
* @param dataSource The source from which the data should be loaded.
* @param trackType The type of the representation. Typically one of the
* {@link com.google.android.exoplayer2.C} {@code TRACK_TYPE_*} constants.
* @param representation The representation which initialization chunk belongs to.
* @return the sample {@link Format} of the given representation.
* @throws IOException Thrown when there is an error while loading.
* @throws InterruptedException Thrown if the thread was interrupted.
*/
public static Format loadSampleFormat(DataSource dataSource, int trackType,
Representation representation) throws IOException, InterruptedException {
ChunkExtractorWrapper extractorWrapper = loadInitializationData(dataSource, trackType,
representation, false);
return extractorWrapper == null ? null : extractorWrapper.getSampleFormats()[0];
}
/**
* Loads initialization and index data for the {@code representation} and returns the {@link
* ChunkIndex}.
*
* @param dataSource The source from which the data should be loaded.
* @param trackType The type of the representation. Typically one of the
* {@link com.google.android.exoplayer2.C} {@code TRACK_TYPE_*} constants.
* @param representation The representation which initialization chunk belongs to.
* @return The {@link ChunkIndex} of the given representation, or null if no initialization or
* index data exists.
* @throws IOException Thrown when there is an error while loading.
* @throws InterruptedException Thrown if the thread was interrupted.
*/
public static ChunkIndex loadChunkIndex(DataSource dataSource, int trackType,
Representation representation) throws IOException, InterruptedException {
ChunkExtractorWrapper extractorWrapper = loadInitializationData(dataSource, trackType,
representation, true);
return extractorWrapper == null ? null : (ChunkIndex) extractorWrapper.getSeekMap();
}
/**
* Loads initialization data for the {@code representation} and optionally index data then
* returns a {@link ChunkExtractorWrapper} which contains the output.
*
* @param dataSource The source from which the data should be loaded.
* @param trackType The type of the representation. Typically one of the
* {@link com.google.android.exoplayer2.C} {@code TRACK_TYPE_*} constants.
* @param representation The representation which initialization chunk belongs to.
* @param loadIndex Whether to load index data too.
* @return A {@link ChunkExtractorWrapper} for the {@code representation}, or null if no
* initialization or (if requested) index data exists.
* @throws IOException Thrown when there is an error while loading.
* @throws InterruptedException Thrown if the thread was interrupted.
*/
private static ChunkExtractorWrapper loadInitializationData(DataSource dataSource, int trackType,
Representation representation, boolean loadIndex) throws IOException, InterruptedException {
RangedUri initializationUri = representation.getInitializationUri();
if (initializationUri == null) {
return null;
}
ChunkExtractorWrapper extractorWrapper = newWrappedExtractor(trackType, representation.format);
RangedUri requestUri;
if (loadIndex) {
RangedUri indexUri = representation.getIndexUri();
if (indexUri == null) {
return null;
}
// It's common for initialization and index data to be stored adjacently. Attempt to merge
// the two requests together to request both at once.
requestUri = initializationUri.attemptMerge(indexUri, representation.baseUrl);
if (requestUri == null) {
loadInitializationData(dataSource, representation, extractorWrapper, initializationUri);
requestUri = indexUri;
}
} else {
requestUri = initializationUri;
}
loadInitializationData(dataSource, representation, extractorWrapper, requestUri);
return extractorWrapper;
}
private static void loadInitializationData(DataSource dataSource,
Representation representation, ChunkExtractorWrapper extractorWrapper, RangedUri requestUri)
throws IOException, InterruptedException {
DataSpec dataSpec = new DataSpec(requestUri.resolveUri(representation.baseUrl),
requestUri.start, requestUri.length, representation.getCacheKey());
InitializationChunk initializationChunk = new InitializationChunk(dataSource, dataSpec,
representation.format, C.SELECTION_REASON_UNKNOWN, null /* trackSelectionData */,
extractorWrapper);
initializationChunk.load();
}
private static ChunkExtractorWrapper newWrappedExtractor(int trackType, Format format) {
String mimeType = format.containerMimeType;
boolean isWebm = mimeType.startsWith(MimeTypes.VIDEO_WEBM)
|| mimeType.startsWith(MimeTypes.AUDIO_WEBM);
Extractor extractor = isWebm ? new MatroskaExtractor() : new FragmentedMp4Extractor();
return new ChunkExtractorWrapper(extractor, trackType, format);
}
private static Representation getFirstRepresentation(Period period, int type) {
int index = period.getAdaptationSetIndex(type);
if (index == C.INDEX_UNSET) {
return null;
}
List<Representation> representations = period.adaptationSets.get(index).representations;
return representations.isEmpty() ? null : representations.get(0);
}
private DashUtil() {}
}
| {
"content_hash": "9874d19d5641c5e727b66e9efa140a22",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 100,
"avg_line_length": 47.755434782608695,
"alnum_prop": 0.7546375327187891,
"repo_name": "kiall/ExoPlayer",
"id": "2227044da74172cd4f337436f7d513a05cc09d38",
"size": "9406",
"binary": false,
"copies": "1",
"ref": "refs/heads/release-v2-kiall",
"path": "library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashUtil.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "59324"
},
{
"name": "Java",
"bytes": "5529820"
},
{
"name": "Makefile",
"bytes": "13718"
},
{
"name": "Shell",
"bytes": "8370"
}
],
"symlink_target": ""
} |
import React from 'react'
import PropTypes from 'prop-types'
import {translate} from 'react-i18next'
class ErrorWrapper extends React.Component {
static propTypes = {
children: PropTypes.node.isRequired,
message: PropTypes.string,
t: PropTypes.func.isRequired
}
static defaultProps = {
message: null
}
state = {}
componentDidCatch() {
this.setState({
error: true
})
}
render() {
const {children, message, t} = this.props
const {error} = this.state
if (error) {
return (
<span>
{message || t('errors.unknown')}
<style jsx>{`
@import 'colors';
span {
color: $red;
}
`}</style>
</span>
)
}
return children
}
}
export default translate()(ErrorWrapper)
| {
"content_hash": "a0c96807ed27d4c35307bff0fdb56cb2",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 45,
"avg_line_length": 17.72340425531915,
"alnum_prop": 0.5558223289315727,
"repo_name": "sgmap/inspire",
"id": "db5efc148510c08fc0b318c39a65eb219d3a74d3",
"size": "833",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/error-wrapper.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "32544"
},
{
"name": "HTML",
"bytes": "3299"
},
{
"name": "JavaScript",
"bytes": "246385"
}
],
"symlink_target": ""
} |
<?php
class Twig_Tests_ErrorTest extends PHPUnit_Framework_TestCase
{
public function testErrorWithObjectFilename()
{
$error = new Twig_Error('foo');
$error->setSourceContext(new Twig_Source('', new SplFileInfo(__FILE__)));
$this->assertContains('test'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Tests'.DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage());
}
public function testErrorWithArrayFilename()
{
$error = new Twig_Error('foo');
$error->setSourceContext(new Twig_Source('', array('foo' => 'bar')));
$this->assertEquals('foo in {"foo":"bar"}', $error->getMessage());
}
public function testTwigExceptionGuessWithMissingVarAndArrayLoader()
{
$loader = new Twig_Loader_Array(array(
'base.html' => '{% block content %}{% endblock %}',
'index.html' => <<<EOHTML
{% extends 'base.html' %}
{% block content %}
{{ foo.bar }}
{% endblock %}
{% block foo %}
{{ foo.bar }}
{% endblock %}
EOHTML
));
$twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false));
$template = $twig->loadTemplate('index.html');
try {
$template->render(array());
$this->fail();
} catch (Twig_Error_Runtime $e) {
$this->assertEquals('Variable "foo" does not exist in "index.html" at line 3.', $e->getMessage());
$this->assertEquals(3, $e->getTemplateLine());
$this->assertEquals('index.html', $e->getSourceContext()->getName());
}
}
public function testTwigExceptionGuessWithExceptionAndArrayLoader()
{
$loader = new Twig_Loader_Array(array(
'base.html' => '{% block content %}{% endblock %}',
'index.html' => <<<EOHTML
{% extends 'base.html' %}
{% block content %}
{{ foo.bar }}
{% endblock %}
{% block foo %}
{{ foo.bar }}
{% endblock %}
EOHTML
));
$twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false));
$template = $twig->loadTemplate('index.html');
try {
$template->render(array('foo' => new Twig_Tests_ErrorTest_Foo()));
$this->fail();
} catch (Twig_Error_Runtime $e) {
$this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index.html" at line 3.', $e->getMessage());
$this->assertEquals(3, $e->getTemplateLine());
$this->assertEquals('index.html', $e->getSourceContext()->getName());
}
}
public function testTwigExceptionGuessWithMissingVarAndFilesystemLoader()
{
$loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors');
$twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false));
$template = $twig->loadTemplate('index.html');
try {
$template->render(array());
$this->fail();
} catch (Twig_Error_Runtime $e) {
$this->assertEquals('Variable "foo" does not exist.', $e->getMessage());
$this->assertEquals(3, $e->getTemplateLine());
$this->assertEquals('index.html', $e->getSourceContext()->getName());
$this->assertEquals(3, $e->getLine());
$this->assertEquals(strtr(dirname(__FILE__).'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile());
}
}
public function testTwigExceptionGuessWithExceptionAndFilesystemLoader()
{
$loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors');
$twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false));
$template = $twig->loadTemplate('index.html');
try {
$template->render(array('foo' => new Twig_Tests_ErrorTest_Foo()));
$this->fail();
} catch (Twig_Error_Runtime $e) {
$this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...").', $e->getMessage());
$this->assertEquals(3, $e->getTemplateLine());
$this->assertEquals('index.html', $e->getSourceContext()->getName());
$this->assertEquals(3, $e->getLine());
$this->assertEquals(strtr(dirname(__FILE__).'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile());
}
}
/**
* @dataProvider getErroredTemplates
*/
public function testTwigExceptionAddsFileAndLine($templates, $name, $line)
{
$loader = new Twig_Loader_Array($templates);
$twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false));
$template = $twig->loadTemplate('index');
try {
$template->render(array());
$this->fail();
} catch (Twig_Error_Runtime $e) {
$this->assertEquals(sprintf('Variable "foo" does not exist in "%s" at line %d.', $name, $line), $e->getMessage());
$this->assertEquals($line, $e->getTemplateLine());
$this->assertEquals($name, $e->getSourceContext()->getName());
}
try {
$template->render(array('foo' => new Twig_Tests_ErrorTest_Foo()));
$this->fail();
} catch (Twig_Error_Runtime $e) {
$this->assertEquals(sprintf('An exception has been thrown during the rendering of a template ("Runtime error...") in "%s" at line %d.', $name, $line), $e->getMessage());
$this->assertEquals($line, $e->getTemplateLine());
$this->assertEquals($name, $e->getSourceContext()->getName());
}
}
public function getErroredTemplates()
{
return array(
// error occurs in a template
array(
array(
'index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}",
),
'index', 3,
),
// error occurs in an included template
array(
array(
'index' => "{% include 'partial' %}",
'partial' => '{{ foo.bar }}',
),
'partial', 1,
),
// error occurs in a parent block when called via parent()
array(
array(
'index' => "{% extends 'base' %}
{% block content %}
{{ parent() }}
{% endblock %}",
'base' => '{% block content %}{{ foo.bar }}{% endblock %}',
),
'base', 1,
),
// error occurs in a block from the child
array(
array(
'index' => "{% extends 'base' %}
{% block content %}
{{ foo.bar }}
{% endblock %}
{% block foo %}
{{ foo.bar }}
{% endblock %}",
'base' => '{% block content %}{% endblock %}',
),
'index', 3,
),
);
}
}
class Twig_Tests_ErrorTest_Foo
{
public function bar()
{
throw new Exception('Runtime error...');
}
}
| {
"content_hash": "8e2cbacca3a9a4a4a07bb8b61c982a8b",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 181,
"avg_line_length": 37.26470588235294,
"alnum_prop": 0.5065772165219679,
"repo_name": "gustavokev/preescolar1",
"id": "9acb3cb1990e86cf65cf219a1dcc78b0aee93300",
"size": "7802",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/twig/twig/test/Twig/Tests/ErrorTest.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "388"
},
{
"name": "CSS",
"bytes": "32330"
},
{
"name": "HTML",
"bytes": "8689942"
},
{
"name": "JavaScript",
"bytes": "70482"
},
{
"name": "PHP",
"bytes": "1931592"
}
],
"symlink_target": ""
} |
'use strict';
var Mailgun = require('mailgun-js');
function Notifier(conf){
this.auth = {
apiKey : conf.apiKey,
domain : conf.domain
};
this.mailData = {
from : conf.from,
to : conf.to,
subject : conf.subject,
text : ''
};
this.okMessage = conf.okMessage;
this.ngMessage = conf.ngMessage;
this.mailer = new Mailgun(this.auth).messages();
}
Notifier.prototype.sendMail = function (message) {
this.mailData.text = message;
this.mailer.send(this.mailData, function(err, body){
if (err) {
console.log(err);
return;
}
console.log('mail sent', body);
});
};
Notifier.prototype.notifyOK = function() {
this.sendMail(this.okMessage);
};
Notifier.prototype.notifyNG = function() {
this.sendMail(this.ngMessage);
};
module.exports = Notifier;
| {
"content_hash": "ecdb0788108643d20f27ee58226cae2e",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 56,
"avg_line_length": 22.121951219512194,
"alnum_prop": 0.577728776185226,
"repo_name": "iwanaga/grove-pi2",
"id": "423aadfcb273507b35def9f3894763911c0a6e24",
"size": "907",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/notifier.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "6560"
}
],
"symlink_target": ""
} |
package vpc.tir.stages;
import cck.util.Option;
import vpc.core.Program;
import vpc.core.virgil.VirgilComponent;
import vpc.sched.Stage;
import vpc.tir.TIRInterpreter;
import java.io.IOException;
/**
* The <code>TIRInit</code> class implements the initialization stage in compiling
* a Virgil program. Initialization is accomplished by interpreting the constructors
* of each component in the program in the order that they were encountered in
* compilation.
*
* @author Ben L. Titzer
*/
public class TIRInit extends Stage {
public Option.Bool TRACE = options.newOption("trace", false,
"This option enables tracing of the method calls invoked during the initialization " +
"phase of the program.");
public void visitProgram(Program p) throws IOException {
TIRInterpreter interpreter = new TIRInterpreter(p);
for (VirgilComponent d : p.closure.getComponents()){
d.setRecord(interpreter.initComponent(d));
}
}
}
| {
"content_hash": "248e25022fc6c87063cedb2154f0f16e",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 98,
"avg_line_length": 30.181818181818183,
"alnum_prop": 0.7178714859437751,
"repo_name": "Mah-D/VICE",
"id": "6cf047a67e8c857056eb471b070124c73a211f37",
"size": "1142",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Compiler/src/vpc/tir/stages/TIRInit.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Coq",
"bytes": "253519"
},
{
"name": "Java",
"bytes": "1714305"
},
{
"name": "Makefile",
"bytes": "3550"
},
{
"name": "Scilab",
"bytes": "1083"
},
{
"name": "Shell",
"bytes": "49488"
},
{
"name": "Verilog",
"bytes": "612749"
}
],
"symlink_target": ""
} |
'use strict';
var connect = require('./connect.js');
var knex = require('knex')({ client: 'pg' });
module.exports = function(settings, express, app, log) {
connect(function(client) {
var lists = knex.schema.createTableIfNotExists('lists', function(table) {
table.bigIncrements('list_id');
table.string('list_name');
table.timestamps();
}).toString();
var items = knex.schema.createTableIfNotExists('items', function(table) {
table.bigIncrements('item_id');
table.string('item_name');
table.bigInteger('list_id').unsigned();
table.foreign('list_id').references('lists.list_id')
table.timestamps();
}).toString();
var text = [lists, items].join("; ");
client.query(text, function(err, result) {
if (err) {
if (err.toString().match('constraint')) { return; }
log('red', err);
return;
}
log('green', 'Database schema created!');
});
});
};
| {
"content_hash": "8cc16a73d718accb6918cb9677fd3a85",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 75,
"avg_line_length": 20.377777777777776,
"alnum_prop": 0.6281352235550709,
"repo_name": "haseebnqureshi/apiworks",
"id": "bc254247ec627a26590a683eeb9d6f6024775b34",
"size": "917",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/basic/db/postgres/schema.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "12517"
}
],
"symlink_target": ""
} |
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { OverridableComponent } from '@mui/types';
import { unstable_useControlled as useControlled, unstable_useId as useId } from '@mui/utils';
import { unstable_composeClasses as composeClasses } from '@mui/base';
import { styled, useThemeProps } from '../styles';
import { getRadioGroupUtilityClass } from './radioGroupClasses';
import radioClasses from '../Radio/radioClasses';
import { RadioGroupProps, RadioGroupTypeMap } from './RadioGroupProps';
import RadioGroupContext from './RadioGroupContext';
const useUtilityClasses = (ownerState: RadioGroupProps) => {
const { row } = ownerState;
const slots = {
root: ['root', row && 'row'],
};
return composeClasses(slots, getRadioGroupUtilityClass, {});
};
const RadioGroupRoot = styled('div', {
name: 'JoyRadioGroup',
slot: 'Root',
overridesResolver: (props, styles) => styles.root,
})<{ ownerState: RadioGroupProps }>(({ ownerState }) => ({
...(ownerState.size === 'sm' && {
'--RadioGroup-gap': '0.5rem',
}),
...(ownerState.size === 'md' && {
'--RadioGroup-gap': '0.75rem',
}),
...(ownerState.size === 'lg' && {
'--RadioGroup-gap': '1rem',
}),
display: 'flex',
flexDirection: ownerState.row ? 'row' : 'column',
[`.${radioClasses.root} + .${radioClasses.root}`]: {
...(ownerState.row
? {
marginLeft: 'var(--RadioGroup-gap)',
}
: {
marginTop: 'var(--RadioGroup-gap)',
}),
},
}));
const RadioGroup = React.forwardRef(function RadioGroup(inProps, ref) {
const props = useThemeProps<typeof inProps & { component?: React.ElementType }>({
props: inProps,
name: 'JoyRadioGroup',
});
const {
className,
component,
children,
name: nameProp,
defaultValue,
disableIcon = false,
overlay,
value: valueProp,
onChange,
color,
variant,
size = 'md',
row = false,
...otherProps
} = props;
const [value, setValueState] = useControlled({
controlled: valueProp,
default: defaultValue,
name: 'RadioGroup',
});
const ownerState = {
row,
size,
...props,
};
const classes = useUtilityClasses(ownerState);
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setValueState(event.target.value);
if (onChange) {
onChange(event);
}
};
const name = useId(nameProp);
return (
<RadioGroupContext.Provider
value={{ color, disableIcon, overlay, size, variant, name, value, onChange: handleChange }}
>
<RadioGroupRoot
ref={ref}
role="radiogroup"
{...otherProps}
as={component}
ownerState={ownerState}
className={clsx(classes.root, className)}
>
{children}
</RadioGroupRoot>
</RadioGroupContext.Provider>
);
}) as OverridableComponent<RadioGroupTypeMap>;
RadioGroup.propTypes /* remove-proptypes */ = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit TypeScript types and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* @ignore
*/
children: PropTypes.node,
/**
* Class name applied to the root element.
*/
className: PropTypes.string,
/**
* The color of the component. It supports those theme colors that make sense for this component.
*/
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['danger', 'info', 'primary', 'success', 'warning']),
PropTypes.string,
]),
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component: PropTypes.elementType,
/**
* The default value. Use when the component is not controlled.
*/
defaultValue: PropTypes.any,
/**
* The radio's `disabledIcon` prop. If specified, the value is passed down to every radios under this element.
*/
disableIcon: PropTypes.bool,
/**
* The `name` attribute of the input.
*/
name: PropTypes.string,
/**
* Callback fired when a radio button is selected.
*
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
* You can pull out the new value by accessing `event.target.value` (string).
*/
onChange: PropTypes.func,
/**
* The radio's `overlay` prop. If specified, the value is passed down to every radios under this element.
*/
overlay: PropTypes.bool,
/**
* If `true`, flex direction is set to 'row'.
* @default false
*/
row: PropTypes.bool,
/**
* The size of the component.
* @default 'md'
*/
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['sm', 'md', 'lg']),
PropTypes.string,
]),
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])),
PropTypes.func,
PropTypes.object,
]),
/**
* Value of the selected radio button. The DOM API casts this to a string.
*/
value: PropTypes.any,
/**
* The variant to use.
*/
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['outlined', 'plain', 'soft', 'solid']),
PropTypes.string,
]),
} as any;
export default RadioGroup;
| {
"content_hash": "a66feb028c3c4c75bb8cdd7f1efbe6e9",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 112,
"avg_line_length": 28.25,
"alnum_prop": 0.6238035037023659,
"repo_name": "rscnt/material-ui",
"id": "addc2fb8ab3f079f89fec71a6c21f36f30cf8cc4",
"size": "5537",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/mui-joy/src/RadioGroup/RadioGroup.tsx",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2126"
},
{
"name": "JavaScript",
"bytes": "3967457"
},
{
"name": "TypeScript",
"bytes": "2468380"
}
],
"symlink_target": ""
} |
// Copyright 2014 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.
import {getFilenameFromURL, PDFViewerElement, shouldIgnoreKeyEvents, ViewerToolbarElement} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_viewer_wrapper.js';
const tests = [
/**
* Test that some key elements exist and that they have a shadowRoot. This
* verifies that Polymer is working correctly.
*/
function testHasElements() {
const viewer = /** @type {!PDFViewerElement} */ (
document.body.querySelector('pdf-viewer'));
const elementNames = ['viewer-pdf-sidenav', 'viewer-toolbar'];
for (let i = 0; i < elementNames.length; i++) {
const elements = viewer.shadowRoot.querySelectorAll(elementNames[i]);
chrome.test.assertEq(1, elements.length);
chrome.test.assertTrue(elements[0].shadowRoot !== null);
}
chrome.test.succeed();
},
/**
* Test that the plugin element exists and is navigated to the correct URL.
*/
function testPluginElement() {
const viewer = /** @type {!PDFViewerElement} */ (
document.body.querySelector('pdf-viewer'));
const plugin = viewer.shadowRoot.querySelector('#plugin');
chrome.test.assertEq('embed', plugin.localName);
chrome.test.assertTrue(
plugin.getAttribute('original-url').indexOf('/pdf/test.pdf') !== -1);
chrome.test.succeed();
},
function testShouldIgnoreKeyEvents() {
const viewer = /** @type {!PDFViewerElement} */ (
document.body.querySelector('pdf-viewer'));
const toolbar = /** @type {!ViewerToolbarElement} */ (
viewer.shadowRoot.querySelector('#toolbar'));
// Test case where an <input> field is focused.
toolbar.shadowRoot.querySelector('viewer-page-selector')
.pageSelector.focus();
chrome.test.assertTrue(shouldIgnoreKeyEvents());
// Test case where another field is focused.
const rotateButton = toolbar.shadowRoot.querySelector(
'cr-icon-button[iron-icon=\'pdf:rotate-left\']');
rotateButton.focus();
chrome.test.assertFalse(shouldIgnoreKeyEvents());
// Test case where the plugin itself is focused.
viewer.shadowRoot.querySelector('#plugin').focus();
chrome.test.assertFalse(shouldIgnoreKeyEvents());
chrome.test.succeed();
},
/**
* Test that the PDF filename is correctly extracted from URLs with query
* parameters and fragments.
*/
function testGetFilenameFromURL(url) {
chrome.test.assertEq(
'path.pdf',
getFilenameFromURL(
'http://example/com/path/with/multiple/sections/path.pdf'));
chrome.test.assertEq(
'fragment.pdf',
getFilenameFromURL('http://example.com/fragment.pdf#zoom=100/Title'));
chrome.test.assertEq(
'query.pdf', getFilenameFromURL('http://example.com/query.pdf?p=a/b'));
chrome.test.assertEq(
'both.pdf',
getFilenameFromURL('http://example.com/both.pdf?p=a/b#zoom=100/Title'));
chrome.test.assertEq(
'name with spaces.pdf',
getFilenameFromURL('http://example.com/name%20with%20spaces.pdf'));
chrome.test.assertEq(
'invalid%EDname.pdf',
getFilenameFromURL('http://example.com/invalid%EDname.pdf'));
chrome.test.succeed();
}
];
chrome.test.runTests(tests);
| {
"content_hash": "1c32b398e1087267c8006f1c4086d3e7",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 172,
"avg_line_length": 35.041666666666664,
"alnum_prop": 0.6756837098692033,
"repo_name": "ric2b/Vivaldi-browser",
"id": "5cd05ec3d9fc79fb75a60ae17394be7841aeea62",
"size": "3364",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chromium/chrome/test/data/pdf/basic_test.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
package io.quarkus.it.hibernate.multitenancy.fruit;
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.transaction.Transactional;
import javax.validation.constraints.NotNull;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import org.jboss.logging.Logger;
import org.jboss.resteasy.annotations.jaxrs.PathParam;
@ApplicationScoped
@Produces("application/json")
@Consumes("application/json")
@Path("/")
public class FruitResource {
private static final Logger LOG = Logger.getLogger(FruitResource.class.getName());
@Inject
EntityManager entityManager;
@GET
@Path("fruits")
public Fruit[] getDefault() {
return get();
}
@GET
@Path("{tenant}/fruits")
public Fruit[] getTenant() {
return get();
}
private Fruit[] get() {
return entityManager.createNamedQuery("Fruits.findAll", Fruit.class)
.getResultList().toArray(new Fruit[0]);
}
@GET
@Path("fruits/{id}")
public Fruit getSingleDefault(@PathParam("id") int id) {
return findById(id);
}
@GET
@Path("{tenant}/fruits/{id}")
public Fruit getSingleTenant(@PathParam("id") int id) {
return findById(id);
}
private Fruit findById(int id) {
Fruit entity = entityManager.find(Fruit.class, id);
if (entity == null) {
throw new WebApplicationException("Fruit with id of " + id + " does not exist.", 404);
}
return entity;
}
@POST
@Transactional
@Path("fruits")
public Response createDefault(@NotNull Fruit fruit) {
return create(fruit);
}
@POST
@Transactional
@Path("{tenant}/fruits")
public Response createTenant(@NotNull Fruit fruit) {
return create(fruit);
}
private Response create(@NotNull Fruit fruit) {
if (fruit.getId() != null) {
throw new WebApplicationException("Id was invalidly set on request.", 422);
}
LOG.debugv("Create {0}", fruit.getName());
entityManager.persist(fruit);
return Response.ok(fruit).status(201).build();
}
@PUT
@Path("fruits/{id}")
@Transactional
public Fruit updateDefault(@PathParam("id") int id, @NotNull Fruit fruit) {
return update(id, fruit);
}
@PUT
@Path("{tenant}/fruits/{id}")
@Transactional
public Fruit updateTenant(@PathParam("id") int id, @NotNull Fruit fruit) {
return update(id, fruit);
}
private Fruit update(@NotNull @PathParam("id") int id, @NotNull Fruit fruit) {
if (fruit.getName() == null) {
throw new WebApplicationException("Fruit Name was not set on request.", 422);
}
Fruit entity = entityManager.find(Fruit.class, id);
if (entity == null) {
throw new WebApplicationException("Fruit with id of " + id + " does not exist.", 404);
}
entity.setName(fruit.getName());
LOG.debugv("Update #{0} {1}", fruit.getId(), fruit.getName());
return entity;
}
@DELETE
@Path("fruits/{id}")
@Transactional
public Response deleteDefault(@PathParam("id") int id) {
return delete(id);
}
@DELETE
@Path("{tenant}/fruits/{id}")
@Transactional
public Response deleteTenant(@PathParam("id") int id) {
return delete(id);
}
private Response delete(int id) {
Fruit fruit = entityManager.getReference(Fruit.class, id);
if (fruit == null) {
throw new WebApplicationException("Fruit with id of " + id + " does not exist.", 404);
}
LOG.debugv("Delete #{0} {1}", fruit.getId(), fruit.getName());
entityManager.remove(fruit);
return Response.status(204).build();
}
@GET
@Path("fruitsFindBy")
public Response findByDefault(@NotNull @QueryParam("type") String type, @NotNull @QueryParam("value") String value) {
return findBy(type, value);
}
@GET
@Path("{tenant}/fruitsFindBy")
public Response findByTenant(@NotNull @QueryParam("type") String type, @NotNull @QueryParam("value") String value) {
return findBy(type, value);
}
private Response findBy(@NotNull String type, @NotNull String value) {
if (!"name".equalsIgnoreCase(type)) {
throw new IllegalArgumentException("Currently only 'fruitsFindBy?type=name' is supported");
}
List<Fruit> list = entityManager.createNamedQuery("Fruits.findByName", Fruit.class).setParameter("name", value)
.getResultList();
if (list.size() == 0) {
return Response.status(404).build();
}
Fruit fruit = list.get(0);
return Response.status(200).entity(fruit).build();
}
@Provider
public static class ErrorMapper implements ExceptionMapper<Exception> {
@Override
public Response toResponse(Exception exception) {
LOG.error("Failed to handle request", exception);
int code = 500;
if (exception instanceof WebApplicationException) {
code = ((WebApplicationException) exception).getResponse().getStatus();
}
Error error = new Error();
error.exceptionType = exception.getClass().getName();
error.code = code;
error.error = exception.getMessage();
return Response.status(code)
.type(MediaType.APPLICATION_JSON)
.entity(error)
.build();
}
}
public static class Error {
public String exceptionType;
public int code;
public String error;
}
}
| {
"content_hash": "a5cde7827fd96c86eab11e7f5b527b87",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 121,
"avg_line_length": 29.468599033816425,
"alnum_prop": 0.6219672131147541,
"repo_name": "quarkusio/quarkus",
"id": "a18b61a029f6f24c4db41cb795f950ce3679fe71",
"size": "6100",
"binary": false,
"copies": "4",
"ref": "refs/heads/main",
"path": "integration-tests/hibernate-orm-tenancy/schema/src/main/java/io/quarkus/it/hibernate/multitenancy/fruit/FruitResource.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "23342"
},
{
"name": "Batchfile",
"bytes": "13096"
},
{
"name": "CSS",
"bytes": "6685"
},
{
"name": "Dockerfile",
"bytes": "459"
},
{
"name": "FreeMarker",
"bytes": "8106"
},
{
"name": "Groovy",
"bytes": "16133"
},
{
"name": "HTML",
"bytes": "1418749"
},
{
"name": "Java",
"bytes": "38584810"
},
{
"name": "JavaScript",
"bytes": "90960"
},
{
"name": "Kotlin",
"bytes": "704351"
},
{
"name": "Mustache",
"bytes": "13191"
},
{
"name": "Scala",
"bytes": "9756"
},
{
"name": "Shell",
"bytes": "71729"
}
],
"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.6.0_27) on Wed Mar 18 13:57:07 CET 2015 -->
<title>Uses of Class com.tailf.maapi.MaapiSchemas.UnionTypeMethodsImpl (CONF API Version 5.4)</title>
<meta name="date" content="2015-03-18">
<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 com.tailf.maapi.MaapiSchemas.UnionTypeMethodsImpl (CONF API Version 5.4)";
}
//-->
</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="../../../../com/tailf/maapi/MaapiSchemas.UnionTypeMethodsImpl.html" title="class in com.tailf.maapi">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/tailf/maapi//class-useMaapiSchemas.UnionTypeMethodsImpl.html" target="_top">Frames</a></li>
<li><a href="MaapiSchemas.UnionTypeMethodsImpl.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 com.tailf.maapi.MaapiSchemas.UnionTypeMethodsImpl" class="title">Uses of Class<br>com.tailf.maapi.MaapiSchemas.UnionTypeMethodsImpl</h2>
</div>
<div class="classUseContainer">No usage of com.tailf.maapi.MaapiSchemas.UnionTypeMethodsImpl</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="../../../../com/tailf/maapi/MaapiSchemas.UnionTypeMethodsImpl.html" title="class in com.tailf.maapi">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/tailf/maapi//class-useMaapiSchemas.UnionTypeMethodsImpl.html" target="_top">Frames</a></li>
<li><a href="MaapiSchemas.UnionTypeMethodsImpl.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "8b75dea642b1215433c46d5489e1b580",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 161,
"avg_line_length": 37.08695652173913,
"alnum_prop": 0.6311840562719813,
"repo_name": "ralph-mikera/routeflow5",
"id": "29f482d9597e9ad8edab3dcfa23018b98d3834c0",
"size": "4265",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "rftest/confd_src/confd-basic-5.4/doc/api/java/com/tailf/maapi/class-use/MaapiSchemas.UnionTypeMethodsImpl.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "112164"
},
{
"name": "C++",
"bytes": "169633"
},
{
"name": "CSS",
"bytes": "29376"
},
{
"name": "Groff",
"bytes": "1849683"
},
{
"name": "HTML",
"bytes": "18822308"
},
{
"name": "JavaScript",
"bytes": "765793"
},
{
"name": "Python",
"bytes": "121174"
},
{
"name": "Shell",
"bytes": "60535"
}
],
"symlink_target": ""
} |
package com.xeiam.xchange.bter.service.polling;
import java.io.IOException;
import com.xeiam.xchange.ExchangeSpecification;
import com.xeiam.xchange.bter.BTERAdapters;
import com.xeiam.xchange.bter.dto.marketdata.BTERDepth;
import com.xeiam.xchange.bter.dto.marketdata.BTERTicker;
import com.xeiam.xchange.bter.dto.marketdata.BTERTradeHistory;
import com.xeiam.xchange.currency.CurrencyPair;
import com.xeiam.xchange.dto.marketdata.OrderBook;
import com.xeiam.xchange.dto.marketdata.Ticker;
import com.xeiam.xchange.dto.marketdata.Trades;
import com.xeiam.xchange.service.polling.PollingMarketDataService;
public class BTERPollingMarketDataService extends BTERPollingMarketDataServiceRaw implements PollingMarketDataService {
/**
* Constructor
*
* @param exchangeSpecification
*/
public BTERPollingMarketDataService(ExchangeSpecification exchangeSpecification) {
super(exchangeSpecification);
}
@Override
public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOException {
BTERTicker ticker = super.getBTERTicker(currencyPair.baseSymbol, currencyPair.counterSymbol);
return BTERAdapters.adaptTicker(currencyPair, ticker);
}
@Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
BTERDepth bterDepth = super.getBTEROrderBook(currencyPair.baseSymbol, currencyPair.counterSymbol);
return BTERAdapters.adaptOrderBook(bterDepth, currencyPair);
}
@Override
public Trades getTrades(CurrencyPair currencyPair, Object... args) throws IOException {
BTERTradeHistory tradeHistory =
(args != null && args.length > 0 && args[0] != null && args[0] instanceof String) ? super.getBTERTradeHistorySince(currencyPair.baseSymbol, currencyPair.counterSymbol, (String) args[0])
: super.getBTERTradeHistory(currencyPair.baseSymbol, currencyPair.counterSymbol);
return BTERAdapters.adaptTrades(tradeHistory, currencyPair);
}
}
| {
"content_hash": "e6cd0c463be04f82e811cce57ed7bd5d",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 193,
"avg_line_length": 37.53703703703704,
"alnum_prop": 0.772076961026147,
"repo_name": "Achterhoeker/XChange",
"id": "faa6839a41d2e66f66bb638b243dbe53e4a890e0",
"size": "2027",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "xchange-bter/src/main/java/com/xeiam/xchange/bter/service/polling/BTERPollingMarketDataService.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "2830566"
}
],
"symlink_target": ""
} |
grunt-useref
============
```
+---------------------------------------------+
| |
| Current version is Grunt 0.4.0 compatible. |
| Version 0.0.12+ is Grunt 0.4.0 compatible. |
| |
| Version 0.0.11 is Grunt 0.3.17 compatible. |
| |
+---------------------------------------------+
```
## Description
Use build blocks to do three things:
1. update the references in your html from orginals to an optionally versioned, optimized file
2. perform file concatenation
3. Perform file minification.
Utilize build blocks in your html to indicate the files to be concatenated and minified. This task will parse the build
blocks by updating the `<script>` and `<style>` blocks in your html, and it will schedule the concatenation and
minification of the desired files by dynamically updating the `concat`, `uglify`, and `cssmin` (part of `grunt-css` - this is
auto included as a dependency for `grunt-useref`) tasks.
**This task modifies files, so it should be executed on a temp directory or the final build directory.**
**This task relies on the concat, uglify, and cssmin tasks to be run after it... concat first.**
Inspiration (and large chunks of code) for `grunt-useref` was taken from the `usemin` tasks of
[H5BP](https://raw.github.com/h5bp/node-build-script/master/tasks/usemin.js) and
[Yeoman](https://raw.github.com/h5bp/node-build-script/master/tasks/usemin.js).
## Usage
[Here is a sample repo](https://github.com/pajtai/grunt-useref-example) that uses `grunt-useref`.
To look at a working example see the [`grunt.js`](https://github.com/pajtai/grunt-useref/blob/master/grunt.js) of this module and look at [`test/input`](https://github.com/pajtai/grunt-useref/tree/master/test/input) of this module.
Example usage with grunt.init:
**in `grunt.js`:**
```javascript
useref: {
// specify which files contain the build blocks
html: 'output/**/*.html',
// explicitly specify the temp directory you are working in
// this is the the base of your links ( "/" )
temp: 'output'
}
```
Below are example corresponding build blocks in an example referenced html file. Multiple build blocks may be
used in a single file. The grunt templating engine can be used in the build file descriptions. The data passed to the
template processing is the entire config object.
**in an html file within the `output` directory**
```html
<!-- build:css /css/combined.css -->
<link href="/css/one.css" rel="stylesheet">
<link href="/css/two.css" rel="stylesheet">
<!-- endbuild -->
<!-- build:js scripts/combined.<%= grunt.file.readJSON('package.json').version %>.concat.min.js -->
<!-- You can put comments in here too -->
<script type="text/javascript" src="scripts/this.js"></script>
<script type="text/javascript" src="scripts/that.js"></script>
<!-- endbuild -->
<!-- build:js scripts/script1.<%= grunt.template.today('yyyy-mm-dd') %>.min.js -->
<script type="text/javascript" src="scripts/script1.js"></script>
<!-- endbuild -->
```
The example above has three build blocks on the same page. The first two blocks concat and minify. The third block
minifies one file. They all put the new scripts into a newly named file. The original JavaScript files remain untouched
in this case due to the naming of the output files.
You can put comments and empty lines within build blocks.
Assuming your `package.json.version` is `0.1.0` after the bump, and it is October 31, 2012 running `grunt useref` would
create the following three files:
```bash
# concat and minified one.css + two.css
output/css/combined.css
# concat and minified this.js + that.js
output/scripts/combined.0.1.0.concat.min.js
# minified script1.js
output/scripts/script1.2012-10-31.min.js
```
Also the html in the file with the build blocks would be updated to:
```html
<link href="/css/combined.css" rel="stylesheet">
<script type="text/javascript" src="scripts/combined.0.1.0.concat.min.js"></script>
<script type="text/javascript" src="scripts/script1.2012-10-31.min.js"></script>
```
Finally, make sure to schedule `concat`, `uglify` and `cssmin` in your `grunt.js`. You must schedule these after `useref`.
You do not need to create `grunt.init` entries for them. If the build blocks do not create work for any one of these
tasks, you can leave that one out.
For example:
```javascript
grunt.registerTask('build', ['cp', 'useref', 'concat', 'uglify', 'cssmin');
```
Or, if you are do not have any css build blocks:
```javascript
grunt.registerTask('build', ['cp', 'useref', 'concat', 'uglify');
```
## Installation and Use
To use this package put it as a dependency in your `package.json`, and then run `npm install`.
Then load the grunt task in your `grunt.js`
```javascript
grunt.loadNpmTasks('grunt-useref');
```
If you use `grunt-useref` you can ommit using `loadNpmTask` for the following plugins:
```
grunt-contrib-concat
grunt-contrib-uglify
grunt-css
```
`grunt-useref` will load the above plugins for you.
## Tests
Currently there are no autmated tests, but the `test` directory does have a working sample setup. To try out the sample
run it from the `grunt-useref` directory using:
```bash
npm install
npm test
```
You can inspect the sample output created. The tests can be run by either cloning the git repo or from this module's
directory inside the `node_modules` folder of your project.
## Change Log
* 0.0.16 - Mar 01, 2013 - Allow empty lines and comments within build blocks for Grunt0.4.0
* 0.0.15 - Feb 23, 2013 - Adding grunt 0.4.0 compatibility
* 0.0.11 - Jan 03, 2013 - Making grunt log output a little less obnoxious.
* 0.0.10 - Jan 02, 2013 - Allow empty lines and comments within build blocks
* 0.0.9 - Dec 23, 2012 - Setting grunt-css dependency to 0.3.2, since 0.4.1 breaks useref - plan to update when grunt goes to 0.4
* 0.0.7 - Nov 27, 2012 - fixed the css minification task so it does not have to be included in your grunt.js as a dependency
* 0.0.6 - Nov 26, 2012 - updated css minification task and its dependency
---
[NPM module](https://npmjs.org/package/grunt-useref)
| {
"content_hash": "42b9d12bf3301adc51d2e241467e1679",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 231,
"avg_line_length": 36.38823529411765,
"alnum_prop": 0.6946330423537019,
"repo_name": "penrillian-cristian/blog",
"id": "fb874f6dca65212f0369cdc1eee60a9bf52b7680",
"size": "6186",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "node_modules/grunt-useref/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "324"
},
{
"name": "JavaScript",
"bytes": "40429"
}
],
"symlink_target": ""
} |
[](https://gitter.im/ThoughtWorksInc/microbuilder?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[](https://travis-ci.org/ThoughtWorksInc/microbuilder)
**Microbuilder** is a toolkit that helps you build system across micro-services
implemented in various languages communicating via RESTful JSON API.
See the [project page](https://thoughtworksinc.github.io/microbuilder/) for more information.
## Supported languages and platforms
* Client-side
* Scala
* JavaScript
* Java
* C#
* PHP
* C++
* ActionScript 3 / Flash
* NekoVM
* Python
* Haxe
* Server-side
* Scala
* Any of your own existing JSON Web API
* Format of Documentation
* Swagger
* Haxedoc
## License
Microbuilder is licensed under the terms of the Apache v2.0 license.
## Authors
Microbuilder is built by [people in ThoughtWorks Xi'an](https://github.com/ThoughtWorksInc/microbuilder/graphs/contributors).
| {
"content_hash": "bf774a6d3fa5696bb790d61a23547282",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 157,
"avg_line_length": 29.571428571428573,
"alnum_prop": 0.7478260869565218,
"repo_name": "ThoughtWorksInc/rest-rpc",
"id": "524d168715f0a3c13dd9482cdc915c4af145cebf",
"size": "1196",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "22899"
},
{
"name": "Scala",
"bytes": "1887"
},
{
"name": "Shell",
"bytes": "547"
}
],
"symlink_target": ""
} |
use std::fmt;
use std::path::PathBuf;
use std::fs::{File, OpenOptions};
use std::io;
use chrono::*;
use libc;
// use isatty::{stdout_isatty, stderr_isatty};
use slog;
use slog_term;
use slog_syslog;
use slog_stream;
use slog::{Drain, DrainExt};
use slog_syslog::Streamer3164;
#[derive(Debug, Clone)]
pub struct Logger {
pub logger: slog::Logger,
// level:
}
/// Custom format for Log File
struct LoggerFormat;
pub enum LoggerLevel {
Debug,
Error,
Info,
Warn,
}
// Maybe expose the slog?
// Maybe allow init options to be passed in?
// #[cfg(target_os = "linux")]
// fn logger(path: Option<&str>) -> slog::Logger {
// if path.is_some() {
// let file = OpenOptions::new()
// .append(true)
// .create(true)
// .open(path.unwrap()).unwrap();
// // let stream = slog_stream::stream(file, LoggerFormat);//.fuse();
// //
// // if tty {
// // let term = slog_term::streamer().build();//.fuse();
// // slog::Logger::root(slog::duplicate(stream, term).fuse(), o!())
// // } else {
// // slog::Logger::root(stream.fuse(), o!())
// // }
//
// let stream = slog_stream::stream(file, LoggerFormat);//.fuse();
// let term = slog_term::streamer().build();//.fuse();
// // slog::Logger::root(stream, o!())
// // slog::Logger::root(slog::Duplicate::new(
// // slog::LevelFilter::new(stream, slog::Level::Info),
// // slog::LevelFilter::new(term, slog::Level::Info),
// // ).fuse(), o!())
// slog::Logger::root(slog::duplicate(stream, term).fuse(), o!())
// } else {
// let stream = slog_syslog::unix_3164(slog_syslog::Facility::LOG_DAEMON).fuse();
// slog::Logger::root(stream, o!())
// }
// }
// #[cfg(not(target_os = "linux"))]
fn logger(path: Option<&str>) -> slog::Logger {
// let tty = stdout_isatty();
if path.is_some() {
let file = OpenOptions::new()
.append(true)
.create(true)
.open(path.unwrap()).unwrap();
let stream = slog_stream::stream(file, LoggerFormat);//.fuse();
let tty = unsafe { libc::isatty(libc::STDOUT_FILENO as i32) } != 0;
if tty {
let term = slog_term::streamer().build();//.fuse();
slog::Logger::root(slog::duplicate(stream, term).fuse(), o!())
} else {
slog::Logger::root(stream.fuse(), o!())
}
} else {
// Assumes tty is available
let stream = slog_term::streamer().build().fuse();
slog::Logger::root(stream, o!())
}
}
// Override formatting here for log files so put level info and/or time here or in Logger::write
impl slog_stream::Format for LoggerFormat {
fn format(&self,
io: &mut io::Write,
rinfo: &slog::Record,
_logger_values: &slog::OwnedKeyValueList)
-> io::Result<()> {
let msg = format!("[{}] {}\n", UTC::now(), rinfo.msg());
let _ = try!(io.write_all(msg.as_bytes()));
Ok(())
}
}
impl Logger {
pub fn new(path: Option<&str>) -> Logger {
let root_logger = logger(path);
Logger{ logger: root_logger }
}
pub fn write(&self, logger_level: LoggerLevel, line: String) {
match logger_level {
LoggerLevel::Error => error!(self.logger, line),
LoggerLevel::Debug => debug!(self.logger, line),
LoggerLevel::Warn => warn!(self.logger, line),
_ => info!(self.logger, line),
}
}
}
| {
"content_hash": "97c40150ccdf64147767228ecb3242d5",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 96,
"avg_line_length": 31.133333333333333,
"alnum_prop": 0.5107066381156317,
"repo_name": "lambdastackio/tokio-http2",
"id": "834316233340b73564cb56916c16bf7762f615e0",
"size": "4380",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/logger.rs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Rust",
"bytes": "221396"
},
{
"name": "Shell",
"bytes": "696"
}
],
"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_91) on Tue Dec 29 12:43:40 AEDT 2015 -->
<title>BlockCipherResetTest (Bouncy Castle Library 1.54 API Specification)</title>
<meta name="date" content="2015-12-29">
<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="BlockCipherResetTest (Bouncy Castle Library 1.54 API Specification)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><b>Bouncy Castle Cryptography Library 1.54</b></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/bouncycastle/crypto/test/BlockCipherMonteCarloTest.html" title="class in org.bouncycastle.crypto.test"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/bouncycastle/crypto/test/BlockCipherVectorTest.html" title="class in org.bouncycastle.crypto.test"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/bouncycastle/crypto/test/BlockCipherResetTest.html" target="_top">Frames</a></li>
<li><a href="BlockCipherResetTest.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.bouncycastle.crypto.test</div>
<h2 title="Class BlockCipherResetTest" class="title">Class BlockCipherResetTest</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../org/bouncycastle/util/test/SimpleTest.html" title="class in org.bouncycastle.util.test">org.bouncycastle.util.test.SimpleTest</a></li>
<li>
<ul class="inheritance">
<li>org.bouncycastle.crypto.test.BlockCipherResetTest</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../org/bouncycastle/util/test/Test.html" title="interface in org.bouncycastle.util.test">Test</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">BlockCipherResetTest</span>
extends <a href="../../../../org/bouncycastle/util/test/SimpleTest.html" title="class in org.bouncycastle.util.test">SimpleTest</a></pre>
<div class="block">Test whether block ciphers implement reset contract on init, encrypt/decrypt and reset.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../org/bouncycastle/crypto/test/BlockCipherResetTest.html#BlockCipherResetTest()">BlockCipherResetTest</a></strong>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../org/bouncycastle/crypto/test/BlockCipherResetTest.html#getName()">getName</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/bouncycastle/crypto/test/BlockCipherResetTest.html#main(java.lang.String[])">main</a></strong>(java.lang.String[] args)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/bouncycastle/crypto/test/BlockCipherResetTest.html#performTest()">performTest</a></strong>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.bouncycastle.util.test.SimpleTest">
<!-- -->
</a>
<h3>Methods inherited from class org.bouncycastle.util.test.<a href="../../../../org/bouncycastle/util/test/SimpleTest.html" title="class in org.bouncycastle.util.test">SimpleTest</a></h3>
<code><a href="../../../../org/bouncycastle/util/test/SimpleTest.html#areEqual(byte[],%20byte[])">areEqual</a>, <a href="../../../../org/bouncycastle/util/test/SimpleTest.html#fail(java.lang.String)">fail</a>, <a href="../../../../org/bouncycastle/util/test/SimpleTest.html#fail(java.lang.String,%20java.lang.Object,%20java.lang.Object)">fail</a>, <a href="../../../../org/bouncycastle/util/test/SimpleTest.html#fail(java.lang.String,%20java.lang.Throwable)">fail</a>, <a href="../../../../org/bouncycastle/util/test/SimpleTest.html#perform()">perform</a>, <a href="../../../../org/bouncycastle/util/test/SimpleTest.html#runTest(org.bouncycastle.util.test.Test)">runTest</a>, <a href="../../../../org/bouncycastle/util/test/SimpleTest.html#runTest(org.bouncycastle.util.test.Test,%20java.io.PrintStream)">runTest</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="BlockCipherResetTest()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>BlockCipherResetTest</h4>
<pre>public BlockCipherResetTest()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getName()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getName</h4>
<pre>public java.lang.String getName()</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../org/bouncycastle/util/test/Test.html#getName()">getName</a></code> in interface <code><a href="../../../../org/bouncycastle/util/test/Test.html" title="interface in org.bouncycastle.util.test">Test</a></code></dd>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../org/bouncycastle/util/test/SimpleTest.html#getName()">getName</a></code> in class <code><a href="../../../../org/bouncycastle/util/test/SimpleTest.html" title="class in org.bouncycastle.util.test">SimpleTest</a></code></dd>
</dl>
</li>
</ul>
<a name="performTest()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>performTest</h4>
<pre>public void performTest()
throws java.lang.Exception</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../org/bouncycastle/util/test/SimpleTest.html#performTest()">performTest</a></code> in class <code><a href="../../../../org/bouncycastle/util/test/SimpleTest.html" title="class in org.bouncycastle.util.test">SimpleTest</a></code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
</ul>
<a name="main(java.lang.String[])">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>main</h4>
<pre>public static void main(java.lang.String[] args)</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><b>Bouncy Castle Cryptography Library 1.54</b></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/bouncycastle/crypto/test/BlockCipherMonteCarloTest.html" title="class in org.bouncycastle.crypto.test"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/bouncycastle/crypto/test/BlockCipherVectorTest.html" title="class in org.bouncycastle.crypto.test"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/bouncycastle/crypto/test/BlockCipherResetTest.html" target="_top">Frames</a></li>
<li><a href="BlockCipherResetTest.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "ed0922a3cee7a80422369725c653c058",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 828,
"avg_line_length": 39.662379421221864,
"alnum_prop": 0.6505066882853668,
"repo_name": "GaloisInc/hacrypto",
"id": "6a46b32aff7ed922635ac09a67acd6e72dd381c1",
"size": "12335",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Java/BouncyCastle/BouncyCastle-1.54/bcprov-jdk15on-154/javadoc/org/bouncycastle/crypto/test/BlockCipherResetTest.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "AGS Script",
"bytes": "62991"
},
{
"name": "Ada",
"bytes": "443"
},
{
"name": "AppleScript",
"bytes": "4518"
},
{
"name": "Assembly",
"bytes": "25398957"
},
{
"name": "Awk",
"bytes": "36188"
},
{
"name": "Batchfile",
"bytes": "530568"
},
{
"name": "C",
"bytes": "344517599"
},
{
"name": "C#",
"bytes": "7553169"
},
{
"name": "C++",
"bytes": "36635617"
},
{
"name": "CMake",
"bytes": "213895"
},
{
"name": "CSS",
"bytes": "139462"
},
{
"name": "Coq",
"bytes": "320964"
},
{
"name": "Cuda",
"bytes": "103316"
},
{
"name": "DIGITAL Command Language",
"bytes": "1545539"
},
{
"name": "DTrace",
"bytes": "33228"
},
{
"name": "Emacs Lisp",
"bytes": "22827"
},
{
"name": "GDB",
"bytes": "93449"
},
{
"name": "Gnuplot",
"bytes": "7195"
},
{
"name": "Go",
"bytes": "393057"
},
{
"name": "HTML",
"bytes": "41466430"
},
{
"name": "Hack",
"bytes": "22842"
},
{
"name": "Haskell",
"bytes": "64053"
},
{
"name": "IDL",
"bytes": "3205"
},
{
"name": "Java",
"bytes": "49060925"
},
{
"name": "JavaScript",
"bytes": "3476841"
},
{
"name": "Jolie",
"bytes": "412"
},
{
"name": "Lex",
"bytes": "26290"
},
{
"name": "Logos",
"bytes": "108920"
},
{
"name": "Lua",
"bytes": "427"
},
{
"name": "M4",
"bytes": "2508986"
},
{
"name": "Makefile",
"bytes": "29393197"
},
{
"name": "Mathematica",
"bytes": "48978"
},
{
"name": "Mercury",
"bytes": "2053"
},
{
"name": "Module Management System",
"bytes": "1313"
},
{
"name": "NSIS",
"bytes": "19051"
},
{
"name": "OCaml",
"bytes": "981255"
},
{
"name": "Objective-C",
"bytes": "4099236"
},
{
"name": "Objective-C++",
"bytes": "243505"
},
{
"name": "PHP",
"bytes": "22677635"
},
{
"name": "Pascal",
"bytes": "99565"
},
{
"name": "Perl",
"bytes": "35079773"
},
{
"name": "Prolog",
"bytes": "350124"
},
{
"name": "Python",
"bytes": "1242241"
},
{
"name": "Rebol",
"bytes": "106436"
},
{
"name": "Roff",
"bytes": "16457446"
},
{
"name": "Ruby",
"bytes": "49694"
},
{
"name": "Scheme",
"bytes": "138999"
},
{
"name": "Shell",
"bytes": "10192290"
},
{
"name": "Smalltalk",
"bytes": "22630"
},
{
"name": "Smarty",
"bytes": "51246"
},
{
"name": "SourcePawn",
"bytes": "542790"
},
{
"name": "SystemVerilog",
"bytes": "95379"
},
{
"name": "Tcl",
"bytes": "35696"
},
{
"name": "TeX",
"bytes": "2351627"
},
{
"name": "Verilog",
"bytes": "91541"
},
{
"name": "Visual Basic",
"bytes": "88541"
},
{
"name": "XS",
"bytes": "38300"
},
{
"name": "Yacc",
"bytes": "132970"
},
{
"name": "eC",
"bytes": "33673"
},
{
"name": "q",
"bytes": "145272"
},
{
"name": "sed",
"bytes": "1196"
}
],
"symlink_target": ""
} |
package Components;
import com.codeborne.selenide.ElementsCollection;
import static com.codeborne.selenide.Selenide.$$;
/**
* Created by YavlanskiyMS on 25.02.2016.
* CardComponents
*/
public class CardComponents {
public ElementsCollection getDescriptionPosition(){
return $$(".overflow.wordwrap");
}
}
| {
"content_hash": "86ffccedbd3955b9659b5a30384d5819",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 55,
"avg_line_length": 20.4375,
"alnum_prop": 0.7308868501529052,
"repo_name": "yavlanskiy/WorkuaTesting",
"id": "ceb74402ccc4392d15cfe97feb222caaf842fc4b",
"size": "327",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/Components/CardComponents.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "16940"
}
],
"symlink_target": ""
} |
package com.cloudant.sync.internal.mazha;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.core.Is.is;
import com.cloudant.common.RequireRunningCouchDB;
import com.cloudant.sync.internal.common.CouchConstants;
import com.cloudant.sync.internal.common.CouchUtils;
import com.cloudant.sync.internal.util.JSONUtils;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.util.List;
import java.util.Map;
@Category(RequireRunningCouchDB.class)
public class GetDocumentRevsTest extends CouchClientTestBase {
/**
* Example output for get docs with revisions
* {
* "_id" : "05195cd197799bde8af095e9a3185597",
* "_rev" : "2-dc16dcd3a3faa8a6b5cdc21b2e16d6a4",
* "hello" : "world",
* "Here" : "Is Cloudant!",
* "_revisions" : {
* "start" : 2,
* "ids" : [
* "dc16dcd3a3faa8a6b5cdc21b2e16d6a4",
* "15f65339921e497348be384867bb940f" ]
* }
* }
*/
@Test
public void getDocRevisions_idAndRevAndMapClass_revsMustBeReturned() {
Response[] responses = createAndUpdateDocumentAndReturnRevisions();
Map<String, Object> revs = client.getDocRevisions(responses[1].getId(), responses[1].getRev(),
JSONUtils.STRING_MAP_TYPE_DEF);
Assert.assertThat(revs.keySet(), hasItem(CouchConstants._revisions));
Map<String, Object> _revisions = (Map<String, Object>) revs.remove(CouchConstants._revisions);
Assert.assertThat(_revisions.keySet(), hasItems(CouchConstants.start, CouchConstants.ids));
Assert.assertThat((Integer)_revisions.get(CouchConstants.start), is(equalTo(2)));
List<String> ids = (List<String>) _revisions.get(CouchConstants.ids);
Assert.assertThat(ids.size(), is(equalTo(2)));
Assert.assertThat(ids, hasItems(CouchUtils.getRevisionIdsSuffix(responses[0].getRev(), responses[1].getRev())));
}
public Response[] createAndUpdateDocumentAndReturnRevisions() {
Response res = ClientTestUtils.createHelloWorldDoc(client);
Assert.assertThat(res.getRev(), startsWith("1-"));
Map<String, Object> doc = client.getDocument(res.getId());
doc.put("Here", "Is Cloudant!");
Response updatedRes = client.update(res.getId(), doc);
Assert.assertThat(updatedRes.getRev(), startsWith("2-"));
return new Response[]{ res, updatedRes };
}
@Test
public void getDocRevisions_idAndRev_revsMustBeReturned() {
Response[] responses = createAndUpdateDocumentAndReturnRevisions();
DocumentRevs docRevs = client.getDocRevisions(responses[1].getId(), responses[1].getRev());
Assert.assertThat(docRevs, is(notNullValue()));
Assert.assertThat(docRevs.getId(), is(equalTo(responses[1].getId())));
Assert.assertThat(docRevs.getRev(), is(equalTo(responses[1].getRev())));
Assert.assertThat(docRevs.getDeleted(), is(equalTo(Boolean.FALSE)));
Assert.assertThat(docRevs.getOthers().size(), is(equalTo(2)));
Assert.assertThat(docRevs.getOthers().keySet(), hasItems("hello", "Here"));
Assert.assertThat((String)docRevs.getOthers().get("hello"), is("world"));
Assert.assertThat((String)docRevs.getOthers().get("Here"), is("Is Cloudant!"));
}
@Test
public void getDocRevisions_documentDeleted_mustReturnedMarkedAsDeleted() {
Response[] responses = createAndUpdateDocumentAndReturnRevisions();
Response response = client.delete(responses[1].getId(), responses[1].getRev());
DocumentRevs documentRevs = client.getDocRevisions(response.getId(), response.getRev());
Assert.assertThat(documentRevs.getId(), is(equalTo(response.getId())));
Assert.assertThat(documentRevs.getRev(), is(equalTo(response.getRev())));
Assert.assertTrue(documentRevs.getDeleted());
Assert.assertEquals(3, documentRevs.getRevisions().getStart());
Assert.assertEquals(3, documentRevs.getRevisions().getIds().size());
Assert.assertThat(documentRevs.getRevisions().getIds(), hasItems(CouchUtils.getRevisionIdsSuffix(
responses[0].getRev(), responses[1].getRev(), response.getRev()
)));
Assert.assertEquals(0, documentRevs.getOthers().size());
}
@Test(expected = NoResourceException.class)
public void getDocRevisions_docNotExistAndMapClass_exception() {
Response res = ClientTestUtils.createHelloWorldDoc(client);
client.getDocRevisions("bad_id", res.getRev());
}
@Test(expected = NoResourceException.class)
public void getDocRevisions_docNotExist_exception() {
Response res = ClientTestUtils.createHelloWorldDoc(client);
client.getDocRevisions("bad_id", res.getRev());
}
@Test(expected = NoResourceException.class)
public void getDocRevisions_wrongRevIdAndMapClass_exception() {
Response res = ClientTestUtils.createHelloWorldDoc(client);
client.getDocRevisions(res.getId(), res.getRev() + "bad");
}
@Test(expected = NoResourceException.class)
public void getDocRevisions_wrongRevId_exception() {
Response res = ClientTestUtils.createHelloWorldDoc(client);
client.getDocRevisions(res.getId(), res.getRev() + "bad");
}
}
| {
"content_hash": "f62bbdec9f2088a030ae32a725a5b909",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 120,
"avg_line_length": 43.390625,
"alnum_prop": 0.6921137918617213,
"repo_name": "cloudant/sync-android",
"id": "24cd10ebfd14531dc0e825763b4df4a1f4a8e239",
"size": "6220",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cloudant-sync-datastore-core/src/test/java/com/cloudant/sync/internal/mazha/GetDocumentRevsTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2541779"
},
{
"name": "Ruby",
"bytes": "3435"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.